bt:rfkill: add bluetooth rfkill support
authorlbt <lbt@rock-chips.com>
Thu, 2 Sep 2010 08:01:39 +0000 (16:01 +0800)
committerlbt <lbt@rock-chips.com>
Thu, 2 Sep 2010 08:01:39 +0000 (16:01 +0800)
arch/arm/mach-rk2818/Makefile
arch/arm/mach-rk2818/board-infosdk.c
arch/arm/mach-rk2818/devices.c

index 0e40cbc98155dece125263aefbeae5c5b5506479..9b050ac315307753edff009a6fe824556499c6c7 100644 (file)
@@ -9,4 +9,4 @@ obj-$(CONFIG_RK28_ADC) += adc.o
 obj-$(CONFIG_MACH_RK2818MID) += board-midsdk.o
 obj-$(CONFIG_MACH_RK2818PHONE) += board-phonesdk.o
 obj-$(CONFIG_MACH_RAHO) += board-raho.o
-obj-$(CONFIG_MACH_RK2818INFO) += board-infosdk.o
+obj-$(CONFIG_MACH_RK2818INFO) += board-infosdk.o board-infosdk-rfkill.o 
index 0da2158e04b72acc7d6c00b08073a2a6d127e56a..695d44bdd85789766d4238be7fe3a30fe76ece64 100755 (executable)
@@ -232,12 +232,31 @@ static int info_wifi_status_register(void (*callback)(int card_present, void *de
        return 0;
 }
 
-static int info_wifi_power_state;
+#define INFO_WIFI_GPIO_POWER_N  TCA6424_P25
+#define INFO_WIFI_GPIO_RESET_N  TCA6424_P27 
+
+int info_wifi_power_state = 0;
+int info_bt_power_state = 0;
+
 static int info_wifi_power(int on)
 {
        pr_info("%s: %d\n", __func__, on);
-       gpio_set_value(TCA6424_P25, on);
-       mdelay(100);
+       if (on){
+               gpio_set_value(INFO_WIFI_GPIO_POWER_N, on);
+               mdelay(100);
+               pr_info("wifi turn on power\n");
+       }else{
+               if (!info_bt_power_state){
+                       gpio_set_value(INFO_WIFI_GPIO_POWER_N, on);     
+                       mdelay(100);
+                       pr_info("wifi shut off power\n");
+               }else
+               {
+                       pr_info("wifi shouldn't shut off power, bt is using it!\n"); 
+               }
+
+       }
+
        info_wifi_power_state = on;
         return 0;
 }
@@ -246,7 +265,7 @@ static int info_wifi_reset_state;
 static int info_wifi_reset(int on)
 {
        pr_info("%s: %d\n", __func__, on);
-       gpio_set_value(TCA6424_P27, on);
+       gpio_set_value(INFO_WIFI_GPIO_RESET_N, on);
        mdelay(100);
        info_wifi_reset_state = on;
        return 0;
@@ -277,7 +296,12 @@ static struct platform_device info_wifi_device = {
          },
 };
 
-
+/* bluetooth rfkill device */
+static struct platform_device info_rfkill = {
+       .name = "info_rfkill",
+       .id = -1,
+};
 /*****************************************************************************************
  * extern gpio devices
  *author: xxx
@@ -1420,6 +1444,7 @@ struct rk2818_nand_platform_data rk2818_nand_data = {
 /*****************************************/
 
 static struct platform_device *devices[] __initdata = {
+       &rk2818_device_uart0,
        &rk2818_device_uart1,
 #ifdef CONFIG_I2C0_RK2818
        &rk2818_device_i2c0,
@@ -1434,6 +1459,7 @@ static struct platform_device *devices[] __initdata = {
        &rk2818_device_sdmmc1,
        &info_wifi_device,
 #endif
+       &info_rfkill,
        &rk2818_device_spim,
        &rk2818_device_i2s,
 #if defined(CONFIG_ANDROID_PMEM)
index 4aaf43bfe87443dcd531e1b3c32835136cb167a4..fbc5dcbad7e71328faff4ac343619c20601dd2ef 100755 (executable)
@@ -420,13 +420,6 @@ struct platform_device rk2818_device_dsp = {
         }
 };
 
-#ifdef CONFIG_BT
-struct platform_device rk2818_device_rfkill = {
-       .name = "rkbt_rfkill",
-       .id = -1,
-};
-#endif
-
 #if defined(CONFIG_ANDROID_PMEM)
 
 static struct android_pmem_platform_data pmem_pdata = {