Wifi:BT: fix rfkill compile warning.
[firefly-linux-kernel-4.4.55.git] / net / rfkill / rfkill-wlan.c
1 /*
2  * Copyright (C) 2012 ROCKCHIP, Inc.
3  *
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.
7  *
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.
12  *
13  */
14 /* Rock-chips rfkill driver for wifi
15 */
16
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 <asm/gpio.h>
24 #include <linux/regulator/consumer.h>
25 #include <linux/delay.h>
26 #include <linux/rfkill-wlan.h>
27 #include <linux/wakelock.h>
28 #include <linux/interrupt.h>
29 #include <asm/irq.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 #ifdef CONFIG_OF
37 #include <linux/of.h>
38 #include <linux/of_device.h>
39 #include <linux/of_gpio.h>
40 #endif
41
42 #if 0
43 #define DBG(x...)   printk(KERN_INFO "[WLAN_RFKILL]: "x)
44 #else
45 #define DBG(x...)
46 #endif
47
48 #define LOG(x...)   printk(KERN_INFO "[WLAN_RFKILL]: "x)
49
50 struct rfkill_wlan_data {
51         struct rksdmmc_gpio_wifi_moudle *pdata;
52     struct wake_lock            wlan_irq_wl;
53 };
54
55 static struct rfkill_wlan_data *g_rfkill = NULL;
56
57 static const char wlan_name[] = 
58 #if defined (CONFIG_BCM4330)
59     #if defined (CONFIG_BT_MODULE_NH660)
60         "nh660"
61     #else
62         "bcm4330"
63     #endif
64 #elif defined (CONFIG_RK903)
65     #if defined(CONFIG_RKWIFI_26M)
66         "rk903_26M"
67     #else
68         "rk903"
69     #endif
70 #elif defined(CONFIG_BCM4329)
71         "bcm4329"
72 #elif defined(CONFIG_MV8787)
73         "mv8787"
74 #elif defined(CONFIG_AP6210)
75     #if defined(CONFIG_RKWIFI_26M)
76         "ap6210"
77     #else
78         "ap6210_24M"
79     #endif
80 #elif defined(CONFIG_AP6330)
81                 "ap6330"
82 #elif defined(CONFIG_AP6476)
83                 "ap6476"
84 #elif defined(CONFIG_AP6493)
85                 "ap6493"
86 #else
87         "wlan_default"
88 #endif
89 ;
90
91 /***********************************************************
92  * 
93  * Broadcom Wifi Static Memory
94  * 
95  **********************************************************/
96 #define BCM_STATIC_MEMORY_SUPPORT 0
97 //===========================
98 #if BCM_STATIC_MEMORY_SUPPORT
99 #define PREALLOC_WLAN_SEC_NUM           4
100 #define PREALLOC_WLAN_BUF_NUM           160
101 #define PREALLOC_WLAN_SECTION_HEADER    24
102 #define WLAN_SKB_BUF_NUM        16
103
104 #define WLAN_SECTION_SIZE_0     (PREALLOC_WLAN_BUF_NUM * 128)
105 #define WLAN_SECTION_SIZE_1     (PREALLOC_WLAN_BUF_NUM * 128)
106 #define WLAN_SECTION_SIZE_2     (PREALLOC_WLAN_BUF_NUM * 512)
107 #define WLAN_SECTION_SIZE_3     (PREALLOC_WLAN_BUF_NUM * 1024)
108 #define WLAN_SECTION_SIZE_5     (PREALLOC_WLAN_BUF_NUM * 512)
109
110 static struct sk_buff *wlan_static_skb[WLAN_SKB_BUF_NUM];
111
112 struct wifi_mem_prealloc {
113     void *mem_ptr;
114     unsigned long size;
115 };
116
117 static struct wifi_mem_prealloc wifi_mem_array[5] = {
118     {NULL, (WLAN_SECTION_SIZE_0 + PREALLOC_WLAN_SECTION_HEADER)},
119     {NULL, (WLAN_SECTION_SIZE_1 + PREALLOC_WLAN_SECTION_HEADER)},
120     {NULL, (WLAN_SECTION_SIZE_2 + PREALLOC_WLAN_SECTION_HEADER)},
121     {NULL, (WLAN_SECTION_SIZE_3 + PREALLOC_WLAN_SECTION_HEADER)},
122     {NULL, (WLAN_SECTION_SIZE_5 + PREALLOC_WLAN_SECTION_HEADER)}
123 };
124
125 static int __init rockchip_init_wifi_mem(void)
126 {
127     int i;
128     int j;
129
130     for (i = 0 ; i < WLAN_SKB_BUF_NUM ; i++) {
131         wlan_static_skb[i] = dev_alloc_skb(
132                ((i < (WLAN_SKB_BUF_NUM / 2)) ? 4096 : 8192));
133
134         if (!wlan_static_skb[i])
135             goto err_skb_alloc;
136     }
137
138     for (i = 0 ; i < 5; i++) {
139         wifi_mem_array[i].mem_ptr =
140                kmalloc(wifi_mem_array[i].size, GFP_KERNEL);
141
142         if (!wifi_mem_array[i].mem_ptr)
143             goto err_mem_alloc;
144         }
145         return 0;
146
147 err_mem_alloc:
148     pr_err("Failed to mem_alloc for WLAN\n");
149     for (j = 0 ; j < i ; j++)
150         kfree(wifi_mem_array[j].mem_ptr);
151     i = WLAN_SKB_BUF_NUM;
152 err_skb_alloc:
153     pr_err("Failed to skb_alloc for WLAN\n");
154     for (j = 0 ; j < i ; j++)
155         dev_kfree_skb(wlan_static_skb[j]);
156
157     return -ENOMEM;
158 }
159
160 void *rockchip_mem_prealloc(int section, unsigned long size)
161 {
162     if (section == PREALLOC_WLAN_SEC_NUM)
163         return wlan_static_skb;
164
165     if ((section < 0) || (section > 5))
166         return NULL;
167
168     if (section == 5)
169         return wifi_mem_array[4].mem_ptr;
170
171     if (wifi_mem_array[section].size < size)
172         return NULL;
173
174     return wifi_mem_array[section].mem_ptr;
175 }
176 #else
177 void *rockchip_mem_prealloc(int section, unsigned long size) { return NULL;}
178 #endif
179 EXPORT_SYMBOL(rockchip_mem_prealloc);
180
181 /**************************************************************************
182  *
183  * Wifi Power Control Func
184  * 0 -> power off
185  * 1 -> power on
186  *
187  *************************************************************************/
188 int rockchip_wifi_power(int on)
189 {
190         struct rfkill_wlan_data *mrfkill = g_rfkill;
191     struct rksdmmc_gpio *poweron, *reset;
192     struct regulator *ldo = NULL;
193
194     LOG("%s: %d\n", __func__, on);
195
196     if (mrfkill == NULL) {
197         LOG("%s: rfkill-wlan driver has not Successful initialized\n", __func__);
198         return -1;
199     }
200
201     if (mrfkill->pdata->mregulator.power_ctrl_by_pmu) {
202         char *ldostr;
203         int ret = -1;
204         int level = mrfkill->pdata->mregulator.enable;
205
206         ldostr = mrfkill->pdata->mregulator.pmu_regulator;
207         if (ldostr == NULL) {
208             LOG("%s: wifi power set to be controled by pmic, but which one?\n", __func__);
209             return -1;
210         }
211         ldo = regulator_get(NULL, ldostr);
212         if (ldo == NULL) {
213             LOG("\n\n\n%s get ldo error,please mod this\n\n\n", __func__);
214         } else {
215                         if (on == level) {
216                                 regulator_set_voltage(ldo, 3000000, 3000000);
217                             LOG("%s: %s enabled\n", __func__, ldostr);
218                                 ret = regulator_enable(ldo);
219                                 if(ret != 0){
220                                     LOG("%s: faild to enable %s\n", __func__, ldostr);
221                                 }
222                             LOG("wifi turn on power.\n");
223             } else {
224                             LOG("wifi shut off power.\n");
225                                 LOG("%s: %s disabled\n", __func__, ldostr);
226                                 ret = regulator_disable(ldo);
227                                 if(ret != 0){
228                                         LOG("%s: faild to disable %s\n", __func__, ldostr);
229                                 }
230                         }
231                         regulator_put(ldo);
232                         mdelay(100);
233                 }
234     } else {
235                 poweron = &mrfkill->pdata->power_n;
236                 reset = &mrfkill->pdata->reset_n;
237
238                 if (on){
239                         if (gpio_is_valid(poweron->io)) {
240                                 gpio_set_value(poweron->io, poweron->enable);
241                         }
242                         mdelay(100);
243
244                         if (gpio_is_valid(reset->io)) {
245                                 gpio_set_value(reset->io, reset->enable);
246                         }
247                         mdelay(100);
248                         LOG("wifi turn on power. %d\n", poweron->io);
249                 }else{
250                         if (gpio_is_valid(poweron->io)) {
251                                 gpio_set_value(poweron->io, !(poweron->enable));
252                         }
253
254                         mdelay(100);
255                         if (gpio_is_valid(reset->io)) {
256                                 gpio_set_value(reset->io, !(reset->enable));
257                         }
258
259                         LOG("wifi shut off power.\n");
260                 }
261     }
262
263     return 0;
264 }
265 EXPORT_SYMBOL(rockchip_wifi_power);
266
267 /**************************************************************************
268  *
269  * Wifi Sdio Detect Func
270  *
271  *************************************************************************/
272 #include <linux/mmc/host.h>
273 extern int mmc_host_rescan(struct mmc_host *host, int val);
274 int rockchip_wifi_set_carddetect(int val)
275 {
276     return mmc_host_rescan(NULL, val);//NULL => SDIO host
277 }
278 EXPORT_SYMBOL(rockchip_wifi_set_carddetect);
279
280 /**************************************************************************
281  *
282  * Wifi Get Interrupt irq Func
283  *
284  *************************************************************************/
285 int rockchip_wifi_get_oob_irq(void)
286 {
287     struct rfkill_wlan_data *mrfkill = g_rfkill;
288     struct rksdmmc_gpio *wifi_int_irq;
289
290     LOG("%s: Enter\n", __func__);
291
292     if (mrfkill == NULL) {
293         LOG("%s: rfkill-wlan driver has not Successful initialized\n", __func__);
294         return -1;
295     }
296     
297     wifi_int_irq = &mrfkill->pdata->wifi_int_b;
298     if (gpio_is_valid(wifi_int_irq->io)) {
299         return gpio_to_irq(wifi_int_irq->io);
300         //return wifi_int_irq->io;
301     } else {
302         LOG("%s: wifi OOB pin isn't defined.\n", __func__);
303     }
304     
305     return -1;
306 }
307 EXPORT_SYMBOL(rockchip_wifi_get_oob_irq);
308
309 /**************************************************************************
310  *
311  * Wifi Reset Func
312  *
313  *************************************************************************/
314 int rockchip_wifi_reset(int on)
315 {
316     return 0;
317 }
318 EXPORT_SYMBOL(rockchip_wifi_reset);
319
320 /**************************************************************************
321  *
322  * Wifi MAC custom Func
323  *
324  *************************************************************************/
325 #include <linux/etherdevice.h>
326 u8 wifi_custom_mac_addr[6] = {0,0,0,0,0,0};
327 extern char GetSNSectorInfo(char * pbuf);
328 int rockchip_wifi_mac_addr(unsigned char *buf)
329 {
330     return -1;
331     char mac_buf[20] = {0};
332     LOG("%s: enter.\n", __func__);
333
334     // from vflash
335     if(is_zero_ether_addr(wifi_custom_mac_addr)) {
336         int i;
337         char *tempBuf = kmalloc(512, GFP_KERNEL);
338         if(tempBuf) {
339             GetSNSectorInfo(tempBuf);
340             for (i = 506; i <= 511; i++)
341                 wifi_custom_mac_addr[i-506] = tempBuf[i];
342             kfree(tempBuf);
343         } else {
344             return -1;
345         }
346     }
347
348     sprintf(mac_buf,"%02x:%02x:%02x:%02x:%02x:%02x",wifi_custom_mac_addr[0],wifi_custom_mac_addr[1],
349     wifi_custom_mac_addr[2],wifi_custom_mac_addr[3],wifi_custom_mac_addr[4],wifi_custom_mac_addr[5]);
350     LOG("falsh wifi_custom_mac_addr=[%s]\n", mac_buf);
351
352     if (is_valid_ether_addr(wifi_custom_mac_addr)) {
353         if (2 == (wifi_custom_mac_addr[0] & 0x0F)) {
354             LOG("This mac address come into conflict with the address of direct, ignored...\n");
355             return -1;
356         }
357     } else {
358         LOG("This mac address is not valid, ignored...\n");
359         return -1;
360     }
361
362 #if defined(CONFIG_RKWIFI)
363     memcpy(buf, wifi_custom_mac_addr, 6);
364 #else
365     memcpy(buf, mac_buf, strlen(mac_buf));//realtek's wifi use this branch
366 #endif
367     return 0;
368 }
369 EXPORT_SYMBOL(rockchip_wifi_mac_addr);
370
371 /**************************************************************************
372  *
373  * wifi get country code func
374  *
375  *************************************************************************/
376 struct cntry_locales_custom {
377     char iso_abbrev[4];  /* ISO 3166-1 country abbreviation */
378     char custom_locale[4];   /* Custom firmware locale */
379     int custom_locale_rev;        /* Custom local revisin default -1 */
380 };
381
382 static struct cntry_locales_custom country_cloc;
383
384 void *rockchip_wifi_country_code(char *ccode)
385 {
386     struct cntry_locales_custom *mcloc;
387
388     LOG("%s: set country code [%s]\n", __func__, ccode);
389     mcloc = &country_cloc;
390     memcpy(mcloc->custom_locale, ccode, 4);
391     mcloc->custom_locale_rev = 0;
392
393     return mcloc;
394 }
395 EXPORT_SYMBOL(rockchip_wifi_country_code);
396 /**************************************************************************/
397
398 static int rockchip_wifi_voltage_select(void)
399 {
400     struct rfkill_wlan_data *mrfkill = g_rfkill;
401     int voltage = 0;
402
403     if (mrfkill == NULL) {
404         LOG("%s: rfkill-wlan driver has not Successful initialized\n", __func__);
405         return -1;
406     }
407     voltage = mrfkill->pdata->sdio_vol;
408     if (voltage > 2700 && voltage < 3500) {
409         writel_relaxed(0x00100000, RK_GRF_VIRT+0x380); //3.3
410         LOG("%s: wifi & sdio reference voltage: 3.3V\n", __func__);
411     } else if (voltage  > 1500 && voltage < 1950) {
412         writel_relaxed(0x00100010, RK_GRF_VIRT+0x380); //1.8
413         LOG("%s: wifi & sdio reference voltage: 1.8V\n", __func__);
414     } else {
415         LOG("%s: unsupport wifi & sdio reference voltage!\n", __func__);
416         return -1;
417     }
418
419     return 0;
420 }
421
422 static int rfkill_rk_setup_gpio(struct rksdmmc_gpio *gpio, const char* prefix, const char* name)
423 {
424     if (gpio_is_valid(gpio->io)) {
425         int ret=0;
426         sprintf(gpio->name, "%s_%s", prefix, name);
427         ret = gpio_request(gpio->io, gpio->name);
428         if (ret) {
429             LOG("Failed to get %s gpio.\n", gpio->name);
430             return -1;
431         }
432     }
433
434     return 0;
435 }
436
437 #ifdef CONFIG_OF
438 static int wlan_platdata_parse_dt(struct device *dev,
439                   struct rksdmmc_gpio_wifi_moudle *data)
440 {
441     struct device_node *node = dev->of_node;
442     const char *strings;
443     u32 value;
444     int gpio,ret;
445     enum of_gpio_flags flags;
446
447     if (!node)
448         return -ENODEV;
449
450     memset(data, 0, sizeof(*data));
451
452     ret = of_property_read_u32(node, "sdio_vref", &value);
453     if (ret < 0) {
454         LOG("%s: Can't get sdio vref.", __func__);
455         return -1;
456     }
457     data->sdio_vol = value;
458
459     if (of_find_property(node, "power_ctrl_by_pmu", NULL)) {
460         data->mregulator.power_ctrl_by_pmu = true;
461         ret = of_property_read_string(node, "pmu_regulator", &strings);
462         if (ret) {
463             LOG("%s: Can not read property: pmu_regulator.\n", __func__);
464             data->mregulator.power_ctrl_by_pmu = false;
465         } else {
466             LOG("%s: wifi power controled by pmu(%s).\n", __func__, strings);
467             sprintf(data->mregulator.pmu_regulator, "%s", strings);
468         }
469         ret = of_property_read_u32(node, "pmu_enable_level", &value);
470         if (ret) {
471             LOG("%s: Can not read property: pmu_enable_level.\n", __func__);
472             data->mregulator.power_ctrl_by_pmu = false;
473         } else {
474             LOG("%s: wifi power controled by pmu(level = %s).\n", __func__, (value == 1)?"HIGH":"LOW");
475             data->mregulator.enable = value;
476         }
477         } else {
478                 data->mregulator.power_ctrl_by_pmu = false;
479                 LOG("%s: wifi power controled by gpio.\n", __func__);
480         gpio = of_get_named_gpio_flags(node, "WIFI,poweren_gpio", 0, &flags);
481         if (gpio_is_valid(gpio)){
482                         data->power_n.io = gpio;
483                         data->power_n.enable = (flags == GPIO_ACTIVE_HIGH)? 1:0;
484                         LOG("%s: get property: WIFI,poweren_gpio = %d, flags = %d.\n", __func__, gpio, flags);
485         } else data->power_n.io = -1;
486         gpio = of_get_named_gpio_flags(node, "WIFI,reset_gpio", 0, &flags);
487         if (gpio_is_valid(gpio)){
488                         data->reset_n.io = gpio;
489                         data->reset_n.enable = (flags == GPIO_ACTIVE_HIGH)? 1:0;
490                         LOG("%s: get property: WIFI,reset_gpio = %d, flags = %d.\n", __func__, gpio, flags);
491         } else data->reset_n.io = -1;
492         gpio = of_get_named_gpio_flags(node, "WIFI,host_wake_irq", 0, &flags);
493         if (gpio_is_valid(gpio)){
494                         data->wifi_int_b.io = gpio;
495                         data->wifi_int_b.enable = flags;
496                         LOG("%s: get property: WIFI,host_wake_irq = %d, flags = %d.\n", __func__, gpio, flags);
497         } else data->wifi_int_b.io = -1;
498         }
499
500     return 0;
501 }
502 #endif //CONFIG_OF
503
504 #if defined(CONFIG_HAS_EARLYSUSPEND)
505 #include <linux/earlysuspend.h>
506
507 static void wlan_early_suspend(struct early_suspend *h)
508 {
509     LOG("%s :enter\n", __func__);
510
511     return;
512 }
513
514 static void wlan_late_resume(struct early_suspend *h)
515 {
516     LOG("%s :enter\n", __func__);
517
518     return;
519 }
520
521 struct early_suspend wlan_early_suspend {
522     .level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN - 20;
523     .suspend = wlan_early_suspend;
524     .resume = wlan_late_resume; 
525 }
526 #endif
527
528 static int rfkill_wlan_probe(struct platform_device *pdev)
529 {
530         struct rfkill_wlan_data *rfkill;
531         struct rksdmmc_gpio_wifi_moudle *pdata = pdev->dev.platform_data;
532         int ret = -1;
533
534     LOG("Enter %s\n", __func__);
535
536         if (!pdata) {
537 #ifdef CONFIG_OF
538         pdata = kzalloc(sizeof(struct rksdmmc_gpio_wifi_moudle), GFP_KERNEL);
539         if (!pdata)
540             return -ENOMEM;
541
542         ret = wlan_platdata_parse_dt(&pdev->dev, pdata);
543         if (ret < 0) {
544 #endif
545                     LOG("%s: No platform data specified\n", __func__);
546             return ret;
547 #ifdef CONFIG_OF
548         }
549 #endif
550         }
551
552         rfkill = kzalloc(sizeof(*rfkill), GFP_KERNEL);
553         if (!rfkill)
554         goto rfkill_alloc_fail;
555
556         rfkill->pdata = pdata;
557     g_rfkill = rfkill;
558
559     LOG("%s: init gpio\n", __func__);
560
561     if (!pdata->mregulator.power_ctrl_by_pmu) {
562         ret = rfkill_rk_setup_gpio(&pdata->power_n, wlan_name, "wlan_poweren");
563         if (ret) goto fail_alloc;
564
565         ret = rfkill_rk_setup_gpio(&pdata->reset_n, wlan_name, "wlan_reset");
566         if (ret) goto fail_alloc;
567     }
568
569     wake_lock_init(&(rfkill->wlan_irq_wl), WAKE_LOCK_SUSPEND, "rfkill_wlan_wake");
570
571     // Turn off wifi power as default
572     if (gpio_is_valid(pdata->power_n.io))
573     {
574         gpio_direction_output(pdata->power_n.io, !pdata->power_n.enable);
575     }
576
577     rockchip_wifi_voltage_select();
578
579 #if BCM_STATIC_MEMORY_SUPPORT
580     rockchip_init_wifi_mem();
581 #endif
582
583 #if defined(CONFIG_HAS_EARLYSUSPEND)
584     register_early_suspend(wlan_early_suspend);
585 #endif
586
587     LOG("Exit %s\n", __func__);
588
589         return 0;
590
591 fail_alloc:
592         kfree(rfkill);
593 rfkill_alloc_fail:
594     kfree(pdata);
595
596     g_rfkill = NULL;
597
598         return ret;
599 }
600
601 static int rfkill_wlan_remove(struct platform_device *pdev)
602 {
603         struct rfkill_wlan_data *rfkill = platform_get_drvdata(pdev);
604
605     LOG("Enter %s\n", __func__);
606
607     wake_lock_destroy(&rfkill->wlan_irq_wl);
608     
609     if (gpio_is_valid(rfkill->pdata->power_n.io))
610         gpio_free(rfkill->pdata->power_n.io);
611     
612     if (gpio_is_valid(rfkill->pdata->reset_n.io))
613         gpio_free(rfkill->pdata->reset_n.io);
614     
615 //    if (gpio_is_valid(rfkill->pdata->vddio.io))
616 //        gpio_free(rfkill->pdata->vddio.io);
617 //
618 //    if (gpio_is_valid(rfkill->pdata->bgf_int_b.io))
619 //        gpio_free(rfkill->pdata->bgf_int_b.io);
620 //    
621 //    if (gpio_is_valid(rfkill->pdata->gps_sync.io))
622 //        gpio_free(rfkill->pdata->gps_sync.io);
623 //    
624 //    if (gpio_is_valid(rfkill->pdata->ANTSEL2.io))
625 //        gpio_free(rfkill->pdata->ANTSEL2.io);
626 //
627 //    if (gpio_is_valid(rfkill->pdata->ANTSEL3.io))
628 //        gpio_free(rfkill->pdata->ANTSEL3.io);
629 //    
630 //    if (gpio_is_valid(rfkill->pdata->GPS_LAN.io))
631 //        gpio_free(rfkill->pdata->GPS_LAN.io);
632
633     kfree(rfkill);
634     g_rfkill = NULL;
635
636         return 0;
637 }
638
639 static int rfkill_wlan_suspend(struct platform_device *pdev, pm_message_t state)
640 {
641     LOG("Enter %s\n", __func__);
642     return 0;
643 }
644
645 static int rfkill_wlan_resume(struct platform_device *pdev)
646 {
647     LOG("Enter %s\n", __func__);
648     return 0;
649 }
650
651 #ifdef CONFIG_OF
652 static struct of_device_id wlan_platdata_of_match[] = {
653     { .compatible = "wlan-platdata" },
654     { }
655 };
656 MODULE_DEVICE_TABLE(of, wlan_platdata_of_match);
657 #endif //CONFIG_OF
658
659 static struct platform_driver rfkill_wlan_driver = {
660         .probe = rfkill_wlan_probe,
661         .remove = rfkill_wlan_remove,
662     .suspend = rfkill_wlan_suspend,
663     .resume = rfkill_wlan_resume,
664         .driver = {
665                 .name = "wlan-platdata",
666                 .owner = THIS_MODULE,
667         .of_match_table = of_match_ptr(wlan_platdata_of_match),
668         },
669 };
670
671 static int __init rfkill_wlan_init(void)
672 {
673     LOG("Enter %s\n", __func__);
674         return platform_driver_register(&rfkill_wlan_driver);
675 }
676
677 static void __exit rfkill_wlan_exit(void)
678 {
679     LOG("Enter %s\n", __func__);
680         platform_driver_unregister(&rfkill_wlan_driver);
681 }
682
683 module_init(rfkill_wlan_init);
684 module_exit(rfkill_wlan_exit);
685
686 MODULE_DESCRIPTION("rock-chips rfkill for wifi v0.1");
687 MODULE_AUTHOR("gwl@rock-chips.com");
688 MODULE_LICENSE("GPL");