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>
Subject: [PATCH v4 5/5] arm64: dts: qcom: sm7225-fairphone-fp4: Add battery temperature node
Date: Tue, 17 Nov 2026 09:23:15 +0100 [thread overview]
Message-ID: <20261117-bat-temp-adc-v4-5-14d5d309ebfa@fairphone.com> (raw)
In-Reply-To: <20261117-bat-temp-adc-v4-0-14d5d309ebfa@fairphone.com>
Add a generic-adc-thermal node to convert the voltage (in millivolt)
read by the battery temperature ADC into degree Celsius (in
millicelsius) using the provided lookup table.
This will later be used as input for the fuel gauge node (QGauge on the
PM7250B).
The lookup table is generated using a Python script:
https://codeberg.org/lucaweiss/batt-ntc-calc
Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
---
arch/arm64/boot/dts/qcom/sm7225-fairphone-fp4.dts | 83 +++++++++++++++++++++++
1 file changed, 83 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/sm7225-fairphone-fp4.dts b/arch/arm64/boot/dts/qcom/sm7225-fairphone-fp4.dts
index 37aa272019cc..0b8c6f353f96 100644
--- a/arch/arm64/boot/dts/qcom/sm7225-fairphone-fp4.dts
+++ b/arch/arm64/boot/dts/qcom/sm7225-fairphone-fp4.dts
@@ -96,6 +96,89 @@ memory@efe01000 {
};
};
+ bat_therm_sensor: thermal-sensor-bat-therm {
+ compatible = "generic-adc-thermal";
+ #thermal-sensor-cells = <0>;
+ #io-channel-cells = <0>;
+ io-channels = <&pm7250b_adc ADC5_BAT_THERM_30K_PU>;
+ io-channel-names = "sensor-channel";
+ /*
+ * Voltage to temperature table for 10kΩ (B=3435K) NTC with a
+ * 1.875V reference and 30kΩ pull-up.
+ */
+ temperature-lookup-table = <
+ (-40000) 1673
+ (-38000) 1649
+ (-36000) 1623
+ (-34000) 1596
+ (-32000) 1566
+ (-30000) 1535
+ (-28000) 1502
+ (-26000) 1467
+ (-24000) 1430
+ (-22000) 1392
+ (-20000) 1352
+ (-18000) 1311
+ (-16000) 1269
+ (-14000) 1226
+ (-12000) 1182
+ (-10000) 1138
+ (-8000) 1093
+ (-6000) 1049
+ (-4000) 1004
+ (-2000) 960
+ 0 917
+ 2000 874
+ 4000 832
+ 6000 791
+ 8000 752
+ 10000 713
+ 12000 676
+ 14000 640
+ 16000 606
+ 18000 573
+ 20000 541
+ 22000 511
+ 24000 483
+ 26000 455
+ 28000 430
+ 30000 405
+ 32000 382
+ 34000 360
+ 36000 340
+ 38000 320
+ 40000 302
+ 42000 285
+ 44000 269
+ 46000 253
+ 48000 239
+ 50000 225
+ 52000 213
+ 54000 201
+ 56000 190
+ 58000 179
+ 60000 169
+ 62000 160
+ 64000 152
+ 66000 143
+ 68000 136
+ 70000 128
+ 72000 122
+ 74000 115
+ 76000 109
+ 78000 104
+ 80000 98
+ 82000 93
+ 84000 89
+ 86000 84
+ 88000 80
+ 90000 76
+ 92000 73
+ 94000 69
+ 96000 66
+ 98000 63>;
+ };
+
msm_therm_sensor: thermal-sensor-msm {
compatible = "generic-adc-thermal";
#thermal-sensor-cells = <0>;
--
2.56.1
prev parent 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 [PATCH v4 0/5] Battery temperature ADC plumbing on Qualcomm platforms Luca Weiss
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 ` Luca Weiss [this message]
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-5-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=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®