From: Dmitry Osipenko <digetx@gmail.com>
To: Sebastian Reichel <sre@kernel.org>,
Rob Herring <robh+dt@kernel.org>, Andy Gross <agross@kernel.org>,
Bjorn Andersson <bjorn.andersson@linaro.org>,
David Heidelberg <david@ixit.cz>
Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
Jonghwa Lee <jonghwa3.lee@samsung.com>,
John Stultz <john.stultz@linaro.org>,
Vinay Simha BN <simhavcs@gmail.com>
Subject: [PATCH v2 3/9] power: supply: Support battery temperature device-tree properties
Date: Sun, 7 Jun 2020 17:41:07 +0300 [thread overview]
Message-ID: <20200607144113.10202-4-digetx@gmail.com> (raw)
In-Reply-To: <20200607144113.10202-1-digetx@gmail.com>
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>
---
drivers/power/supply/power_supply_core.c | 18 ++++++++++++++++++
include/linux/power_supply.h | 6 ++++++
2 files changed, 24 insertions(+)
diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
index 02b37fe6061c..8b54a5a107d7 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -579,6 +579,12 @@ int power_supply_get_battery_info(struct power_supply *psy,
info->charge_term_current_ua = -EINVAL;
info->constant_charge_current_max_ua = -EINVAL;
info->constant_charge_voltage_max_uv = -EINVAL;
+ info->temp_ambient_alert_min = INT_MIN;
+ info->temp_ambient_alert_max = INT_MAX;
+ info->temp_alert_min = INT_MIN;
+ info->temp_alert_max = INT_MAX;
+ info->temp_min = INT_MIN;
+ info->temp_max = INT_MAX;
info->factory_internal_resistance_uohm = -EINVAL;
info->resist_table = NULL;
@@ -638,6 +644,18 @@ int power_supply_get_battery_info(struct power_supply *psy,
&info->constant_charge_voltage_max_uv);
of_property_read_u32(battery_np, "factory-internal-resistance-micro-ohms",
&info->factory_internal_resistance_uohm);
+ of_property_read_u32(battery_np, "temperature-ambient-min-alert-celsius",
+ &info->temp_ambient_alert_min);
+ of_property_read_u32(battery_np, "temperature-ambient-max-alert-celsius",
+ &info->temp_ambient_alert_max);
+ of_property_read_u32(battery_np, "temperature-min-alert-celsius",
+ &info->temp_alert_min);
+ of_property_read_u32(battery_np, "temperature-max-alert-celsius",
+ &info->temp_alert_max);
+ of_property_read_u32(battery_np, "temperature-min-celsius",
+ &info->temp_min);
+ of_property_read_u32(battery_np, "temperature-max-celsius",
+ &info->temp_max);
len = of_property_count_u32_elems(battery_np, "ocv-capacity-celsius");
if (len < 0 && len != -EINVAL) {
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index ac1345a48ad0..31fcadd81d63 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -361,6 +361,12 @@ struct power_supply_battery_info {
int constant_charge_voltage_max_uv; /* microVolts */
int factory_internal_resistance_uohm; /* microOhms */
int ocv_temp[POWER_SUPPLY_OCV_TEMP_MAX];/* celsius */
+ int temp_ambient_alert_min; /* celsius */
+ int temp_ambient_alert_max; /* celsius */
+ int temp_alert_min; /* celsius */
+ int temp_alert_max; /* celsius */
+ int temp_min; /* celsius */
+ int temp_max; /* celsius */
struct power_supply_battery_ocv_table *ocv_table[POWER_SUPPLY_OCV_TEMP_MAX];
int ocv_table_size[POWER_SUPPLY_OCV_TEMP_MAX];
struct power_supply_resistance_temp_table *resist_table;
--
2.26.0
next prev parent reply other threads:[~2020-06-07 14:46 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-07 14:41 [PATCH v2 0/9] Summit SMB3xx driver & device-tree Dmitry Osipenko
2020-06-07 14:41 ` [PATCH v2 1/9] dt-bindings: power: supply: Add device-tree binding for Summit SMB3xx Dmitry Osipenko
2020-07-13 23:39 ` Rob Herring
2020-07-16 17:24 ` Dmitry Osipenko
2020-06-07 14:41 ` [PATCH v2 2/9] dt-bindings: battery: Add temperature properties Dmitry Osipenko
2020-07-13 23:46 ` Rob Herring
2020-07-16 17:24 ` Dmitry Osipenko
2020-06-07 14:41 ` Dmitry Osipenko [this message]
2020-06-07 14:41 ` [PATCH v2 4/9] power: supply: smb347-charger: Use resource-managed API Dmitry Osipenko
2020-06-07 14:41 ` [PATCH v2 5/9] power: supply: smb347-charger: Implement device-tree support Dmitry Osipenko
2020-06-07 14:41 ` [PATCH v2 6/9] power: supply: smb347-charger: Support SMB345 and SMB358 Dmitry Osipenko
2020-06-07 14:41 ` [PATCH v2 7/9] power: supply: smb347-charger: Remove virtual smb347-battery Dmitry Osipenko
2020-06-07 14:41 ` [PATCH v2 8/9] power: supply: smb347-charger: Replace mutex with IRQ disable/enable Dmitry Osipenko
2020-06-07 14:41 ` [PATCH v2 9/9] ARM: dts: qcom: apq8064-nexus7: Add SMB345 charger node Dmitry Osipenko
2020-07-08 7:42 ` [PATCH v2 0/9] Summit SMB3xx driver & device-tree Dmitry Osipenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200607144113.10202-4-digetx@gmail.com \
--to=digetx@gmail.com \
--cc=agross@kernel.org \
--cc=bjorn.andersson@linaro.org \
--cc=david@ixit.cz \
--cc=devicetree@vger.kernel.org \
--cc=john.stultz@linaro.org \
--cc=jonghwa3.lee@samsung.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=simhavcs@gmail.com \
--cc=sre@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).