// ============================================================ // static kal_uint32 charging_hw_init_bq24196(void *data) { kal_uint32 status = STATUS_OK; upmu_set_rg_bc11_bb_ctrl(1); //BC11_BB_CTRL upmu_set_rg_bc11_rst(1); //BC11_RST bq24196_set_en_hiz(0x0); bq24196_set_vindpm(0xA); //VIN DPM check 4.68V bq24196_set_reg_rst(0x0); bq24196_set_wdt_rst(0x1); //Kick watchdog bq24196_set_sys_min(0x5); //Minimum system voltage 3.5V bq24196_set_iprechg(0x3); //Precharge current 512mA bq24196_set_iterm(0x0); //Termination current 128mA bq24196_set_vreg(0x2C); //VREG 4.208V bq24196_set_batlowv(0x1); //BATLOWV 3.0V bq24196_set_vrechg(0x0); //VRECHG 0.1V (4.108V) bq24196_set_en_term(0x1); //Enable termination bq24196_set_term_stat(0x0); //Match ITERM bq24196_set_watchdog(0x1); //WDT 40s bq24196_set_en_timer(0x0); //Disable charge timer bq24196_set_int_mask(0x0); //Disable fault interrupt return status; }
static kal_uint32 charging_hw_init(void *data) { kal_uint32 status = STATUS_OK; upmu_set_rg_bc11_bb_ctrl(1); //BC11_BB_CTRL upmu_set_rg_bc11_rst(1); //BC11_RST #if 0 //no use //pull PSEL low mt_set_gpio_mode(GPIO_CHR_PSEL_PIN,GPIO_MODE_GPIO); mt_set_gpio_dir(GPIO_CHR_PSEL_PIN,GPIO_DIR_OUT); mt_set_gpio_out(GPIO_CHR_PSEL_PIN,GPIO_OUT_ZERO); #endif //pull CE low mt_set_gpio_mode(GPIO_SWCHARGER_EN_PIN,GPIO_MODE_GPIO); mt_set_gpio_dir(GPIO_SWCHARGER_EN_PIN,GPIO_DIR_OUT); mt_set_gpio_out(GPIO_SWCHARGER_EN_PIN,GPIO_OUT_ZERO); //battery_xlog_printk(BAT_LOG_FULL, "gpio_number=0x%x,gpio_on_mode=%d,gpio_off_mode=%d\n", gpio_number, gpio_on_mode, gpio_off_mode); bq24196_set_en_hiz(0x0); if (get_usb_current_unlimited()) { bq24196_set_vindpm(0x7); //VIN DPM check 4.44V battery_xlog_printk(BAT_LOG_CRTI, "[charging_hw_init] VIN DPM check 4.44V\n"); }else{ bq24196_set_vindpm(0xA); //VIN DPM check 4.68V } bq24196_set_reg_rst(0x0); bq24196_set_wdt_rst(0x1); //Kick watchdog bq24196_set_sys_min(0x5); //Minimum system voltage 3.5V bq24196_set_iprechg(0x3); //Precharge current 512mA bq24196_set_iterm(0x0); //Termination current 128mA bq24196_set_batlowv(0x1); //BATLOWV 3.0V bq24196_set_vrechg(0x0); //VRECHG 0.1V (4.108V) bq24196_set_en_term(0x1); //Enable termination bq24196_set_term_stat(0x0); //Match ITERM bq24196_set_watchdog(0x1); //WDT 40s bq24196_set_en_timer(0x0); //Disable charge timer bq24196_set_int_mask(0x0); //Disable fault interrupt return status; }
static kal_uint32 charging_hw_init(void *data) { kal_uint32 status = STATUS_OK; bq24196_set_en_hiz(0x0); bq24196_set_vindpm(0xA); //VIN DPM check 4.68V bq24196_set_reg_rst(0x0); bq24196_set_wdt_rst(0x1); //Kick watchdog bq24196_set_sys_min(0x5); //Minimum system voltage 3.5V bq24196_set_iprechg(0x3); //Precharge current 512mA bq24196_set_iterm(0x0); //Termination current 128mA #if defined(HIGH_BATTERY_VOLTAGE_SUPPORT) bq24196_set_vreg(0x32); //VREG 4.304V #else bq24196_set_vreg(0x2C); //VREG 4.208V #endif bq24196_set_batlowv(0x1); //BATLOWV 3.0V bq24196_set_vrechg(0x0); //VRECHG 0.1V (4.108V) bq24196_set_en_term(0x1); //Enable termination bq24196_set_term_stat(0x0); //Match ITERM bq24196_set_watchdog(0x1); //WDT 40s bq24196_set_en_timer(0x0); //Disable charge timer bq24196_set_int_mask(0x0); //Disable fault interrupt #if defined(MTK_WIRELESS_CHARGER_SUPPORT) if(wireless_charger_gpio_number!=0) { mt_set_gpio_mode(wireless_charger_gpio_number,0); // 0:GPIO mode mt_set_gpio_dir(wireless_charger_gpio_number,0); // 0: input, 1: output } #endif #ifdef CONFIG_MTK_DUAL_INPUT_CHARGER_SUPPORT mt_set_gpio_mode(vin_sel_gpio_number,0); // 0:GPIO mode mt_set_gpio_dir(vin_sel_gpio_number,0); // 0: input, 1: output #endif return status; }