Skip to content

Commit 83ca793

Browse files
goldelicogregkh
authored andcommitted
power: supply: bq27xxx: restrict no-battery detection to bq27000
commit 1e45197 upstream. There are fuel gauges in the bq27xxx series (e.g. bq27z561) which may in some cases report 0xff as the value of BQ27XXX_REG_FLAGS that should not be interpreted as "no battery" like for a disconnected battery with some built in bq27000 chip. So restrict the no-battery detection originally introduced by commit 3dd843e ("bq27000: report missing device better.") to the bq27000. There is no need to backport further because this was hidden before commit f16d9fb ("power: supply: bq27xxx: Retrieve again when busy") Fixes: f16d9fb ("power: supply: bq27xxx: Retrieve again when busy") Suggested-by: Jerry Lv <Jerry.Lv@axis.com> Cc: stable@vger.kernel.org Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Link: https://lore.kernel.org/r/dd979fa6855fd051ee5117016c58daaa05966e24.1755945297.git.hns@goldelico.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 208c60d commit 83ca793

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/power/supply/bq27xxx_battery.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1872,8 +1872,8 @@ static void bq27xxx_battery_update_unlocked(struct bq27xxx_device_info *di)
18721872
bool has_singe_flag = di->opts & BQ27XXX_O_ZERO;
18731873

18741874
cache.flags = bq27xxx_read(di, BQ27XXX_REG_FLAGS, has_singe_flag);
1875-
if ((cache.flags & 0xff) == 0xff)
1876-
cache.flags = -ENODEV; /* read error */
1875+
if (di->chip == BQ27000 && (cache.flags & 0xff) == 0xff)
1876+
cache.flags = -ENODEV; /* bq27000 hdq read error */
18771877
if (cache.flags >= 0) {
18781878
cache.temperature = bq27xxx_battery_read_temperature(di);
18791879
if (di->regs[BQ27XXX_REG_TTE] != INVALID_REG_ADDR)

0 commit comments

Comments
 (0)