Skip to content

Commit

Permalink
power: mediatek: add voltage_now battery property
Browse files Browse the repository at this point in the history
Add battery property voltage_now, in units of uV per power_supply standard.
healthd and Android will use this value instead of the existing batt_vol
property (which is unepxectedly in mV units).

Change-Id: Ida25d702c30507ecedba4818a84be9baf66f67e0
Signed-off-by: Todd Poynor <[email protected]>
  • Loading branch information
toddpoynor authored and carlitros900 committed Jun 10, 2019
1 parent 81afebe commit 367fcea
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/power/mediatek/battery_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ static enum power_supply_property battery_props[] = {
POWER_SUPPLY_PROP_CURRENT_MAX,
POWER_SUPPLY_PROP_VOLTAGE_MAX,
POWER_SUPPLY_PROP_CHARGE_COUNTER,
POWER_SUPPLY_PROP_VOLTAGE_NOW,
/* Add for Battery Service */
POWER_SUPPLY_PROP_batt_vol,
POWER_SUPPLY_PROP_batt_temp,
Expand Down Expand Up @@ -720,6 +721,9 @@ static int battery_get_property(struct power_supply *psy,
case POWER_SUPPLY_PROP_CAPACITY:
val->intval = data->BAT_CAPACITY;
break;
case POWER_SUPPLY_PROP_VOLTAGE_NOW:
val->intval = data->BAT_batt_vol * 1000; /* uV */
break;
case POWER_SUPPLY_PROP_batt_vol:
val->intval = data->BAT_batt_vol * 1000;
break;
Expand Down

0 comments on commit 367fcea

Please sign in to comment.