charging: add icl*vbus to report power max

As pd type can't equal to real_charger_type in discrete charging,
so need to add icl*vbus to report power max for showing turbopower
connected UI.

Change-Id: I16f4b559383f86eb38ec1b5e6cac09556d9dfada
Signed-off-by: mahj8 <mahj8@motorola.com>
Reviewed-on: https://gerrit.mot.com/2154206
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
mahj8 2021-12-24 16:07:25 +08:00 • committed by Haijian Ma
commit 264b8e8d71

View file

@ -2153,6 +2153,7 @@ static int mmi_discrete_get_chg_info(void *data, struct mmi_charger_info *chg_in
int rc;
int usb_type;
int usb_icl;
int vbus;
union power_supply_propval val;
struct mmi_discrete_chg_client *chg = data;
struct mmi_discrete_charger *chip = chg->chip;
@ -2195,8 +2196,13 @@ static int mmi_discrete_get_chg_info(void *data, struct mmi_charger_info *chg_in
chip->chg_info.chrg_pmax_mw = 2500;
usb_icl = get_effective_result(chip->usb_icl_votable);
if (chip->chg_info.chrg_pmax_mw < (usb_icl * 5 / 1000))
chip->chg_info.chrg_pmax_mw = usb_icl * 5 / 1000;
val.intval = 0;
rc = get_prop_usb_voltage_now(chip, &val);
if (rc < 0)
mmi_err(chip, "Couldn't read usb voltage rc=%d\n", rc);
vbus = (val.intval /1000 + 500) /1000;
if (chip->chg_info.chrg_pmax_mw < (usb_icl * vbus / 1000))
chip->chg_info.chrg_pmax_mw = usb_icl * vbus / 1000;
rc = 0;
goto completed;