build/patch/kernel/sun8i-default/linux-203-rf_pm-auto-power-on.patch

67 lines
1.7 KiB
Diff

diff -Nur a/drivers/misc/rf_pm/wifi_pm.c b/drivers/misc/rf_pm/wifi_pm.c
--- a/drivers/misc/rf_pm/wifi_pm.c 2016-06-09 19:33:23.000000000 +0200
+++ b/drivers/misc/rf_pm/wifi_pm.c 2016-10-02 18:43:35.001633433 +0200
@@ -73,18 +73,6 @@
}
EXPORT_SYMBOL(wifi_pm_gpio_ctrl);
-#ifdef CONFIG_PROC_FS
-static int wifi_pm_power_stat(char *page, char **start, off_t off, int count, int *eof, void *data)
-{
- char *p = page;
-
-#if defined(CONFIG_ARCH_SUN8IW7P1)
- p += sprintf(p, "%s", wl_info.wl_power_state ? "0" : "1");
-#else
- p += sprintf(p, "%s", wl_info.wl_power_state ? "1" : "0");
-#endif
- return p - page;
-}
static void scan_device(int onoff)
{
int sdc_id = -1;
@@ -123,16 +111,31 @@
}
}
-static int wifi_pm_power_ctrl(struct file *file, const char __user *buffer, unsigned long count, void *data)
+static void wifi_power_ctrl(int power)
{
- int power = simple_strtoul(buffer, NULL, 10);
- power = power ? 1 : 0;
-
wifi_pm_power(power);
mdelay(100);
-
scan_device(power);
mdelay(100);
+}
+
+#ifdef CONFIG_PROC_FS
+static int wifi_pm_power_stat(char *page, char **start, off_t off, int count, int *eof, void *data)
+{
+ char *p = page;
+
+#if defined(CONFIG_ARCH_SUN8IW7P1)
+ p += sprintf(p, "%s", wl_info.wl_power_state ? "0" : "1");
+#else
+ p += sprintf(p, "%s", wl_info.wl_power_state ? "1" : "0");
+#endif
+ return p - page;
+}
+
+static int wifi_pm_power_ctrl(struct file *file, const char __user *buffer, unsigned long count, void *data)
+{
+ int power = simple_strtoul(buffer, NULL, 10);
+ wifi_power_ctrl(power ? 1 : 0);
return sizeof(power);
}
@@ -264,6 +267,7 @@
static int __devinit wifi_pm_probe(struct platform_device *pdev)
{
awwifi_procfs_attach();
+ wifi_power_ctrl(1);
wifi_pm_msg("wifi gpio init is OK !!\n");
return 0;
}