Skip to content

Commit

Permalink
Update surface-rt-ec.c
Browse files Browse the repository at this point in the history
temporary workaround to fix rpios widget bug for battery capacity, code by Jonas Schwöbel <jonasschwoebel@yahoo.de>
  • Loading branch information
wmjb authored Sep 7, 2023
1 parent 526f003 commit dee271c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/power/supply/surface-rt-ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ static const enum power_supply_property srt_bat_power_supply_props[] = {
POWER_SUPPLY_PROP_CAPACITY,
POWER_SUPPLY_PROP_CHARGE_FULL,
POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
POWER_SUPPLY_PROP_CHARGE_NOW,
POWER_SUPPLY_PROP_CURRENT_NOW,
POWER_SUPPLY_PROP_CYCLE_COUNT,
POWER_SUPPLY_PROP_MANUFACTURER,
Expand Down Expand Up @@ -196,6 +197,14 @@ static int srt_bat_power_supply_get_property(struct power_supply *psy,
ret = srt_bat_get_value(client, REGW_CHARGE_FULL_DESIGN,
&val->intval);
break;
case POWER_SUPPLY_PROP_CHARGE_NOW:
{
int full_design, capacity;
ret = srt_bat_get_value(client, REGW_CHARGE_FULL, &full_design);
ret = srt_bat_get_value(client, REGW_CAPACITY, &capacity);
val->intval = full_design * capacity / 100;
}
break;
case POWER_SUPPLY_PROP_CURRENT_NOW:
ret = srt_bat_get_value(client, REGW_CURRENT_NOW, &val->intval);
break;
Expand Down

0 comments on commit dee271c

Please sign in to comment.