mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 22:40:54 -04:00
adjust flip charger input current
The charger input current provides for both main and flip battery charger, so there should be balance between the two charger input in order to meet the BC1.2 charger current spec: SDP: 500/900mA CDP: 1500mA DCP: 1500mA Change-Id: Idf52ec497a46a01340a8a96888148cc324858ad3 Signed-off-by: Yonghua Yan <yanyh2@motorola.com> Reviewed-on: https://gerrit.mot.com/2331227 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Jianqi Yang <yangj@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
c6c43063cf
commit
a2caade93d
1 changed files with 30 additions and 11 deletions
|
|
@ -27,6 +27,7 @@
|
|||
#define DEF_IBAT_OCP_MA (1500)
|
||||
#define DEF_IBAT_OCCP_MA (1500)
|
||||
#define DEF_PROTECT_DURATION_MS (60000)
|
||||
#define DEF_USB_CURRENT_MA (500000)
|
||||
|
||||
static bool paired_vbat_panic_enabled = false;
|
||||
module_param(paired_vbat_panic_enabled, bool, 0644);
|
||||
|
|
@ -1396,17 +1397,12 @@ static void charger_detect_work_func(struct work_struct *work)
|
|||
return;
|
||||
}
|
||||
|
||||
if (sgm->use_ext_usb_psy && sgm->usb) {
|
||||
if (curr_in_limit < sgm->state.ibus_limit)
|
||||
curr_in_limit = sgm->state.ibus_limit;
|
||||
if (curr_in_limit > sgm->init_data.ilim)
|
||||
curr_in_limit = sgm->init_data.ilim;
|
||||
if (prev_in_limit != curr_in_limit) {
|
||||
dev_info(sgm->dev, "Update: curr_in_limit = %d\n",
|
||||
curr_in_limit);
|
||||
sgm4154x_set_input_curr_lim(sgm, curr_in_limit);
|
||||
prev_in_limit = curr_in_limit;
|
||||
}
|
||||
if ((!sgm->use_ext_usb_psy || !sgm->usb) &&
|
||||
prev_in_limit != curr_in_limit) {
|
||||
dev_info(sgm->dev, "Update: curr_in_limit = %d\n",
|
||||
curr_in_limit);
|
||||
sgm4154x_set_input_curr_lim(sgm, curr_in_limit);
|
||||
prev_in_limit = curr_in_limit;
|
||||
}
|
||||
#endif
|
||||
if (state_changed) {
|
||||
|
|
@ -2243,6 +2239,7 @@ static int sgm4154x_charger_config_charge(void *data, struct mmi_charger_cfg *co
|
|||
bool high_load_en;
|
||||
bool low_load_en;
|
||||
static int prev_paired_load = PAIRED_LOAD_OFF;
|
||||
int curr_in_limit = chg->sgm->ilim;
|
||||
|
||||
/* Monitor vbat and ibat for OVP and OCP */
|
||||
if (chg->batt_info.batt_mv >= chg->sgm->vbat_ovp_threshold) {
|
||||
|
|
@ -2453,6 +2450,28 @@ static int sgm4154x_charger_config_charge(void *data, struct mmi_charger_cfg *co
|
|||
pr_info("Battery charging reconfigure triggered\n");
|
||||
}
|
||||
|
||||
if (chg->chg_info.chrg_present && !state.hiz_en &&
|
||||
chg->sgm->use_ext_usb_psy && chg->sgm->usb) {
|
||||
if (state.ibus_limit < DEF_USB_CURRENT_MA &&
|
||||
state.ibus_adc < DEF_USB_CURRENT_MA) {
|
||||
curr_in_limit = DEF_USB_CURRENT_MA - state.ibus_adc;
|
||||
} else if (state.ibus_limit > state.ibus_adc) {
|
||||
curr_in_limit = state.ibus_limit - state.ibus_adc;
|
||||
} else {
|
||||
curr_in_limit = 0;
|
||||
}
|
||||
if (curr_in_limit > chg->sgm->init_data.ilim)
|
||||
curr_in_limit = chg->sgm->init_data.ilim;
|
||||
} else if (!chg->chg_info.chrg_present) {
|
||||
curr_in_limit = 0;
|
||||
}
|
||||
|
||||
if (chg->sgm->ilim != curr_in_limit) {
|
||||
sgm4154x_set_input_curr_lim(chg->sgm, curr_in_limit);
|
||||
pr_info("ibus_limit=%d, ibus_adc=%d, curr=%d\n",
|
||||
state.ibus_limit, state.ibus_adc, curr_in_limit);
|
||||
}
|
||||
|
||||
if (cfg_changed) {
|
||||
cancel_delayed_work(&chg->sgm->charge_monitor_work);
|
||||
schedule_delayed_work(&chg->sgm->charge_monitor_work,
|
||||
|
|
|
|||
Loading…
Reference in a new issue