public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/5] Battery temperature ADC plumbing on Qualcomm platforms
@ 2026-02-20  9:19 Luca Weiss
  2026-02-20  9:19 ` [PATCH v2 1/5] iio: adc: qcom-spmi-adc5: Add battery thermal channels Luca Weiss
                   ` (5 more replies)
  0 siblings, 6 replies; 20+ messages in thread
From: Luca Weiss @ 2026-02-20  9:19 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Laxman Dewangan,
	Bjorn Andersson, Konrad Dybcio, Hans de Goede, Jens Reidel,
	Casey Connolly
  Cc: ~postmarketos/upstreaming, phone-devel, linux-arm-msm, linux-iio,
	linux-kernel, linux-pm, devicetree, Luca Weiss

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 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              | 20 +++---
 include/linux/iio/adc/qcom-vadc-common.h           |  3 +
 7 files changed, 147 insertions(+), 9 deletions(-)
---
base-commit: 8dd3bcb7855ad929d732f48e8a2307fdab6a5667
change-id: 20251010-bat-temp-adc-8539bf0b85bc

Best regards,
-- 
Luca Weiss <luca.weiss@fairphone.com>


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2026-02-24  8:15 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-20  9:19 [PATCH v2 0/5] Battery temperature ADC plumbing on Qualcomm platforms Luca Weiss
2026-02-20  9:19 ` [PATCH v2 1/5] iio: adc: qcom-spmi-adc5: Add battery thermal channels Luca Weiss
2026-02-20  9:19 ` [PATCH v2 2/5] dt-bindings: thermal: generic-adc: Document #io-channel-cells Luca Weiss
2026-02-23 18:48   ` Rob Herring
2026-02-24  8:14     ` Luca Weiss
2026-02-20  9:19 ` [PATCH v2 3/5] thermal/drivers/generic-adc: Allow probe without TZ registration Luca Weiss
2026-02-20 10:50   ` Andy Shevchenko
2026-02-20 11:31     ` Luca Weiss
2026-02-20 13:43       ` Andy Shevchenko
2026-02-20  9:19 ` [PATCH v2 4/5] arm64: dts: qcom: pm7250b: Define battery temperature ADC channels Luca Weiss
2026-02-20  9:57   ` Konrad Dybcio
2026-02-20  9:19 ` [PATCH v2 5/5] arm64: dts: qcom: sm7225-fairphone-fp4: Add battery temperature node Luca Weiss
2026-02-20 10:00   ` Konrad Dybcio
2026-02-20 10:40     ` Luca Weiss
2026-02-20 10:51       ` Konrad Dybcio
2026-02-20 11:26         ` Luca Weiss
2026-02-21  2:49           ` Dmitry Baryshkov
2026-02-23  7:50             ` Luca Weiss
2026-02-23 19:05               ` Dmitry Baryshkov
2026-02-20 11:58 ` [PATCH v2 0/5] Battery temperature ADC plumbing on Qualcomm platforms Hans de Goede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox