static int rtl8723au_gpio_ctrl(char* name, int level) { static int usbc_enable = 0; if (strcmp(name, "rtl8723au_wl") == 0) { if ((level && !rtl8723au_bt_power) || (!level && !rtl8723au_bt_power)) { rtl8723au_msg("rtl8723au is powered %s by wifi\n", level ? "up" : "down"); goto power_change; } else { if (level) { rtl8723au_msg("rtl8723au is already on by bt\n"); } else { rtl8723au_msg("rtl8723au should stay on because of bt\n"); } goto state_change; } } if (strcmp(name, "rtl8723au_bt") == 0) { if ((level && !rtl8723au_wifi_power && !rtl8723au_bt_power) || (!level && !rtl8723au_wifi_power)) { rtl8723au_msg("rtl8723au is powered %s by bt\n", level ? "up" : "down"); goto power_change; } else { if (level) { rtl8723au_msg("rtl8723au is already on by wifi\n"); } else { rtl8723au_msg("rtl8723au should stay on because of wifi\n"); } goto state_change; } } return 0; power_change: if (level) { rtl8723au_module_power(level); if (!usbc_enable) { msleep(10); sw_usb_enable_hcd(usbc_id); usbc_enable = 1; } } else { if (usbc_enable && !rtl8723au_bt_power) { sw_usb_disable_hcd(usbc_id); msleep(1); usbc_enable = 0; } rtl8723au_module_power(level); } state_change: if (strcmp(name, "rtl8723au_wl")==0) rtl8723au_wifi_power = level; if (strcmp(name, "rtl8723au_bt")==0) rtl8723au_bt_power = level; rtl8723au_msg("rtl8723au power state change: wifi %d, bt %d !!\n", rtl8723au_wifi_power, rtl8723au_bt_power); return 0; }
/* Deinit driver module */ VOID __exit rtusb_exit(void) { usb_deregister(&rtusb_driver); #ifdef RESOURCE_BOOT_ALLOC rtusb_resource_exit(); #endif /* RESOURCE_BOOT_ALLOC */ printk("sw_usb_disable_hcd: usbc_num = %d\n", usb_wifi_host); sw_usb_disable_hcd(usb_wifi_host); printk("<--- rtusb exit\n"); }
void platform_wifi_power_off(void) { #if defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I) #if !(defined(CONFIG_RTL8723A)) && !(defined(CONFIG_RTL8723B)) sw_usb_disable_hcd(item.val); #endif wifi_pm_power(0); #endif //defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I) #if defined(CONFIG_PLATFORM_ARM_SUNxI) #if !(defined(CONFIG_RTL8723A)) && !(defined(CONFIG_RTL8723B)) sunxi_usb_disable_hcd(item.val); #endif wifi_pm_power(0); #endif //defined(CONFIG_PLATFORM_ARM_SUNxI) }