diff --git a/Documentation/devicetree/bindings/power/apple,pmc.yaml b/Documentation/devicetree/bindings/power/apple,pmc.yaml index fe47291dff0dc..c0f1af75560ae 100644 --- a/Documentation/devicetree/bindings/power/apple,pmc.yaml +++ b/Documentation/devicetree/bindings/power/apple,pmc.yaml @@ -268,6 +268,13 @@ patternProperties: The SMC, whose package power reading the low-power platform profile holds the CPU clusters to. + apple,low-power-cpu-max-khz: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + CPU frequency ceiling of the low-power platform profile, in kHz. + The boot loader copies it from the ADT (pmgr/clpc + cpu-low-power-frequency-max, in MHz). + required: - compatible - reg diff --git a/drivers/soc/apple/clpc.c b/drivers/soc/apple/clpc.c index ff859036c040d..71283507dc4b1 100644 --- a/drivers/soc/apple/clpc.c +++ b/drivers/soc/apple/clpc.c @@ -104,7 +104,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-cpu-max-khz; 0 for no platform profile * @low_power_machine: the machine compatible @low_power_khz was read for; SoCs * sharing this CLPC without it get no low-power profile. NULL for any * @low_power_mw: package power (the SMC's PHPC key) the low-power profile @@ -232,7 +233,7 @@ struct apple_clpc { /* The platform profile and, for its power target, the SMC */ enum platform_profile_option profile; bool low_power; - /* hw->low_power_khz where it applies to this machine, else 0 */ + /* the DT ceiling, else hw->low_power_khz where it applies, else 0 */ unsigned int low_power_khz; struct device_node *smc_np; struct apple_smc *smc; @@ -1431,7 +1432,15 @@ static int apple_clpc_probe(struct platform_device *pdev) clpc->profile = PLATFORM_PROFILE_BALANCED; clpc->power_next = jiffies; - if (!clpc->hw->low_power_machine || of_machine_is_compatible(clpc->hw->low_power_machine)) + /* + * 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-cpu-max-khz", + &clpc->low_power_khz) && + (!clpc->hw->low_power_machine || + of_machine_is_compatible(clpc->hw->low_power_machine))) clpc->low_power_khz = clpc->hw->low_power_khz; if (clpc->low_power_khz && IS_REACHABLE(CONFIG_ACPI_PLATFORM_PROFILE)) { struct device *ppdev;