Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

power: supply: max17042: time to empty is meaningless when charging

When charging, the fuel gauge reports U16_MAX as time to empty.
Ignoring this special case (as this driver currently does), causes the
remaining time to be reported as ~102hours, which is incorrect.

Update the code to not return anything in this case.

Reviewed-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: André Draszik <andre.draszik@linaro.org>
Link: https://patch.msgid.link/20260302-max77759-fg-v3-7-3c5f01dbda23@linaro.org
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

authored by

André Draszik and committed by
Sebastian Reichel
0c5a6dc8 9a44949d

+4
+4
drivers/power/supply/max17042_battery.c
··· 430 430 if (ret < 0) 431 431 return ret; 432 432 433 + /* when charging, the value is not meaningful */ 434 + if (data == U16_MAX) 435 + return -ENODATA; 436 + 433 437 val->intval = data * 5625 / 1000; 434 438 break; 435 439 default: