power: fix wrong charger presence detection

L(CR) (CR) we need to make sure to set intval
to 0 at the end of chrager presence detection because
it can report incorrectly while in sink mode(aka otg cable)

Change-Id: Ib7b93ec77929d4c738498fe3fee2e78d556661ce
Signed-off-by: Curtis Porter <porterc@motorola.com>
Reviewed-on: https://gerrit.mot.com/1438655
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Cesar Augusto Marcelino dos Santos <cmsantos@motorola.com>
Reviewed-by: Ling Jin <lingjin@motorola.com>
Submit-Approved: Jira Key
(cherry picked from commit 0a86b47264b81c699ac20613b3dbbd7a643708a2)
Reviewed-on: https://gerrit.mot.com/1444680
This commit is contained in:
Curtis Porter 2019-10-17 16:09:36 -05:00
commit 6218ed77dc

View file

@ -1674,7 +1674,6 @@ static int get_prop_charger_present(struct smb_mmi_charger *chg,
return rc;
}
val->intval = 0;
if (chg->usb_psy) {
rc = power_supply_get_property(chg->usb_psy,
POWER_SUPPLY_PROP_TYPEC_MODE, val);
@ -1688,6 +1687,9 @@ static int get_prop_charger_present(struct smb_mmi_charger *chg,
}
}
//intval can be changed by get_property call we should reset to 0
//this is true for a OTG cable
val->intval = 0;
return rc;
}