Skip to content

Commit 1a4ddf6

Browse files
asdfugilvireshk
authored andcommitted
cpufreq: apple-soc: Add Apple A7-A8X SoC cpufreq support
These SoCs only use 3 bits for p-states, and have a different APPLE_DVFS_CMD_PS1 mask value. Signed-off-by: Nick Chan <towinchenmi@gmail.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
1 parent 13b147b commit 1a4ddf6

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

drivers/cpufreq/apple-soc-cpufreq.c

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@
2222
#include <linux/pm_opp.h>
2323
#include <linux/slab.h>
2424

25-
#define APPLE_DVFS_CMD 0x20
26-
#define APPLE_DVFS_CMD_BUSY BIT(31)
27-
#define APPLE_DVFS_CMD_SET BIT(25)
28-
#define APPLE_DVFS_CMD_PS2 GENMASK(15, 12)
29-
#define APPLE_DVFS_CMD_PS1 GENMASK(4, 0)
30-
#define APPLE_DVFS_CMD_PS1_SHIFT 0
25+
#define APPLE_DVFS_CMD 0x20
26+
#define APPLE_DVFS_CMD_BUSY BIT(31)
27+
#define APPLE_DVFS_CMD_SET BIT(25)
28+
#define APPLE_DVFS_CMD_PS1_S5L8960X GENMASK(24, 22)
29+
#define APPLE_DVFS_CMD_PS1_S5L8960X_SHIFT 22
30+
#define APPLE_DVFS_CMD_PS2 GENMASK(15, 12)
31+
#define APPLE_DVFS_CMD_PS1 GENMASK(4, 0)
32+
#define APPLE_DVFS_CMD_PS1_SHIFT 0
3133

3234
/* Same timebase as CPU counter (24MHz) */
3335
#define APPLE_DVFS_LAST_CHG_TIME 0x38
@@ -36,6 +38,9 @@
3638
* Apple ran out of bits and had to shift this in T8112...
3739
*/
3840
#define APPLE_DVFS_STATUS 0x50
41+
#define APPLE_DVFS_STATUS_CUR_PS_S5L8960X GENMASK(5, 3)
42+
#define APPLE_DVFS_STATUS_CUR_PS_SHIFT_S5L8960X 3
43+
#define APPLE_DVFS_STATUS_TGT_PS_S5L8960X GENMASK(2, 0)
3944
#define APPLE_DVFS_STATUS_CUR_PS_T8103 GENMASK(7, 4)
4045
#define APPLE_DVFS_STATUS_CUR_PS_SHIFT_T8103 4
4146
#define APPLE_DVFS_STATUS_TGT_PS_T8103 GENMASK(3, 0)
@@ -72,6 +77,15 @@ struct apple_cpu_priv {
7277

7378
static struct cpufreq_driver apple_soc_cpufreq_driver;
7479

80+
static const struct apple_soc_cpufreq_info soc_s5l8960x_info = {
81+
.has_ps2 = false,
82+
.max_pstate = 7,
83+
.cur_pstate_mask = APPLE_DVFS_STATUS_CUR_PS_S5L8960X,
84+
.cur_pstate_shift = APPLE_DVFS_STATUS_CUR_PS_SHIFT_S5L8960X,
85+
.ps1_mask = APPLE_DVFS_CMD_PS1_S5L8960X,
86+
.ps1_shift = APPLE_DVFS_CMD_PS1_S5L8960X_SHIFT,
87+
};
88+
7589
static const struct apple_soc_cpufreq_info soc_t8103_info = {
7690
.has_ps2 = true,
7791
.max_pstate = 15,
@@ -99,6 +113,10 @@ static const struct apple_soc_cpufreq_info soc_default_info = {
99113
};
100114

101115
static const struct of_device_id apple_soc_cpufreq_of_match[] __maybe_unused = {
116+
{
117+
.compatible = "apple,s5l8960x-cluster-cpufreq",
118+
.data = &soc_s5l8960x_info,
119+
},
102120
{
103121
.compatible = "apple,t8103-cluster-cpufreq",
104122
.data = &soc_t8103_info,

0 commit comments

Comments
 (0)