Skip to content

Commit 145d390

Browse files
committed
cpufreq: Fix a dumb bug and drop the DESIRED2 field
I don't think that field ever did anything and Apple don't set it on newer macOS/SoCs. Also expand DESIRED1 to T602x width. Signed-off-by: Hector Martin <[email protected]>
1 parent b2a479f commit 145d390

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

src/cpufreq.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010

1111
#define CLUSTER_PSTATE_BUSY BIT(31)
1212
#define CLUSTER_PSTATE_SET BIT(25)
13-
#define CLUSTER_PSTATE_DESIRED2 GENMASK(15, 12)
14-
#define CLUSTER_PSTATE_DESIRED1 GENMASK(3, 0)
13+
#define CLUSTER_PSTATE_DESIRED1 GENMASK(4, 0)
1514

1615
#define CLUSTER_CONFIG_ENABLE BIT(63)
1716
#define CLUSTER_CONFIG_DVMR1 BIT(32)
@@ -41,9 +40,8 @@ int cpufreq_init_cluster(const struct cluster_t *cluster)
4140
val = read64(cluster->base + CLUSTER_PSTATE);
4241

4342
if (FIELD_GET(CLUSTER_PSTATE_DESIRED1, val) != cluster->boot_pstate) {
44-
val &= CLUSTER_PSTATE_DESIRED1 | CLUSTER_PSTATE_DESIRED2;
45-
val |= CLUSTER_PSTATE_SET | FIELD_PREP(CLUSTER_PSTATE_DESIRED1, cluster->boot_pstate) |
46-
FIELD_PREP(CLUSTER_PSTATE_DESIRED2, cluster->boot_pstate);
43+
val &= ~CLUSTER_PSTATE_DESIRED1;
44+
val |= CLUSTER_PSTATE_SET | FIELD_PREP(CLUSTER_PSTATE_DESIRED1, cluster->boot_pstate);
4745
printf("cpufreq: Switching cluster %s to P-State %d\n", cluster->name,
4846
cluster->boot_pstate);
4947
write64(cluster->base + CLUSTER_PSTATE, val);

0 commit comments

Comments
 (0)