Skip to content

Commit b82a772

Browse files
committed
fixup! cpuidle: apple: Add Apple SoC cpuidle driver
1 parent 41a4424 commit b82a772

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

drivers/cpuidle/cpuidle-apple.c

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ enum idle_state {
1919
};
2020

2121
asm(
22+
".pushsection .cpuidle.text, \"ax\"\n"
2223
".type apple_cpu_deep_wfi, @function\n"
2324
"apple_cpu_deep_wfi:\n"
2425
"str x30, [sp, #-16]!\n"
@@ -53,10 +54,17 @@ asm(
5354
"ldr x30, [sp], #16\n"
5455

5556
"ret\n"
57+
".popsection\n"
5658
);
5759

5860
void apple_cpu_deep_wfi(void);
5961

62+
static __cpuidle int apple_enter_wfi(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index)
63+
{
64+
cpu_do_idle();
65+
return index;
66+
}
67+
6068
static __cpuidle int apple_enter_idle(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index)
6169
{
6270
/*
@@ -67,10 +75,9 @@ static __cpuidle int apple_enter_idle(struct cpuidle_device *dev, struct cpuidle
6775
if (cpu_pm_enter())
6876
return -1;
6977

78+
ct_cpuidle_enter();
79+
7080
switch(index) {
71-
case STATE_WFI:
72-
cpu_do_idle();
73-
break;
7481
case STATE_PWRDOWN:
7582
apple_cpu_deep_wfi();
7683
break;
@@ -79,6 +86,8 @@ static __cpuidle int apple_enter_idle(struct cpuidle_device *dev, struct cpuidle
7986
break;
8087
}
8188

89+
ct_cpuidle_exit();
90+
8291
cpu_pm_exit();
8392

8493
return index;
@@ -89,13 +98,14 @@ static struct cpuidle_driver apple_idle_driver = {
8998
.owner = THIS_MODULE,
9099
.states = {
91100
[STATE_WFI] = {
92-
.enter = apple_enter_idle,
93-
.enter_s2idle = apple_enter_idle,
101+
.enter = apple_enter_wfi,
102+
.enter_s2idle = apple_enter_wfi,
94103
.exit_latency = 1,
95104
.target_residency = 1,
96105
.power_usage = UINT_MAX,
97106
.name = "WFI",
98107
.desc = "CPU clock-gated",
108+
.flags = 0,
99109
},
100110
[STATE_PWRDOWN] = {
101111
.enter = apple_enter_idle,
@@ -105,6 +115,7 @@ static struct cpuidle_driver apple_idle_driver = {
105115
.power_usage = 0,
106116
.name = "CPU PD",
107117
.desc = "CPU/cluster powered down",
118+
.flags = CPUIDLE_FLAG_RCU_IDLE,
108119
},
109120
},
110121
.safe_state_index = STATE_WFI,

0 commit comments

Comments
 (0)