charging: add pd support judge

For avoiding effect another product which don't support pd,
so add pd support judge.

Change-Id: Iafc014835b6042e211afdcfa246d09a626dbe28b
Signed-off-by: mahj8 <mahj8@motorola.com>
Reviewed-on: https://gerrit.mot.com/2174030
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Wei Xu <xuwei9@lenovo.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
mahj8 2022-01-19 10:36:18 +08:00 • committed by Haijian Ma
commit d4deb70169
2 changed files with 5 additions and 4 deletions

View file

@ -108,7 +108,7 @@ static int mmi_discrete_parse_dts(struct mmi_discrete_charger *chip)
}
}
chip->pd_not_supported = of_property_read_bool(node, "mmi,usb-pd-disable");
chip->pd_supported = of_property_read_bool(node, "mmi,usb-pd-supported");
return 0;
}
@ -1368,9 +1368,10 @@ static int mmi_discrete_usb_get_prop(struct power_supply *psy,
/*when in COM, pd will trigger hard reset to let source send source_cap.
*but pd hard reset will closed vbus and re-enable vbus by adaptor, so usb
*present will return 0 to let COM shutdown. Typec mode is always on.*/
if (chip->typec_mode == MMI_POWER_SUPPLY_TYPEC_SOURCE_DEFAULT
if (chip->pd_supported &&
(chip->typec_mode == MMI_POWER_SUPPLY_TYPEC_SOURCE_DEFAULT
|| chip->typec_mode == MMI_POWER_SUPPLY_TYPEC_SOURCE_MEDIUM
|| chip->typec_mode == MMI_POWER_SUPPLY_TYPEC_SOURCE_HIGH) {
|| chip->typec_mode == MMI_POWER_SUPPLY_TYPEC_SOURCE_HIGH)) {
val->intval = 1;
break;
}

View file

@ -107,7 +107,7 @@ struct mmi_discrete_charger {
/*PD*/
struct adapter_device *pd_adapter_dev;
int pd_active;
bool pd_not_supported;
bool pd_supported;
int dc_cl_ma;
int batt_profile_fv_uv;