rk30: sdk: refactor rfkill code
author黄涛 <huangtao@rock-chips.com>
Thu, 7 Jun 2012 01:53:03 +0000 (09:53 +0800)
committer黄涛 <huangtao@rock-chips.com>
Thu, 7 Jun 2012 02:03:22 +0000 (10:03 +0800)
arch/arm/mach-rk30/board-rk30-sdk.c
arch/arm/mach-rk30/devices.c

index 8a484c8adca61fdaad804f9f85ac0dfa2992a0d4..481f6da93a602f971412971d633430387ccf0b95 100755 (executable)
@@ -1221,6 +1221,68 @@ static struct platform_device rk30_device_adc_battery = {
 #include "board-rk30-sdk-vmac.c"
 #endif
 
+#ifdef CONFIG_RFKILL_RK
+// bluetooth rfkill device, its driver in net/rfkill/rfkill-rk.c
+static struct rfkill_rk_platform_data rfkill_rk_platdata = {
+    .type               = RFKILL_TYPE_BLUETOOTH,
+
+    .poweron_gpio       = { // BT_REG_ON
+        .io             = RK30_PIN3_PC7,
+        .enable         = GPIO_HIGH,
+        .iomux          = {
+            .name       = GPIO3C7_SDMMC1WRITEPRT_NAME,
+            .fgpio      = GPIO3C_GPIO3C7,
+        },
+    },
+
+    .reset_gpio         = { // BT_RST
+        .io             = RK30_PIN3_PD1, // set io to INVALID_GPIO for disable it
+        .enable         = GPIO_LOW,
+        .iomux          = {
+            .name       = GPIO3D1_SDMMC1BACKENDPWR_NAME,
+            .fgpio      = GPIO3D_GPIO3D1,
+        },
+    },
+
+    .wake_gpio          = { // BT_WAKE, use to control bt's sleep and wakeup
+        .io             = RK30_PIN3_PC6, // set io to INVALID_GPIO for disable it
+        .enable         = GPIO_HIGH,
+        .iomux          = {
+            .name       = GPIO3C6_SDMMC1DETECTN_NAME,
+            .fgpio      = GPIO3C_GPIO3C6,
+        },
+    },
+
+    .wake_host_irq      = { // BT_HOST_WAKE, for bt wakeup host when it is in deep sleep
+        .gpio           = {
+            .io         = RK30_PIN6_PA7, // set io to INVALID_GPIO for disable it
+            .iomux      = {
+                .name   = NULL,
+            },
+        },
+        .is_falling     = 1, // trigger type, set 1 for falling, set 0 for rising
+    },
+
+    .rts_gpio           = { // UART_RTS, enable or disable BT's data coming
+        .io             = RK30_PIN1_PA3, // set io to INVALID_GPIO for disable it
+        .enable         = GPIO_LOW,
+        .iomux          = {
+            .name       = GPIO1A3_UART0RTSN_NAME,
+            .fgpio      = GPIO1A_GPIO1A3,
+            .fmux       = GPIO1A_UART0_RTS_N,
+        },
+    },
+};
+
+static struct platform_device device_rfkill_rk = {
+    .name   = "rfkill_rk",
+    .id     = -1,
+    .dev    = {
+        .platform_data = &rfkill_rk_platdata,
+    },
+};
+#endif
+
 static struct platform_device *devices[] __initdata = {
 #ifdef CONFIG_BACKLIGHT_RK29_BL
        &rk29_device_backlight,
@@ -1249,6 +1311,9 @@ static struct platform_device *devices[] __initdata = {
 #ifdef CONFIG_BATTERY_RK30_ADC
        &rk30_device_adc_battery,
 #endif
+#ifdef CONFIG_RFKILL_RK
+       &device_rfkill_rk,
+#endif
 };
 
 // i2c
@@ -1415,68 +1480,6 @@ static struct i2c_board_info __initdata i2c_gpio_info[] = {
 };
 #endif
 
-#ifdef CONFIG_BT
-// bluetooth rfkill device, its driver in net/rfkill/rfkill-rk.c
-static struct rfkill_rk_platform_data rfkill_rk_platdata = {
-    .type               = RFKILL_TYPE_BLUETOOTH,
-
-    .poweron_gpio       = { // BT_REG_ON
-        .io             = RK30_PIN3_PC7,
-        .enable         = GPIO_HIGH,
-        .iomux          = {
-            .name       = GPIO3C7_SDMMC1WRITEPRT_NAME,
-            .fgpio      = GPIO3C_GPIO3C7,
-        },
-    },
-
-    .reset_gpio         = { // BT_RST
-        .io             = RK30_PIN3_PD1, // set io to INVALID_GPIO for disable it
-        .enable         = GPIO_LOW,
-        .iomux          = {
-            .name       = GPIO3D1_SDMMC1BACKENDPWR_NAME,
-            .fgpio      = GPIO3D_GPIO3D1,
-        },
-    },
-
-    .wake_gpio          = { // BT_WAKE, use to control bt's sleep and wakeup
-        .io             = RK30_PIN3_PC6, // set io to INVALID_GPIO for disable it
-        .enable         = GPIO_HIGH,
-        .iomux          = {
-            .name       = GPIO3C6_SDMMC1DETECTN_NAME,
-            .fgpio      = GPIO3C_GPIO3C6,
-        },
-    },
-
-    .wake_host_irq      = { // BT_HOST_WAKE, for bt wakeup host when it is in deep sleep
-        .gpio           = {
-            .io         = RK30_PIN6_PA7, // set io to INVALID_GPIO for disable it
-            .iomux      = {
-                .name   = NULL,
-            },
-        },
-        .is_falling     = 1, // trigger type, set 1 for falling, set 0 for rising
-    },
-
-    .rts_gpio           = { // UART_RTS, enable or disable BT's data coming
-        .io             = RK30_PIN1_PA3, // set io to INVALID_GPIO for disable it
-        .enable         = GPIO_LOW,
-        .iomux          = {
-            .name       = GPIO1A3_UART0RTSN_NAME,
-            .fgpio      = GPIO1A_GPIO1A3,
-            .fmux       = GPIO1A_UART0_RTS_N,
-        },
-    },
-};
-
-struct platform_device device_rfkill_rk = {
-    .name   = "rfkill_rk",
-    .id     = -1,
-    .dev    = {
-        .platform_data = &rfkill_rk_platdata,
-    },
-};
-#endif
-
 static void __init rk30_i2c_register_board_info(void)
 {
 #ifdef CONFIG_I2C0_RK30
index 35ecb998482146a98b0be2b2d95fc8f5d3176b50..852ded9a79aa5dea14d2782eea3e2a4fd1bac081 100755 (executable)
@@ -28,7 +28,6 @@
 #include <mach/gpio.h>
 #include <mach/iomux.h>
 #include <plat/rk_fiq_debugger.h>
-#include <linux/rfkill-rk.h>
 
 #ifdef CONFIG_ADC_RK30
 static struct resource rk30_adc_resource[] = {
@@ -1171,10 +1170,6 @@ static int __init rk30_init_devices(void)
 #ifdef CONFIG_RK29_VMAC
        platform_device_register(&device_vmac);
 #endif
-#ifdef CONFIG_BT
-    extern struct platform_device device_rfkill_rk;
-    platform_device_register(&device_rfkill_rk);
-#endif
 
        return 0;
 }