Skip to content

Commit a8b6518

Browse files
committed
cpuidle: apple: Do not load on unsupported Apple platforms
Pre-t8103 SoCs do not retain state during deep WFI. Reject to load on such platforms. Suggested-by: Nick Chan <towinchenmi@gmail.com> Signed-off-by: Janne Grunau <j@jannau.net>
1 parent 4c135ef commit a8b6518

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

drivers/cpuidle/cpuidle-apple.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@
66
*/
77

88
#include <linux/init.h>
9+
#include <linux/bitfield.h>
910
#include <linux/cpuidle.h>
1011
#include <linux/cpu_pm.h>
1112
#include <linux/platform_device.h>
1213
#include <linux/of.h>
1314
#include <asm/cpuidle.h>
1415

16+
#define DEEP_WFI_STATE_RETENTION BIT(2) // retains base CPU registers in deep WFI
17+
1518
enum idle_state {
1619
STATE_WFI,
1720
STATE_PWRDOWN,
@@ -146,6 +149,11 @@ static int __init apple_cpuidle_init(void)
146149
if (!of_machine_is_compatible("apple,arm-platform"))
147150
return 0;
148151

152+
if (!FIELD_GET(DEEP_WFI_STATE_RETENTION, read_sysreg(aidr_el1))) {
153+
pr_info("cpuidle-apple: CPU does not retain state in deep WFI\n");
154+
return 0;
155+
}
156+
149157
pdev = platform_device_register_simple("cpuidle-apple", -1, NULL, 0);
150158
if (IS_ERR(pdev)) {
151159
platform_driver_unregister(&apple_cpuidle_driver);

0 commit comments

Comments
 (0)