From: gwl Date: Mon, 15 Sep 2014 09:09:28 +0000 (+0800) Subject: Wifi: add wifi power control configration [keep_wifi_power_on]. X-Git-Tag: firefly_0821_release~4708 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=8da569e3a7f124d9ca8b5b46b17efc6d34aebd0e;p=firefly-linux-kernel-4.4.55.git Wifi: add wifi power control configration [keep_wifi_power_on]. --- diff --git a/arch/arm/boot/dts/rk3288-tb.dts b/arch/arm/boot/dts/rk3288-tb.dts index 289ab3e648ff..c7cd3c0b28d8 100755 --- a/arch/arm/boot/dts/rk3288-tb.dts +++ b/arch/arm/boot/dts/rk3288-tb.dts @@ -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 diff --git a/arch/arm/boot/dts/rk3288-tb_8846.dts b/arch/arm/boot/dts/rk3288-tb_8846.dts index 21b2fc2ac791..9e4df64fd829 100644 --- a/arch/arm/boot/dts/rk3288-tb_8846.dts +++ b/arch/arm/boot/dts/rk3288-tb_8846.dts @@ -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 diff --git a/include/linux/rfkill-wlan.h b/include/linux/rfkill-wlan.h index 5f5468fd5da5..17257c9cb14b 100755 --- a/include/linux/rfkill-wlan.h +++ b/include/linux/rfkill-wlan.h @@ -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 diff --git a/net/rfkill/rfkill-wlan.c b/net/rfkill/rfkill-wlan.c index 85ea624d7ef4..56c0de199083 100755 --- a/net/rfkill/rfkill-wlan.c +++ b/net/rfkill/rfkill-wlan.c @@ -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