From: Luca Weiss <luca.weiss@fairphone.com>
To: "Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Zhang Rui" <rui.zhang@intel.com>,
"Lukasz Luba" <lukasz.luba@arm.com>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Laxman Dewangan" <ldewangan@nvidia.com>,
"Bjorn Andersson" <andersson@kernel.org>,
"Konrad Dybcio" <konradybcio@kernel.org>,
"Hans de Goede" <hansg@kernel.org>,
"Jens Reidel" <adrian@mainlining.org>,
"Casey Connolly" <casey.connolly@linaro.org>,
"Val Packett" <val@packett.cool>,
"Daniel Lezcano" <daniel.lezcano@kernel.org>
Cc: ~postmarketos/upstreaming@lists.sr.ht,
phone-devel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org, devicetree@vger.kernel.org,
Luca Weiss <luca.weiss@fairphone.com>,
Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Subject: [PATCH v4 0/5] Battery temperature ADC plumbing on Qualcomm platforms
Date: Tue, 17 Nov 2026 09:23:10 +0100 [thread overview]
Message-ID: <20261117-bat-temp-adc-v4-0-14d5d309ebfa@fairphone.com> (raw)
This implements a solution to get battery temperature readings working
on (for example) smartphones with Qualcomm SoCs.
The solution chosen in downstream Qualcomm kernels is exposing
ADC_BAT_THERM_PU* in the ADC driver as temperature channels with the
lookup table ("struct vadc_map_pt") for the specific NTC found in a
device's battery patched to adjust the lookup table. Patching a kernel
per-device is obviously nothing we can put upstream.
The high level solution proposed here:
* ADC driver provides temperature channel in (milli)volt as IIO channel
* generic-adc-thermal driver converts voltage to temperature based on
provided lookup table from DT (driver has one IIO channel input, one
IIO channel output)
* The fuel gauge driver can use that temperature IIO channel to expose
battery temperature via the power supply device
See RFC for other variants or alternatives considered.
Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
---
Changes in v4:
- spmi-adc5/vadc-common: Fix inconsistency micro vs milli (Sashiko)
- spmi-adc5/vadc-common: use 'MICRO / MILLI' instead of 1000, use _mV (Andy)
- thermal-generic-adc: simplify devm_thermal_of_zone_register return (Andy)
- thermal-generic-adc: move iio read + convert into gadc_thermal_iio_to_temp() function (Jonathan)
- thermal-generic-adc: convert 'register failed' dev_info to dev_dbg (Jonathan)
- Link to v3: https://patch.msgid.link/20261113-bat-temp-adc-v3-0-743979a8fd90@fairphone.com
Changes in v3:
- Expand commit message on dt-bindings patch (Rob)
- Some commit message improvements in generic-adc patch (Andy)
- Fix dt node location, move higher up (Konrad)
- Pick up tags
- Link to v2: https://lore.kernel.org/r/20260220-bat-temp-adc-v2-0-fe34ed4ea851@fairphone.com
Changes in v2:
- Rebase on linux-next (a different patch to add IIO to
generic-adc-thermal has already landed upstream)
- Un-mark as RFC
- Link to v1: https://lore.kernel.org/r/20251010-bat-temp-adc-v1-0-d51ec895dac6@fairphone.com
---
Luca Weiss (5):
iio: adc: qcom-spmi-adc5: Add battery thermal channels
dt-bindings: thermal: generic-adc: Document #io-channel-cells
thermal/drivers/generic-adc: Allow probe without TZ registration
arm64: dts: qcom: pm7250b: Define battery temperature ADC channels
arm64: dts: qcom: sm7225-fairphone-fp4: Add battery temperature node
.../bindings/thermal/generic-adc-thermal.yaml | 4 ++
arch/arm64/boot/dts/qcom/pm7250b.dtsi | 24 +++++++
arch/arm64/boot/dts/qcom/sm7225-fairphone-fp4.dts | 83 ++++++++++++++++++++++
drivers/iio/adc/qcom-spmi-adc5.c | 6 ++
drivers/iio/adc/qcom-vadc-common.c | 16 +++++
drivers/thermal/thermal-generic-adc.c | 27 +++----
include/linux/iio/adc/qcom-vadc-common.h | 3 +
7 files changed, 151 insertions(+), 12 deletions(-)
---
base-commit: 6aa7dbf8ad5ebd3babf53a4d6209018f86939f17
change-id: 20251010-bat-temp-adc-8539bf0b85bc
Best regards,
--
Luca Weiss <luca.weiss@fairphone.com>
next reply other threads:[~2026-11-17 8:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 8:23 Luca Weiss [this message]
2026-11-17 8:23 ` [PATCH v4 1/5] iio: adc: qcom-spmi-adc5: Add battery thermal channels Luca Weiss
2026-11-17 8:23 ` [PATCH v4 2/5] dt-bindings: thermal: generic-adc: Document #io-channel-cells Luca Weiss
2026-11-18 16:42 ` Rob Herring
2026-11-17 8:23 ` [PATCH v4 3/5] thermal/drivers/generic-adc: Allow probe without TZ registration Luca Weiss
2026-11-17 8:23 ` [PATCH v4 4/5] arm64: dts: qcom: pm7250b: Define battery temperature ADC channels Luca Weiss
2026-11-17 8:23 ` [PATCH v4 5/5] arm64: dts: qcom: sm7225-fairphone-fp4: Add battery temperature node Luca Weiss
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=20261117-bat-temp-adc-v4-0-14d5d309ebfa@fairphone.com \
--to=luca.weiss@fairphone.com \
--cc=adrian@mainlining.org \
--cc=andersson@kernel.org \
--cc=andy@kernel.org \
--cc=casey.connolly@linaro.org \
--cc=conor+dt@kernel.org \
--cc=daniel.lezcano@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=hansg@kernel.org \
--cc=jic23@kernel.org \
--cc=konrad.dybcio@oss.qualcomm.com \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=ldewangan@nvidia.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=nuno.sa@analog.com \
--cc=phone-devel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=robh@kernel.org \
--cc=rui.zhang@intel.com \
--cc=val@packett.cool \
--cc=~postmarketos/upstreaming@lists.sr.ht \
/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
all inboxes | Powered by JetHome®