:: [maemo-leste] [PATCH 1/2] Revert "p…
Góra strony
Delete this message
Reply to this message
Autor: Sicelo A. Mhlongo
Data:  
Dla: Sebastian Reichel, linux-pm
CC: H . Nikolaus Schaller, pali, maemo-leste, phone-devel, letux-kernel, akemnade, Sicelo A. Mhlongo
Stare tematy: [maemo-leste] [PATCH 0/2] power: supply: bq27xxx: do not report incorrect zero values
Temat: [maemo-leste] [PATCH 1/2] Revert "power: supply: bq27xxx: do not report bogus zero values"
Commit f3974aca381e ("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@???>
Closes: https://lore.kernel.org/linux-pm/CB5B8FE7-D619-4D30-BD2D-58B6CEF83D46@goldelico.com/
Fixes: f3974aca381e ("power: supply: bq27xxx: do not report bogus zero values")
Signed-off-by: Sicelo A. Mhlongo <absicsz@???>
---
drivers/power/supply/bq27xxx_battery.c | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 1789167c68e3..2f31d750a4c1 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -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);
-- 
2.47.2