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 bluetooth
16 * BT Ô´ÂëÓÉÔÀ´µÄarch/arm/mach-rkxx/board-xxx-rfkill.cÒÆÖÁ´Ë´¦
17 * GPIOµÄÅäÖÃÔÚ arch/arm/mach-rkxx/board-rkxx-sdk.c µÄrfkill_rk_platdata½á¹¹ÌåÖÐ
19 * Çë¸ù¾Ýʵ¼ÊÇé¿öÅäÖúÃÀ¶ÑÀµÄ¸÷¸öGPIOÒý½Å£¬Òý½ÅÅäÖÃ˵Ã÷ÈçÏÂ:
21 .io = -1, // GPIOÖµ£¬ -1 ±íʾÎ޴˹¦ÄÜ
22 .enable = -1, // ʹÄÜ, GPIO_HIGH - ¸ßʹÄÜ£¬ GPIO_LOW - µÍʹÄÜ
24 .name = NULL, // IOMUXÃû³Æ£¬NULL ±íʾËüÊǵ¥¹¦ÄÜ£¬²»ÐèÒªmux
25 .fgpio = -1, // ÅäÖÃΪGPIOʱ£¬Ó¦ÉèÖõÄÖµ
26 .fmux = -1, // ÅäÖÃΪ¸´Óù¦ÄÜʱ£¬Ó¦ÉèÖõÄÖµ
31 #include <linux/kernel.h>
32 #include <linux/platform_device.h>
33 #include <linux/module.h>
34 #include <linux/rfkill.h>
35 #include <linux/init.h>
36 #include <linux/slab.h>
38 #include <mach/iomux.h>
39 #include <linux/delay.h>
40 #include <linux/rfkill-rk.h>
41 #include <linux/wakelock.h>
42 #include <linux/interrupt.h>
44 #include <linux/suspend.h>
45 #include <linux/proc_fs.h>
46 #include <linux/uaccess.h>
49 #define DBG(x...) printk(KERN_INFO "[BT_RFKILL]: "x)
54 #define LOG(x...) printk(KERN_INFO "[BT_RFKILL]: "x)
56 #define BT_WAKEUP_TIMEOUT 10000
57 #define BT_IRQ_WAKELOCK_TIMEOUT 10*1000
59 #define BT_BLOCKED true
60 #define BT_UNBLOCK false
62 #define BT_WAKEUP false
70 #ifdef CONFIG_ARCH_RK29
71 #define rk_mux_api_set(name,mode) rk29_mux_api_set(name,mode)
72 #elif defined (CONFIG_ARCH_RK30)
73 #define rk_mux_api_set(name,mode) rk30_mux_api_set(name,mode)
75 #define rk_mux_api_set(name,mode) rk30_mux_api_set(name,mode)
78 // RK29+BCM4329, ÆäwifiÓëbtµÄpower¿ØÖƽÅÊǽÓÔÚÒ»ÆðµÄ
79 // ÔÚ¸øbtϵçʱ£¬ÐèÒªÏÈÅжÏwifi״̬
80 #if defined(CONFIG_BCM4329)
81 #define WIFI_BT_POWER_TOGGLE 1
82 extern int rk29sdk_bt_power_state;
83 extern int rk29sdk_wifi_power_state;
85 #define WIFI_BT_POWER_TOGGLE 0
88 struct rfkill_rk_data {
89 // Ö¸ÏòboardÖж¨ÒåµÄplatform data
90 struct rfkill_rk_platform_data *pdata;
92 // Ö¸ÏòrfkillÉ豸£¬ËüÓÉrfkill_alloc´´½¨
93 struct rfkill *rfkill_dev;
95 // ÔÚIRQÖжϺ¯ÊýÖÐʹÓã¬È·±£ÔÚBT»½ÐÑAPºó£¬²»»áÁ¢¼´
96 // µ÷ÓÃsuspend½øÈë˯Ãß
97 struct wake_lock bt_irq_wl;
99 // ÔÚ»½ÐÑBTºó£¬Í¨¹ý¸Ãdelay workÑÓʱһ¶Îʱ¼äºó½øÈë˯Ãß
100 // Èç¹ûdelay work»¹Î´Ö´ÐоÍÓÖÀ´Ò»´Î BT wake£¬Ôò»áÏÈcancel
101 // ÒÑÓÐµÄ delay work£¬²¢ÖØмÆʱ¡£
102 struct delayed_work bt_sleep_delay_work;
105 static struct rfkill_rk_data *g_rfkill = NULL;
107 static const char bt_name[] =
108 #if defined (CONFIG_BCM4330)
109 #if defined (CONFIG_BT_MODULE_NH660)
114 #elif defined (CONFIG_RK903)
115 #if defined(CONFIG_RKWIFI_26M)
120 #elif defined(CONFIG_BCM4329)
122 #elif defined(CONFIG_MV8787)
124 #elif defined(CONFIG_AP6210)
126 #elif defined(CONFIG_AP6330)
128 #elif defined(CONFIG_AP6476)
130 #elif defined(CONFIG_AP6493)
132 #elif defined(CONFIG_AP6441)
140 * rfkill_rk_wake_host_irq - BT_WAKE_HOST Öжϻص÷º¯Êý
141 * ÉêÇëÒ»¸öwakelock£¬ÒÔÈ·±£´Ë´Î»½ÐѲ»»áÂíÉϽáÊø
143 static irqreturn_t rfkill_rk_wake_host_irq(int irq, void *dev)
145 struct rfkill_rk_data *rfkill = dev;
146 LOG("BT_WAKE_HOST IRQ fired\n");
148 DBG("BT IRQ wakeup, request %dms wakelock\n", BT_IRQ_WAKELOCK_TIMEOUT);
150 wake_lock_timeout(&rfkill->bt_irq_wl,
151 msecs_to_jiffies(BT_IRQ_WAKELOCK_TIMEOUT));
157 * rfkill_rk_setup_gpio - ÉèÖÃGPIO
158 * gpio - ÒªÉèÖõÄGPIO
159 * mux - iomux ʲô¹¦ÄÜ
160 * prefix,name - ×é³É¸ÃIOµÄÃû³Æ
162 * ·µ»ØÖµÓë gpio_request Ïàͬ
164 static int rfkill_rk_setup_gpio(struct rfkill_rk_gpio* gpio, int mux, const char* prefix, const char* name)
166 if (gpio_is_valid(gpio->io)) {
168 sprintf(gpio->name, "%s_%s", prefix, name);
169 ret = gpio_request(gpio->io, gpio->name);
171 LOG("Failed to get %s gpio.\n", gpio->name);
174 if (gpio->iomux.name)
176 if (mux==IOMUX_FGPIO)
177 rk_mux_api_set(gpio->iomux.name, gpio->iomux.fgpio);
178 else if (mux==IOMUX_FMUX)
179 rk_mux_api_set(gpio->iomux.name, gpio->iomux.fmux);
188 // ÉèÖÃ BT_WAKE_HOST IRQ
189 static int rfkill_rk_setup_wake_irq(struct rfkill_rk_data* rfkill)
192 struct rfkill_rk_irq* irq = &(rfkill->pdata->wake_host_irq);
194 #ifndef CONFIG_BK3515A_COMBO
195 ret = rfkill_rk_setup_gpio(&irq->gpio, IOMUX_FGPIO, rfkill->pdata->name, "wake_host");
199 if (gpio_is_valid(irq->gpio.io))
201 #ifndef CONFIG_BK3515A_COMBO
202 ret = gpio_pull_updown(irq->gpio.io, (irq->gpio.enable==GPIO_LOW)?GPIOPullUp:GPIOPullDown);
205 LOG("Request irq for bt wakeup host\n");
206 irq->irq = gpio_to_irq(irq->gpio.io);
207 sprintf(irq->name, "%s_irq", irq->gpio.name);
208 ret = request_irq(irq->irq,
209 rfkill_rk_wake_host_irq,
210 (irq->gpio.enable==GPIO_LOW)?IRQF_TRIGGER_FALLING:IRQF_TRIGGER_RISING,
214 LOG("** disable irq\n");
215 disable_irq(irq->irq);
216 ret = enable_irq_wake(irq->irq);
223 free_irq(irq->gpio.io, rfkill);
225 gpio_free(irq->gpio.io);
230 static inline void rfkill_rk_sleep_bt_internal(struct rfkill_rk_data *rfkill, bool sleep)
232 struct rfkill_rk_gpio *wake = &rfkill->pdata->wake_gpio;
234 DBG("*** bt sleep: %d ***\n", sleep);
235 #ifndef CONFIG_BK3515A_COMBO
236 gpio_direction_output(wake->io, sleep?!wake->enable:wake->enable);
240 DBG("HOST_UART0_TX pull down 10us\n");
241 if (rfkill_rk_setup_gpio(wake, IOMUX_FGPIO, rfkill->pdata->name, "wake") != 0) {
245 gpio_direction_output(wake->io, wake->enable);
247 gpio_direction_output(wake->io, !wake->enable);
249 rk_mux_api_set(wake->iomux.name, wake->iomux.fmux);
255 static void rfkill_rk_delay_sleep_bt(struct work_struct *work)
257 struct rfkill_rk_data *rfkill = NULL;
258 DBG("Enter %s\n",__FUNCTION__);
260 rfkill = container_of(work, struct rfkill_rk_data, bt_sleep_delay_work.work);
262 rfkill_rk_sleep_bt_internal(rfkill, BT_SLEEP);
266 * rfkill_rk_sleep_bt - Sleep or Wakeup BT
267 * 1 ÔÚ¸øBTÉϵçʱºò£¬µ÷Óøú¯Êý»½ÐÑBT
268 * 2 ÔÚsuspendÇý¶¯Ê±ºò£¬µ÷Óøú¯Êý˯ÃßBT
269 * 3 ÔÚHCIÇý¶¯ÖУ¬µ±ÓÐÃüÁî·¢Ë͸øBTʱ£¬µ÷Óøú¯Êý»½ÐÑBT
271 * ¶ÔÀ¶ÑÀµÄÖ¸Áî·¢ËÍÊÇ·¢ÉúÔÚÀ¶ÑÀÉϵçÖ®ºó£¬Òò´Ë1Óë3²»»áͬʱµ÷Óøú¯Êý
272 * À¶ÑÀÖ¸Áî·¢ËÍÓÉÓû§²ã·¢Æð£¬2Óë3²»»áͬʱµ÷Óøú¯Êý
274 void rfkill_rk_sleep_bt(bool sleep)
276 struct rfkill_rk_data *rfkill = g_rfkill;
277 struct rfkill_rk_gpio *wake;
279 DBG("Enter %s\n",__FUNCTION__);
283 LOG("*** RFKILL is empty???\n");
287 wake = &rfkill->pdata->wake_gpio;
288 if (!gpio_is_valid(wake->io))
290 DBG("*** Not support bt wakeup and sleep\n");
294 // È¡Ïûdelay work£¬Èç¹ûwork´¦ÓÚpendding£¬ÔòÁ¢¼´È¡Ïû
295 // Èç¹ûwork´¦ÓÚrunning£¬ÔòµÈ´ýÖ±µ½¸Ãwork½áÊø
296 ret = cancel_delayed_work_sync(&rfkill->bt_sleep_delay_work);
298 rfkill_rk_sleep_bt_internal(rfkill, sleep);
300 #ifdef CONFIG_BT_AUTOSLEEP
301 if (sleep==BT_WAKEUP)
303 // ÖØÐÂÉèÖÃdelay work
304 schedule_delayed_work(&rfkill->bt_sleep_delay_work,
305 msecs_to_jiffies(BT_WAKEUP_TIMEOUT));
309 EXPORT_SYMBOL(rfkill_rk_sleep_bt);
311 static int rfkill_rk_set_power(void *data, bool blocked)
313 struct rfkill_rk_data *rfkill = data;
314 struct rfkill_rk_gpio *poweron = &rfkill->pdata->poweron_gpio;
315 struct rfkill_rk_gpio *reset = &rfkill->pdata->reset_gpio;
316 struct rfkill_rk_gpio* rts = &rfkill->pdata->rts_gpio;
318 DBG("Enter %s\n", __func__);
320 DBG("Set blocked:%d\n", blocked);
322 if (false == blocked) {
323 rfkill_rk_sleep_bt(BT_WAKEUP); // ensure bt is wakeup
325 if (gpio_is_valid(poweron->io))
327 gpio_direction_output(poweron->io, poweron->enable);
330 if (gpio_is_valid(reset->io))
332 gpio_direction_output(reset->io, reset->enable);
334 gpio_direction_output(reset->io, !reset->enable);
338 #if defined(CONFIG_AP6210)
339 if (gpio_is_valid(rts->io))
343 rk_mux_api_set(rts->iomux.name, rts->iomux.fgpio);
345 LOG("ENABLE UART_RTS\n");
346 gpio_direction_output(rts->io, rts->enable);
350 LOG("DISABLE UART_RTS\n");
351 gpio_direction_output(rts->io, !rts->enable);
354 rk_mux_api_set(rts->iomux.name, rts->iomux.fmux);
359 LOG("bt turn on power\n");
361 #if WIFI_BT_POWER_TOGGLE
362 if (!rk29sdk_wifi_power_state) {
364 if (gpio_is_valid(poweron->io))
366 gpio_direction_output(poweron->io, !poweron->enable);
370 LOG("bt shut off power\n");
371 #if WIFI_BT_POWER_TOGGLE
373 LOG("bt shouldn't shut off power, wifi is using it!\n");
376 if (gpio_is_valid(reset->io))
378 gpio_direction_output(reset->io, reset->enable);/* bt reset active*/
383 #if WIFI_BT_POWER_TOGGLE
384 rk29sdk_bt_power_state = !blocked;
389 static int rfkill_rk_pm_prepare(struct device *dev)
391 struct rfkill_rk_data *rfkill = g_rfkill;
392 struct rfkill_rk_gpio* rts;
393 struct rfkill_rk_irq* wake_host_irq;
394 DBG("Enter %s\n",__FUNCTION__);
399 rts = &rfkill->pdata->rts_gpio;
400 wake_host_irq = &rfkill->pdata->wake_host_irq;
402 //To prevent uart to receive bt data when suspended
403 if (gpio_is_valid(rts->io))
405 DBG("Disable UART_RTS\n");
408 rk_mux_api_set(rts->iomux.name, rts->iomux.fgpio);
410 gpio_direction_output(rts->io, !rts->enable);
413 #ifdef CONFIG_BT_AUTOSLEEP
414 // BT½øÈë˯Ãß״̬£¬²»½ÓÊÕÖ÷¿ØÊý¾Ý
415 rfkill_rk_sleep_bt(BT_SLEEP);
418 /* ÖÁ´Ë£¬À¶ÑÀ²»ÔÙËÍÊý¾Ýµ½UART£¬Ò²²»ÔÙ½ÓÊÕÖ÷¿ØµÄUARTÊý¾Ý
419 * ½Ó×ŵ÷ÓÃenable_irqʹÄÜ bt_wake_host irq£¬µ±Ô¶¶ËÉ豸ÓÐÊý¾Ý
420 * µ½À´Ê±£¬½«Í¨¹ý¸ÃIRQ»½ÐÑÖ÷¿Ø
423 // enable bt wakeup host
424 if (gpio_is_valid(wake_host_irq->gpio.io))
426 #ifdef CONFIG_BK3515A_COMBO
428 ret = rfkill_rk_setup_gpio(&wake_host_irq->gpio, IOMUX_FGPIO, rfkill->pdata->name, "wake_host");
430 LOG("irq rfkill_rk_setup_gpio failed\n");
432 ret = gpio_pull_updown(wake_host_irq->gpio.io, (wake_host_irq->gpio.enable==GPIO_LOW)?GPIOPullUp:GPIOPullDown);
434 LOG("irq gpio_pull_updown failed\n");
436 DBG("enable irq for bt wakeup host\n");
437 enable_irq(wake_host_irq->irq);
440 #ifdef CONFIG_RFKILL_RESET
441 rfkill_set_states(rfkill->rfkill_dev, BT_BLOCKED, false);
442 rfkill_rk_set_power(rfkill, BT_BLOCKED);
448 static void rfkill_rk_pm_complete(struct device *dev)
450 struct rfkill_rk_data *rfkill = g_rfkill;
451 struct rfkill_rk_irq* wake_host_irq;
452 struct rfkill_rk_gpio* rts;
453 DBG("Enter %s\n",__FUNCTION__);
458 wake_host_irq = &rfkill->pdata->wake_host_irq;
459 rts = &rfkill->pdata->rts_gpio;
461 if (gpio_is_valid(wake_host_irq->gpio.io))
463 // ½ûÓõô BT_WAKE_HOST IRQ£¬È·±£ÔÚϵͳ»½ÐѺ󲻻áÒòBTµÄ²Ù×÷
465 LOG("** disable irq\n");
466 disable_irq(wake_host_irq->irq);
467 #ifdef CONFIG_BK3515A_COMBO
468 rk_mux_api_set(wake_host_irq->gpio.iomux.name, wake_host_irq->gpio.iomux.fmux);
469 gpio_free(wake_host_irq->gpio.io);
473 /* ʹÓÃUART_RTS£¬´ËʱÀ¶ÑÀÈç¹ûÓÐÊý¾Ý¾Í»áË͵½UART
474 * Éϲã·ÖÎöËÍÀ´µÄÊý¾Ý²¢×ö³öÏàÓ¦µÄ¶¯×÷£¬±ÈÈç: ËÍÀ´µÄÊÇ
475 * Åä¶ÔÇëÇó£¬ÔòÉϲ㽫»áÁÁÆÁ²¢µ¯³öÅä¶Ô½çÃæ
477 if (gpio_is_valid(rts->io))
479 DBG("Enable UART_RTS\n");
480 gpio_direction_output(rts->io, rts->enable);
483 rk_mux_api_set(rts->iomux.name, rts->iomux.fmux);
488 static const struct rfkill_ops rfkill_rk_ops = {
489 .set_block = rfkill_rk_set_power,
492 #define PROC_DIR "bluetooth/sleep"
494 static struct proc_dir_entry *bluetooth_dir, *sleep_dir;
496 static int bluesleep_read_proc_lpm(char *page, char **start, off_t offset,
497 int count, int *eof, void *data)
500 return sprintf(page, "unsupported to read\n");
503 static int bluesleep_write_proc_lpm(struct file *file, const char *buffer,
504 unsigned long count, void *data)
509 static int bluesleep_read_proc_btwrite(char *page, char **start, off_t offset,
510 int count, int *eof, void *data)
513 return sprintf(page, "unsupported to read\n");
516 static int bluesleep_write_proc_btwrite(struct file *file, const char *buffer,
517 unsigned long count, void *data)
524 if (copy_from_user(&b, buffer, 1))
527 DBG("btwrite %c\n", b);
530 rfkill_rk_sleep_bt(BT_WAKEUP);
536 static int rfkill_rk_probe(struct platform_device *pdev)
538 struct rfkill_rk_data *rfkill;
539 struct rfkill_rk_platform_data *pdata = pdev->dev.platform_data;
541 struct proc_dir_entry *ent;
543 DBG("Enter %s\n", __func__);
546 LOG("%s: No platform data specified\n", __func__);
550 pdata->name = (char*)bt_name;
552 rfkill = kzalloc(sizeof(*rfkill), GFP_KERNEL);
556 rfkill->pdata = pdata;
559 bluetooth_dir = proc_mkdir("bluetooth", NULL);
560 if (bluetooth_dir == NULL) {
561 LOG("Unable to create /proc/bluetooth directory");
565 sleep_dir = proc_mkdir("sleep", bluetooth_dir);
566 if (sleep_dir == NULL) {
567 LOG("Unable to create /proc/%s directory", PROC_DIR);
571 /* read/write proc entries */
572 ent = create_proc_entry("lpm", 0, sleep_dir);
574 LOG("Unable to create /proc/%s/lpm entry", PROC_DIR);
578 ent->read_proc = bluesleep_read_proc_lpm;
579 ent->write_proc = bluesleep_write_proc_lpm;
581 /* read/write proc entries */
582 ent = create_proc_entry("btwrite", 0, sleep_dir);
584 LOG("Unable to create /proc/%s/btwrite entry", PROC_DIR);
588 ent->read_proc = bluesleep_read_proc_btwrite;
589 ent->write_proc = bluesleep_write_proc_btwrite;
593 // ¶ÔÓÚRK29 BCM4329£¬ËüµÄpoweron ioÓëwifi¹²Óã¬ÔÚboadÎļþÖÐÒѾrequest
595 #if !WIFI_BT_POWER_TOGGLE
596 ret = rfkill_rk_setup_gpio(&pdata->poweron_gpio, IOMUX_FGPIO, pdata->name, "poweron");
597 if (ret) goto fail_alloc;
600 ret = rfkill_rk_setup_gpio(&pdata->reset_gpio, IOMUX_FGPIO, pdata->name, "reset");
601 if (ret) goto fail_poweron;
603 #ifndef CONFIG_BK3515A_COMBO
604 ret = rfkill_rk_setup_gpio(&pdata->wake_gpio, IOMUX_FGPIO, pdata->name, "wake");
605 if (ret) goto fail_reset;
608 ret = rfkill_rk_setup_wake_irq(rfkill);
609 if (ret) goto fail_wake;
611 ret = rfkill_rk_setup_gpio(&pdata->rts_gpio, IOMUX_FMUX, rfkill->pdata->name, "rts");
612 if (ret) goto fail_wake_host_irq;
614 // ´´½¨²¢×¢²áRFKILLÉ豸
615 DBG("setup rfkill\n");
616 rfkill->rfkill_dev = rfkill_alloc(pdata->name, &pdev->dev, pdata->type,
617 &rfkill_rk_ops, rfkill);
618 if (!rfkill->rfkill_dev)
621 // cmy: ÉèÖÃrfkill³õʼ״̬Ϊblocked£¬ÔÚ×¢²áʱ²»»áµ÷Óà set_blockedº¯Êý
622 rfkill_set_states(rfkill->rfkill_dev, BT_BLOCKED, false);
623 ret = rfkill_register(rfkill->rfkill_dev);
627 wake_lock_init(&(rfkill->bt_irq_wl), WAKE_LOCK_SUSPEND, "rfkill_rk_irq_wl");
628 INIT_DELAYED_WORK(&rfkill->bt_sleep_delay_work, rfkill_rk_delay_sleep_bt);
630 // cmy: ÉèÖÃÀ¶ÑÀµçÔ´µÄ״̬Ϊ blocked
631 rfkill_rk_set_power(rfkill, BT_BLOCKED);
633 platform_set_drvdata(pdev, rfkill);
635 LOG("%s device registered.\n", pdata->name);
640 rfkill_destroy(rfkill->rfkill_dev);
642 if (gpio_is_valid(pdata->rts_gpio.io))
643 gpio_free(pdata->rts_gpio.io);
645 if (gpio_is_valid(pdata->wake_host_irq.gpio.io)){
646 free_irq(pdata->wake_host_irq.irq, rfkill);
647 #ifndef CONFIG_BK3515A_COMBO
648 gpio_free(pdata->wake_host_irq.gpio.io);
652 #ifndef CONFIG_BK3515A_COMBO
653 if (gpio_is_valid(pdata->wake_gpio.io))
654 gpio_free(pdata->wake_gpio.io);
657 if (gpio_is_valid(pdata->reset_gpio.io))
658 gpio_free(pdata->reset_gpio.io);
660 #if !WIFI_BT_POWER_TOGGLE
661 if (gpio_is_valid(pdata->poweron_gpio.io))
662 gpio_free(pdata->poweron_gpio.io);
668 remove_proc_entry("btwrite", sleep_dir);
669 remove_proc_entry("lpm", sleep_dir);
674 static int rfkill_rk_remove(struct platform_device *pdev)
676 struct rfkill_rk_data *rfkill = platform_get_drvdata(pdev);
678 LOG("Enter %s\n", __func__);
680 rfkill_unregister(rfkill->rfkill_dev);
681 rfkill_destroy(rfkill->rfkill_dev);
683 wake_lock_destroy(&rfkill->bt_irq_wl);
685 cancel_delayed_work_sync(&rfkill->bt_sleep_delay_work);
688 if (gpio_is_valid(rfkill->pdata->rts_gpio.io))
689 gpio_free(rfkill->pdata->rts_gpio.io);
691 if (gpio_is_valid(rfkill->pdata->wake_host_irq.gpio.io)){
692 free_irq(rfkill->pdata->wake_host_irq.irq, rfkill);
693 #ifndef CONFIG_BK3515A_COMBO
694 gpio_free(rfkill->pdata->wake_host_irq.gpio.io);
698 #ifndef CONFIG_BK3515A_COMBO
699 if (gpio_is_valid(rfkill->pdata->wake_gpio.io))
700 gpio_free(rfkill->pdata->wake_gpio.io);
703 if (gpio_is_valid(rfkill->pdata->reset_gpio.io))
704 gpio_free(rfkill->pdata->reset_gpio.io);
706 if (gpio_is_valid(rfkill->pdata->poweron_gpio.io))
707 gpio_free(rfkill->pdata->poweron_gpio.io);
715 static const struct dev_pm_ops rfkill_rk_pm_ops = {
716 .prepare = rfkill_rk_pm_prepare,
717 .complete = rfkill_rk_pm_complete,
720 static struct platform_driver rfkill_rk_driver = {
721 .probe = rfkill_rk_probe,
722 .remove = __devexit_p(rfkill_rk_remove),
725 .owner = THIS_MODULE,
726 .pm = &rfkill_rk_pm_ops,
730 static int __init rfkill_rk_init(void)
732 LOG("Enter %s\n", __func__);
733 return platform_driver_register(&rfkill_rk_driver);
736 static void __exit rfkill_rk_exit(void)
738 LOG("Enter %s\n", __func__);
739 platform_driver_unregister(&rfkill_rk_driver);
742 module_init(rfkill_rk_init);
743 module_exit(rfkill_rk_exit);
745 MODULE_DESCRIPTION("rock-chips rfkill for Bluetooth v0.2");
746 MODULE_AUTHOR("cmy@rock-chips.com, cz@rock-chips.com");
747 MODULE_LICENSE("GPL");