static kal_uint32 charging_hw_init(void *data) { //static kal_uint32 run_hw_init_once_flag=1; kal_uint32 ncp1854_status; kal_uint32 status = STATUS_OK; if (Enable_BATDRV_LOG == 1) { xlog_printk(ANDROID_LOG_INFO, "Power/Battery", "[BATTERY:ncp1854] ChargerHwInit_ncp1854\n" ); } ncp1854_status = ncp1854_get_chip_status(); ncp1854_set_otg_en(0x0); ncp1854_set_trans_en(0); ncp1854_set_tj_warn_opt(0x0);//set at disabled, by MT6325 BATON // ncp1854_set_int_mask(0x0); //disable all interrupt ncp1854_set_int_mask(0x1); //enable all interrupt for boost mode status monitor // ncp1854_set_tchg_rst(0x1); //reset charge timer #ifdef NCP1854_PWR_PATH ncp1854_set_pwr_path(0x1); #else ncp1854_set_pwr_path(0x0); #endif ncp1854_set_chgto_dis(0x1); //disable charge timer if((ncp1854_status == 0x8) || (ncp1854_status == 0x9) || (ncp1854_status == 0xA)) //WEAK WAIT, WEAK SAFE, WEAK CHARGE ncp1854_set_ctrl_vbat(0x1C); //VCHG = 4.0V //if(run_hw_init_once_flag) //{ ncp1854_set_ieoc(0x4); // terminate current = 200mA for ICS optimized suspend power ncp1854_set_iweak(0x3); //weak charge current = 300mA // run_hw_init_once_flag=0; //} ncp1854_set_aicl_en(0x1); //enable AICL as PT team suggest ncp1854_set_iinset_pin_en(0x0); //Input current limit and AICL control by I2C ncp1854_set_ctrl_vfet(0x3); // VFET = 3.4V #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 return status; }
static kal_uint32 charging_hw_init(void *data) { kal_uint32 ncp1854_status; kal_uint32 status = STATUS_OK; if (Enable_BATDRV_LOG == 1) { battery_log(BAT_LOG_CRTI, "[BATTERY:ncp1854] ChargerHwInit_ncp1854\n"); } ncp1854_status = ncp1854_get_chip_status(); upmu_set_rg_bc11_bb_ctrl(1); //BC11_BB_CTRL upmu_set_rg_bc11_rst(1); //BC11_RST ncp1854_set_otg_en(0x0); ncp1854_set_trans_en(0); ncp1854_set_tj_warn_opt(0x1); // ncp1854_set_int_mask(0x0); //disable all interrupt ncp1854_set_int_mask(0x1); //enable all interrupt for boost mode status monitor ncp1854_set_tchg_rst(0x1); //reset charge timer #ifdef NCP1854_PWR_PATH ncp1854_set_pwr_path(0x1); #else ncp1854_set_pwr_path(0x0); #endif if((ncp1854_status == 0x8) || (ncp1854_status == 0x9) || (ncp1854_status == 0xA)) //WEAK WAIT, WEAK SAFE, WEAK CHARGE ncp1854_set_ctrl_vbat(0x1C); //VCHG = 4.0V else if(ncp1854_status == 0x4) ncp1854_set_ctrl_vbat(0x28); //VCHG = 4.3V to decrease charge time else ncp1854_set_ctrl_vbat(0x24); //VCHG = 4.2V ncp1854_set_ieoc(0x4); // terminate current = 200mA for ICS optimized suspend power ncp1854_set_iweak(0x3); //weak charge current = 300mA ncp1854_set_ctrl_vfet(0x3); // VFET = 3.4V return status; }