Skip to content

Commit dc77721

Browse files
linuswsre
authored andcommitted
power: supply: ab8500: Set typing and props
I had the following weird phenomena on a mobile phone: while the capacity in /sys/class/power_supply/ab8500_fg/capacity would reflect the actual charge and capacity of the battery, only 1/3 of the value was shown on the battery status indicator and warnings for low battery appeared. It turns out that UPower, the Freedesktop power daemon, will average all the power supplies of type "battery" in /sys/class/power_supply/* if there is more than one battery. For the AB8500, there was "battery" ab8500_fg, ab8500_btemp and ab8500_chargalg. The latter two don't know anything about the battery, and should not be considered. They were however averaged and with the capacity of 0. Flag ab8500_btemp and ab8500_chargalg with type "unknown" so they are not averaged as batteries. Remove the technology prop from ab8500_btemp as well, all it does is snoop in on knowledge from another supply. After this the battery indicator shows the right value. Cc: Stefan Hansson <[email protected]> Cc: [email protected] Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
1 parent 0bb80ec commit dc77721

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

drivers/power/supply/ab8500_btemp.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ struct ab8500_btemp {
115115
static enum power_supply_property ab8500_btemp_props[] = {
116116
POWER_SUPPLY_PROP_PRESENT,
117117
POWER_SUPPLY_PROP_ONLINE,
118-
POWER_SUPPLY_PROP_TECHNOLOGY,
119118
POWER_SUPPLY_PROP_TEMP,
120119
};
121120

@@ -532,12 +531,6 @@ static int ab8500_btemp_get_property(struct power_supply *psy,
532531
else
533532
val->intval = 1;
534533
break;
535-
case POWER_SUPPLY_PROP_TECHNOLOGY:
536-
if (di->bm->bi)
537-
val->intval = di->bm->bi->technology;
538-
else
539-
val->intval = POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
540-
break;
541534
case POWER_SUPPLY_PROP_TEMP:
542535
val->intval = ab8500_btemp_get_temp(di);
543536
break;
@@ -662,7 +655,7 @@ static char *supply_interface[] = {
662655

663656
static const struct power_supply_desc ab8500_btemp_desc = {
664657
.name = "ab8500_btemp",
665-
.type = POWER_SUPPLY_TYPE_BATTERY,
658+
.type = POWER_SUPPLY_TYPE_UNKNOWN,
666659
.properties = ab8500_btemp_props,
667660
.num_properties = ARRAY_SIZE(ab8500_btemp_props),
668661
.get_property = ab8500_btemp_get_property,

drivers/power/supply/ab8500_chargalg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1720,7 +1720,7 @@ static char *supply_interface[] = {
17201720

17211721
static const struct power_supply_desc ab8500_chargalg_desc = {
17221722
.name = "ab8500_chargalg",
1723-
.type = POWER_SUPPLY_TYPE_BATTERY,
1723+
.type = POWER_SUPPLY_TYPE_UNKNOWN,
17241724
.properties = ab8500_chargalg_props,
17251725
.num_properties = ARRAY_SIZE(ab8500_chargalg_props),
17261726
.get_property = ab8500_chargalg_get_property,

0 commit comments

Comments
 (0)