void tbl_charger_otg_vbus(int mode) { xlog_printk(ANDROID_LOG_INFO, "Power/Battery", "[tbl_charger_otg_vbus] mode = %d\n", mode); if(mode&0xFF) { #ifdef CONFIG_MTK_BQ24196_SUPPORT bq24196_set_chg_config(0x3); //OTG bq24196_set_boost_lim(0x1); //1.3A on VBUS bq24196_set_en_hiz(0x0); #endif #ifdef CONFIG_MTK_BQ24297_SUPPORT bq24297_set_otg_config(0x1); //OTG bq24297_set_boost_lim(0x1); //1.5A on VBUS bq24297_set_en_hiz(0x0); #endif #ifdef MTK_BQ24296_SUPPORT bq24296_set_chg_config(0x0); //disable charge bq24296_set_otg_config(0x1); //OTG bq24296_set_boostv(0x7); //boost voltage 4.998V bq24296_set_boost_lim(0x1); //1.5A on VBUS bq24296_set_en_hiz(0x0); #endif #ifdef CONFIG_MTK_NCP1851_SUPPORT ncp1851_set_chg_en(0x0); //charger disable ncp1851_set_otg_en(0x1); //otg enable #endif #ifdef MTK_NCP1854_SUPPORT ncp1854_set_chg_en(0x0); //charger disable ncp1854_set_otg_en(0x1); //otg enable #endif } else { #ifdef CONFIG_MTK_BQ24196_SUPPORT bq24196_set_chg_config(0x0); //OTG & Charge disabled #endif #ifdef CONFIG_MTK_BQ24297_SUPPORT bq24297_set_otg_config(0x0); //OTG & Charge disabled #endif #ifdef MTK_BQ24296_SUPPORT bq24296_set_otg_config(0x0); //OTG disabled bq24296_set_chg_config(0x0); //Charge disabled #endif #ifdef CONFIG_MTK_NCP1851_SUPPORT ncp1851_set_otg_en(0x0); #endif #ifdef MTK_NCP1854_SUPPORT ncp1854_set_otg_en(0x0); #endif } };
void mt_usb_set_vbus(struct musb *musb, int is_on) { DBG(0, "mt65xx_usb20_vbus++,is_on=%d\r\n", is_on); #ifndef FPGA_PLATFORM if (is_on) { /* power on VBUS, implement later... */ #ifdef CONFIG_MTK_FAN5405_SUPPORT fan5405_set_opa_mode(1); fan5405_set_otg_pl(1); fan5405_set_otg_en(1); #elif defined(CONFIG_MTK_BQ24261_SUPPORT) bq24261_set_en_boost(1); #elif defined(CONFIG_MTK_BQ24296_SUPPORT) bq24296_set_otg_config(0x1); /* OTG */ bq24296_set_boostv(0x7); /* boost voltage 4.998V */ bq24296_set_boost_lim(0x1); /* 1.5A on VBUS */ bq24296_set_en_hiz(0x0); #elif defined(CONFIG_MTK_BQ24196_SUPPORT) bq24196_set_otg_config(0x01); /* OTG */ bq24196_set_boost_lim(0x01); /* 1.3A on VBUS */ #elif defined(CONFIG_MTK_NCP1854_SUPPORT) ncp1854_set_otg_en(0); ncp1854_set_chg_en(0); ncp1854_set_otg_en(1); #else #ifdef CONFIG_OF #if defined(CONFIG_MTK_LEGACY) mt_set_gpio_mode(drvvbus_pin, drvvbus_pin_mode); mt_set_gpio_out(drvvbus_pin, GPIO_OUT_ONE); #else pr_debug("****%s:%d Drive VBUS HIGH KS!!!!!\n", __func__, __LINE__); pinctrl_select_state(pinctrl, pinctrl_drvvbus_high); #endif #else mt_set_gpio_mode(GPIO_OTG_DRVVBUS_PIN, GPIO_OTG_DRVVBUS_PIN_M_GPIO); mt_set_gpio_out(GPIO_OTG_DRVVBUS_PIN, GPIO_OUT_ONE); #endif #endif } else { /* power off VBUS, implement later... */ #ifdef CONFIG_MTK_FAN5405_SUPPORT fan5405_reg_config_interface(0x01, 0x30); fan5405_reg_config_interface(0x02, 0x8e); #elif defined(CONFIG_MTK_BQ24261_SUPPORT) bq24261_set_en_boost(0); #elif defined(CONFIG_MTK_BQ24296_SUPPORT) bq24296_set_otg_config(0); #elif defined(CONFIG_MTK_BQ24196_SUPPORT) bq24196_set_otg_config(0x0); /* OTG disabled */ #elif defined(CONFIG_MTK_NCP1854_SUPPORT) ncp1854_set_otg_en(0x0); #else #ifdef CONFIG_OF #if defined(CONFIG_MTK_LEGACY) mt_set_gpio_mode(drvvbus_pin, drvvbus_pin_mode); mt_set_gpio_out(drvvbus_pin, GPIO_OUT_ZERO); #else pr_debug("****%s:%d Drive VBUS LOW KS!!!!!\n", __func__, __LINE__); pinctrl_select_state(pinctrl, pinctrl_drvvbus_low); #endif #else mt_set_gpio_mode(GPIO_OTG_DRVVBUS_PIN, GPIO_OTG_DRVVBUS_PIN_M_GPIO); mt_set_gpio_out(GPIO_OTG_DRVVBUS_PIN, GPIO_OUT_ZERO); #endif #endif } #endif }