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

power: supply: Support battery temperature device-tree properties

The generic battery temperature properties are already supported by the
power-supply core. Let's support parsing of the common battery temperature
properties from a device-tree.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

authored by

Dmitry Osipenko and committed by
Sebastian Reichel
00cda13e c1f90759

+25
+19
drivers/power/supply/power_supply_core.c
··· 579 579 info->charge_term_current_ua = -EINVAL; 580 580 info->constant_charge_current_max_ua = -EINVAL; 581 581 info->constant_charge_voltage_max_uv = -EINVAL; 582 + info->temp_ambient_alert_min = INT_MIN; 583 + info->temp_ambient_alert_max = INT_MAX; 584 + info->temp_alert_min = INT_MIN; 585 + info->temp_alert_max = INT_MAX; 586 + info->temp_min = INT_MIN; 587 + info->temp_max = INT_MAX; 582 588 info->factory_internal_resistance_uohm = -EINVAL; 583 589 info->resist_table = NULL; 584 590 ··· 644 638 &info->constant_charge_voltage_max_uv); 645 639 of_property_read_u32(battery_np, "factory-internal-resistance-micro-ohms", 646 640 &info->factory_internal_resistance_uohm); 641 + 642 + of_property_read_u32_index(battery_np, "ambient-celsius", 643 + 0, &info->temp_ambient_alert_min); 644 + of_property_read_u32_index(battery_np, "ambient-celsius", 645 + 1, &info->temp_ambient_alert_max); 646 + of_property_read_u32_index(battery_np, "alert-celsius", 647 + 0, &info->temp_alert_min); 648 + of_property_read_u32_index(battery_np, "alert-celsius", 649 + 1, &info->temp_alert_max); 650 + of_property_read_u32_index(battery_np, "operating-range-celsius", 651 + 0, &info->temp_min); 652 + of_property_read_u32_index(battery_np, "operating-range-celsius", 653 + 1, &info->temp_max); 647 654 648 655 len = of_property_count_u32_elems(battery_np, "ocv-capacity-celsius"); 649 656 if (len < 0 && len != -EINVAL) {
+6
include/linux/power_supply.h
··· 365 365 int constant_charge_voltage_max_uv; /* microVolts */ 366 366 int factory_internal_resistance_uohm; /* microOhms */ 367 367 int ocv_temp[POWER_SUPPLY_OCV_TEMP_MAX];/* celsius */ 368 + int temp_ambient_alert_min; /* celsius */ 369 + int temp_ambient_alert_max; /* celsius */ 370 + int temp_alert_min; /* celsius */ 371 + int temp_alert_max; /* celsius */ 372 + int temp_min; /* celsius */ 373 + int temp_max; /* celsius */ 368 374 struct power_supply_battery_ocv_table *ocv_table[POWER_SUPPLY_OCV_TEMP_MAX]; 369 375 int ocv_table_size[POWER_SUPPLY_OCV_TEMP_MAX]; 370 376 struct power_supply_resistance_temp_table *resist_table;