Wifi: add wifi power control configration [keep_wifi_power_on].
authorgwl <gwl@rock-chips.com>
Mon, 15 Sep 2014 09:09:28 +0000 (17:09 +0800)
committergwl <gwl@rock-chips.com>
Mon, 15 Sep 2014 09:09:42 +0000 (17:09 +0800)
arch/arm/boot/dts/rk3288-tb.dts
arch/arm/boot/dts/rk3288-tb_8846.dts
include/linux/rfkill-wlan.h
net/rfkill/rfkill-wlan.c

index 289ab3e648ffd178ab5e2c6a6783195809fd2540..c7cd3c0b28d84d30e56f3aeb8e7236af5a2672fa 100755 (executable)
@@ -21,6 +21,8 @@
 
         sdio_vref = <1800>; //1800mv or 3300mv
 
+        //keep_wifi_power_on;
+
         //power_ctrl_by_pmu;
         power_pmu_regulator = "act_ldo3";
         power_pmu_enable_level = <1>; //1->HIGH, 0->LOW
index 21b2fc2ac791e550e647712eb890316fdfa1e813..9e4df64fd829a1003f265c465e42b54b400dd2ae 100644 (file)
@@ -23,6 +23,8 @@
 
         sdio_vref = <1800>; //1800mv or 3300mv
 
+        //keep_wifi_power_on;
+
         //power_ctrl_by_pmu;
         power_pmu_regulator = "act_ldo3";
         power_pmu_enable_level = <1>; //1->HIGH, 0->LOW
index 5f5468fd5da555d84f9bf031a9a0b4f634c6a2ea..17257c9cb14b1e95ed0d4e1ce48973657ede939c 100755 (executable)
@@ -27,6 +27,7 @@ struct rksdmmc_pmu {
 struct rksdmmc_gpio_wifi_moudle {
     int sdio_vol;    //sdio reference voltage
     bool vref_ctrl_enble;
+    bool wifi_power_remain;
     struct rksdmmc_pmu    mregulator;
     struct rksdmmc_pmu    ioregulator;
     struct rksdmmc_gpio   power_n;  //PMU_EN  
index 85ea624d7ef487ebb6e50b90635f95b62ecae592..56c0de199083be0e2e9c9bedbb10becc6ffa2bd7 100755 (executable)
@@ -56,6 +56,7 @@ struct rfkill_wlan_data {
 };
 
 static struct rfkill_wlan_data *g_rfkill = NULL;
+static int power_set_time = 0;
 
 static const char wlan_name[] = 
 #if defined (CONFIG_BCM4330)
@@ -95,14 +96,14 @@ static char wifi_chip_type_string[64];
 int get_wifi_chip_type(void)
 {
     int type;
-    if (strcmp(wifi_chip_type_string, "rkwifi") == 0) {
+    if (strcmp(wifi_chip_type_string, "bcmwifi") == 0) {
         type = WIFI_BCMWIFI;
     } else if (strcmp(wifi_chip_type_string, "rtkwifi") == 0) {
         type = WIFI_RTKWIFI;
     } else if (strcmp(wifi_chip_type_string, "esp8089") == 0) {
         type = WIFI_ESP8089;
     } else {
-        type = WIFI_BCMWIFI;
+        type = TYPE_MAX;
     }
     return type;
 }
@@ -349,6 +350,11 @@ int rockchip_wifi_power(int on)
         return -1;
     }
 
+    if (mrfkill->pdata->wifi_power_remain && power_set_time) {
+        LOG("%s: wifi power is setted to be remain on. skip anything to the power control", __func__);
+        return 0;
+    } else power_set_time++;
+
     if (!rfkill_get_bt_power_state(&power, &toggle)) {
         if (toggle == true && power == 1) {
             LOG("%s: wifi shouldn't control the power, it was enabled by BT!\n", __func__);
@@ -650,6 +656,14 @@ static int wlan_platdata_parse_dt(struct device *dev,
                data->sdio_vol = value;
        }
 
+    if (of_find_property(node, "keep_wifi_power_on", NULL)) {
+        data->wifi_power_remain = true;
+        LOG("%s: wifi power will enabled while kernel starting and keep on.\n", __func__);
+    } else {
+        data->wifi_power_remain = false;
+        LOG("%s: enable wifi power control.\n", __func__);
+    }
+       
     if (of_find_property(node, "vref_ctrl_enable", NULL)) {
         LOG("%s: enable wifi io reference voltage control.\n", __func__);
         data->vref_ctrl_enble = true;
@@ -809,6 +823,11 @@ static int rfkill_wlan_probe(struct platform_device *pdev)
         gpio_direction_output(pdata->power_n.io, !pdata->power_n.enable);
     }
 
+    if (pdata->wifi_power_remain)
+    {
+        rockchip_wifi_power(1);
+    }
+
     rockchip_wifi_voltage_select();
 
 #if BCM_STATIC_MEMORY_SUPPORT