Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jeroen Trappers <jeroen.trappers@gmail.com>
To: rafael@kernel.org, daniel.lezcano@kernel.org, sven@kernel.org,
	j@jannau.net, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org
Cc: rui.zhang@intel.com, lukasz.luba@arm.com, neal@gompa.dev,
	towinchenmi@gmail.com, konradybcio@kernel.org,
	asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	linux-pm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Jeroen Trappers <jeroen.trappers@gmail.com>
Subject: [PATCH v2 0/3] Apple T7000 (A8) die temperature sensors and thermal zones
Date: Fri,  4 Dec 2026 08:43:25 +0100	[thread overview]
Message-ID: <20261204074328.3741080-1-jeroen.trappers@gmail.com> (raw)

The Apple A8 has no thermal zones in Linux today. Unlike Apple Silicon
Macs, it has no SMC doing thermal management in firmware; on iOS the
kernel reads the die sensors itself. With nothing reading them, the
only protection is the hardware failsafe (SoCHOT) at 120 C.

This series adds a binding and a driver for the A8's five die
temperature sensors, in two blocks: two sensors in the power manager
(PMGR) and three in the CPU complex (TCC). It also adds thermal zones
in t7000.dtsi on three of the sensors. The zones throttle the CPUs
from 70 C, with 90 C hot and 100 C critical.

The register interface is the one iOS drives (AppleT700XTempSensor):
 - only 32-bit accesses;
 - a freeze / read / restart of each sensor's accumulator;
 - no writes to calibration, alarm or SoCHOT registers;
 - the per-sensor offsets from the tempsensor0..4 nodes of the iPhone 6
   device tree.
The driver is adapted from Berkay Kösebay's out-of-tree A9 (S8003)
driver for the same block.

Changes in v2 (all from the Sashiko review of v1):
 - Binding: each block is its own node, with its own compatible
   (apple,t7000-pmgr-thermal and apple,t7000-tcc-thermal) and the
   sensor index within the block as the cell. This replaces one node
   with two reg pages, where the TCC page was optional.
 - Driver: an accumulation interval is never cut shorter than 100 ms,
   so fast polling cannot starve the accumulator. In v1, a read that
   found no sample still restarted the interval.
 - Driver: a sensor without a valid sample for 5 s reads -EIO, and one
   disabled since probe reads -ENODEV without being restarted. v1 kept
   returning the last sample forever.
 - Driver: a sensor is only started once a zone using it is
   registered. Sensors no zone uses are not written at all; v1 started
   and then stopped them.
 - DTS: both CPUs are in the cooling maps.
 - DTS: the commit message explains why TCC sensors 0 and 1 get no zone
   yet.

Testing on v2, on an iPhone 6 (N61): the driver is byte-identical on a
7.3-rc1 based kernel, the iPhone 6 port this work comes from. That
kernel's n61 device tree has the same two sensor nodes and zones, plus
a GPU cooling map for a GPU driver that is not upstream. The v7.4-rc5
tree itself was not booted.
 - Both nodes bind after a cold boot. The zones read 31.5 / 29.0 /
   29.8 C idle (CPU complex / SOC0 / SOC1).
 - 2000 back-to-back reads of the CPU zone return no errors.
 - The unused TCC sensors 0 and 1 keep the CTL0 value the boot chain
   left. The three used sensors accumulate while bound, stop on unbind,
   and start again on rebind.
 - Two busy cores take the CPU complex sensor from 33 to 62 C in 5 s.
   It is back at 34 C seconds after the load stops.
The 70 C throttling step was tested on v1, with the same zones and
trips: the CPUs stepped to 1128 MHz and held 67-74 C. It was not
repeated on v2.

On v7.4-rc5, all of these are clean:
 - a W=1 arm64 build;
 - checkpatch --strict;
 - dt_binding_check;
 - CHECK_DTBS for every t7000 board.

v1: https://lore.kernel.org/r/20261203155600.3911447-1-jeroen.trappers@gmail.com

Tool use (Documentation/process/generated-content.rst): the series was
written with an LLM coding assistant over a longer working session. The
assistant drafted:
 - the driver, adapting the A9 driver to the A8 offsets and the iOS
   register sequence;
 - the binding;
 - the device tree nodes;
 - the changelogs.
Under my direction, it also ran the on-device tests and the build and
schema checks, and made the v2 changes. A separate LLM review pass, with
the review prompts Sashiko uses, found an issue that was fixed before
posting. I have reviewed the series and can answer for it.

Jeroen Trappers (3):
  dt-bindings: thermal: Add Apple T7000 die temperature sensors
  thermal/drivers/apple: Add T7000 (A8) on-die temperature sensor driver
  arm64: dts: apple: t7000: Add die temperature sensors and thermal
    zones

 .../bindings/thermal/apple,t7000-thermal.yaml |  57 ++++
 MAINTAINERS                                   |   8 +
 arch/arm64/boot/dts/apple/t7000.dtsi          | 130 ++++++++
 drivers/thermal/Kconfig                       |  13 +
 drivers/thermal/Makefile                      |   1 +
 drivers/thermal/apple_t7000_thermal.c         | 295 ++++++++++++++++++
 6 files changed, 504 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/thermal/apple,t7000-thermal.yaml
 create mode 100644 drivers/thermal/apple_t7000_thermal.c


base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
--
2.47.3



             reply	other threads:[~2026-12-04  7:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  7:43 Jeroen Trappers [this message]
2026-12-04  7:43 ` [PATCH v2 1/3] dt-bindings: thermal: Add Apple T7000 die temperature sensors Jeroen Trappers
2026-12-04  7:43 ` [PATCH v2 2/3] thermal/drivers/apple: Add T7000 (A8) on-die temperature sensor driver Jeroen Trappers
2026-12-04  8:36   ` Uwe Kleine-König
2026-12-04  7:43 ` [PATCH v2 3/3] arm64: dts: apple: t7000: Add die temperature sensors and thermal zones Jeroen Trappers

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=20261204074328.3741080-1-jeroen.trappers@gmail.com \
    --to=jeroen.trappers@gmail.com \
    --cc=asahi@lists.linux.dev \
    --cc=conor+dt@kernel.org \
    --cc=daniel.lezcano@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=j@jannau.net \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=neal@gompa.dev \
    --cc=rafael@kernel.org \
    --cc=robh@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=sven@kernel.org \
    --cc=towinchenmi@gmail.com \
    /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