From 5ad2c72abf9864c3b5b1c87266a16b7e4abd3517 Mon Sep 17 00:00:00 2001 From: DjDeveloperr Date: Mon, 9 Nov 2026 08:46:47 -0500 Subject: [PATCH] cpufreq: apple: Add the T6050 thermal-owned profile The T6050 clusters' DVFS command register reads back the last request it accepted, not a measured state, so the profile verifies each transition against that readback, with a 2 ms timeout. On this chip the firmware owns the clusters' thermal limits; the profile refuses a cluster whose node doesn't say so (apple,firmware-managed-thermal), and the binding requires that property for apple,t6050-cluster-cpufreq. Tested on J714s (M5 Pro, bare metal under aura Stage 2): all three clusters bind (M 300-4380 MHz, P 300-4608 MHz, schedutil) with no DVFS error; idle clusters sit at 300 MHz and loaded ones at their top state. Clocks measured with a dependent add chain go from iBoot's 2.65/1.34/ 1.31 GHz to 4.29/4.38/4.60 GHz (with WFI idle); one-thread work is 1.6x faster on M and 3.4x on P, and idle system power drops from 20.1 to 7.2-7.9 W while idle still spins under idle=nop. Carried for the bare-metal kit by Erik Bourget (#944). Signed-off-by: Diljit Singh --- .../cpufreq/apple,cluster-cpufreq.yaml | 10 ++++++++ drivers/cpufreq/apple-soc-cpufreq.c | 23 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/Documentation/devicetree/bindings/cpufreq/apple,cluster-cpufreq.yaml b/Documentation/devicetree/bindings/cpufreq/apple,cluster-cpufreq.yaml index 807eb00b967eb..b7ed80708377e 100644 --- a/Documentation/devicetree/bindings/cpufreq/apple,cluster-cpufreq.yaml +++ b/Documentation/devicetree/bindings/cpufreq/apple,cluster-cpufreq.yaml @@ -84,6 +84,16 @@ required: - reg - '#performance-domain-cells' +allOf: + - if: + properties: + compatible: + contains: + const: apple,t6050-cluster-cpufreq + then: + required: + - apple,firmware-managed-thermal + additionalProperties: false examples: diff --git a/drivers/cpufreq/apple-soc-cpufreq.c b/drivers/cpufreq/apple-soc-cpufreq.c index 85e592faa0538..fb87ae6ae137a 100644 --- a/drivers/cpufreq/apple-soc-cpufreq.c +++ b/drivers/cpufreq/apple-soc-cpufreq.c @@ -206,6 +206,7 @@ struct apple_soc_cpufreq_info { /* Fail closed when the DT describes no fast die-temperature limit. */ bool needs_thermal_policy; bool needs_thermal_owner; + bool needs_firmware_thermal_control; u32 transition_timeout_us; /* Highest P-state allowed without a thermal policy; 0 if not capped. */ u32 max_unmanaged_pstate; @@ -340,6 +341,16 @@ static const struct apple_soc_cpufreq_info soc_t8132_info = { .ps1_shift = APPLE_DVFS_CMD_PS1_SHIFT, }; +/* Command-state readback, not a measurement of the clock frequency. */ +static const struct apple_soc_cpufreq_info soc_t6050_info = { + .verify_transition = true, + .needs_firmware_thermal_control = true, + .transition_timeout_us = 2000, + .max_pstate = 31, + .ps1_mask = APPLE_DVFS_CMD_PS1, + .ps1_shift = APPLE_DVFS_CMD_PS1_SHIFT, +}; + static const struct apple_soc_cpufreq_info soc_default_info = { .has_ps2 = false, .max_pstate = 15, @@ -373,6 +384,10 @@ static const struct of_device_id apple_soc_cpufreq_of_match[] __maybe_unused = { .compatible = "apple,t8140-cluster-cpufreq", .data = &soc_t8140_info, }, + { + .compatible = "apple,t6050-cluster-cpufreq", + .data = &soc_t6050_info, + }, { .compatible = "apple,t8142-cluster-cpufreq", .data = &soc_t8142_info, @@ -1355,6 +1370,14 @@ static int apple_soc_cpufreq_init(struct cpufreq_policy *policy) goto out_free_priv; } + /* The boot producer must retain and qualify firmware thermal control. */ + if (info->needs_firmware_thermal_control && + !of_property_read_bool(cluster, "apple,firmware-managed-thermal")) { + dev_err(cpu_dev, "firmware thermal ownership is not declared\n"); + ret = -ENODEV; + goto out_iounmap; + } + ret = dev_pm_opp_of_cpumask_add_table(policy->cpus); if (ret < 0) { dev_err(cpu_dev, "%s: failed to add OPP table: %d\n", __func__, ret);