From 809315f97623856e7766789e38361f2441193ee7 Mon Sep 17 00:00:00 2001 From: Nick Date: Thu, 19 Nov 2026 21:41:34 +0700 Subject: [PATCH 1/2] dt-bindings: power: apple,pmc: Add the CLPC's Low Power mode ceiling Let the boot loader pass the CPU frequency ceiling of macOS's Low Power mode, which the ADT has as pmgr/clpc cpu-low-power-frequency-max, on the performance controller node. The property keeps the ADT's unit (MHz), so the loader copies the value as it is. The name and text match the property proposed for the same ADT key on the M4 Pro and Max MacBook Pros. Signed-off-by: Nick --- Documentation/devicetree/bindings/power/apple,pmc.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/power/apple,pmc.yaml b/Documentation/devicetree/bindings/power/apple,pmc.yaml index bd8d9972e1533..ff5332880a531 100644 --- a/Documentation/devicetree/bindings/power/apple,pmc.yaml +++ b/Documentation/devicetree/bindings/power/apple,pmc.yaml @@ -270,6 +270,13 @@ patternProperties: The SMC, whose package power reading the low-power platform profile holds the CPU clusters to. + apple,low-power-frequency-max-mhz: + description: + The machine's CPU frequency ceiling in macOS's Low Power mode, in + MHz, as the ADT's cpu-low-power-frequency-max has it. The low-power + platform profile holds the CPU clusters to it, up to the next + frequency of their tables. + required: - compatible - reg From 0cbf68da4a076a84cb40d09aac83875b23976a04 Mon Sep 17 00:00:00 2001 From: Nick Date: Thu, 19 Nov 2026 21:41:34 +0700 Subject: [PATCH 2/2] soc: apple: clpc: Take the Low Power mode ceiling from the DT The ADT has macOS's Low Power mode CPU ceiling as pmgr/clpc cpu-low-power-frequency-max: 2220 MHz on the J704, J813 and J815 (M5), 2088 MHz on the J713 (M4 Air), 3144 MHz on the J700. The boot loader now copies it into the CLPC node as apple,low-power-frequency-max-mhz. Register the low-power platform profile wherever the node has that property, with its value as the ceiling. A node without it keeps the SoC's built-in value where there is one, so the T6041 and T8140 profiles stay as they are under an older loader. With the same ceiling built into the driver for the J815, low-power took its P cluster from 4464 to 2220 MHz and back (M5, 27.2 stub). Signed-off-by: Nick --- drivers/soc/apple/clpc.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/drivers/soc/apple/clpc.c b/drivers/soc/apple/clpc.c index c06f00e508bde..b03ee56d35cfa 100644 --- a/drivers/soc/apple/clpc.c +++ b/drivers/soc/apple/clpc.c @@ -105,7 +105,8 @@ enum apple_clpc_rail { * @idle_on_time: sample every period even with no vote held, instead of * from a deferrable timer * @low_power_khz: CPU frequency ceiling of the low-power platform profile, - * taken up to the next table frequency; 0 for no platform profile + * taken up to the next table frequency, for a node without + * apple,low-power-frequency-max-mhz; 0 for no platform profile * @low_power_mw: package power (the SMC's PHPC key) the low-power profile * holds the CPU clusters to; 0 for none * @high_power_machine: the machine compatible on which the performance @@ -234,6 +235,8 @@ struct apple_clpc { /* The platform profile and, for its power target, the SMC */ enum platform_profile_option profile; bool low_power; + /* the DT ceiling, else hw->low_power_khz, else 0 */ + unsigned int low_power_khz; struct device_node *smc_np; struct apple_smc *smc; /* The performance profile is sent to the SMC as High Power mode */ @@ -845,7 +848,7 @@ static bool apple_clpc_steps_first(unsigned int a_khz, unsigned int a_max, /* * The platform profile's ceilings. In the low-power profile every cluster - * stays at or below the first frequency at or above hw->low_power_khz. Each + * stays at or below the first frequency at or above clpc->low_power_khz. Each * new package power reading above hw->low_power_mw takes one table step off * one cluster, and each one below 90% of it puts one back, in the order of * apple_clpc_steps_first(). Elsewhere there is no ceiling. @@ -857,7 +860,7 @@ static void apple_clpc_profile_limit(struct apple_clpc *clpc) unsigned int i, khz, pick_khz = 0; int mw, step = 0, pick = -1; - if (!clpc->hw->low_power_khz || time_before(jiffies, clpc->power_next)) + if (!clpc->low_power_khz || time_before(jiffies, clpc->power_next)) return; clpc->power_next = jiffies + msecs_to_jiffies(APPLE_CLPC_POWER_MS); if (low && clpc->hw->low_power_mw) { @@ -883,10 +886,10 @@ static void apple_clpc_profile_limit(struct apple_clpc *clpc) freq_qos_add_request(&policy[i]->constraints, &cl->max_qos, FREQ_QOS_MAX, FREQ_QOS_MAX_DEFAULT_VALUE) < 0) clpc->update_errors++; - /* The top: the first table frequency at or above hw->low_power_khz */ + /* The top: the first table frequency at or above clpc->low_power_khz */ cl->top_khz = apple_clpc_step_khz(policy[i], - clpc->hw->low_power_khz - 1, true); - if (cl->top_khz < clpc->hw->low_power_khz) + clpc->low_power_khz - 1, true); + if (cl->top_khz < clpc->low_power_khz) cl->top_khz = policy[i]->cpuinfo.max_freq; if (!low) cl->max_khz = 0; @@ -1055,7 +1058,7 @@ static int apple_clpc_status_show(struct seq_file *s, void *unused) } seq_printf(s, "samples: %lu update errors: %lu\n", clpc->samples, clpc->update_errors); - if (clpc->hw->low_power_khz) { + if (clpc->low_power_khz) { seq_printf(s, "profile: %s power %d mW (%lu new of %lu readings) ceilings (kHz):", clpc->profile == PLATFORM_PROFILE_LOW_POWER ? "low-power" : clpc->profile == PLATFORM_PROFILE_PERFORMANCE ? "performance" : @@ -1360,6 +1363,7 @@ static int apple_clpc_probe(struct platform_device *pdev) struct device_node *gpu = NULL; struct apple_clpc *clpc; unsigned int rail, i; + u32 mhz; int ret; clpc = devm_kzalloc(dev, sizeof(*clpc), GFP_KERNEL); @@ -1497,7 +1501,16 @@ static int apple_clpc_probe(struct platform_device *pdev) clpc->profile = PLATFORM_PROFILE_BALANCED; clpc->power_next = jiffies; - if (clpc->hw->low_power_khz && IS_REACHABLE(CONFIG_ACPI_PLATFORM_PROFILE)) { + /* + * The boot loader copies the ADT's Low Power mode CPU ceiling + * (pmgr/clpc cpu-low-power-frequency-max) into the node. Without it, + * a SoC's own value applies where it has one. + */ + if (!of_property_read_u32(dev->of_node, "apple,low-power-frequency-max-mhz", &mhz)) + clpc->low_power_khz = mhz * 1000; + else + clpc->low_power_khz = clpc->hw->low_power_khz; + if (clpc->low_power_khz && IS_REACHABLE(CONFIG_ACPI_PLATFORM_PROFILE)) { struct device *ppdev; /* The SMC is optional: without it the low-power profile has only its ceiling. */