Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Documentation/devicetree/bindings/power/apple,pmc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 12 additions & 3 deletions drivers/soc/apple/clpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Loading