p938x_charger: report fast charging if >= 15W

Only report fast charging rate if the guaranteed power
is greater than or equal to 15W.

Change-Id: I6f8a5492d47bf7a81b5b17215b5c8aa0ca65e871
Signed-off-by: Ryan Lattrel <ryanl@motorola.com>
Reviewed-on: https://gerrit.mot.com/1548059
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Drew Abbott <drewa@motorola.com>
Reviewed-by: Ling Jin <lingjin@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
Ryan Lattrel 2020-05-05 12:55:59 -05:00
commit 47210f01e5

View file

@ -160,6 +160,8 @@
#define IDC_THERMAL_BACKOFF_MA 100
#define IDC_THERMAL_MIN_CURRENT 400
#define FAST_CHARGE_MW 15000
#define DETACH_ON_READ_FAILURE
#define p938x_err(chip, fmt, ...) \
@ -2733,6 +2735,8 @@ static int p938x_wls_get_prop(struct power_supply *psy,
union power_supply_propval *val)
{
struct p938x_charger *chip = power_supply_get_drvdata(psy);
int tx_guaranteed;
int tx_potential;
switch (psp) {
case POWER_SUPPLY_PROP_PRESENT:
@ -2762,7 +2766,9 @@ static int p938x_wls_get_prop(struct power_supply *psy,
break;
case POWER_SUPPLY_PROP_CHARGE_TYPE:
if (p938x_is_ldo_on(chip)) {
if (chip->epp_mode)
if (chip->epp_mode &&
!p938x_get_tx_capability(chip, &tx_guaranteed, &tx_potential) &&
tx_guaranteed >= FAST_CHARGE_MW)
val->intval = POWER_SUPPLY_CHARGE_TYPE_FAST;
else
val->intval = POWER_SUPPLY_CHARGE_TYPE_TRICKLE;