mirror of
https://github.com/torvalds/linux.git
synced 2026-05-21 05:18:45 +02:00
Revert "power: supply: bq27xxx: do not report bogus zero values"
Commitf3974aca38("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:f3974aca38("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>
This commit is contained in:
parent
30cc7b0d0e
commit
4ebeb27b72
|
|
@ -2148,10 +2148,6 @@ static int bq27xxx_battery_get_property(struct power_supply *psy,
|
|||
break;
|
||||
case POWER_SUPPLY_PROP_CAPACITY:
|
||||
ret = bq27xxx_simple_value(di->cache.capacity, val);
|
||||
/* If 0 is reported, it is expected that EDVF is also set */
|
||||
if (!ret && di->opts & BQ27XXX_O_ZERO &&
|
||||
!(di->cache.flags & BQ27000_FLAG_EDVF))
|
||||
return -EINVAL;
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_CAPACITY_LEVEL:
|
||||
ret = bq27xxx_battery_capacity_level(di, val);
|
||||
|
|
@ -2175,15 +2171,10 @@ static int bq27xxx_battery_get_property(struct power_supply *psy,
|
|||
val->intval = POWER_SUPPLY_TECHNOLOGY_LION;
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_CHARGE_NOW:
|
||||
if (di->regs[BQ27XXX_REG_NAC] != INVALID_REG_ADDR) {
|
||||
if (di->regs[BQ27XXX_REG_NAC] != INVALID_REG_ADDR)
|
||||
ret = bq27xxx_battery_read_nac(di, val);
|
||||
/* If 0 is reported, it is expected that EDVF is also set */
|
||||
if (!ret && di->opts & BQ27XXX_O_ZERO &&
|
||||
!(di->cache.flags & BQ27000_FLAG_EDVF))
|
||||
return -EINVAL;
|
||||
} else {
|
||||
else
|
||||
ret = bq27xxx_battery_read_rc(di, val);
|
||||
}
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_CHARGE_FULL:
|
||||
ret = bq27xxx_battery_read_fcc(di, val);
|
||||
|
|
@ -2208,10 +2199,6 @@ static int bq27xxx_battery_get_property(struct power_supply *psy,
|
|||
break;
|
||||
case POWER_SUPPLY_PROP_ENERGY_NOW:
|
||||
ret = bq27xxx_battery_read_energy(di, val);
|
||||
/* If 0 is reported, it is expected that EDVF is also set */
|
||||
if (!ret && di->opts & BQ27XXX_O_ZERO &&
|
||||
!(di->cache.flags & BQ27000_FLAG_EDVF))
|
||||
return -EINVAL;
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_POWER_AVG:
|
||||
ret = bq27xxx_battery_pwr_avg(di, val);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user