diff options
author | Krzysztof Kozlowski <k.kozlowski@samsung.com> | 2015-06-07 21:11:38 -0400 |
---|---|---|
committer | Sebastian Reichel <sre@kernel.org> | 2015-06-10 10:14:03 -0400 |
commit | a6e6b63ee2798f18e0e786feb407cc7846077ea3 (patch) | |
tree | 936d2fcd154eb8fe50ffc7eb9624cb1dc00904a3 /drivers/power | |
parent | 5c6e3a97e969e978368df83239583771c936efea (diff) |
power_supply: max17042: Add OF support for setting thresholds
The commit edd4ab055931 ("power: max17042_battery: add HEALTH and TEMP_*
properties support") added support for setting voltage and temperature
thresholds with platform data. For DeviceTree default of 0 was always
used.
This caused reporting battery health always as over voltage or
over heated.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Fixes: edd4ab055931 ("power: max17042_battery: add HEALTH and TEMP_* properties support")
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/max17042_battery.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/power/max17042_battery.c b/drivers/power/max17042_battery.c index 748d9762e89b..e89255764745 100644 --- a/drivers/power/max17042_battery.c +++ b/drivers/power/max17042_battery.c | |||
@@ -809,6 +809,15 @@ max17042_get_pdata(struct device *dev) | |||
809 | pdata->enable_current_sense = true; | 809 | pdata->enable_current_sense = true; |
810 | } | 810 | } |
811 | 811 | ||
812 | if (of_property_read_s32(np, "maxim,cold-temp", &pdata->temp_min)) | ||
813 | pdata->temp_min = INT_MIN; | ||
814 | if (of_property_read_s32(np, "maxim,over-heat-temp", &pdata->temp_max)) | ||
815 | pdata->temp_max = INT_MAX; | ||
816 | if (of_property_read_s32(np, "maxim,dead-volt", &pdata->vmin)) | ||
817 | pdata->vmin = INT_MIN; | ||
818 | if (of_property_read_s32(np, "maxim,over-volt", &pdata->vmax)) | ||
819 | pdata->vmax = INT_MAX; | ||
820 | |||
812 | return pdata; | 821 | return pdata; |
813 | } | 822 | } |
814 | #else | 823 | #else |