From: Tony Lindgren <tony@atomide.com>
To: Thomas Richard <thomas.richard@bootlin.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>,
"Théo Lebrun" <theo.lebrun@bootlin.com>,
"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 13:14:15 +0200 [thread overview]
Message-ID: <20231220111415.GZ5166@atomide.com> (raw)
In-Reply-To: <4c31acd8-4edb-44f5-9a90-cb2f2dc530b6@bootlin.com>
* 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?
> > 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:
static int omap_i2c_suspend(struct device *dev)
{
return pm_runtime_resume_and_get(dev);
}
static int omap_i2c_resume(struct device *dev)
{
pm_runtime_mark_last_busy(dev);
pm_runtime_put_autosuspend(dev);
return 0;
}
> > static const struct dev_pm_ops omap_i2c_pm_ops = {
> > SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
> > pm_runtime_force_resume)
> > + SET_SYSTEM_SLEEP_PM_OPS(omap_i2c_suspend, omap_i2c_resume)
> > SET_RUNTIME_PM_OPS(omap_i2c_runtime_suspend,
> > omap_i2c_runtime_resume, NULL)
> > };
And with the changes you did to omap_i2c_pm_ops naturally. This way
the controller should stay active until noirq ops.
Of course it's possible I did not quite understand what you're trying
to do, but if so please let me know :)
Regards,
Tony
next prev parent reply other threads:[~2023-12-20 11:14 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 [this message]
2023-12-20 11:36 ` Thomas Richard
2023-12-20 13:46 ` Théo Lebrun
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=20231220111415.GZ5166@atomide.com \
--to=tony@atomide.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=theo.lebrun@bootlin.com \
--cc=thomas.richard@bootlin.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