From 178de51cc34d5c4f68a9a70011a4e9f6ab6f3240 Mon Sep 17 00:00:00 2001 From: wdc Date: Tue, 12 Jun 2012 12:25:44 +0800 Subject: [PATCH] BT: change board_rfkill to net/rfkill --- arch/arm/configs/rk30_phone_loquat_defconfig | 1 + arch/arm/mach-rk30/Makefile | 4 +- arch/arm/mach-rk30/board-rk30-phone-loquat.c | 76 ++++++++++++++++++-- 3 files changed, 72 insertions(+), 9 deletions(-) diff --git a/arch/arm/configs/rk30_phone_loquat_defconfig b/arch/arm/configs/rk30_phone_loquat_defconfig index 6de798ffb216..edcec87c9b2c 100755 --- a/arch/arm/configs/rk30_phone_loquat_defconfig +++ b/arch/arm/configs/rk30_phone_loquat_defconfig @@ -179,6 +179,7 @@ CONFIG_BT_HCIUART_H4=y CONFIG_BT_HCIBCM4325=y CONFIG_BT_AUTOSLEEP=y CONFIG_RFKILL=y +CONFIG_RFKILL_RK=y CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y # CONFIG_FIRMWARE_IN_KERNEL is not set diff --git a/arch/arm/mach-rk30/Makefile b/arch/arm/mach-rk30/Makefile index 85fa2de46b93..13bfb8d5eea2 100755 --- a/arch/arm/mach-rk30/Makefile +++ b/arch/arm/mach-rk30/Makefile @@ -22,6 +22,6 @@ obj-$(CONFIG_DDR_FREQ) += ddr_freq.o obj-$(CONFIG_MACH_RK3066_SDK) += board-rk30-sdk.o board-rk30-sdk-key.o obj-$(CONFIG_MACH_RK30_SDK) += board-rk30-sdk.o board-rk30-sdk-key.o -obj-$(CONFIG_MACH_RK30_PHONE) += board-rk30-phone.o board-rk30-phone-key.o board-rk30-phone-rfkill.o -obj-$(CONFIG_MACH_RK30_PHONE_LOQUAT) += board-rk30-phone-loquat.o board-rk30-phone-loquat-key.o board-rk30-phone-loquat-rfkill.o +obj-$(CONFIG_MACH_RK30_PHONE) += board-rk30-phone.o board-rk30-phone-key.o +obj-$(CONFIG_MACH_RK30_PHONE_LOQUAT) += board-rk30-phone-loquat.o board-rk30-phone-loquat-key.o diff --git a/arch/arm/mach-rk30/board-rk30-phone-loquat.c b/arch/arm/mach-rk30/board-rk30-phone-loquat.c index f000fd24f3b0..0ea406d5edae 100755 --- a/arch/arm/mach-rk30/board-rk30-phone-loquat.c +++ b/arch/arm/mach-rk30/board-rk30-phone-loquat.c @@ -47,6 +47,9 @@ #include #endif +#include +#include + #if defined(CONFIG_HDMI_RK30) #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h" #endif @@ -1513,11 +1516,6 @@ struct rk29_sdmmc_platform_data default_sdmmc1_data = { }; #endif //endif--#ifdef CONFIG_SDMMC1_RK29 -/* bluetooth rfkill device */ -static struct platform_device rk29sdk_rfkill = { - .name = "rk29sdk_rfkill", - .id = -1, -}; #ifdef CONFIG_BATTERY_RK30_ADC static struct rk30_adc_battery_platform_data rk30_adc_battery_platdata = { @@ -1538,6 +1536,70 @@ static struct platform_device rk30_device_adc_battery = { }; #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_PIN4_PD5, + .enable = GPIO_HIGH, + .iomux = { + .name = GPIO4D5_SMCDATA13_TRACEDATA13_NAME, + .fgpio = GPIO4D_GPIO4D5, + }, + }, + + .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_PIN3_PD2, // set io to INVALID_GPIO for disable it + .enable = GPIO_LOW, // set GPIO_LOW for falling, set 0 for rising + .iomux = { + .name = GPIO3D2_SDMMC1INTN_NAME, + .fgpio = RK30_PIN3_PD2, + }, + }, + }, + + .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 + /************************************************************************************************** * the end of setting for SDMMC devices **************************************************************************************************/ @@ -1564,8 +1626,8 @@ static struct platform_device *devices[] __initdata = { #ifdef CONFIG_WIFI_CONTROL_FUNC &rk29sdk_wifi_device, #endif -#ifdef CONFIG_BT - &rk29sdk_rfkill, +#ifdef CONFIG_RFKILL_RK + &device_rfkill_rk, #endif #ifdef CONFIG_RK29_SUPPORT_MODEM &rk30_device_modem, -- 2.34.1