Skip to content

Commit ba99035

Browse files
committed
soc: apple: rtkit: Add function to poweroff
Add a function to put a co-processor into the lowest possible power state from which recovery usually isn't possible without a full SoC reset. This is required for the USB4/Thunderbolt co-processors which can be restarted since the entire USB4 root complex can be completely reset independently of the rest of the SoC. Reviewed-by: Janne Grunau <j@jannau.net> Link: https://patch.msgid.link/20260117-apple-rtkit-poweroff-v2-1-b882a180e44d@kernel.org Signed-off-by: Sven Peter <sven@kernel.org>
1 parent 8f0b4cc commit ba99035

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

drivers/soc/apple/rtkit.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,22 @@ int apple_rtkit_shutdown(struct apple_rtkit *rtk)
851851
}
852852
EXPORT_SYMBOL_GPL(apple_rtkit_shutdown);
853853

854+
int apple_rtkit_poweroff(struct apple_rtkit *rtk)
855+
{
856+
int ret;
857+
858+
ret = apple_rtkit_set_ap_power_state(rtk, APPLE_RTKIT_PWR_STATE_OFF);
859+
if (ret)
860+
return ret;
861+
862+
ret = apple_rtkit_set_iop_power_state(rtk, APPLE_RTKIT_PWR_STATE_OFF);
863+
if (ret)
864+
return ret;
865+
866+
return apple_rtkit_reinit(rtk);
867+
}
868+
EXPORT_SYMBOL_GPL(apple_rtkit_poweroff);
869+
854870
int apple_rtkit_idle(struct apple_rtkit *rtk)
855871
{
856872
int ret;

include/linux/soc/apple/rtkit.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,13 @@ int apple_rtkit_wake(struct apple_rtkit *rtk);
125125
*/
126126
int apple_rtkit_shutdown(struct apple_rtkit *rtk);
127127

128+
/*
129+
* Put the co-processor into the lowest power state. Note that it usually
130+
* is not possible to recover from this state without a full SoC reset.
131+
*/
132+
133+
int apple_rtkit_poweroff(struct apple_rtkit *rtk);
134+
128135
/*
129136
* Put the co-processor into idle mode
130137
*/

0 commit comments

Comments
 (0)