* [PATCH 0/4] Suspend-to-RAM fixes for RK3588 + SPI-connected RK806 PMIC, enable PMIC sleep on RK3588 Tiger
@ 2026-10-29 10:06 Jakob Unterwurzacher
2026-10-29 10:06 ` [PATCH 1/4] Input: rk805-pwrkey - enable the wakeup interrupt during system suspend Jakob Unterwurzacher
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Jakob Unterwurzacher @ 2026-10-29 10:06 UTC (permalink / raw)
To: Dmitry Torokhov, Joseph Chen, Lee Jones, Sebastian Reichel,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner
Cc: linux-arm-kernel, linux-rockchip, linux-kernel, linux-input, mfd,
devicetree, Jakob Unterwurzacher
This series, together with a few out-of-tree patches (see below), makes
suspend-to-RAM on RK3588-Tiger work, down to a power consumption of
about 0.4 W. Patches 1-3 apply to all boards with an RK806 PMIC
connected via SPI, which includes most RK3588 boards.
Patch 1 ("Input: rk805-pwrkey - enable the wakeup interrupt during system suspend")
arms the power key interrupt as a wakeup source, so that the
power key can wake up the system. This is done in the regular suspend
phase, because the SPI bus to the PMIC can no longer be used in the
noirq phase.
Patch 2 ("mfd: rk8xx-core: keep the PMIC interrupt disabled during system suspend")
keeps the PMIC interrupt disabled across system suspend, so that its
handler does not run before the bus to the PMIC has resumed.
Patch 3 ("mfd: rk8xx-spi: add system sleep PM ops")
hooks up the existing rk8xx suspend/resume callbacks for the SPI
variant, which so far lacked them.
Patch 4 ("arm64: dts: rockchip: put the PMIC into sleep mode in suspend on RK3588 Tiger")
configures the RK806 PWRCTRL1 pin on RK3588 Tiger for its sleep
function, so that the regulator suspend states take effect. This lowers
the module's power consumption in suspend-to-RAM from 1.09 W to 0.43 W.
The patches do not depend on each other and can be applied through
their respective trees.
Testing
-------
Tested on RK3588-Tiger on the Haikou baseboard, on top of the v7.4 merge
window (a8530b69fc4dd): 30 consecutive suspend-to-RAM cycles, each woken
up by the PMIC power key, all resumed without errors in the kernel log.
USB devices (a SuperSpeed hub with an Ethernet adapter, and its
High-Speed part) stayed connected across suspend.
Out-of-tree patches
-------------------
To test this series, out-of-tree patches were needed and used:
1) Upstream TF-A does not complete suspend-to-RAM on this board yet, so the
tests used Rockchip's BL31 (rkbin v1.47), configured through a small
out-of-tree driver. The plan is to get suspend working in TF-A instead.
2) The inno-usb2 PHY has to be resumed when its 480 MHz clock is enabled,
otherwise EHCI/OHCI resume hangs. This is addressed by Sebastian
Reichel's inno-usb2 series [1].
3) The GPU and NPU domain supplies were kept always-on. genpd powers
these domains on in the noirq resume phase, when their regulators (on
I2C/SPI) cannot be reached yet. I'm not sure what to do here, yet.
[1] https://lore.kernel.org/linux-phy/20261001-phy-rockchip-inno-usb2-clock-fix-v2-4-e01bf509359e@collabora.com/
Known issues
------------
PCIe devices do not survive resume; this depends on system PM
support in pcie-dw-rockchip [2].
[2] https://lore.kernel.org/r/20260316-rockchip-pcie-system-suspend-v5-0-5bb5ad37d643@collabora.com
Tool use
--------
These patches were developed with an LLM-based coding assistant (Claude
Code). It ran the suspend/resume tests on the hardware, analysed the
kernel logs to find the causes of the failures, and drafted the code
changes and commit messages. I reviewed all changes and tested them as
described above.
Signed-off-by: Jakob Unterwurzacher <jakob.unterwurzacher@cherry.de>
---
Jakob Unterwurzacher (4):
Input: rk805-pwrkey - enable the wakeup interrupt during system suspend
mfd: rk8xx-core: keep the PMIC interrupt disabled during system suspend
mfd: rk8xx-spi: add system sleep PM ops
arm64: dts: rockchip: put the PMIC into sleep mode in suspend on RK3588 Tiger
arch/arm64/boot/dts/rockchip/rk3588-tiger.dtsi | 6 ++--
drivers/input/misc/rk805-pwrkey.c | 42 +++++++++++++++++++++++++-
drivers/mfd/rk8xx-core.c | 19 +++++++++++-
drivers/mfd/rk8xx-spi.c | 3 ++
include/linux/mfd/rk808.h | 1 +
5 files changed, 66 insertions(+), 5 deletions(-)
---
base-commit: 8f6620b65ae2458c36cbc9569a26fc2d777593a3
change-id: 20261028-dev-tiger-v7-4-pre-20261028-tiger-suspend-b4-13b6ec08d2c5
Best regards,
--
Jakob Unterwurzacher <jakob.unterwurzacher@cherry.de>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/4] Input: rk805-pwrkey - enable the wakeup interrupt during system suspend
2026-10-29 10:06 [PATCH 0/4] Suspend-to-RAM fixes for RK3588 + SPI-connected RK806 PMIC, enable PMIC sleep on RK3588 Tiger Jakob Unterwurzacher
@ 2026-10-29 10:06 ` Jakob Unterwurzacher
2026-10-29 10:06 ` [PATCH 2/4] mfd: rk8xx-core: keep the PMIC interrupt disabled " Jakob Unterwurzacher
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Jakob Unterwurzacher @ 2026-10-29 10:06 UTC (permalink / raw)
To: Dmitry Torokhov, Joseph Chen, Lee Jones, Sebastian Reichel,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner
Cc: linux-arm-kernel, linux-rockchip, linux-kernel, linux-input, mfd,
devicetree, Jakob Unterwurzacher
From: Jakob Unterwurzacher <jakob.unterwurzacher@cherry.de>
The driver marks the device as wakeup capable, but never enables the
power key interrupt as a wakeup interrupt. As a consequence, the PMIC
interrupt line is masked during system suspend and the power key cannot
wake up the system, e.g. from suspend-to-ram on RK3588 with an RK806.
Enable the interrupt as wakeup interrupt in the suspend callback if the
device may wake up the system, and disable it again on resume.
This is done in the regular suspend phase on purpose, rather than with
dev_pm_set_wake_irq(), which arms the wakeup in the noirq phase: there,
enabling it updates the PMIC's interrupt registers through regmap-irq,
which fails when the PMIC is connected via SPI:
spi_master spi2: Failed to power device: -13
rk8xx-spi spi2.0: Failed to sync masks in 7a
Fixes: 5a35b85c2d92 ("Input: add power key driver for Rockchip RK805 PMIC")
---
drivers/input/misc/rk805-pwrkey.c | 42 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 41 insertions(+), 1 deletion(-)
diff --git a/drivers/input/misc/rk805-pwrkey.c b/drivers/input/misc/rk805-pwrkey.c
index 76873aa005b41..9b64ec7463c62 100644
--- a/drivers/input/misc/rk805-pwrkey.c
+++ b/drivers/input/misc/rk805-pwrkey.c
@@ -15,6 +15,10 @@
#include <linux/module.h>
#include <linux/platform_device.h>
+struct rk805_pwrkey {
+ int irq;
+};
+
static irqreturn_t pwrkey_fall_irq(int irq, void *_pwr)
{
struct input_dev *pwr = _pwr;
@@ -37,10 +41,15 @@ static irqreturn_t pwrkey_rise_irq(int irq, void *_pwr)
static int rk805_pwrkey_probe(struct platform_device *pdev)
{
+ struct rk805_pwrkey *priv;
struct input_dev *pwr;
int fall_irq, rise_irq;
int err;
+ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
+ if (!priv)
+ return -ENOMEM;
+
pwr = devm_input_allocate_device(&pdev->dev);
if (!pwr) {
dev_err(&pdev->dev, "Can't allocate power button\n");
@@ -84,16 +93,47 @@ static int rk805_pwrkey_probe(struct platform_device *pdev)
return err;
}
- platform_set_drvdata(pdev, pwr);
+ priv->irq = fall_irq;
+ platform_set_drvdata(pdev, priv);
device_init_wakeup(&pdev->dev, true);
return 0;
}
+/*
+ * Arm the wakeup in the regular suspend phase rather than with
+ * dev_pm_set_wake_irq(), which does it in the noirq phase: enabling the
+ * wakeup updates the PMIC's interrupt registers, which is no longer
+ * possible once the bus to the PMIC (e.g. SPI on RK806) is suspended.
+ */
+static int rk805_pwrkey_suspend(struct device *dev)
+{
+ struct rk805_pwrkey *priv = dev_get_drvdata(dev);
+
+ if (device_may_wakeup(dev))
+ enable_irq_wake(priv->irq);
+
+ return 0;
+}
+
+static int rk805_pwrkey_resume(struct device *dev)
+{
+ struct rk805_pwrkey *priv = dev_get_drvdata(dev);
+
+ if (device_may_wakeup(dev))
+ disable_irq_wake(priv->irq);
+
+ return 0;
+}
+
+static DEFINE_SIMPLE_DEV_PM_OPS(rk805_pwrkey_pm_ops, rk805_pwrkey_suspend,
+ rk805_pwrkey_resume);
+
static struct platform_driver rk805_pwrkey_driver = {
.probe = rk805_pwrkey_probe,
.driver = {
.name = "rk805-pwrkey",
+ .pm = pm_sleep_ptr(&rk805_pwrkey_pm_ops),
},
};
module_platform_driver(rk805_pwrkey_driver);
--
2.47.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/4] mfd: rk8xx-core: keep the PMIC interrupt disabled during system suspend
2026-10-29 10:06 [PATCH 0/4] Suspend-to-RAM fixes for RK3588 + SPI-connected RK806 PMIC, enable PMIC sleep on RK3588 Tiger Jakob Unterwurzacher
2026-10-29 10:06 ` [PATCH 1/4] Input: rk805-pwrkey - enable the wakeup interrupt during system suspend Jakob Unterwurzacher
@ 2026-10-29 10:06 ` Jakob Unterwurzacher
2026-10-29 10:21 ` sashiko-bot
2026-10-29 10:06 ` [PATCH 3/4] mfd: rk8xx-spi: add system sleep PM ops Jakob Unterwurzacher
` (2 subsequent siblings)
4 siblings, 1 reply; 7+ messages in thread
From: Jakob Unterwurzacher @ 2026-10-29 10:06 UTC (permalink / raw)
To: Dmitry Torokhov, Joseph Chen, Lee Jones, Sebastian Reichel,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner
Cc: linux-arm-kernel, linux-rockchip, linux-kernel, linux-input, mfd,
devicetree, Jakob Unterwurzacher
From: Jakob Unterwurzacher <jakob.unterwurzacher@cherry.de>
When the system is woken up by the PMIC (e.g. by the power key), the
PMIC interrupt is handled as soon as interrupts are re-enabled on
resume. At that point, the bus to the PMIC may not have resumed yet, so
reading and acking the interrupt status fails. On RK3588 with an RK806
on SPI:
spi_master spi2: noqueue transfer failed
rk8xx-spi spi2.0: Failed to ack 0x79: -13
Disable the interrupt at the end of rk8xx_suspend() and re-enable it at
the start of rk8xx_resume(). Both run in the regular suspend/resume
phase, while the parent bus controller is active. If the interrupt is a
wakeup source, it stays armed while disabled, and the pending event is
replayed by enable_irq() on resume.
Store the interrupt number in struct rk808 for this.
---
drivers/mfd/rk8xx-core.c | 19 ++++++++++++++++++-
include/linux/mfd/rk808.h | 1 +
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/drivers/mfd/rk8xx-core.c b/drivers/mfd/rk8xx-core.c
index 21182df45d1b6..2ae9107fc5161 100644
--- a/drivers/mfd/rk8xx-core.c
+++ b/drivers/mfd/rk8xx-core.c
@@ -851,6 +851,8 @@ int rk8xx_probe(struct device *dev, int variant, unsigned int irq, struct regmap
if (!irq)
return dev_err_probe(dev, -EINVAL, "No interrupt support, no core IRQ\n");
+ rk808->irq = irq;
+
ret = devm_regmap_add_irq_chip(dev, rk808->regmap, irq,
IRQF_ONESHOT | dual_support, -1,
rk808->regmap_irq_chip, &rk808->irq_data);
@@ -929,7 +931,20 @@ int rk8xx_suspend(struct device *dev)
break;
}
- return ret;
+ if (ret)
+ return ret;
+
+ /*
+ * Keep the interrupt disabled while the bus to the PMIC may be
+ * suspended: otherwise a wakeup event (e.g. the power key) is handled
+ * as soon as interrupts are re-enabled on resume, before the bus has
+ * resumed, and reading/acking the interrupt status fails. If the
+ * interrupt is a wakeup source, it stays armed, and the pending event
+ * is replayed by enable_irq() on resume.
+ */
+ disable_irq(rk808->irq);
+
+ return 0;
}
EXPORT_SYMBOL_GPL(rk8xx_suspend);
@@ -938,6 +953,8 @@ int rk8xx_resume(struct device *dev)
struct rk808 *rk808 = dev_get_drvdata(dev);
int ret = 0;
+ enable_irq(rk808->irq);
+
switch (rk808->variant) {
case RK809_ID:
case RK817_ID:
diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
index 7ffc904c864c9..1255de484ab51 100644
--- a/include/linux/mfd/rk808.h
+++ b/include/linux/mfd/rk808.h
@@ -1461,6 +1461,7 @@ enum {
struct rk808 {
struct device *dev;
+ unsigned int irq;
struct regmap_irq_chip_data *irq_data;
struct regmap *regmap;
long variant;
--
2.47.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/4] mfd: rk8xx-spi: add system sleep PM ops
2026-10-29 10:06 [PATCH 0/4] Suspend-to-RAM fixes for RK3588 + SPI-connected RK806 PMIC, enable PMIC sleep on RK3588 Tiger Jakob Unterwurzacher
2026-10-29 10:06 ` [PATCH 1/4] Input: rk805-pwrkey - enable the wakeup interrupt during system suspend Jakob Unterwurzacher
2026-10-29 10:06 ` [PATCH 2/4] mfd: rk8xx-core: keep the PMIC interrupt disabled " Jakob Unterwurzacher
@ 2026-10-29 10:06 ` Jakob Unterwurzacher
2026-10-29 10:06 ` [PATCH 4/4] arm64: dts: rockchip: put the PMIC into sleep mode in suspend on RK3588 Tiger Jakob Unterwurzacher
2026-10-29 19:31 ` [PATCH 0/4] Suspend-to-RAM fixes for RK3588 + SPI-connected RK806 PMIC, enable PMIC sleep " Quentin Schulz
4 siblings, 0 replies; 7+ messages in thread
From: Jakob Unterwurzacher @ 2026-10-29 10:06 UTC (permalink / raw)
To: Dmitry Torokhov, Joseph Chen, Lee Jones, Sebastian Reichel,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner
Cc: linux-arm-kernel, linux-rockchip, linux-kernel, linux-input, mfd,
devicetree, Jakob Unterwurzacher
From: Jakob Unterwurzacher <jakob.unterwurzacher@cherry.de>
Unlike rk8xx-i2c, the SPI driver does not hook up rk8xx_suspend() and
rk8xx_resume(), so the RK806 never gets its system sleep handling, e.g.
keeping its interrupt disabled while the SPI controller is suspended.
Add the same PM ops as rk8xx-i2c.
Fixes: 210f418f8ace ("mfd: rk8xx: Add rk806 support")
---
drivers/mfd/rk8xx-spi.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/mfd/rk8xx-spi.c b/drivers/mfd/rk8xx-spi.c
index bb85fe60518f6..a0b7d7a058108 100644
--- a/drivers/mfd/rk8xx-spi.c
+++ b/drivers/mfd/rk8xx-spi.c
@@ -97,6 +97,8 @@ static int rk8xx_spi_probe(struct spi_device *spi)
return rk8xx_probe(&spi->dev, RK806_ID, spi->irq, regmap);
}
+static DEFINE_SIMPLE_DEV_PM_OPS(rk8xx_spi_pm_ops, rk8xx_suspend, rk8xx_resume);
+
static const struct of_device_id rk8xx_spi_of_match[] = {
{ .compatible = "rockchip,rk806", },
{ }
@@ -113,6 +115,7 @@ static struct spi_driver rk8xx_spi_driver = {
.driver = {
.name = "rk8xx-spi",
.of_match_table = rk8xx_spi_of_match,
+ .pm = pm_sleep_ptr(&rk8xx_spi_pm_ops),
},
.probe = rk8xx_spi_probe,
.id_table = rk8xx_spi_id_table,
--
2.47.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/4] arm64: dts: rockchip: put the PMIC into sleep mode in suspend on RK3588 Tiger
2026-10-29 10:06 [PATCH 0/4] Suspend-to-RAM fixes for RK3588 + SPI-connected RK806 PMIC, enable PMIC sleep on RK3588 Tiger Jakob Unterwurzacher
` (2 preceding siblings ...)
2026-10-29 10:06 ` [PATCH 3/4] mfd: rk8xx-spi: add system sleep PM ops Jakob Unterwurzacher
@ 2026-10-29 10:06 ` Jakob Unterwurzacher
2026-10-29 19:31 ` [PATCH 0/4] Suspend-to-RAM fixes for RK3588 + SPI-connected RK806 PMIC, enable PMIC sleep " Quentin Schulz
4 siblings, 0 replies; 7+ messages in thread
From: Jakob Unterwurzacher @ 2026-10-29 10:06 UTC (permalink / raw)
To: Dmitry Torokhov, Joseph Chen, Lee Jones, Sebastian Reichel,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner
Cc: linux-arm-kernel, linux-rockchip, linux-kernel, linux-input, mfd,
devicetree, Jakob Unterwurzacher
From: Jakob Unterwurzacher <jakob.unterwurzacher@cherry.de>
The RK806's PWRCTRL1 pin is connected to the SoC's pmic_sleep1 output,
which the firmware (TF-A) asserts when the SoC enters suspend-to-ram.
It is configured for no function, though, so the PMIC ignores it: all
regulators stay on in suspend and the regulator-state-mem settings have
no effect.
Configure the pin for the sleep function instead, like other RK806
boards do.
Measured on RK3588 Tiger on Haikou, suspend-to-ram with the logic
domain powered off by the firmware, module supply current (5 V):
PMIC pin with no function: 0.218 A (1.09 W)
PMIC pin with sleep function: 0.086 A (0.43 W)
---
arch/arm64/boot/dts/rockchip/rk3588-tiger.dtsi | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm64/boot/dts/rockchip/rk3588-tiger.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-tiger.dtsi
index 161c89c62bcda..592a2d11b36b9 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-tiger.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588-tiger.dtsi
@@ -471,7 +471,7 @@ pmic@0 {
gpio-controller;
#gpio-cells = <2>;
pinctrl-names = "default";
- pinctrl-0 = <&pmic_pins>, <&rk806_dvs1_null>,
+ pinctrl-0 = <&pmic_pins>, <&rk806_dvs1_slp>,
<&rk806_dvs2_null>, <&rk806_dvs3_null>;
spi-max-frequency = <1000000>;
system-power-controller;
@@ -492,9 +492,9 @@ pmic@0 {
vcca-supply = <&vcc5v0_sys>;
rockchip,reset-mode = <RK806_RESTART>;
- rk806_dvs1_null: dvs1-null-pins {
+ rk806_dvs1_slp: dvs1-slp-pins {
pins = "gpio_pwrctrl1";
- function = "pin_fun0";
+ function = "pin_fun1";
};
rk806_dvs2_null: dvs2-null-pins {
--
2.47.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/4] mfd: rk8xx-core: keep the PMIC interrupt disabled during system suspend
2026-10-29 10:06 ` [PATCH 2/4] mfd: rk8xx-core: keep the PMIC interrupt disabled " Jakob Unterwurzacher
@ 2026-10-29 10:21 ` sashiko-bot
0 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-10-29 10:21 UTC (permalink / raw)
To: Jakob Unterwurzacher
Cc: linux-input, mfd, devicetree, robh, conor+dt, dmitry.torokhov,
lee
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] mfd: rk8xx-core: disable_irq() in rk8xx_suspend() breaks s2idle wakeup
--
commit 1642fdff105aee2817fbf318588a972d4d3d49a4
Author: Jakob Unterwurzacher <jakob.unterwurzacher@cherry.de>
mfd: rk8xx-core: keep the PMIC interrupt disabled during system suspend
This commit disables the PMIC interrupt at the end of rk8xx_suspend() and
re-enables it at the start of rk8xx_resume() so that wakeup interrupts are
not handled before the parent bus controller has resumed.
> diff --git a/drivers/mfd/rk8xx-core.c b/drivers/mfd/rk8xx-core.c
> index 3dcf6abfda74f..3a68a7974ed06 100644
> --- a/drivers/mfd/rk8xx-core.c
> +++ b/drivers/mfd/rk8xx-core.c
[ ... ]
> @@ -929,7 +931,20 @@ int rk8xx_suspend(struct device *dev)
> break;
> }
>
> - return ret;
> + if (ret)
> + return ret;
> +
> + /*
> + * Keep the interrupt disabled while the bus to the PMIC may be
> + * suspended: otherwise a wakeup event (e.g. the power key) is handled
> + * as soon as interrupts are re-enabled on resume, before the bus has
> + * resumed, and reading/acking the interrupt status fails. If the
> + * interrupt is a wakeup source, it stays armed, and the pending event
> + * is replayed by enable_irq() on resume.
> + */
> + disable_irq(rk808->irq);
[Severity: High]
Does calling disable_irq(rk808->irq) in rk8xx_suspend() break wakeup from
suspend-to-idle (s2idle) on Rockchip platforms?
On Rockchip SoCs, the PMIC interrupt parent is the Rockchip GPIO irqchip in
drivers/gpio/gpio-rockchip.c, which implements rockchip_irq_disable() to mask
the pin in hardware and does not set the irqchip wakeup-on-suspend flag:
drivers/gpio/gpio-rockchip.c:rockchip_irq_disable() {
irq_gc_mask_set_bit(d);
}
When disable_irq(rk808->irq) runs during dpm_suspend() -> rk8xx_suspend(),
it invokes __disable_irq() -> irq_disable() -> __irq_disable() ->
rockchip_irq_disable(), masking the interrupt line in the GPIO int_mask
register and marking the descriptor disabled.
Later in dpm_suspend_noirq() -> suspend_device_irqs(),
kernel/irq/pm.c:suspend_device_irq() only re-enables a disabled wakeup
interrupt in the irqchip if that flag is set on the chip:
kernel/irq/pm.c:suspend_device_irq() {
if (irqd_is_wakeup_set(irqd)) {
irqd_set(irqd, IRQD_WAKEUP_ARMED);
if ((chipflags & IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND) &&
irqd_irq_disabled(irqd)) {
__enable_irq(desc);
irqd_set(irqd, IRQD_IRQ_ENABLED_ON_SUSPEND);
}
}
During suspend-to-RAM, syscore_suspend() subsequently runs irq_gc_suspend() ->
rockchip_irq_suspend(), which writes ~gc->wake_active to int_mask:
drivers/gpio/gpio-rockchip.c:rockchip_irq_suspend() {
struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
struct rockchip_pin_bank *bank = gc->private;
bank->saved_masks = irq_reg_readl(gc, bank->gpio_regs->int_mask);
irq_reg_writel(gc, ~gc->wake_active, bank->gpio_regs->int_mask);
}
However, during suspend-to-idle, kernel/power/suspend.c:suspend_enter() enters
s2idle_loop() and jumps to Platform_wake without calling syscore_suspend():
kernel/power/suspend.c:suspend_enter() {
if (state == PM_SUSPEND_TO_IDLE) {
s2idle_loop();
goto Platform_wake;
}
}
Wouldn't that leave rk808->irq masked in the GPIO hardware throughout
s2idle_loop(), preventing the PMIC power key or RTC alarm from waking the
system from s2idle?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261029-dev-tiger-v7-4-pre-20261028-tiger-suspend-b4-v1-0-cb12621c1fb4@cherry.de?part=2
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/4] Suspend-to-RAM fixes for RK3588 + SPI-connected RK806 PMIC, enable PMIC sleep on RK3588 Tiger
2026-10-29 10:06 [PATCH 0/4] Suspend-to-RAM fixes for RK3588 + SPI-connected RK806 PMIC, enable PMIC sleep on RK3588 Tiger Jakob Unterwurzacher
` (3 preceding siblings ...)
2026-10-29 10:06 ` [PATCH 4/4] arm64: dts: rockchip: put the PMIC into sleep mode in suspend on RK3588 Tiger Jakob Unterwurzacher
@ 2026-10-29 19:31 ` Quentin Schulz
4 siblings, 0 replies; 7+ messages in thread
From: Quentin Schulz @ 2026-10-29 19:31 UTC (permalink / raw)
To: Jakob Unterwurzacher, Dmitry Torokhov, Joseph Chen, Lee Jones,
Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Heiko Stuebner
Cc: linux-arm-kernel, linux-rockchip, linux-kernel, linux-input, mfd,
devicetree, Jakob Unterwurzacher
Hi Jakob,
On 10/29/26 11:06 AM, Jakob Unterwurzacher wrote:
> This series, together with a few out-of-tree patches (see below), makes
> suspend-to-RAM on RK3588-Tiger work, down to a power consumption of
> about 0.4 W. Patches 1-3 apply to all boards with an RK806 PMIC
> connected via SPI, which includes most RK3588 boards.
>
> Patch 1 ("Input: rk805-pwrkey - enable the wakeup interrupt during system suspend")
> arms the power key interrupt as a wakeup source, so that the
> power key can wake up the system. This is done in the regular suspend
> phase, because the SPI bus to the PMIC can no longer be used in the
> noirq phase.
>
> Patch 2 ("mfd: rk8xx-core: keep the PMIC interrupt disabled during system suspend")
> keeps the PMIC interrupt disabled across system suspend, so that its
> handler does not run before the bus to the PMIC has resumed.
>
> Patch 3 ("mfd: rk8xx-spi: add system sleep PM ops")
> hooks up the existing rk8xx suspend/resume callbacks for the SPI
> variant, which so far lacked them.
>
> Patch 4 ("arm64: dts: rockchip: put the PMIC into sleep mode in suspend on RK3588 Tiger")
> configures the RK806 PWRCTRL1 pin on RK3588 Tiger for its sleep
> function, so that the regulator suspend states take effect. This lowers
> the module's power consumption in suspend-to-RAM from 1.09 W to 0.43 W.
>
> The patches do not depend on each other and can be applied through
> their respective trees.
>
Then have them in separate series. Series should be as small as
possible, down to a single commit if possible.
> Testing
> -------
>
> Tested on RK3588-Tiger on the Haikou baseboard, on top of the v7.4 merge
> window (a8530b69fc4dd): 30 consecutive suspend-to-RAM cycles, each woken
> up by the PMIC power key, all resumed without errors in the kernel log.
> USB devices (a SuperSpeed hub with an Ethernet adapter, and its
> High-Speed part) stayed connected across suspend.
>
> Out-of-tree patches
> -------------------
>
> To test this series, out-of-tree patches were needed and used:
>
> 1) Upstream TF-A does not complete suspend-to-RAM on this board yet, so the
> tests used Rockchip's BL31 (rkbin v1.47), configured through a small
> out-of-tree driver. The plan is to get suspend working in TF-A instead.
>
I'm guessing you(r LLM) meant upstream TF-A here? Or what is it that you
mean?
> 2) The inno-usb2 PHY has to be resumed when its 480 MHz clock is enabled,
> otherwise EHCI/OHCI resume hangs. This is addressed by Sebastian
> Reichel's inno-usb2 series [1].
>
Having access to your downstream branch, you have a patch generated by
your LLM and not Sebastian's patch series. Either use what Sebastian
posted, or be more careful in your choice of words as I read the above
as implying you used his series.
> 3) The GPU and NPU domain supplies were kept always-on. genpd powers
> these domains on in the noirq resume phase, when their regulators (on
> I2C/SPI) cannot be reached yet. I'm not sure what to do here, yet.
>
> [1] https://lore.kernel.org/linux-phy/20261001-phy-rockchip-inno-usb2-clock-fix-v2-4-e01bf509359e@collabora.com/
>
> Known issues
> ------------
>
> PCIe devices do not survive resume; this depends on system PM
> support in pcie-dw-rockchip [2].
>
> [2] https://lore.kernel.org/r/20260316-rockchip-pcie-system-suspend-v5-0-5bb5ad37d643@collabora.com
>
There already is a v6 from almost two months ago. Did you actually test
with the v5 or are you just hinting at what could be helping resume PCIe
devices?
I'm sure Sebastian would be happy to receive a nice Tested-by tag if you
did indeed test that. Link to v6:
https://lore.kernel.org/all/20260908-rockchip-pcie-system-suspend-v6-0-fbabcca9921b@collabora.com/
> Tool use
> --------
>
> These patches were developed with an LLM-based coding assistant (Claude
> Code). It ran the suspend/resume tests on the hardware, analysed the
> kernel logs to find the causes of the failures, and drafted the code
> changes and commit messages. I reviewed all changes and tested them as
> described above.
>
All your patches are missing the Signed-off-by, required to signify
DCO[1]. LLMs are forbidden to add it, so I guess you missed that when
reviewing the patches before sending. Please triple check that you agree
to all criteria listed in the documentation before adding the SoB to
patches generated by LLMs[2].
[1]
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin
[2]
https://docs.kernel.org/process/coding-assistants.html#signed-off-by-and-developer-certificate-of-origin
Cheers,
Quentin
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-10-29 19:31 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-29 10:06 [PATCH 0/4] Suspend-to-RAM fixes for RK3588 + SPI-connected RK806 PMIC, enable PMIC sleep on RK3588 Tiger Jakob Unterwurzacher
2026-10-29 10:06 ` [PATCH 1/4] Input: rk805-pwrkey - enable the wakeup interrupt during system suspend Jakob Unterwurzacher
2026-10-29 10:06 ` [PATCH 2/4] mfd: rk8xx-core: keep the PMIC interrupt disabled " Jakob Unterwurzacher
2026-10-29 10:21 ` sashiko-bot
2026-10-29 10:06 ` [PATCH 3/4] mfd: rk8xx-spi: add system sleep PM ops Jakob Unterwurzacher
2026-10-29 10:06 ` [PATCH 4/4] arm64: dts: rockchip: put the PMIC into sleep mode in suspend on RK3588 Tiger Jakob Unterwurzacher
2026-10-29 19:31 ` [PATCH 0/4] Suspend-to-RAM fixes for RK3588 + SPI-connected RK806 PMIC, enable PMIC sleep " Quentin Schulz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox