static int bluetooth_set_power(void *data, bool blocked) { #if defined(CONFIG_BCM4335BT) //+++BRCM 4335 AXI Patch int lock_cookie_bt = 'B' | 'T'<<8 | '3'<<16 | '5'<<24; /* cookie is "BT35" */ //---BRCM #endif // defined(CONFIG_BCM4335BT) printk(KERN_ERR "bluetooth_set_power set blocked=%d",blocked); if (!blocked) { #if defined(CONFIG_BCM4335BT) //+++BRCM 4335 AXI Patch if (bcm_bt_lock(lock_cookie_bt) != 0) printk("** BT rfkill: timeout in acquiring bt lock**\n"); //---BRCM #endif // defined(CONFIG_BCM4335BT) printk(KERN_ERR "bluetooth_set_power set BT On"); gpio_direction_output(LGPS3_GPIO_BT_RESET_N, 0); msleep(30); gpio_direction_output(LGPS3_GPIO_BT_RESET_N, 1); } else { printk(KERN_ERR "bluetooth_set_power set BT Off"); gpio_direction_output(LGPS3_GPIO_BT_RESET_N, 0); } return 0; }
/* ---BRCM */ #endif /* defined(CONFIG_BCM4335BT) */ static int bluetooth_set_power(void *data, bool blocked) { #if defined(CONFIG_BCM4335BT) /* +++BRCM 4335 AXI Patch */ int lock_cookie_bt = 'B' | 'T'<<8 | '3'<<16 | '5'<<24; /* cookie is "BT35" */ /* ---BRCM */ #endif /* defined(CONFIG_BCM4335BT) */ BTRFKILLDBG("bluetooth_set_power set blocked=%d", blocked); if (!blocked) { #if defined(CONFIG_BCM4335BT) /* +++BRCM 4335 AXI Patch */ if (bcm_bt_lock(lock_cookie_bt) != 0) printk("** BT rfkill: timeout in acquiring bt lock**\n"); /* ---BRCM */ #endif /* defined(CONFIG_BCM4335BT) */ gpio_direction_output(GPIO_BT_RESET_N, 0); msleep(30); gpio_direction_output(GPIO_BT_RESET_N, 1); BTRFKILLDBG("Bluetooth RESET HIGH!!"); } else { gpio_direction_output(GPIO_BT_RESET_N, 0); BTRFKILLDBG("Bluetooth RESET LOW!!"); } return 0; }
int m7wl_wifi_power(int on) { const unsigned SDC3_HDRV_PULL_CTL_ADDR = (unsigned) MSM_TLMM_BASE + 0x20A4; #ifdef ENABLE_4335BT_WAR int lock_cookie_wifi = 'W' | 'i'<<8 | 'F'<<16 | 'i'<<24; printk("WiFi: trying to acquire BT lock\n"); if (bcm_bt_lock(lock_cookie_wifi) != 0) printk("** WiFi: timeout in acquiring bt lock**\n"); else printk("** WiFi: btlock acquired**\n"); #endif printk(KERN_INFO "%s: %d\n", __func__, on); if (on) { #if 0 writel(0x1FDB, SDC3_HDRV_PULL_CTL_ADDR); #else sdc_pad_gpio_config(SDC3_HDRV_PULL_CTL_ADDR, BIT_HDRIV_PULL_UP, BIT_HDRIV_PULL_UP, HDRIV_STR_14MA, HDRIV_STR_12MA, HDRIV_STR_12MA); #endif config_gpio_table(wifi_on_gpio_table, ARRAY_SIZE(wifi_on_gpio_table)); } else { #if 0 writel(0x0BDB, SDC3_HDRV_PULL_CTL_ADDR); #else sdc_pad_gpio_config(SDC3_HDRV_PULL_CTL_ADDR, BIT_HDRIV_PULL_UP, BIT_HDRIV_PULL_UP, HDRIV_STR_2MA, HDRIV_STR_2MA, HDRIV_STR_2MA); #endif config_gpio_table(wifi_off_gpio_table, ARRAY_SIZE(wifi_off_gpio_table)); } mdelay(1); htc_BCM4335_wl_reg_ctl((on)?BCM4335_WL_REG_ON:BCM4335_WL_REG_OFF, ID_WIFI); mdelay(1); #if 0 wl_dev_wake_gpio.config.output_value = on? 1: 0; pm8xxx_gpio_config(wl_dev_wake_gpio.gpio, &wl_dev_wake_gpio.config); #endif mdelay(120); #ifdef ENABLE_4335BT_WAR bcm_bt_unlock(lock_cookie_wifi); #endif return 0; }
static ssize_t btlock_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct btlock lock_para; ssize_t ret = 0; if (count < sizeof(struct btlock)) return -EINVAL; if (copy_from_user(&lock_para, buffer, sizeof(struct btlock))) return -EFAULT; if (lock_para.lock == 0) bcm_bt_unlock(lock_para.cookie); else if (lock_para.lock == 1) ret = bcm_bt_lock(lock_para.cookie); else if (lock_para.lock == 2) ret = bcm_bt_lock(lock_para.cookie); return ret; }
int wifi_platform_set_power(wifi_adapter_info_t *adapter, bool on, unsigned long msec) { int err = 0; #ifdef CONFIG_DTS if (on) { err = regulator_enable(wifi_regulator); is_power_on = TRUE; } else { err = regulator_disable(wifi_regulator); is_power_on = FALSE; } if (err < 0) DHD_ERROR(("%s: regulator enable/disable failed", __FUNCTION__)); #else struct wifi_platform_data *plat_data; if (!adapter || !adapter->wifi_plat_data) return -EINVAL; plat_data = adapter->wifi_plat_data; DHD_ERROR(("%s = %d\n", __FUNCTION__, on)); if (plat_data->set_power) { #ifdef ENABLE_4335BT_WAR if (on) { printk("WiFi: trying to acquire BT lock\n"); if (bcm_bt_lock(lock_cookie_wifi) != 0) printk("** WiFi: timeout in acquiring bt lock**\n"); printk("%s: btlock acquired\n", __FUNCTION__); } else { /* For a exceptional case, release btlock */ bcm_bt_unlock(lock_cookie_wifi); } #endif /* ENABLE_4335BT_WAR */ err = plat_data->set_power(on); } if (msec && !err) OSL_SLEEP(msec); if (on && !err) is_power_on = TRUE; else is_power_on = FALSE; #endif /* CONFIG_DTS */ return err; }
int wifi_platform_set_power(wifi_adapter_info_t *adapter, bool on, unsigned long msec) { int err = 0; struct wifi_platform_data *plat_data; #ifdef ENABLE_4335BT_WAR bool is4335_revb0 = true; #endif if (!adapter || !adapter->wifi_plat_data) return -EINVAL; plat_data = adapter->wifi_plat_data; DHD_ERROR(("%s = %d\n", __FUNCTION__, on)); if (plat_data->set_power) { #ifdef ENABLE_4335BT_WAR if (on) { printk("WiFi: trying to acquire BT lock\n"); if (bcm_bt_lock(lock_cookie_wifi) != 0) printk("** WiFi: timeout in acquiring bt lock**\n"); printk("%s: btlock acquired\n", __FUNCTION__); } else { /* For a exceptional case, release btlock */ bcm_bt_unlock(lock_cookie_wifi); } #endif /* ENABLE_4335BT_WAR */ #ifdef ENABLE_4335BT_WAR is4335_revb0 = check_bcm4335_rev(); err = plat_data->set_power(on,is4335_revb0); #else err = plat_data->set_power(on); #endif } if (msec && !err) OSL_SLEEP(msec); if (on && !err) is_power_on = TRUE; else is_power_on = FALSE; return err; }
static int bluetooth_set_power(void *data, bool blocked) { #ifdef CONFIG_BCM4335BT int lock_cookie_bt = 'B' | 'T'<<8 | '3'<<16 | '5'<<24; /* cookie is "BT35" */ #endif /* CONFIG_BCM4335BT */ printk(KERN_ERR "bluetooth_set_power set blocked=%d", blocked); if (!blocked) { #ifdef CONFIG_BCM4335BT if (bcm_bt_lock(lock_cookie_bt) != 0) printk("** BT rfkill: timeout in acquiring bt lock**\n"); #endif /* CONFIG_BCM4335BT */ gpio_direction_output(GPIO_BT_RESET_N, 0); msleep(30); gpio_direction_output(GPIO_BT_RESET_N, 1); printk(KERN_ERR "Bluetooth RESET HIGH!!"); } else { gpio_direction_output(GPIO_BT_RESET_N, 0); printk(KERN_ERR "Bluetooth RESET LOW!!"); } return 0; }