2 * Copyright (C) 2012 ROCKCHIP, Inc.
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
14 /* Rock-chips rfkill driver for wifi
17 #include <linux/kernel.h>
18 #include <linux/platform_device.h>
19 #include <linux/module.h>
20 #include <linux/rfkill.h>
21 #include <linux/init.h>
22 #include <linux/slab.h>
23 #include <linux/regulator/consumer.h>
24 #include <linux/delay.h>
25 #include <linux/rfkill-wlan.h>
26 #include <linux/rfkill-bt.h>
27 #include <linux/wakelock.h>
28 #include <linux/interrupt.h>
30 #include <linux/suspend.h>
31 #include <linux/proc_fs.h>
32 #include <linux/uaccess.h>
33 #include <linux/gpio.h>
34 #include <linux/rockchip/iomap.h>
35 #include <dt-bindings/gpio/gpio.h>
36 #include <linux/skbuff.h>
38 #include <linux/rockchip/grf.h>
39 #include <linux/rockchip/common.h>
40 #include <linux/regmap.h>
41 #include <linux/mfd/syscon.h>
42 #include <linux/mmc/host.h>
45 #include <linux/of_device.h>
46 #include <linux/of_gpio.h>
48 #include <linux/soc/rockchip/rk_vendor_storage.h>
51 #define DBG(x...) printk(KERN_INFO "[WLAN_RFKILL]: "x)
56 #define LOG(x...) printk(KERN_INFO "[WLAN_RFKILL]: "x)
58 extern struct mmc_host *primary_sdio_host;
59 extern void mmc_pwrseq_power_off(struct mmc_host *host);
61 struct rfkill_wlan_data {
62 struct rksdmmc_gpio_wifi_moudle *pdata;
63 struct wake_lock wlan_irq_wl;
66 static struct rfkill_wlan_data *g_rfkill = NULL;
67 static int power_set_time = 0;
69 static const char wlan_name[] =
70 #if defined (CONFIG_BCM4330)
71 #if defined (CONFIG_BT_MODULE_NH660)
76 #elif defined (CONFIG_RK903)
77 #if defined(CONFIG_RKWIFI_26M)
82 #elif defined(CONFIG_BCM4329)
84 #elif defined(CONFIG_MV8787)
86 #elif defined(CONFIG_AP6210)
87 #if defined(CONFIG_RKWIFI_26M)
92 #elif defined(CONFIG_AP6330)
94 #elif defined(CONFIG_AP6476)
96 #elif defined(CONFIG_AP6493)
103 static char wifi_chip_type_string[64];
104 int get_wifi_chip_type(void)
107 if (strcmp(wifi_chip_type_string, "ap6210") == 0) {
109 } else if (strcmp(wifi_chip_type_string, "ap6212") == 0) {
111 } else if (strcmp(wifi_chip_type_string, "rk901") == 0) {
113 } else if (strcmp(wifi_chip_type_string, "rk903") == 0) {
115 } else if (strcmp(wifi_chip_type_string, "ap6181") == 0) {
117 } else if (strcmp(wifi_chip_type_string, "ap6234") == 0) {
119 } else if (strcmp(wifi_chip_type_string, "ap6330") == 0) {
121 } else if (strcmp(wifi_chip_type_string, "ap6335") == 0) {
123 } else if (strcmp(wifi_chip_type_string, "ap6354") == 0) {
125 } else if (strcmp(wifi_chip_type_string, "ap6441") == 0) {
127 } else if (strcmp(wifi_chip_type_string, "ap6476") == 0) {
129 } else if (strcmp(wifi_chip_type_string, "ap6493") == 0) {
131 } else if (strcmp(wifi_chip_type_string, "rtl8188eu") == 0) {
132 type = WIFI_RTL8188EU;
133 } else if (strcmp(wifi_chip_type_string, "rtl8192du") == 0) {
134 type = WIFI_RTL8192DU;
135 } else if (strcmp(wifi_chip_type_string, "rtl8723as") == 0) {
136 type = WIFI_RTL8723AS;
137 } else if (strcmp(wifi_chip_type_string, "rtl8723bs_vq0") == 0) {
138 type = WIFI_RTL8723BS_VQ0;
139 } else if (strcmp(wifi_chip_type_string, "rtl8723bs") == 0) {
140 type = WIFI_RTL8723BS;
141 } else if (strcmp(wifi_chip_type_string, "rtl8723au") == 0) {
142 type = WIFI_RTL8723AU;
143 } else if (strcmp(wifi_chip_type_string, "rtl8723bu") == 0) {
144 type = WIFI_RTL8723BU;
145 } else if (strcmp(wifi_chip_type_string, "rtl8189es") == 0) {
146 type = WIFI_RTL8189ES;
147 } else if (strcmp(wifi_chip_type_string, "rtl8812au") == 0) {
148 type = WIFI_RTL8812AU;
149 } else if (strcmp(wifi_chip_type_string, "esp8089") == 0) {
156 EXPORT_SYMBOL(get_wifi_chip_type);
158 /***********************************************************
160 * Broadcom Wifi Static Memory
162 **********************************************************/
164 #define BCM_STATIC_MEMORY_SUPPORT 0
166 #define BCM_STATIC_MEMORY_SUPPORT 0
168 //===========================
169 #if BCM_STATIC_MEMORY_SUPPORT
170 #define PREALLOC_WLAN_SEC_NUM 4
171 #define PREALLOC_WLAN_BUF_NUM 160
172 #define PREALLOC_WLAN_SECTION_HEADER 0
173 #define WLAN_SKB_BUF_NUM 16
175 #define WLAN_SECTION_SIZE_0 (12 * 1024)
176 #define WLAN_SECTION_SIZE_1 (12 * 1024)
177 #define WLAN_SECTION_SIZE_2 (32 * 1024)
178 #define WLAN_SECTION_SIZE_3 (136* 1024)
179 #define WLAN_SECTION_SIZE_4 (4 * 1024)
180 #define WLAN_SECTION_SIZE_5 (64 * 1024)
181 #define WLAN_SECTION_SIZE_6 (4 * 1024)
182 #define WLAN_SECTION_SIZE_7 (4 * 1024)
184 static struct sk_buff *wlan_static_skb[WLAN_SKB_BUF_NUM+1];
186 struct wifi_mem_prealloc {
191 static struct wifi_mem_prealloc wifi_mem_array[8] = {
192 {NULL, (WLAN_SECTION_SIZE_0)},
193 {NULL, (WLAN_SECTION_SIZE_1)},
194 {NULL, (WLAN_SECTION_SIZE_2)},
195 {NULL, (WLAN_SECTION_SIZE_3)},
196 {NULL, (WLAN_SECTION_SIZE_4)},
197 {NULL, (WLAN_SECTION_SIZE_5)},
198 {NULL, (WLAN_SECTION_SIZE_6)},
199 {NULL, (WLAN_SECTION_SIZE_7)}
202 static int rockchip_init_wifi_mem(void)
207 for (i = 0 ; i < WLAN_SKB_BUF_NUM ; i++) {
208 wlan_static_skb[i] = dev_alloc_skb(
209 ((i < (WLAN_SKB_BUF_NUM / 2)) ? (PAGE_SIZE*1) : (PAGE_SIZE*2)));
211 if (!wlan_static_skb[i])
215 wlan_static_skb[i] = dev_alloc_skb((PAGE_SIZE*4));
216 if (!wlan_static_skb[i])
219 for (i = 0 ; i <= 7; i++) {
220 wifi_mem_array[i].mem_ptr =
221 kmalloc(wifi_mem_array[i].size, GFP_KERNEL);
223 if (!wifi_mem_array[i].mem_ptr)
229 pr_err("Failed to mem_alloc for WLAN\n");
230 for (j = 0 ; j < i ; j++)
231 kfree(wifi_mem_array[j].mem_ptr);
232 i = WLAN_SKB_BUF_NUM;
234 pr_err("Failed to skb_alloc for WLAN\n");
235 for (j = 0 ; j < i ; j++)
236 dev_kfree_skb(wlan_static_skb[j]);
237 dev_kfree_skb(wlan_static_skb[j]);
242 void *rockchip_mem_prealloc(int section, unsigned long size)
244 //printk("rockchip_mem_prealloc: section = %d, size = %d\n", section, size);
245 if (section == PREALLOC_WLAN_SEC_NUM)
246 return wlan_static_skb;
248 if ((section < 0) || (section > 7))
251 if (wifi_mem_array[section].size < size)
254 return wifi_mem_array[section].mem_ptr;
257 void *rockchip_mem_prealloc(int section, unsigned long size) { return NULL;}
259 EXPORT_SYMBOL(rockchip_mem_prealloc);
261 /**************************************************************************
263 * get wifi power state Func
265 *************************************************************************/
266 static int wifi_power_state = 0;
267 int rfkill_get_wifi_power_state(int *power, int *vref_ctrl_enable)
269 struct rfkill_wlan_data *mrfkill = g_rfkill;
271 if (mrfkill == NULL) {
272 LOG("%s: rfkill-wlan driver has not Successful initialized\n", __func__);
276 *power = wifi_power_state;
281 /**************************************************************************
283 * Wifi Power Control Func
287 *************************************************************************/
288 int rockchip_wifi_power(int on)
290 struct rfkill_wlan_data *mrfkill = g_rfkill;
291 struct rksdmmc_gpio *poweron, *reset;
292 struct regulator *ldo = NULL;
296 LOG("%s: %d\n", __func__, on);
298 if (!on && primary_sdio_host)
299 mmc_pwrseq_power_off(primary_sdio_host);
301 if (mrfkill == NULL) {
302 LOG("%s: rfkill-wlan driver has not Successful initialized\n", __func__);
306 if (mrfkill->pdata->wifi_power_remain && power_set_time) {
307 LOG("%s: wifi power is setted to be remain on. skip anything to the power control", __func__);
309 } else power_set_time++;
311 if (!rfkill_get_bt_power_state(&power, &toggle)) {
312 if (toggle == true && power == 1) {
313 LOG("%s: wifi shouldn't control the power, it was enabled by BT!\n", __func__);
318 if (mrfkill->pdata->mregulator.power_ctrl_by_pmu) {
321 int level = mrfkill->pdata->mregulator.enable;
323 ldostr = mrfkill->pdata->mregulator.pmu_regulator;
324 if (ldostr == NULL) {
325 LOG("%s: wifi power set to be controled by pmic, but which one?\n", __func__);
328 ldo = regulator_get(NULL, ldostr);
329 if (ldo == NULL || IS_ERR(ldo)) {
330 LOG("\n\n\n%s get ldo error,please mod this\n\n\n", __func__);
334 regulator_set_voltage(ldo, 3000000, 3000000);
335 LOG("%s: %s enabled\n", __func__, ldostr);
336 ret = regulator_enable(ldo);
337 wifi_power_state = 1;
338 LOG("wifi turn on power.\n");
340 LOG("%s: %s disabled\n", __func__, ldostr);
341 while (regulator_is_enabled(ldo) > 0) {
342 ret = regulator_disable(ldo);
344 wifi_power_state = 0;
345 LOG("wifi shut off power.\n");
351 poweron = &mrfkill->pdata->power_n;
352 reset = &mrfkill->pdata->reset_n;
355 if (gpio_is_valid(poweron->io)) {
356 gpio_set_value(poweron->io, poweron->enable);
360 if (gpio_is_valid(reset->io)) {
361 gpio_set_value(reset->io, reset->enable);
365 wifi_power_state = 1;
366 LOG("wifi turn on power. %d\n", poweron->io);
368 if (gpio_is_valid(poweron->io)) {
369 gpio_set_value(poweron->io, !(poweron->enable));
373 if (gpio_is_valid(reset->io)) {
374 gpio_set_value(reset->io, !(reset->enable));
377 wifi_power_state = 0;
378 LOG("wifi shut off power.\n");
384 EXPORT_SYMBOL(rockchip_wifi_power);
386 /**************************************************************************
388 * Wifi Sdio Detect Func
390 *************************************************************************/
391 extern int mmc_host_rescan(struct mmc_host *host, int val, int irq_type);
392 int rockchip_wifi_set_carddetect(int val)
394 return mmc_host_rescan(NULL, val, 1);
396 EXPORT_SYMBOL(rockchip_wifi_set_carddetect);
398 /**************************************************************************
400 * Wifi Get Interrupt irq Func
402 *************************************************************************/
403 int rockchip_wifi_get_oob_irq(void)
405 struct rfkill_wlan_data *mrfkill = g_rfkill;
406 struct rksdmmc_gpio *wifi_int_irq;
408 LOG("%s: Enter\n", __func__);
410 if (mrfkill == NULL) {
411 LOG("%s: rfkill-wlan driver has not Successful initialized\n", __func__);
415 wifi_int_irq = &mrfkill->pdata->wifi_int_b;
416 if (gpio_is_valid(wifi_int_irq->io)) {
417 return gpio_to_irq(wifi_int_irq->io);
418 //return wifi_int_irq->io;
420 LOG("%s: wifi OOB pin isn't defined.\n", __func__);
425 EXPORT_SYMBOL(rockchip_wifi_get_oob_irq);
427 /**************************************************************************
431 *************************************************************************/
432 int rockchip_wifi_reset(int on)
436 EXPORT_SYMBOL(rockchip_wifi_reset);
438 /**************************************************************************
440 * Wifi MAC custom Func
442 *************************************************************************/
443 #include <linux/etherdevice.h>
444 #include <linux/errno.h>
445 u8 wifi_custom_mac_addr[6] = {0,0,0,0,0,0};
447 //#define RANDOM_ADDRESS_SAVE
448 static int get_wifi_addr_vendor(unsigned char *addr)
452 ret = rk_vendor_read(WIFI_MAC_ID, addr, 6);
453 if (ret != 6 || is_zero_ether_addr(addr)) {
454 LOG("%s: rk_vendor_read wifi mac address failed (%d)\n",
456 #ifdef RANDOM_ADDRESS_SAVE
457 random_ether_addr(addr);
458 LOG("%s: generate random wifi mac address: "
459 "%02x:%02x:%02x:%02x:%02x:%02x\n",
460 __func__, addr[0], addr[1], addr[2],
461 addr[3], addr[4], addr[5]);
462 ret = rk_vendor_write(WIFI_MAC_ID, addr, 6);
464 LOG("%s: rk_vendor_write"
465 " wifi mac address failed (%d)\n",
474 LOG("%s: rk_vendor_read wifi mac address: "
475 "%02x:%02x:%02x:%02x:%02x:%02x\n",
476 __func__, addr[0], addr[1], addr[2],
477 addr[3], addr[4], addr[5]);
482 int rockchip_wifi_mac_addr(unsigned char *buf)
484 char mac_buf[20] = {0};
486 LOG("%s: enter.\n", __func__);
488 // from vendor storage
489 if (is_zero_ether_addr(wifi_custom_mac_addr)) {
490 if (get_wifi_addr_vendor(wifi_custom_mac_addr) != 0)
494 sprintf(mac_buf, "%02x:%02x:%02x:%02x:%02x:%02x",
495 wifi_custom_mac_addr[0], wifi_custom_mac_addr[1],
496 wifi_custom_mac_addr[2], wifi_custom_mac_addr[3],
497 wifi_custom_mac_addr[4], wifi_custom_mac_addr[5]);
498 LOG("falsh wifi_custom_mac_addr=[%s]\n", mac_buf);
500 if (is_valid_ether_addr(wifi_custom_mac_addr)) {
501 if (!strncmp(wifi_chip_type_string, "rtl", 3))
502 wifi_custom_mac_addr[0] &= ~0x2; // for p2p
504 LOG("This mac address is not valid, ignored...\n");
508 memcpy(buf, wifi_custom_mac_addr, 6);
512 EXPORT_SYMBOL(rockchip_wifi_mac_addr);
514 /**************************************************************************
516 * wifi get country code func
518 *************************************************************************/
519 struct cntry_locales_custom {
520 char iso_abbrev[4]; /* ISO 3166-1 country abbreviation */
521 char custom_locale[4]; /* Custom firmware locale */
522 int custom_locale_rev; /* Custom local revisin default -1 */
525 static struct cntry_locales_custom country_cloc;
527 void *rockchip_wifi_country_code(char *ccode)
529 struct cntry_locales_custom *mcloc;
531 LOG("%s: set country code [%s]\n", __func__, ccode);
532 mcloc = &country_cloc;
533 memcpy(mcloc->custom_locale, ccode, 4);
534 mcloc->custom_locale_rev = 0;
538 EXPORT_SYMBOL(rockchip_wifi_country_code);
539 /**************************************************************************/
541 static int rfkill_rk_setup_gpio(struct rksdmmc_gpio *gpio, const char* prefix, const char* name)
543 if (gpio_is_valid(gpio->io)) {
545 sprintf(gpio->name, "%s_%s", prefix, name);
546 ret = gpio_request(gpio->io, gpio->name);
548 LOG("Failed to get %s gpio.\n", gpio->name);
557 static int wlan_platdata_parse_dt(struct device *dev,
558 struct rksdmmc_gpio_wifi_moudle *data)
560 struct device_node *node = dev->of_node;
564 enum of_gpio_flags flags;
569 memset(data, 0, sizeof(*data));
571 #ifdef CONFIG_MFD_SYSCON
572 data->grf = syscon_regmap_lookup_by_phandle(node, "rockchip,grf");
573 if (IS_ERR(data->grf)) {
574 LOG("can't find rockchip,grf property\n");
579 ret = of_property_read_string(node, "wifi_chip_type", &strings);
581 LOG("%s: Can not read wifi_chip_type, set default to rkwifi.\n", __func__);
582 strcpy(wifi_chip_type_string, "rkwifi");
584 strcpy(wifi_chip_type_string, strings);
586 LOG("%s: wifi_chip_type = %s\n", __func__, wifi_chip_type_string);
588 if (of_find_property(node, "keep_wifi_power_on", NULL)) {
589 data->wifi_power_remain = true;
590 LOG("%s: wifi power will enabled while kernel starting and keep on.\n", __func__);
592 data->wifi_power_remain = false;
593 LOG("%s: enable wifi power control.\n", __func__);
596 if (of_find_property(node, "power_ctrl_by_pmu", NULL)) {
597 data->mregulator.power_ctrl_by_pmu = true;
598 ret = of_property_read_string(node, "power_pmu_regulator", &strings);
600 LOG("%s: Can not read property: power_pmu_regulator.\n", __func__);
601 data->mregulator.power_ctrl_by_pmu = false;
603 LOG("%s: wifi power controled by pmu(%s).\n", __func__, strings);
604 sprintf(data->mregulator.pmu_regulator, "%s", strings);
606 ret = of_property_read_u32(node, "power_pmu_enable_level", &value);
608 LOG("%s: Can not read property: power_pmu_enable_level.\n", __func__);
609 data->mregulator.power_ctrl_by_pmu = false;
611 LOG("%s: wifi power controled by pmu(level = %s).\n", __func__, (value == 1)?"HIGH":"LOW");
612 data->mregulator.enable = value;
615 data->mregulator.power_ctrl_by_pmu = false;
616 LOG("%s: wifi power controled by gpio.\n", __func__);
617 gpio = of_get_named_gpio_flags(node, "WIFI,poweren_gpio", 0, &flags);
618 if (gpio_is_valid(gpio)){
619 data->power_n.io = gpio;
620 data->power_n.enable = (flags == GPIO_ACTIVE_HIGH)? 1:0;
621 LOG("%s: get property: WIFI,poweren_gpio = %d, flags = %d.\n", __func__, gpio, flags);
622 } else data->power_n.io = -1;
623 gpio = of_get_named_gpio_flags(node, "WIFI,reset_gpio", 0, &flags);
624 if (gpio_is_valid(gpio)){
625 data->reset_n.io = gpio;
626 data->reset_n.enable = (flags == GPIO_ACTIVE_HIGH)? 1:0;
627 LOG("%s: get property: WIFI,reset_gpio = %d, flags = %d.\n", __func__, gpio, flags);
628 } else data->reset_n.io = -1;
629 gpio = of_get_named_gpio_flags(node, "WIFI,host_wake_irq", 0, &flags);
630 if (gpio_is_valid(gpio)){
631 data->wifi_int_b.io = gpio;
632 data->wifi_int_b.enable = flags;
633 LOG("%s: get property: WIFI,host_wake_irq = %d, flags = %d.\n", __func__, gpio, flags);
634 } else data->wifi_int_b.io = -1;
641 #if defined(CONFIG_HAS_EARLYSUSPEND)
642 #include <linux/earlysuspend.h>
644 static void wlan_early_suspend(struct early_suspend *h)
646 LOG("%s :enter\n", __func__);
651 static void wlan_late_resume(struct early_suspend *h)
653 LOG("%s :enter\n", __func__);
658 struct early_suspend wlan_early_suspend {
659 .level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN - 20;
660 .suspend = wlan_early_suspend;
661 .resume = wlan_late_resume;
665 static void rfkill_wlan_early_suspend(void)
667 //LOG("%s :enter\n", __func__);
672 static void rfkill_wlan_later_resume(void)
674 //LOG("%s :enter\n", __func__);
679 static int rfkill_wlan_fb_event_notify(struct notifier_block *self,
680 unsigned long action, void *data)
683 struct fb_event *event = data;
684 int blank_mode = *((int *)event->data);
686 switch (blank_mode) {
687 case FB_BLANK_UNBLANK:
688 rfkill_wlan_later_resume();
690 case FB_BLANK_NORMAL:
691 rfkill_wlan_early_suspend();
694 rfkill_wlan_early_suspend();
701 static struct notifier_block rfkill_wlan_fb_notifier = {
702 .notifier_call = rfkill_wlan_fb_event_notify,
706 static int rfkill_wlan_probe(struct platform_device *pdev)
708 struct rfkill_wlan_data *rfkill;
709 struct rksdmmc_gpio_wifi_moudle *pdata = pdev->dev.platform_data;
712 LOG("Enter %s\n", __func__);
716 pdata = kzalloc(sizeof(struct rksdmmc_gpio_wifi_moudle), GFP_KERNEL);
720 ret = wlan_platdata_parse_dt(&pdev->dev, pdata);
723 LOG("%s: No platform data specified\n", __func__);
730 rfkill = kzalloc(sizeof(*rfkill), GFP_KERNEL);
732 goto rfkill_alloc_fail;
734 rfkill->pdata = pdata;
737 LOG("%s: init gpio\n", __func__);
739 if (!pdata->mregulator.power_ctrl_by_pmu) {
740 ret = rfkill_rk_setup_gpio(&pdata->power_n, wlan_name, "wlan_poweren");
741 if (ret) goto fail_alloc;
743 ret = rfkill_rk_setup_gpio(&pdata->reset_n, wlan_name, "wlan_reset");
744 if (ret) goto fail_alloc;
747 wake_lock_init(&(rfkill->wlan_irq_wl), WAKE_LOCK_SUSPEND, "rfkill_wlan_wake");
749 // Turn off wifi power as default
750 if (gpio_is_valid(pdata->power_n.io))
752 gpio_direction_output(pdata->power_n.io, !pdata->power_n.enable);
755 if (pdata->wifi_power_remain)
757 rockchip_wifi_power(1);
760 #if BCM_STATIC_MEMORY_SUPPORT
761 rockchip_init_wifi_mem();
764 #if defined(CONFIG_HAS_EARLYSUSPEND)
765 register_early_suspend(wlan_early_suspend);
768 fb_register_client(&rfkill_wlan_fb_notifier);
770 LOG("Exit %s\n", __func__);
784 static int rfkill_wlan_remove(struct platform_device *pdev)
786 struct rfkill_wlan_data *rfkill = platform_get_drvdata(pdev);
788 LOG("Enter %s\n", __func__);
790 wake_lock_destroy(&rfkill->wlan_irq_wl);
792 fb_unregister_client(&rfkill_wlan_fb_notifier);
794 if (gpio_is_valid(rfkill->pdata->power_n.io))
795 gpio_free(rfkill->pdata->power_n.io);
797 if (gpio_is_valid(rfkill->pdata->reset_n.io))
798 gpio_free(rfkill->pdata->reset_n.io);
800 // if (gpio_is_valid(rfkill->pdata->vddio.io))
801 // gpio_free(rfkill->pdata->vddio.io);
803 // if (gpio_is_valid(rfkill->pdata->bgf_int_b.io))
804 // gpio_free(rfkill->pdata->bgf_int_b.io);
806 // if (gpio_is_valid(rfkill->pdata->gps_sync.io))
807 // gpio_free(rfkill->pdata->gps_sync.io);
809 // if (gpio_is_valid(rfkill->pdata->ANTSEL2.io))
810 // gpio_free(rfkill->pdata->ANTSEL2.io);
812 // if (gpio_is_valid(rfkill->pdata->ANTSEL3.io))
813 // gpio_free(rfkill->pdata->ANTSEL3.io);
815 // if (gpio_is_valid(rfkill->pdata->GPS_LAN.io))
816 // gpio_free(rfkill->pdata->GPS_LAN.io);
824 static int rfkill_wlan_suspend(struct platform_device *pdev, pm_message_t state)
826 LOG("Enter %s\n", __func__);
830 static int rfkill_wlan_resume(struct platform_device *pdev)
832 LOG("Enter %s\n", __func__);
837 static struct of_device_id wlan_platdata_of_match[] = {
838 { .compatible = "wlan-platdata" },
841 MODULE_DEVICE_TABLE(of, wlan_platdata_of_match);
844 static struct platform_driver rfkill_wlan_driver = {
845 .probe = rfkill_wlan_probe,
846 .remove = rfkill_wlan_remove,
847 .suspend = rfkill_wlan_suspend,
848 .resume = rfkill_wlan_resume,
850 .name = "wlan-platdata",
851 .owner = THIS_MODULE,
852 .of_match_table = of_match_ptr(wlan_platdata_of_match),
856 static int __init rfkill_wlan_init(void)
858 LOG("Enter %s\n", __func__);
859 return platform_driver_register(&rfkill_wlan_driver);
862 static void __exit rfkill_wlan_exit(void)
864 LOG("Enter %s\n", __func__);
865 platform_driver_unregister(&rfkill_wlan_driver);
868 module_init(rfkill_wlan_init);
869 module_exit(rfkill_wlan_exit);
871 MODULE_DESCRIPTION("rock-chips rfkill for wifi v0.1");
872 MODULE_AUTHOR("gwl@rock-chips.com");
873 MODULE_LICENSE("GPL");