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

power: supply: max17042_battery: Add support for the TTE_NOW prop

The max170{42,47,50,55} family of fuel gauges all provide time-to-empty
estimation. As such, let's export this as a property.

Signed-off-by: Geordan Neukum <gneukum1@gmail.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

authored by

Geordan Neukum and committed by
Sebastian Reichel
21b01cc8 aa86e907

+8
+8
drivers/power/supply/max17042_battery.c
··· 87 87 POWER_SUPPLY_PROP_SCOPE, 88 88 POWER_SUPPLY_PROP_CURRENT_NOW, 89 89 POWER_SUPPLY_PROP_CURRENT_AVG, 90 + POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW, 90 91 }; 91 92 92 93 static int max17042_get_temperature(struct max17042_chip *chip, int *temp) ··· 411 410 } else { 412 411 return -EINVAL; 413 412 } 413 + break; 414 + case POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW: 415 + ret = regmap_read(map, MAX17042_TTE, &data); 416 + if (ret < 0) 417 + return ret; 418 + 419 + val->intval = data * 5625 / 1000; 414 420 break; 415 421 default: 416 422 return -EINVAL;