Linux Input/HID development
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Jakob Unterwurzacher <jakobunt@gmail.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Joseph Chen <chenjh@rock-chips.com>,
	Sebastian Reichel <sebastian.reichel@collabora.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Heiko Stuebner <heiko@sntech.de>,
	linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-input@vger.kernel.org, mfd@lists.linux.dev,
	devicetree@vger.kernel.org,
	Jakob Unterwurzacher <jakob.unterwurzacher@cherry.de>
Subject: Re: [PATCH 2/4] mfd: rk8xx-core: keep the PMIC interrupt disabled during system suspend
Date: Thu, 19 Nov 2026 19:27:00 +0000	[thread overview]
Message-ID: <179510313469.63755.466425546513135743@kernel.org> (raw)
In-Reply-To: <20261029-dev-tiger-v7-4-pre-20261028-tiger-suspend-b4-v1-2-cb12621c1fb4@cherry.de>

> 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.

SoB?

> ---
>  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);

This is early - are you sure you want to do this right away?

> +
>  	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
>

-- 
Lee Jones

  parent reply	other threads:[~2026-11-19 19:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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-11-12  0:25   ` Dmitry Torokhov
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-11-19 19:27   ` Lee Jones [this message]
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
2026-11-12  0:03   ` Sebastian Reichel
2026-11-19  9:12   ` Jakob Unterwurzacher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179510313469.63755.466425546513135743@kernel.org \
    --to=lee@kernel.org \
    --cc=chenjh@rock-chips.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=heiko@sntech.de \
    --cc=jakob.unterwurzacher@cherry.de \
    --cc=jakobunt@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mfd@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=sebastian.reichel@collabora.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox