1
0
Fork 0

max77818-charger: add check for OTG mode when returning status_ex property

Ignore POGO connection state when in OTG mode, as the charger driver
always reports CHGIN OK (aka. connected) when charger_mode = OTG Supply
pull/10/head
Steinar Bakkemo 2019-09-30 12:55:16 +02:00
parent 3e0b6b929a
commit e2b3b99c8a
1 changed files with 9 additions and 2 deletions

View File

@ -598,8 +598,15 @@ static int max77818_charger_get_property(struct power_supply *psy,
val->intval = chg->charger_mode;
break;
case POWER_SUPPLY_PROP_STATUS_EX:
val->intval = (max77818_charger_chgin_present(chg) |
(max77818_charger_wcin_present(chg) << 1));
if (chg->charger_mode == POWER_SUPPLY_MODE_OTG_SUPPLY)
/* Charger device reports CHGIN OK in OTG mode anyway,
* so just ignore this and report WCIN status only when
* in OTG mode (charging is off anyway)
*/
val->intval = (max77818_charger_wcin_present(chg) << 1);
else
val->intval = (max77818_charger_chgin_present(chg) |
(max77818_charger_wcin_present(chg) << 1));
break;
default:
ret = -EINVAL;