Skip to content

Commit 4ebeb27

Browse files
sicelosre
authored andcommitted
Revert "power: supply: bq27xxx: do not report bogus zero values"
Commit f3974ac ("power: supply: bq27xxx: do not report bogus zero values") breaks property reporting on chips which are reporting normal values. During testing, excessive emphasis was evidently placed on the chip with non-working conditions, and not enough testing was done on a battery that had normal state. A correct fix will be submitted in a separate patch. Reported-by: H. Nikolaus Schaller <hns@goldelico.com> Closes: https://lore.kernel.org/linux-pm/CB5B8FE7-D619-4D30-BD2D-58B6CEF83D46@goldelico.com/ Fixes: f3974ac ("power: supply: bq27xxx: do not report bogus zero values") Signed-off-by: Sicelo A. Mhlongo <absicsz@gmail.com> Link: https://lore.kernel.org/r/20250312121712.146109-2-absicsz@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
1 parent 30cc7b0 commit 4ebeb27

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

drivers/power/supply/bq27xxx_battery.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2148,10 +2148,6 @@ static int bq27xxx_battery_get_property(struct power_supply *psy,
21482148
break;
21492149
case POWER_SUPPLY_PROP_CAPACITY:
21502150
ret = bq27xxx_simple_value(di->cache.capacity, val);
2151-
/* If 0 is reported, it is expected that EDVF is also set */
2152-
if (!ret && di->opts & BQ27XXX_O_ZERO &&
2153-
!(di->cache.flags & BQ27000_FLAG_EDVF))
2154-
return -EINVAL;
21552151
break;
21562152
case POWER_SUPPLY_PROP_CAPACITY_LEVEL:
21572153
ret = bq27xxx_battery_capacity_level(di, val);
@@ -2175,15 +2171,10 @@ static int bq27xxx_battery_get_property(struct power_supply *psy,
21752171
val->intval = POWER_SUPPLY_TECHNOLOGY_LION;
21762172
break;
21772173
case POWER_SUPPLY_PROP_CHARGE_NOW:
2178-
if (di->regs[BQ27XXX_REG_NAC] != INVALID_REG_ADDR) {
2174+
if (di->regs[BQ27XXX_REG_NAC] != INVALID_REG_ADDR)
21792175
ret = bq27xxx_battery_read_nac(di, val);
2180-
/* If 0 is reported, it is expected that EDVF is also set */
2181-
if (!ret && di->opts & BQ27XXX_O_ZERO &&
2182-
!(di->cache.flags & BQ27000_FLAG_EDVF))
2183-
return -EINVAL;
2184-
} else {
2176+
else
21852177
ret = bq27xxx_battery_read_rc(di, val);
2186-
}
21872178
break;
21882179
case POWER_SUPPLY_PROP_CHARGE_FULL:
21892180
ret = bq27xxx_battery_read_fcc(di, val);
@@ -2208,10 +2199,6 @@ static int bq27xxx_battery_get_property(struct power_supply *psy,
22082199
break;
22092200
case POWER_SUPPLY_PROP_ENERGY_NOW:
22102201
ret = bq27xxx_battery_read_energy(di, val);
2211-
/* If 0 is reported, it is expected that EDVF is also set */
2212-
if (!ret && di->opts & BQ27XXX_O_ZERO &&
2213-
!(di->cache.flags & BQ27000_FLAG_EDVF))
2214-
return -EINVAL;
22152202
break;
22162203
case POWER_SUPPLY_PROP_POWER_AVG:
22172204
ret = bq27xxx_battery_pwr_avg(di, val);

0 commit comments

Comments
 (0)