static int brcm_wlan_power(int onoff) { printk(KERN_INFO"------------------------------------------------"); printk(KERN_INFO"------------------------------------------------\n"); printk(KERN_INFO"%s Enter: power %s\n", __func__, onoff ? "on" : "off"); if (onoff) { /* if (gpio_request(GPIO_WL_REG_ON, "WL_REG_ON")) { printk("Failed to request for WL_REG_ON\n"); } */ #if defined(CONFIG_SEC_H_PROJECT) || defined(CONFIG_SEC_MONTBLANC_PROJECT)\ || defined(CONFIG_SEC_VIENNA_PROJECT) || defined(CONFIG_MACH_KS01SKT)\ || defined(CONFIG_TIZEN_R_PROJECT) || defined(CONFIG_MACH_B3) printk(KERN_INFO"WL_REG_ON on-step : [%d]\n" , gpio_get_value(GPIO_WL_REG_ON)); if (gpio_direction_output(GPIO_WL_REG_ON, 1)) { printk(KERN_ERR "%s: check WL_REG_ON pin for H\n", __func__); #else if (ice_gpiox_set(FPGA_GPIO_WLAN_EN, 1)) { // yhcha-patch #endif /* defined CONFIG_SEC_H_PROJECT */ printk(KERN_ERR "%s: WL_REG_ON failed to pull up\n", __func__); return -EIO; } #if defined(CONFIG_SEC_H_PROJECT) || defined(CONFIG_SEC_MONTBLANC_PROJECT)\ || defined(CONFIG_SEC_VIENNA_PROJECT) || defined(CONFIG_MACH_KS01SKT)\ || defined(CONFIG_TIZEN_R_PROJECT) || defined(CONFIG_MACH_B3) if(gpio_get_value(GPIO_WL_REG_ON)){ printk(KERN_INFO"WL_REG_ON on-step-2 : [%d]\n" , gpio_get_value(GPIO_WL_REG_ON)); printk("[%s] gpio ok!!!\n",__func__); } else { printk("[%s] gpio value is 0. We need reinit.\n",__func__); if (gpio_tlmm_config(config_gpio_wl_reg_on[0], GPIO_CFG_ENABLE)) printk(KERN_ERR "%s: Failed to configure GPIO" " - WL_REG_ON\n", __func__); if (gpio_direction_output(GPIO_WL_REG_ON, 1)) printk(KERN_ERR "%s: WL_REG_ON " "failed to pull down\n", __func__); } #endif /* defined CONFIG_SEC_H_PROJECT */ #if defined(CONFIG_BCM4339) || defined(CONFIG_BCM4335) || defined(CONFIG_BCM4354) || defined(CONFIG_BCM4334) /* Power on/off SDIO host */ sdio_ctrl_power((struct mmc_host *)wifi_mmc_host, onoff); #endif /* CONFIG_BCM4339 || CONFIG_BCM4335 || CONFIG_BCM4354 */ } else { #if defined(CONFIG_BCM4339) || defined(CONFIG_BCM4335) || defined(CONFIG_BCM4354) || defined(CONFIG_BCM4334) /* Power on/off SDIO host */ sdio_ctrl_power((struct mmc_host *)wifi_mmc_host, onoff); #endif /* CONFIG_BCM4339 || CONFIG_BCM4335 || CONFIG_BCM4354 */ /* if (gpio_request(GPIO_WL_REG_ON, "WL_REG_ON")) { printk("Failed to request for WL_REG_ON\n"); } */ #if defined(CONFIG_SEC_H_PROJECT) || defined(CONFIG_SEC_MONTBLANC_PROJECT)\ || defined(CONFIG_SEC_VIENNA_PROJECT) || defined(CONFIG_MACH_KS01SKT)\ || defined(CONFIG_TIZEN_R_PROJECT) || defined(CONFIG_MACH_B3) if (gpio_direction_output(GPIO_WL_REG_ON, 0)) { #else if (ice_gpiox_set(FPGA_GPIO_WLAN_EN, 0)) { // yhcha-patch #endif /* defined CONFIG_SEC_H_PROJECT */ printk(KERN_ERR "%s: WL_REG_ON failed to pull down\n", __func__); return -EIO; } } return 0; } static int brcm_wlan_reset(int onoff) { /* gpio_set_value(GPIO_WLAN_ENABLE, onoff ? GPIO_LEVEL_HIGH : GPIO_LEVEL_LOW); */ return 0; } int brcm_wifi_status_register( void (*callback)(int card_present, void *dev_id), void *dev_id, void *mmc_host) { if (wifi_status_cb) return -EAGAIN; wifi_status_cb = callback; wifi_status_cb_devid = dev_id; wifi_mmc_host = mmc_host; printk(KERN_ERR "%s: callback is %p, devid is %p\n", __func__, wifi_status_cb, dev_id); return 0; } unsigned int brcm_wifi_status(struct device *dev) { printk("%s:%d status %d\n",__func__,__LINE__,brcm_wifi_cd); return brcm_wifi_cd; } static int brcm_wlan_set_carddetect(int val) { pr_warning("%s: wifi_status_cb : %p, devid : %p, val : %d\n", __func__, wifi_status_cb, wifi_status_cb_devid, val); brcm_wifi_cd = val; if (wifi_status_cb) wifi_status_cb(val, wifi_status_cb_devid); else pr_warning("%s: Nobody to notify\n", __func__); /* msleep(200); wait for carddetect */ return 0; }
static int brcm_wlan_power(int onoff) #endif { int ret = 0; printk(KERN_INFO"------------------------------------------------"); printk(KERN_INFO"------------------------------------------------\n"); printk(KERN_INFO"%s Enter: power %s\n", __func__, onoff ? "on" : "off"); if (onoff) { #if defined(ENABLE_4335BT_WAR) || defined(ENABLE_4339BT_WAR) if(b0rev == true && gpio_get_value(FPGA_GPIO_BT_EN) == 0) { bt_off = 1; gpio_direction_output(FPGA_GPIO_BT_EN, 1); printk("[brcm_wlan_power] Bluetooth Power On.\n"); msleep(50); } else { bt_off = 0; } #endif #if defined(CONFIG_SEC_KS01_PROJECT) || defined(CONFIG_SEC_JACTIVE_PROJECT) if (ice_gpiox_set(FPGA_GPIO_WLAN_EN, 1)) { printk(KERN_ERR "%s: WL_REG_ON failed to pull up\n", __func__); ret = -EIO; } #else printk(KERN_INFO"WL_REG_ON on-step : [%d]\n" , gpio_get_value(GPIO_WL_REG_ON)); if (gpio_direction_output(GPIO_WL_REG_ON, 1)) { printk(KERN_ERR "%s: check WL_REG_ON pin for H\n", __func__); printk(KERN_ERR "%s: WL_REG_ON failed to pull up\n", __func__); ret = -EIO; } if(gpio_get_value(GPIO_WL_REG_ON)){ printk(KERN_INFO"WL_REG_ON on-step-2 : [%d]\n" , gpio_get_value(GPIO_WL_REG_ON)); } else { printk("[%s] gpio value is 0. We need reinit.\n",__func__); #if !defined(CONFIG_SEC_K_PROJECT) && !defined(CONFIG_SEC_KACTIVE_PROJECT) && !defined(CONFIG_SEC_PATEK_PROJECT) if (gpio_tlmm_config(config_gpio_wl_reg_on[0], GPIO_CFG_ENABLE)) printk(KERN_ERR "%s: Failed to configure GPIO" " - WL_REG_ON\n", __func__); #endif /* not defined CONFIG_SEC_K_PROJECT and CONFIG_SEC_KACTIVE_PROJECT*/ if (gpio_direction_output(GPIO_WL_REG_ON, 1)) printk(KERN_ERR "%s: WL_REG_ON " "failed to pull down\n", __func__); } #endif /* defined CONFIG_SEC_KS01_PROJECT */ #if defined(CONFIG_BCM4339) || defined(CONFIG_BCM4335) || defined(CONFIG_BCM4354) /* Power on/off SDIO host */ sdio_ctrl_power((struct mmc_host *)wifi_mmc_host, onoff); #endif /* CONFIG_BCM4339 || CONFIG_BCM4335 || CONFIG_BCM4354 */ } else { #if defined(CONFIG_BCM4339) || defined(CONFIG_BCM4335) || defined(CONFIG_BCM4354) /* Power on/off SDIO host */ sdio_ctrl_power((struct mmc_host *)wifi_mmc_host, onoff); #endif /* CONFIG_BCM4339 || CONFIG_BCM4335 || CONFIG_BCM4354 */ /* if (gpio_request(GPIO_WL_REG_ON, "WL_REG_ON")) { printk("Failed to request for WL_REG_ON\n"); } */ #if defined(CONFIG_SEC_KS01_PROJECT) || defined(CONFIG_SEC_JACTIVE_PROJECT) if (ice_gpiox_set(FPGA_GPIO_WLAN_EN, 0)) { printk(KERN_ERR "%s: WL_REG_ON failed to pull down\n", __func__); ret = -EIO; } #else printk(KERN_INFO"WL_REG_ON off-step : [%d]\n" , gpio_get_value(GPIO_WL_REG_ON)); if (gpio_direction_output(GPIO_WL_REG_ON, 0)) { printk(KERN_ERR "%s: WL_REG_ON failed to pull down\n", __func__); ret = -EIO; } printk(KERN_INFO"WL_REG_ON off-step-2 : [%d]\n" , gpio_get_value(GPIO_WL_REG_ON)); #endif } #if defined(ENABLE_4335BT_WAR) || defined(ENABLE_4339BT_WAR) if(onoff && (bt_off == 1) && (bt_is_running == 0)) { msleep(100); gpio_direction_output(FPGA_GPIO_BT_EN, 0); printk("[brcm_wlan_power] BT_REG_OFF.\n"); } #endif return ret; }