From: "Théo Lebrun" <theo.lebrun@bootlin.com>
To: "Thomas Richard" <thomas.richard@bootlin.com>,
"Tony Lindgren" <tony@atomide.com>
Cc: <linux-pm@vger.kernel.org>, <linux-i2c@vger.kernel.org>,
<linux-omap@vger.kernel.org>,
"Vignesh Raghavendra" <vigneshr@ti.com>,
"Kevin Hilman" <khilman@kernel.org>,
"Gregory CLEMENT" <gregory.clement@bootlin.com>,
"Kumar Udit" <u-kumar1@ti.com>
Subject: Re: omap-i2c: runtime pm issue during suspend to ram
Date: Wed, 20 Dec 2023 14:46:39 +0100 [thread overview]
Message-ID: <CXT7H2RTWJLL.11PFC2VV861BW@bootlin.com> (raw)
In-Reply-To: <7b743758-fbc1-4cad-bfbc-d3fd3e69ce17@bootlin.com>
Hello,
On Wed Dec 20, 2023 at 12:36 PM CET, Thomas Richard wrote:
> On 12/20/23 12:14, Tony Lindgren wrote:
> > * Thomas Richard <thomas.richard@bootlin.com> [231220 10:50]:
> >> On 12/19/23 18:15, Thomas Richard wrote:
> >>> Hello,
> >>
> >> I add some people in this thread.
> >>
> >>>
> >>> I have a gpio expander (pca953x driver) connected to an i2c controller
> >>> managed by the omap-i2c driver.
> >>> And I have some issues with pm_runtime_force_suspend/resume during
> >>> suspend to ram.
> >>> For some reasons, related to hardware design, I need to access to this
> >>> gpio expander during suspend_noirq and resume_noirq. So I had to move
> >>> the suspend/resume of the pca953x to suspend_noirq/resume_noirq.
> >
> > Hmm at noirq level you need to do polling on the i2c controller?
>
> Hello Tony,
>
> Thanks for your reply.
>
> No, irq is still active in suspend_noirq for this i2c controller due to
> the flag IRQF_NO_SUSPEND [1].
> If this flag is set, the interrupt is still enabled in suspend_noirq [2].
>
> [1]
> https://elixir.bootlin.com/linux/v6.7-rc6/source/drivers/i2c/busses/i2c-omap.c#L1473
> [2]
> https://www.kernel.org/doc/html/latest/power/suspend-and-interrupts.html#the-irqf-no-suspend-flag
>
> >
> >>> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> >>> index 42165ef57946..fe79b27b46fd 100644
> >>> --- a/drivers/i2c/busses/i2c-omap.c
> >>> +++ b/drivers/i2c/busses/i2c-omap.c
> >>> @@ -1575,9 +1575,24 @@ static int __maybe_unused
> >>> omap_i2c_runtime_resume(struct device *dev)
> >>> return 0;
> >>> }
> >>>
> >>> +static int omap_i2c_suspend(struct device *dev)
> >>> +{
> >>> + pm_runtime_get_sync(dev);
> >>> + pm_runtime_disable(dev);
> >>> + return 0;
> >>> +}
> >
> > If you want the i2c controller enabled during suspend, you can leave it
> > enabled above, and as we already have SET_NOIRQ_SYSTEM_SLEEP_PM_OPS
> > doing force_suspend() and force_resume(), you can runtime PM put on
> > resume. So something like below might do the trick:
>
> Ok I'll test it. Thanks
The issue with this approach is that it requires knowing at suspend-time
if the controller will be used at resume_noirq-time. Ideally the
controller's behavior would not be modified until a xfer is done at
resume_noirq time. There are many platforms that use this driver that
probably don't need the controller woken up.
Thanks,
--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2023-12-20 13:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-19 17:15 omap-i2c: runtime pm issue during suspend to ram Thomas Richard
2023-12-20 10:49 ` Thomas Richard
2023-12-20 11:14 ` Tony Lindgren
2023-12-20 11:36 ` Thomas Richard
2023-12-20 13:46 ` Théo Lebrun [this message]
2023-12-26 16:47 ` Thomas Richard
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=CXT7H2RTWJLL.11PFC2VV861BW@bootlin.com \
--to=theo.lebrun@bootlin.com \
--cc=gregory.clement@bootlin.com \
--cc=khilman@kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=thomas.richard@bootlin.com \
--cc=tony@atomide.com \
--cc=u-kumar1@ti.com \
--cc=vigneshr@ti.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