mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] soc: apple: rtkit: Add function to poweroff
@ 2026-01-17 17:59 Sven Peter
  2026-01-18 19:33 ` Sven Peter
  0 siblings, 1 reply; 2+ messages in thread
From: Sven Peter @ 2026-01-17 17:59 UTC (permalink / raw)
  To: Janne Grunau, Neal Gompa
  Cc: asahi, linux-arm-kernel, linux-kernel, Sven Peter

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>
Signed-off-by: Sven Peter <sven@kernel.org>
---
Changes in v2:
- Collected Janne's r-b tag, thanks!
- Fixed line wrapping (Janne)
- Link to v1: https://patch.msgid.link/20260117-apple-rtkit-poweroff-v1-1-6fbe8145e965@kernel.org
---
 drivers/soc/apple/rtkit.c       | 16 ++++++++++++++++
 include/linux/soc/apple/rtkit.h |  7 +++++++
 2 files changed, 23 insertions(+)

diff --git a/drivers/soc/apple/rtkit.c b/drivers/soc/apple/rtkit.c
index b8d4da147d23f7e99e76eea314e4d976cddbd1c6..4ad4f964fde7f821a40b8cde452fb201ec337ffc 100644
--- a/drivers/soc/apple/rtkit.c
+++ b/drivers/soc/apple/rtkit.c
@@ -851,6 +851,22 @@ int apple_rtkit_shutdown(struct apple_rtkit *rtk)
 }
 EXPORT_SYMBOL_GPL(apple_rtkit_shutdown);
 
+int apple_rtkit_poweroff(struct apple_rtkit *rtk)
+{
+	int ret;
+
+	ret = apple_rtkit_set_ap_power_state(rtk, APPLE_RTKIT_PWR_STATE_OFF);
+	if (ret)
+		return ret;
+
+	ret = apple_rtkit_set_iop_power_state(rtk, APPLE_RTKIT_PWR_STATE_OFF);
+	if (ret)
+		return ret;
+
+	return apple_rtkit_reinit(rtk);
+}
+EXPORT_SYMBOL_GPL(apple_rtkit_poweroff);
+
 int apple_rtkit_idle(struct apple_rtkit *rtk)
 {
 	int ret;
diff --git a/include/linux/soc/apple/rtkit.h b/include/linux/soc/apple/rtkit.h
index 736f530180179bd144cf85eb0f0bd93844d7188a..bda3c528b51553c13f7fe5685ab60f7fc675361b 100644
--- a/include/linux/soc/apple/rtkit.h
+++ b/include/linux/soc/apple/rtkit.h
@@ -125,6 +125,13 @@ int apple_rtkit_wake(struct apple_rtkit *rtk);
  */
 int apple_rtkit_shutdown(struct apple_rtkit *rtk);
 
+/*
+ * Put the co-processor into the lowest power state. Note that it usually
+ * is not possible to recover from this state without a full SoC reset.
+ */
+
+int apple_rtkit_poweroff(struct apple_rtkit *rtk);
+
 /*
  * Put the co-processor into idle mode
  */

---
base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
change-id: 20260117-apple-rtkit-poweroff-bc3bb1f4a105

Best regards,
-- 
Sven Peter <sven@kernel.org>


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] soc: apple: rtkit: Add function to poweroff
  2026-01-17 17:59 [PATCH v2] soc: apple: rtkit: Add function to poweroff Sven Peter
@ 2026-01-18 19:33 ` Sven Peter
  0 siblings, 0 replies; 2+ messages in thread
From: Sven Peter @ 2026-01-18 19:33 UTC (permalink / raw)
  To: Janne Grunau, Neal Gompa, Sven Peter
  Cc: asahi, linux-arm-kernel, linux-kernel

On Sat, 17 Jan 2026 18:59:10 +0100, Sven Peter wrote:
> 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.
> 
> 
> [...]

Applied to sven/linux (apple-soc/drivers-6.20), thanks!

[1/1] soc: apple: rtkit: Add function to poweroff
      https://github.com/AsahiLinux/linux/commit/ba99035bf16e

Best regards,
-- 
Sven Peter <sven@kernel.org>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-01-18 19:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-17 17:59 [PATCH v2] soc: apple: rtkit: Add function to poweroff Sven Peter
2026-01-18 19:33 ` Sven Peter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®