mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-13 00:00:00 -04:00
power: override USB ICL
Override USB ICL using the targer ICL value, so that the ICL settled value will not be limited to a lower value than target value. For example, when connect device using a CC floated typec cable, the settled icl will be set to 100mA, which will block the charging. Change-Id: Icd2ea3e020437297642d790f4e1fa8ab25231504 Signed-off-by: Yonghua Yan <yanyh2@motorola.com> Reviewed-on: https://gerrit.mot.com/1393334 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Ryan Lattrel <ryanl@motorola.com> Reviewed-by: Huosheng Liao <liaohs@motorola.com> Reviewed-by: Haijian Ma <mahj8@motorola.com> Reviewed-by: Jianqi Yang <yangj@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
26b854ce75
commit
7385bf598a
1 changed files with 28 additions and 0 deletions
|
|
@ -1670,6 +1670,31 @@ static int get_prop_charger_present(struct smb_mmi_charger *chg,
|
|||
return rc;
|
||||
}
|
||||
|
||||
int mmi_usb_icl_override(struct smb_mmi_charger *chg, int icl)
|
||||
{
|
||||
int rc = 0;
|
||||
union power_supply_propval val;
|
||||
|
||||
val.intval = icl;
|
||||
if (chg->main_psy) {
|
||||
rc = power_supply_set_property(chg->main_psy,
|
||||
POWER_SUPPLY_PROP_CURRENT_MAX,
|
||||
&val);
|
||||
if (rc < 0) {
|
||||
mmi_err(chg, "Couldn't set usb icl, rc=%d\n", rc);
|
||||
}
|
||||
}
|
||||
|
||||
rc = smblib_masked_write_mmi(chg, USBIN_CMD_ICL_OVERRIDE_REG,
|
||||
USBIN_ICL_OVERRIDE_BIT,
|
||||
USBIN_ICL_OVERRIDE_BIT);
|
||||
if (rc < 0) {
|
||||
mmi_err(chg, "Couldn't override usb icl, rc=%d\n", rc);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
#define HVDCP_VOLTAGE_NOM 5000
|
||||
#define HVDCP_VOLTAGE_MAX 5400
|
||||
#define HVDCP_VOLTAGE_MIN 4000
|
||||
|
|
@ -2587,6 +2612,9 @@ static void mmi_basic_charge_sm(struct smb_mmi_charger *chip,
|
|||
vote(chip->fcc_votable, MMI_HB_VOTER,
|
||||
true, (target_fcc >= 0) ? (target_fcc * 1000) : 0);
|
||||
|
||||
/* Override USB ICL using the target value */
|
||||
mmi_usb_icl_override(chip, get_effective_result(chip->usb_icl_votable));
|
||||
|
||||
/* Rerun AICL to recover USB ICL from recharge */
|
||||
if (is_chg_dis != get_effective_result(chip->chg_dis_votable)) {
|
||||
power_supply_set_property(chip->qcom_psy,
|
||||
|
|
|
|||
Loading…
Reference in a new issue