Skip to content
Closed
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) AND GPL-2.0-only
%YAML 1.2
---
$id: http://devicetree.org/schemas/cpufreq/apple,cluster-cpufreq.yaml#
Expand Down Expand Up @@ -37,6 +37,7 @@ properties:
- const: apple,s5l8960x-cluster-cpufreq
- const: apple,t8140-cluster-cpufreq
- const: apple,t8142-cluster-cpufreq
- const: apple,t6050-cluster-cpufreq
- const: apple,t8152-cluster-cpufreq
- items:
- const: apple,t6020-cluster-cpufreq
Expand All @@ -57,6 +58,16 @@ properties:
- description: Cluster lane (0 for E, 1 for P on T8140)
enum: [0, 1]

apple,firmware-managed-thermal:
type: boolean
description: |
The boot producer has retained active firmware thermal control and
qualified it for every OPP published for this cluster. Firmware
throttling, voltage and PLL ownership must remain intact throughout
the guest lifetime, including after PMP reinitialization. This is
an ownership assertion, not a request to enable thermal control.
Without it the T6050 driver refuses DVFS registration.

'#performance-domain-cells':
const: 0

Expand All @@ -65,6 +76,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:
Expand Down
23 changes: 23 additions & 0 deletions drivers/cpufreq/apple-soc-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ struct apple_soc_cpufreq_info {
bool has_ps2;
bool verify_transition;
bool needs_thermal_policy;
bool needs_firmware_thermal_control;
u32 transition_timeout_us;
u32 max_unmanaged_pstate;
u64 min_pstate;
Expand Down Expand Up @@ -274,6 +275,16 @@ static const struct apple_soc_cpufreq_info soc_t8152_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,
Expand Down Expand Up @@ -303,6 +314,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,
Expand Down Expand Up @@ -814,6 +829,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);
Expand Down