bluetooth: rfkill-bt: enalbe 32K for ap6356
authorXu Xuehui <xxh@rock-chips.com>
Wed, 17 Aug 2016 09:41:08 +0000 (17:41 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Wed, 24 Aug 2016 07:49:25 +0000 (15:49 +0800)
Change-Id: I71a14f38ab1d46bbf3bfc991140a20d8c6a27eec
Signed-off-by: Xu Xuehui <xxh@rock-chips.com>
include/linux/rfkill-bt.h
net/rfkill/rfkill-bt.c

index 4a014b6..c4174b1 100755 (executable)
@@ -22,6 +22,7 @@
 
 #include <linux/types.h>
 #include <linux/rfkill.h>
 
 #include <linux/types.h>
 #include <linux/rfkill.h>
+#include <linux/clk.h>
 
 #define RFKILL_RK_GPIO_NAME_SIZE   64
 
 
 #define RFKILL_RK_GPIO_NAME_SIZE   64
 
@@ -63,6 +64,7 @@ struct rfkill_rk_platform_data {
     struct rfkill_rk_gpio   wake_gpio;      // Host wake or sleep BT
     struct rfkill_rk_irq    wake_host_irq;  // BT wakeup host
     struct rfkill_rk_gpio   rts_gpio;
     struct rfkill_rk_gpio   wake_gpio;      // Host wake or sleep BT
     struct rfkill_rk_irq    wake_host_irq;  // BT wakeup host
     struct rfkill_rk_gpio   rts_gpio;
+    struct clk              *ext_clk;
 };
 
 int rfkill_get_bt_power_state(int *power, bool *toggle);
 };
 
 int rfkill_get_bt_power_state(int *power, bool *toggle);
index 11e1828..332eb47 100644 (file)
@@ -522,7 +522,13 @@ static int bluetooth_platdata_parse_dt(struct device *dev,
         LOG("%s: get property: BT,wake_host_irq = %d.\n", __func__, gpio);
     } else data->wake_host_irq.gpio.io = -1;
 
         LOG("%s: get property: BT,wake_host_irq = %d.\n", __func__, gpio);
     } else data->wake_host_irq.gpio.io = -1;
 
-    return 0;
+       data->ext_clk = devm_clk_get(dev, "ext_clock");
+       if (IS_ERR(data->ext_clk)) {
+               LOG("%s: clk_get failed!!!.\n", __func__);
+       } else {
+               clk_prepare_enable(data->ext_clk);
+       }
+       return 0;
 }
 #endif //CONFIG_OF
 
 }
 #endif //CONFIG_OF
 
@@ -696,7 +702,7 @@ static int rfkill_rk_remove(struct platform_device *pdev)
     
     if (gpio_is_valid(rfkill->pdata->poweron_gpio.io))
         gpio_free(rfkill->pdata->poweron_gpio.io);
     
     if (gpio_is_valid(rfkill->pdata->poweron_gpio.io))
         gpio_free(rfkill->pdata->poweron_gpio.io);
-
+       clk_disable_unprepare(rfkill->pdata->ext_clk);
     g_rfkill = NULL;
 
        return 0;
     g_rfkill = NULL;
 
        return 0;