* [PATCH 0/3] Apple T7000 (A8) die temperature sensors and thermal zones
@ 2026-12-03 15:55 Jeroen Trappers
2026-12-03 15:55 ` [PATCH 1/3] dt-bindings: thermal: Add Apple T7000 die temperature sensors Jeroen Trappers
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Jeroen Trappers @ 2026-12-03 15:55 UTC (permalink / raw)
To: rafael, daniel.lezcano, sven, j, robh, krzk+dt, conor+dt
Cc: rui.zhang, lukasz.luba, neal, towinchenmi, konradybcio, asahi,
linux-arm-kernel, linux-pm, devicetree, linux-kernel
The Apple A8 has had no thermal zones in Linux: unlike Apple Silicon
Macs it has no SMC doing thermal management in firmware, and 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 adds a binding and a driver for the A8's five die temperature
sensors (two in the power manager, three in the CPU complex), and
thermal zones in t7000.dtsi on three of them that 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, and
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. The A8X (t7001) has the same
block; a compatible for it can follow once it is tested there.
Testing, on an iPhone 6 (N61), with this driver byte-identical on a
7.3-rc1 based kernel (the iPhone 6 port this work comes from), whose
t7000.dtsi has the same sensor node and whose n61 zones use the same
sensors and trips (plus a GPU cooling map for a GPU driver that is not
upstream); the v7.4-rc5 tree itself was not booted:
- the used sensors (IDs 0, 1, 4) accumulate about 400 samples a
second; the unused TCC0 / TCC1 are left untouched; unbinding the
driver stops the used ones again;
- 37 / 38 / 40 C (SOC0 / SOC1 / CPU complex) idle after boot;
- two busy cores take the CPU complex sensor past 70 C within 10 s;
the zone steps the CPUs to 1128 MHz and holds 67-74 C, while the
power manager sensors stay at 55-61 C.
On v7.4-rc5: W=1 / W=12 builds (arm64, and x86_64 with COMPILE_TEST),
checkpatch --strict, dt_binding_check and CHECK_DTBS for every t7000
board are clean.
Tool use (Documentation/process/generated-content.rst): the series was
written with an LLM coding assistant over a longer working session. It
drafted the driver (adapting the A9 driver to the A8 offsets and the
iOS register sequence), the binding, the device tree nodes and the
changelogs, and ran the on-device register checks, thermal tests and
build and schema checks under my direction; a separate LLM review pass
found issues that were 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 | 65 +++++
MAINTAINERS | 8 +
arch/arm64/boot/dts/apple/t7000.dtsi | 119 +++++++++
drivers/thermal/Kconfig | 13 +
drivers/thermal/Makefile | 1 +
drivers/thermal/apple_t7000_thermal.c | 239 ++++++++++++++++++
6 files changed, 445 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] dt-bindings: thermal: Add Apple T7000 die temperature sensors
2026-12-03 15:55 [PATCH 0/3] Apple T7000 (A8) die temperature sensors and thermal zones Jeroen Trappers
@ 2026-12-03 15:55 ` Jeroen Trappers
2026-12-03 16:12 ` sashiko-bot
2026-12-03 15:55 ` [PATCH 2/3] thermal/drivers/apple: Add T7000 (A8) on-die temperature sensor driver Jeroen Trappers
2026-12-03 15:56 ` [PATCH 3/3] arm64: dts: apple: t7000: Add die temperature sensors and thermal zones Jeroen Trappers
2 siblings, 1 reply; 6+ messages in thread
From: Jeroen Trappers @ 2026-12-03 15:55 UTC (permalink / raw)
To: rafael, daniel.lezcano, sven, j, robh, krzk+dt, conor+dt
Cc: rui.zhang, lukasz.luba, neal, towinchenmi, konradybcio, asahi,
linux-arm-kernel, linux-pm, devicetree, linux-kernel
The Apple A8 (T7000) has five die temperature sensors, the tempsensor0..4
nodes of Apple's device tree: two in the power manager, sharing one
register page, and three in the CPU complex (TCC), sharing a second
page. Describe them as one thermal sensor whose cell is Apple's
tempsensor index; the TCC page is optional.
The binding was drafted with an LLM coding assistant and reviewed by me.
Signed-off-by: Jeroen Trappers <jeroen.trappers@gmail.com>
---
.../bindings/thermal/apple,t7000-thermal.yaml | 65 +++++++++++++++++++
MAINTAINERS | 7 ++
2 files changed, 72 insertions(+)
create mode 100644 Documentation/devicetree/bindings/thermal/apple,t7000-thermal.yaml
diff --git a/Documentation/devicetree/bindings/thermal/apple,t7000-thermal.yaml b/Documentation/devicetree/bindings/thermal/apple,t7000-thermal.yaml
new file mode 100644
index 000000000000..c5418ba9697b
--- /dev/null
+++ b/Documentation/devicetree/bindings/thermal/apple,t7000-thermal.yaml
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/thermal/apple,t7000-thermal.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Apple T7000 (A8) die temperature sensors
+
+maintainers:
+ - Jeroen Trappers <jeroen.trappers@gmail.com>
+
+description:
+ The Apple A8 (T7000) has five die temperature sensors, the tempsensor0..4
+ nodes of Apple's device tree. Two are in the power manager and share one
+ register page; three are in the CPU complex (TCC) and share a second page.
+ Each sensor accumulates samples between a start and a freeze of its
+ control register; the result is a signed fixed-point temperature in
+ degrees Celsius, converted with the calibration the boot chain programs.
+
+$ref: thermal-sensor.yaml#
+
+properties:
+ compatible:
+ const: apple,t7000-thermal
+
+ reg:
+ minItems: 1
+ items:
+ - description: power manager (SOC) sensor page
+ - description: CPU complex (TCC) sensor page
+
+ reg-names:
+ minItems: 1
+ items:
+ - const: soc
+ - const: tcc
+
+ "#thermal-sensor-cells":
+ const: 1
+ description: |
+ The sensor ID, Apple's tempsensor index:
+ 0 = power manager (SOC) sensor 0
+ 1 = power manager (SOC) sensor 1
+ 2 = CPU complex (TCC) sensor 0
+ 3 = CPU complex (TCC) sensor 1
+ 4 = CPU complex (TCC) sensor 2
+ IDs 2 to 4 need the "tcc" page.
+
+required:
+ - compatible
+ - reg
+ - reg-names
+ - "#thermal-sensor-cells"
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ thermal-sensor@e02b000 {
+ compatible = "apple,t7000-thermal";
+ reg = <0x0e02b000 0x1000>,
+ <0x02230000 0x1000>;
+ reg-names = "soc", "tcc";
+ #thermal-sensor-cells = <1>;
+ };
diff --git a/MAINTAINERS b/MAINTAINERS
index 84cb98ef4c49..667f9f37b824 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2140,6 +2140,13 @@ L: linux-hwmon@vger.kernel.org
S: Odd fixes
F: drivers/hwmon/applesmc.c
+APPLE T7000 THERMAL DRIVER
+M: Jeroen Trappers <jeroen.trappers@gmail.com>
+L: asahi@lists.linux.dev
+L: linux-pm@vger.kernel.org
+S: Maintained
+F: Documentation/devicetree/bindings/thermal/apple,t7000-thermal.yaml
+
APPLETALK NETWORK LAYER
L: netdev@vger.kernel.org
S: Obsolete
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] thermal/drivers/apple: Add T7000 (A8) on-die temperature sensor driver
2026-12-03 15:55 [PATCH 0/3] Apple T7000 (A8) die temperature sensors and thermal zones Jeroen Trappers
2026-12-03 15:55 ` [PATCH 1/3] dt-bindings: thermal: Add Apple T7000 die temperature sensors Jeroen Trappers
@ 2026-12-03 15:55 ` Jeroen Trappers
2026-12-03 15:56 ` [PATCH 3/3] arm64: dts: apple: t7000: Add die temperature sensors and thermal zones Jeroen Trappers
2 siblings, 0 replies; 6+ messages in thread
From: Jeroen Trappers @ 2026-12-03 15:55 UTC (permalink / raw)
To: rafael, daniel.lezcano, sven, j, robh, krzk+dt, conor+dt
Cc: rui.zhang, lukasz.luba, neal, towinchenmi, konradybcio, asahi,
linux-arm-kernel, linux-pm, devicetree, linux-kernel
The Apple A8 (T7000) has the temperature sensor block iOS drives with
its AppleT700XTempSensor class. The per-sensor register offsets are the
sensor-offset-* properties of the tempsensor0..4 nodes in the iPhone 6
device tree. Each sensor accumulates samples between a start and a
freeze of CTL0 bit 3; a read freezes it, reads the result word (bit 31
valid, signed Q6 degrees Celsius) and the sample count, and starts the
next interval, as iOS's timer callback does.
Only 32-bit accesses are made. The driver never writes the trims,
CTL1/CTL2, the alarms or the SoCHOT thresholds, never sets a sensor's
enable bit (a sensor the boot chain left disabled is skipped), and only
starts sensors that a thermal zone uses, stopping them again on unbind.
The TCC page is optional.
It is a thermal driver rather than hwmon because the zones drive CPU
cooling; the readings are also exposed through the thermal hwmon bridge.
Adapted from Berkay Kösebay's out-of-tree driver for the A9 (S8003),
which uses the same block. The driver was drafted with an LLM coding
assistant and reviewed by me.
Signed-off-by: Jeroen Trappers <jeroen.trappers@gmail.com>
---
MAINTAINERS | 1 +
drivers/thermal/Kconfig | 13 ++
drivers/thermal/Makefile | 1 +
drivers/thermal/apple_t7000_thermal.c | 239 ++++++++++++++++++++++++++
4 files changed, 254 insertions(+)
create mode 100644 drivers/thermal/apple_t7000_thermal.c
diff --git a/MAINTAINERS b/MAINTAINERS
index 667f9f37b824..049c3b8c8377 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2146,6 +2146,7 @@ L: asahi@lists.linux.dev
L: linux-pm@vger.kernel.org
S: Maintained
F: Documentation/devicetree/bindings/thermal/apple,t7000-thermal.yaml
+F: drivers/thermal/apple_t7000_thermal.c
APPLETALK NETWORK LAYER
L: netdev@vger.kernel.org
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 810eeccedfba..4a2190b9f4a0 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -432,6 +432,19 @@ depends on ARCH_MEDIATEK || COMPILE_TEST
source "drivers/thermal/mediatek/Kconfig"
endmenu
+config APPLE_T7000_THERMAL
+ tristate "Apple T7000 (A8) on-die temperature sensors"
+ depends on ARCH_APPLE || COMPILE_TEST
+ depends on THERMAL_OF
+ help
+ Thermal zone sensors for the die temperature sensors of the
+ Apple A8 (T7000) SoC, as used in the iPhone 6 family and other
+ 2014 / 2015 Apple devices. The sensors are read with the
+ calibration the boot chain programs.
+
+ This driver can also be built as a module. If so, the module will
+ be called apple_t7000_thermal.
+
config AMLOGIC_THERMAL
tristate "Amlogic Thermal Support"
default ARCH_MESON
diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
index 3b249195c088..f2b6cbbe3307 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -64,6 +64,7 @@ obj-$(CONFIG_HISI_THERMAL) += hisi_thermal.o
obj-y += mediatek/
obj-$(CONFIG_GENERIC_ADC_THERMAL) += thermal-generic-adc.o
obj-$(CONFIG_UNIPHIER_THERMAL) += uniphier_thermal.o
+obj-$(CONFIG_APPLE_T7000_THERMAL) += apple_t7000_thermal.o
obj-$(CONFIG_AMLOGIC_THERMAL) += amlogic_thermal.o
obj-y += spacemit/
obj-$(CONFIG_SPRD_THERMAL) += sprd_thermal.o
diff --git a/drivers/thermal/apple_t7000_thermal.c b/drivers/thermal/apple_t7000_thermal.c
new file mode 100644
index 000000000000..7d80ddf6e2f5
--- /dev/null
+++ b/drivers/thermal/apple_t7000_thermal.c
@@ -0,0 +1,239 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Apple T7000 (A8) on-die temperature sensors.
+ *
+ * Copyright (C) 2026 Jeroen Trappers <jeroen.trappers@gmail.com>
+ *
+ * Adapted from the out-of-tree Apple S8003 (A9) temperature sensor driver
+ * by Berkay Kösebay (GPL-2.0), which drives the same block.
+ *
+ * The block is the one iOS drives with its AppleT700XTempSensor class; the
+ * per-sensor register offsets are the "sensor-offset-*" properties of the
+ * tempsensor0..4 nodes in the iPhone 6 device tree. The hardware converts
+ * with the calibration the boot chain programs: this driver never writes the
+ * trims, CTL1/CTL2, the alarm registers or the SoCHOT thresholds, and never
+ * sets a sensor's enable bit (a sensor the boot chain left disabled is
+ * skipped). Only 32-bit accesses are made.
+ *
+ * Each sensor accumulates samples between a "start" (CTL0 set, bit 3) and a
+ * "freeze" (CTL0 clear, bit 3). A read freezes the accumulator, reads the
+ * result word (bit 31 valid, signed Q6 degrees Celsius in the low bits) and
+ * the sample count, and starts the next interval, as iOS's timer callback
+ * does.
+ */
+
+#include <linux/array_size.h>
+#include <linux/bitops.h>
+#include <linux/bits.h>
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/jiffies.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/thermal.h>
+
+#include "thermal_hwmon.h"
+
+#define T7000_CTL0_ENABLE BIT(0)
+#define T7000_CTL0_ACCUMULATE BIT(3)
+#define T7000_BK_VALID BIT(31)
+/*
+ * Every read restarts the accumulator, and the thermal core, sysfs and hwmon
+ * may all read a zone: readers within this interval get the last sample, so
+ * each one still averages over a useful window (about 400 samples a second).
+ */
+#define T7000_MIN_INTERVAL_MS 100
+
+enum t7000_page {
+ T7000_PAGE_SOC, /* power manager sensors */
+ T7000_PAGE_TCC, /* CPU complex sensors */
+ T7000_PAGES,
+};
+
+/**
+ * struct t7000_sensor_desc - one sensor channel
+ * @page: register page
+ * @ctl_set: CTL0 set register
+ * @ctl_clear: CTL0 clear register
+ * @bk: result register
+ * @count: accumulated sample count
+ * @sign_bit: sign bit of the Q6 value (14 for sensor-accuracy 2, else 15)
+ */
+struct t7000_sensor_desc {
+ enum t7000_page page;
+ u16 ctl_set;
+ u16 ctl_clear;
+ u16 bk;
+ u16 count;
+ u8 sign_bit;
+};
+
+/* Sensor IDs are the device tree's tempsensor indices (see the binding). */
+static const struct t7000_sensor_desc t7000_sensors[] = {
+ [0] = { .page = T7000_PAGE_SOC, .ctl_set = 0x000, .ctl_clear = 0x004,
+ .bk = 0x018, .count = 0x024, .sign_bit = 14 },
+ [1] = { .page = T7000_PAGE_SOC, .ctl_set = 0x044, .ctl_clear = 0x048,
+ .bk = 0x05c, .count = 0x068, .sign_bit = 14 },
+ [2] = { .page = T7000_PAGE_TCC, .ctl_set = 0x000, .ctl_clear = 0x408,
+ .bk = 0x020, .count = 0x038, .sign_bit = 15 },
+ [3] = { .page = T7000_PAGE_TCC, .ctl_set = 0x040, .ctl_clear = 0x438,
+ .bk = 0x060, .count = 0x078, .sign_bit = 15 },
+ [4] = { .page = T7000_PAGE_TCC, .ctl_set = 0x200, .ctl_clear = 0x468,
+ .bk = 0x220, .count = 0x238, .sign_bit = 15 },
+};
+
+/**
+ * struct t7000_sensor - one registered sensor
+ * @base: its register page
+ * @desc: its registers
+ * @sampled: jiffies of the last valid sample
+ * @temp: the last valid sample, millidegrees Celsius
+ * @valid: whether @temp holds a sample
+ *
+ * The thermal core serializes the get_temp() calls of a zone.
+ */
+struct t7000_sensor {
+ void __iomem *base;
+ const struct t7000_sensor_desc *desc;
+ unsigned long sampled;
+ int temp;
+ bool valid;
+};
+
+static int t7000_sample(struct t7000_sensor *s)
+{
+ const struct t7000_sensor_desc *d = s->desc;
+ u32 ctl, bk, count;
+ int temp;
+
+ writel(T7000_CTL0_ACCUMULATE, s->base + d->ctl_clear);
+ ctl = readl(s->base + d->ctl_set);
+ bk = readl(s->base + d->bk);
+ count = readl(s->base + d->count);
+ writel(T7000_CTL0_ACCUMULATE, s->base + d->ctl_set);
+
+ if (!(ctl & T7000_CTL0_ENABLE) || !(bk & T7000_BK_VALID) || !count)
+ return -EAGAIN;
+
+ temp = DIV_ROUND_CLOSEST(sign_extend32(bk, d->sign_bit) * 1000, 64);
+ /* An impossible code is a glitch; iOS substitutes 30 C instead. */
+ if (temp < -40000 || temp > 150000)
+ return -EAGAIN;
+
+ s->temp = temp;
+ s->sampled = jiffies;
+ s->valid = true;
+ return 0;
+}
+
+static int t7000_get_temp(struct thermal_zone_device *tz, int *temp)
+{
+ struct t7000_sensor *s = thermal_zone_device_priv(tz);
+ int ret = 0;
+
+ if (!s->valid ||
+ time_after_eq(jiffies, s->sampled + msecs_to_jiffies(T7000_MIN_INTERVAL_MS)))
+ ret = t7000_sample(s);
+ /* No new sample (an interval without one, or a glitch): keep the last one. */
+ if (ret == -EAGAIN && s->valid)
+ ret = 0;
+ if (!ret)
+ *temp = s->temp;
+
+ return ret;
+}
+
+static const struct thermal_zone_device_ops t7000_thermal_ops = {
+ .get_temp = t7000_get_temp,
+};
+
+/* On unbind, stop accumulating: the sensor is left as the boot chain left it. */
+static void t7000_sensor_stop(void *data)
+{
+ struct t7000_sensor *s = data;
+
+ writel(T7000_CTL0_ACCUMULATE, s->base + s->desc->ctl_clear);
+}
+
+static int t7000_thermal_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ void __iomem *page[T7000_PAGES] = { };
+ struct resource *res;
+ unsigned int i;
+ int ret;
+
+ page[T7000_PAGE_SOC] = devm_platform_ioremap_resource_byname(pdev, "soc");
+ if (IS_ERR(page[T7000_PAGE_SOC]))
+ return PTR_ERR(page[T7000_PAGE_SOC]);
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "tcc");
+ if (res) {
+ page[T7000_PAGE_TCC] = devm_ioremap_resource(dev, res);
+ if (IS_ERR(page[T7000_PAGE_TCC]))
+ return PTR_ERR(page[T7000_PAGE_TCC]);
+ }
+
+ for (i = 0; i < ARRAY_SIZE(t7000_sensors); i++) {
+ const struct t7000_sensor_desc *d = &t7000_sensors[i];
+ struct thermal_zone_device *tz;
+ struct t7000_sensor *s;
+
+ if (!page[d->page])
+ continue;
+ if (!(readl(page[d->page] + d->ctl_set) & T7000_CTL0_ENABLE)) {
+ dev_dbg(dev, "sensor %u not enabled by the boot chain\n", i);
+ continue;
+ }
+
+ s = devm_kzalloc(dev, sizeof(*s), GFP_KERNEL);
+ if (!s)
+ return -ENOMEM;
+ s->base = page[d->page];
+ s->desc = d;
+
+ /* Start accumulating, as iOS does, before the zone's first read. */
+ writel(T7000_CTL0_ACCUMULATE, s->base + d->ctl_set);
+ ret = devm_add_action_or_reset(dev, t7000_sensor_stop, s);
+ if (ret)
+ return ret;
+
+ tz = devm_thermal_of_zone_register(dev, i, s, &t7000_thermal_ops);
+ if (IS_ERR(tz)) {
+ /* No zone uses this sensor: leave it alone. */
+ if (PTR_ERR(tz) == -ENODEV) {
+ devm_release_action(dev, t7000_sensor_stop, s);
+ continue;
+ }
+ return dev_err_probe(dev, PTR_ERR(tz),
+ "failed to register sensor %u\n", i);
+ }
+
+ ret = devm_thermal_add_hwmon_sysfs(dev, tz);
+ if (ret)
+ dev_warn(dev, "failed to add hwmon for sensor %u: %d\n",
+ i, ret);
+ }
+
+ return 0;
+}
+
+static const struct of_device_id t7000_thermal_of_match[] = {
+ { .compatible = "apple,t7000-thermal" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, t7000_thermal_of_match);
+
+static struct platform_driver t7000_thermal_driver = {
+ .probe = t7000_thermal_probe,
+ .driver = {
+ .name = "apple-t7000-thermal",
+ .of_match_table = t7000_thermal_of_match,
+ },
+};
+module_platform_driver(t7000_thermal_driver);
+
+MODULE_AUTHOR("Jeroen Trappers <jeroen.trappers@gmail.com>");
+MODULE_DESCRIPTION("Apple T7000 on-die temperature sensors");
+MODULE_LICENSE("GPL");
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] arm64: dts: apple: t7000: Add die temperature sensors and thermal zones
2026-12-03 15:55 [PATCH 0/3] Apple T7000 (A8) die temperature sensors and thermal zones Jeroen Trappers
2026-12-03 15:55 ` [PATCH 1/3] dt-bindings: thermal: Add Apple T7000 die temperature sensors Jeroen Trappers
2026-12-03 15:55 ` [PATCH 2/3] thermal/drivers/apple: Add T7000 (A8) on-die temperature sensor driver Jeroen Trappers
@ 2026-12-03 15:56 ` Jeroen Trappers
2026-12-03 16:18 ` sashiko-bot
2 siblings, 1 reply; 6+ messages in thread
From: Jeroen Trappers @ 2026-12-03 15:56 UTC (permalink / raw)
To: rafael, daniel.lezcano, sven, j, robh, krzk+dt, conor+dt
Cc: rui.zhang, lukasz.luba, neal, towinchenmi, konradybcio, asahi,
linux-arm-kernel, linux-pm, devicetree, linux-kernel
Describe the A8's die temperature sensors and add three zones: the CPU
complex (TCC sensor 2) and the two power manager sensors. The CPUs
throttle from 70 C (apple-soc-cpufreq is the cooling device), 90 C is
hot and 100 C, the alarm temperature in the boot chain's device tree,
is critical, below the hardware failsafe (SoCHOT) at 120 / 125 C. The
CPUs are the only cooling device, so the power manager sensors, which
also see the GPU's heat, throttle them too.
The sensor page lies after the end of the pmgr node's range
(0x20e000000 + 0x24000), like the watchdog's.
The trips were validated on the iPhone 6 (N61); they are conservative
for the other T7000 devices, which share the SoC.
The nodes were drafted with an LLM coding assistant and reviewed by me.
Signed-off-by: Jeroen Trappers <jeroen.trappers@gmail.com>
---
arch/arm64/boot/dts/apple/t7000.dtsi | 119 +++++++++++++++++++++++++++
1 file changed, 119 insertions(+)
diff --git a/arch/arm64/boot/dts/apple/t7000.dtsi b/arch/arm64/boot/dts/apple/t7000.dtsi
index 0342455d3444..ecac3d3b59b4 100644
--- a/arch/arm64/boot/dts/apple/t7000.dtsi
+++ b/arch/arm64/boot/dts/apple/t7000.dtsi
@@ -12,6 +12,7 @@
#include <dt-bindings/interrupt-controller/apple-aic.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/pinctrl/apple.h>
+#include <dt-bindings/thermal/thermal.h>
/ {
interrupt-parent = <&aic>;
@@ -34,6 +35,7 @@ cpu0: cpu@0 {
reg = <0x0 0x0>;
cpu-release-addr = <0 0>; /* To be filled in by loader */
performance-domains = <&cpufreq>;
+ #cooling-cells = <2>;
operating-points-v2 = <&typhoon_opp>;
enable-method = "spin-table";
device_type = "cpu";
@@ -47,6 +49,7 @@ cpu1: cpu@1 {
reg = <0x0 0x1>;
cpu-release-addr = <0 0>; /* To be filled in by loader */
performance-domains = <&cpufreq>;
+ #cooling-cells = <2>;
operating-points-v2 = <&typhoon_opp>;
enable-method = "spin-table";
device_type = "cpu";
@@ -216,6 +219,14 @@ wdt: watchdog@20e027000 {
interrupts = <AIC_IRQ 4 IRQ_TYPE_LEVEL_HIGH>;
};
+ die_temp: thermal-sensor@20e02b000 {
+ compatible = "apple,t7000-thermal";
+ reg = <0x2 0x0e02b000 0x0 0x1000>,
+ <0x2 0x02230000 0x0 0x1000>;
+ reg-names = "soc", "tcc";
+ #thermal-sensor-cells = <1>;
+ };
+
aic: interrupt-controller@20e100000 {
compatible = "apple,t7000-aic", "apple,aic";
reg = <0x2 0x0e100000 0x0 0x100000>;
@@ -274,6 +285,114 @@ i2c3_pins: i2c3-pins {
};
};
+ /*
+ * The CPUs throttle from 70 C, 90 C is hot and 100 C (the alarm
+ * temperature in the boot chain's device tree) is critical, below
+ * the hardware failsafe (SoCHOT) at 120 / 125 C. The CPUs are the
+ * only cooling device, so the power manager sensors, which also see
+ * the GPU's heat, throttle them as well.
+ */
+ thermal-zones {
+ cpu-thermal {
+ polling-delay-passive = <250>;
+ polling-delay = <1000>;
+ thermal-sensors = <&die_temp 4>;
+
+ trips {
+ cpu_alert: cpu-alert {
+ temperature = <70000>;
+ hysteresis = <3000>;
+ type = "passive";
+ };
+
+ cpu-hot {
+ temperature = <90000>;
+ hysteresis = <3000>;
+ type = "hot";
+ };
+
+ cpu-crit {
+ temperature = <100000>;
+ hysteresis = <0>;
+ type = "critical";
+ };
+ };
+
+ cooling-maps {
+ map0 {
+ trip = <&cpu_alert>;
+ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+ };
+ };
+ };
+
+ soc0-thermal {
+ polling-delay-passive = <250>;
+ polling-delay = <1000>;
+ thermal-sensors = <&die_temp 0>;
+
+ trips {
+ soc0_alert: soc0-alert {
+ temperature = <70000>;
+ hysteresis = <3000>;
+ type = "passive";
+ };
+
+ soc0-hot {
+ temperature = <90000>;
+ hysteresis = <3000>;
+ type = "hot";
+ };
+
+ soc0-crit {
+ temperature = <100000>;
+ hysteresis = <0>;
+ type = "critical";
+ };
+ };
+
+ cooling-maps {
+ map0 {
+ trip = <&soc0_alert>;
+ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+ };
+ };
+ };
+
+ soc1-thermal {
+ polling-delay-passive = <250>;
+ polling-delay = <1000>;
+ thermal-sensors = <&die_temp 1>;
+
+ trips {
+ soc1_alert: soc1-alert {
+ temperature = <70000>;
+ hysteresis = <3000>;
+ type = "passive";
+ };
+
+ soc1-hot {
+ temperature = <90000>;
+ hysteresis = <3000>;
+ type = "hot";
+ };
+
+ soc1-crit {
+ temperature = <100000>;
+ hysteresis = <0>;
+ type = "critical";
+ };
+ };
+
+ cooling-maps {
+ map0 {
+ trip = <&soc1_alert>;
+ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+ };
+ };
+ };
+ };
+
timer {
compatible = "arm,armv8-timer";
interrupt-parent = <&aic>;
--
2.47.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] dt-bindings: thermal: Add Apple T7000 die temperature sensors
2026-12-03 15:55 ` [PATCH 1/3] dt-bindings: thermal: Add Apple T7000 die temperature sensors Jeroen Trappers
@ 2026-12-03 16:12 ` sashiko-bot
0 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-12-03 16:12 UTC (permalink / raw)
To: Jeroen Trappers; +Cc: devicetree, robh, conor+dt
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] dt-bindings: thermal: merge of disjoint PMGR and TCC blocks
into one DT node
- [Low] dt-bindings: thermal: unjustified minItems: 1 makes TCC page
optional
--
commit 98e2e31e2df770c267988433fedc4f9f8b671b26
Author: Jeroen Trappers <jeroen.trappers@gmail.com>
dt-bindings: thermal: Add Apple T7000 die temperature sensors
This commit adds a Devicetree binding schema for the Apple T7000 (A8) die
temperature sensors and a corresponding MAINTAINERS entry.
> diff --git a/Documentation/devicetree/bindings/thermal/apple,t7000-thermal.yaml b/Documentation/devicetree/bindings/thermal/apple,t7000-thermal.yaml
> new file mode 100644
> index 0000000000000..c5418ba9697b0
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/thermal/apple,t7000-thermal.yaml
> @@ -0,0 +1,65 @@
[ ... ]
> +properties:
> + compatible:
> + const: apple,t7000-thermal
> +
> + reg:
> + minItems: 1
> + items:
> + - description: power manager (SOC) sensor page
> + - description: CPU complex (TCC) sensor page
> +
> + reg-names:
> + minItems: 1
> + items:
> + - const: soc
> + - const: tcc
[Severity: Medium]
Should the power manager and CPU complex sensor pages be modeled as two
separate DT nodes instead of one composite thermal-sensor node?
In arch/arm64/boot/dts/apple/t7000.dtsi these are physically disjoint
subsystems about 190 MiB apart: the power manager sits at 0x20e000000
and the CPU complex at 0x202220000. The two blocks have independent
register layouts and no shared hardware state.
Merging independent IP blocks into one node to keep Apple's flat 0..4
numbering locks in a DT ABI that makes per-block resources (clocks,
interrupts, power-domains) awkward to attach and does not scale cleanly
to sibling SoCs with different CPU cluster counts.
Each block can be its own thermal-sensor node with local sensor IDs and
distinct compatibles for the different register layouts.
> +
> + "#thermal-sensor-cells":
> + const: 1
> + description: |
> + The sensor ID, Apple's tempsensor index:
> + 0 = power manager (SOC) sensor 0
> + 1 = power manager (SOC) sensor 1
> + 2 = CPU complex (TCC) sensor 0
> + 3 = CPU complex (TCC) sensor 1
> + 4 = CPU complex (TCC) sensor 2
> + IDs 2 to 4 need the "tcc" page.
[Severity: Low]
If both pages remain in a single apple,t7000-thermal node, should reg
and reg-names drop minItems: 1?
The binding matches only one fixed SoC compatible and documents sensors
0..4 across both pages, without describing any hardware variant that
lacks the tcc sensors. Allowing the tcc entry to be omitted accepts
nodes where documented sensor IDs 2..4 cannot work.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203155600.3911447-1-jeroen.trappers@gmail.com?part=1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] arm64: dts: apple: t7000: Add die temperature sensors and thermal zones
2026-12-03 15:56 ` [PATCH 3/3] arm64: dts: apple: t7000: Add die temperature sensors and thermal zones Jeroen Trappers
@ 2026-12-03 16:18 ` sashiko-bot
0 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-12-03 16:18 UTC (permalink / raw)
To: Jeroen Trappers; +Cc: devicetree, robh, conor+dt
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Low] arm64: dts: apple: t7000: commit omits rationale for skipping
TCC sensors 0 and 1
- [Low] arm64: dts: apple: t7000 combines disjoint PMGR and TCC thermal
blocks
- [Low] arm64: dts: apple: t7000: omit cpu1 from thermal cooling-device
maps
--
commit ad0a71a0e92279f590636e8ff4001864d101f6d7
Author: Jeroen Trappers <jeroen.trappers@gmail.com>
arm64: dts: apple: t7000: Add die temperature sensors and thermal zones
This commit adds the die temperature sensor node, cooling-cells on both
CPUs, and three thermal zones (cpu-thermal, soc0-thermal, and
soc1-thermal) to the Apple T7000 device tree.
> diff --git a/arch/arm64/boot/dts/apple/t7000.dtsi b/arch/arm64/boot/dts/apple/t7000.dtsi
> index 0342455d34447..ecac3d3b59b42 100644
> --- a/arch/arm64/boot/dts/apple/t7000.dtsi
> +++ b/arch/arm64/boot/dts/apple/t7000.dtsi
[ ... ]
> @@ -216,6 +219,14 @@ wdt: watchdog@20e027000 {
> interrupts = <AIC_IRQ 4 IRQ_TYPE_LEVEL_HIGH>;
> };
>
> + die_temp: thermal-sensor@20e02b000 {
> + compatible = "apple,t7000-thermal";
> + reg = <0x2 0x0e02b000 0x0 0x1000>,
> + <0x2 0x02230000 0x0 0x1000>;
> + reg-names = "soc", "tcc";
> + #thermal-sensor-cells = <1>;
> + };
[Severity: Low]
Should the PMGR and TCC thermal blocks be separate thermal-sensor nodes
instead of one combined node?
0x20e02b000 is in the PMGR region while 0x202230000 is ~190 MiB away in
the CPU complex next to cpufreq@202220000. In the driver, the two pages
have distinct register layouts and sign-bit widths (14 vs 15) with no
shared state, and the binding already makes the tcc window optional.
Merging two independent blocks into one node locks in a DT ABI that
complicates adding per-block clocks, power domains, or interrupts later
and hinders reuse on sibling SoCs like T7001. Splitting them into two
nodes across the series would avoid baking this layout into the ABI.
[ ... ]
> + thermal-zones {
> + cpu-thermal {
> + polling-delay-passive = <250>;
> + polling-delay = <1000>;
> + thermal-sensors = <&die_temp 4>;
[Severity: Low]
Why are TCC sensors 0 and 1 (IDs 2 and 3) omitted from thermal-zones?
The binding and driver define five sensors on T7000 (SOC 0-1 and TCC
0-2), and t7000_thermal_probe() skips any sensor without a thermal zone
(-ENODEV), leaving IDs 2 and 3 inactive and unexposed.
Documenting in the commit message or a DTS comment why only TCC sensor 2
is wired up would clarify whether IDs 2 and 3 are intentionally excluded
or left disabled by the boot chain.
[ ... ]
> + cooling-maps {
> + map0 {
> + trip = <&cpu_alert>;
> + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
> + };
> + };
[Severity: Low]
Should cpu1 also be listed in cooling-device here and in soc0-thermal
and soc1-thermal?
Both cpu0 and cpu1 declare #cooling-cells = <2> and share one cpufreq
policy, so of_cpufreq_cooling_register() binds the cooling device to
of_get_cpu_node(policy->cpu, NULL).
If the kernel boots on physical cpu@1 (such as during a kdump crash,
which machine_kexec_prepare() permits on spin-table systems), logical
CPU 0 maps to cpu1, so thermal_of_get_cooling_spec() rejects the
cpu0-only entry and silently disables passive throttling in all zones.
Listing both <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT> and
<&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT> in all three cooling-maps
avoids this without duplicating bindings.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203155600.3911447-1-jeroen.trappers@gmail.com?part=3
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-12-03 16:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 15:55 [PATCH 0/3] Apple T7000 (A8) die temperature sensors and thermal zones Jeroen Trappers
2026-12-03 15:55 ` [PATCH 1/3] dt-bindings: thermal: Add Apple T7000 die temperature sensors Jeroen Trappers
2026-12-03 16:12 ` sashiko-bot
2026-12-03 15:55 ` [PATCH 2/3] thermal/drivers/apple: Add T7000 (A8) on-die temperature sensor driver Jeroen Trappers
2026-12-03 15:56 ` [PATCH 3/3] arm64: dts: apple: t7000: Add die temperature sensors and thermal zones Jeroen Trappers
2026-12-03 16:18 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox