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>
if (ret < 0)
return ret;
+ /* when charging, the value is not meaningful */
+ if (data == U16_MAX)
+ return -ENODATA;
+
val->intval = data * 5625 / 1000;
break;
default: