mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 21:59:12 -04:00
power: charger presence bases on usb and pc_port online
Typec mode is not a sufficient condition for USB charger presence detection, in the cases that typec mode is not source type. Here takes audio adapter with charger port support for example. It is reasonable to keep consistent with QC SMB charger driver charger presence report. Change-Id: I43b795d142aa75cbdd372b288d64c83b85075f3a Signed-off-by: Yonghua Yan <yanyh2@motorola.com> Reviewed-on: https://gerrit.mot.com/1371201 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Huosheng Liao <liaohs@motorola.com> Reviewed-by: Kenneth Kessler <kennykessler@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
267e494d0f
commit
ab148d38d5
1 changed files with 14 additions and 14 deletions
|
|
@ -1516,27 +1516,27 @@ static int get_prop_charger_present(struct smb_mmi_charger *chg,
|
|||
union power_supply_propval *val)
|
||||
{
|
||||
int rc = -EINVAL;
|
||||
bool chg_online = false;
|
||||
|
||||
val->intval = 0;
|
||||
|
||||
if (chg->usb_psy)
|
||||
if (chg->usb_psy) {
|
||||
rc = power_supply_get_property(chg->usb_psy,
|
||||
POWER_SUPPLY_PROP_TYPEC_MODE, val);
|
||||
if (rc < 0) {
|
||||
mmi_err(chg, "Couldn't read TypeC Mode rc=%d\n", rc);
|
||||
return rc;
|
||||
POWER_SUPPLY_PROP_ONLINE, val);
|
||||
if (rc < 0)
|
||||
mmi_err(chg, "Couldn't read USB online rc=%d\n", rc);
|
||||
}
|
||||
chg_online = !!val->intval;
|
||||
|
||||
switch (val->intval) {
|
||||
case POWER_SUPPLY_TYPEC_SOURCE_DEFAULT:
|
||||
case POWER_SUPPLY_TYPEC_SOURCE_MEDIUM:
|
||||
case POWER_SUPPLY_TYPEC_SOURCE_HIGH:
|
||||
val->intval = 1;
|
||||
break;
|
||||
default:
|
||||
val->intval = 0;
|
||||
break;
|
||||
if (chg->pc_port_psy) {
|
||||
rc = power_supply_get_property(chg->pc_port_psy,
|
||||
POWER_SUPPLY_PROP_ONLINE, val);
|
||||
if (rc < 0)
|
||||
mmi_err(chg, "Couldn't read PC online rc=%d\n", rc);
|
||||
}
|
||||
chg_online = chg_online || !!val->intval;
|
||||
|
||||
val->intval = chg_online;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue