From: lbt Date: Thu, 2 Sep 2010 08:01:39 +0000 (+0800) Subject: bt:rfkill: add bluetooth rfkill support X-Git-Tag: firefly_0821_release~11198 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b1f7738147554c3676efef7d57b68c48cce8330d;p=firefly-linux-kernel-4.4.55.git bt:rfkill: add bluetooth rfkill support --- diff --git a/arch/arm/mach-rk2818/Makefile b/arch/arm/mach-rk2818/Makefile index 0e40cbc98155..9b050ac31530 100644 --- a/arch/arm/mach-rk2818/Makefile +++ b/arch/arm/mach-rk2818/Makefile @@ -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 diff --git a/arch/arm/mach-rk2818/board-infosdk.c b/arch/arm/mach-rk2818/board-infosdk.c index 0da2158e04b7..695d44bdd857 100755 --- a/arch/arm/mach-rk2818/board-infosdk.c +++ b/arch/arm/mach-rk2818/board-infosdk.c @@ -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) diff --git a/arch/arm/mach-rk2818/devices.c b/arch/arm/mach-rk2818/devices.c index 4aaf43bfe874..fbc5dcbad7e7 100755 --- a/arch/arm/mach-rk2818/devices.c +++ b/arch/arm/mach-rk2818/devices.c @@ -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 = {