ensure that user configuration takes precedence.

sc760x:
If there is no user configuration, set the value of thermal limit.

Change-Id: I0866031ab7f33445846d868d2fa4202c51812185
Reviewed-on: https://gerrit.mot.com/2532545
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Wentao Xu <xuwt2@motorola.com>
Reviewed-by: Tao Sun <suntao2@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
litong20 2023-03-08 17:23:57 +08:00 • committed by litong
commit e9e36e9fca

View file

@ -297,6 +297,11 @@ static int sc760x_set_auto_bsm_dis(struct sc760x_chip *sc, bool en)
static int sc760x_set_ibat_limit(struct sc760x_chip *sc, int curr)
{
if (sc->user_ichg >= 0 && sc->user_ichg != curr) {
curr = sc->user_ichg;
dev_info(sc->dev, "%s : User request override ibat = %duA\n", __func__, curr);
}
dev_info(sc->dev, "%s : %dmA\n", __func__, curr);
return sc760x_field_write(sc, IBAT_CHG_LIM,
@ -687,7 +692,7 @@ static int sc760x_set_thermal_mitigation(struct sc760x_chip *sc, int val)
if (!sc->num_thermal_levels)
return 0;
if (sc->num_thermal_levels < 0 || sc->user_ichg) {
if (sc->num_thermal_levels < 0) {
pr_err("Incorrect num_thermal_levels\n");
return -EINVAL;
}