diff mbox series

power: supply: cw2015: correct time_to_empty units in sysfs

Message ID 20231111221704.5579-1-jpalus@fastmail.com
State Accepted
Commit f37669119423ca852ca855b24732f25c0737aa57
Headers show
Series power: supply: cw2015: correct time_to_empty units in sysfs | expand

Commit Message

Jan Palus Nov. 11, 2023, 10:17 p.m. UTC
RRT_ALRT register holds remaining battery time in minutes therefore it
needs to be scaled accordingly when exposing TIME_TO_EMPTY via sysfs
expressed in seconds

Fixes: b4c7715c10c1 ("power: supply: add CellWise cw2015 fuel gauge driver")
Signed-off-by: Jan Palus <jpalus@fastmail.com>
---
 drivers/power/supply/cw2015_battery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sebastian Reichel Nov. 16, 2023, 12:35 a.m. UTC | #1
On Sat, 11 Nov 2023 23:17:04 +0100, Jan Palus wrote:
> RRT_ALRT register holds remaining battery time in minutes therefore it
> needs to be scaled accordingly when exposing TIME_TO_EMPTY via sysfs
> expressed in seconds
> 
> 

Applied, thanks!

[1/1] power: supply: cw2015: correct time_to_empty units in sysfs
      commit: f37669119423ca852ca855b24732f25c0737aa57

Best regards,
diff mbox series

Patch

diff --git a/drivers/power/supply/cw2015_battery.c b/drivers/power/supply/cw2015_battery.c
index bb29e9ebd24a..99f3ccdc30a6 100644
--- a/drivers/power/supply/cw2015_battery.c
+++ b/drivers/power/supply/cw2015_battery.c
@@ -491,7 +491,7 @@  static int cw_battery_get_property(struct power_supply *psy,
 
 	case POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW:
 		if (cw_battery_valid_time_to_empty(cw_bat))
-			val->intval = cw_bat->time_to_empty;
+			val->intval = cw_bat->time_to_empty * 60;
 		else
 			val->intval = 0;
 		break;