From: Mika Westerberg <mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>,
"Rafael J. Wysocki"
<rafael.j.wysocki-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Lv Zheng <lv.zheng-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Aaron Lu <aaron.lu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH RESEND 1/2] i2c: prepare runtime PM support for I2C client devices
Date: Tue, 10 Sep 2013 17:26:31 +0300 [thread overview]
Message-ID: <20130910142631.GL7393@intel.com> (raw)
In-Reply-To: <20130910122754.GK29403-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
On Tue, Sep 10, 2013 at 01:27:54PM +0100, Mark Brown wrote:
> On Tue, Sep 10, 2013 at 10:51:00AM +0300, Mika Westerberg wrote:
> > On Mon, Sep 09, 2013 at 04:40:28PM +0100, Mark Brown wrote:
>
> > > How is this going to interact with client devices which are already
> > > enabling runtime PM for themselves, and what are the advantages of doing
> > > this over having the client device enable runtime PM for itself (given
> > > that the client still needs an explicit put() adding)?
>
> > My understanding is that you can call pm_runtime_enable() several times
> > (provided that pm_runtime_disable() is called as many times). So that
> > should have no effect on the current drivers that already take advantage of
> > runtime PM.
>
> Not quite...
>
> > There is one difference though -- runtime PM is now blocked by default and
> > it needs to be unblocked from the userspace per each device.
>
> ...as you say.
>
> This seems crazy, why on earth would we want to have userspace be forced
> to manually go through every single device and manually enable power
> saving? I can't see anyone finding that helpful and it's going to be a
> pain to deploy.
There are things like HID over I2C devices (e.g touch screen) where going
to lower power states too aggressively makes the touch experience really
sluggish. However, other HID over I2C devices like sensor hubs it doesn't
matter that much. In order to get the best performance we have runtime PM
blocked by default (and leave it up to the user to unblock to get power
savings).
That's basically what PCI drivers currently do.
> However I had thought it was just a case of the drivers doing a put()
> instead of their current code to enable runtime PM (you mention that
> later on)?
User still needs to unblock runtime PM for the device. The driver can call
the runtime PM functions but they don't have any effect until runtime PM is
unblocked by the user.
However, I don't have problems dropping the call to pm_runtime_forbid() in
this patch and leave it up to the user to decide whether runtime PM should
be blocked for the device.
> That seems both sensible and doable, though it would need
> doing as part of the conversion to avoid regressions and I'd expect it
> does mean that SPI needs to be converted at the same time.
OK.
> > For the advantages compared to each driver handling it completely
> > themselves:
>
> > - Few lines less as you only need to call _put().
> > - It follows what is already been done for other buses, like PCI
> > and AMBA .
> > - The I2C core makes sure that the device is available (from bus
> > point of view) when the driver ->probe() is called.
>
> I can't understand your last point here at all, sorry. Can you expand
> please?
Sorry about that.
At least with ACPI enumerated I2C client devices, they might be powered off
by the BIOS (there are power resources attached to the devices). So when
the driver ->probe() is called we can't access the device's registers etc.
So we bind the device to the ACPI power domain (the second patch in this
series) and then call pm_runtime_get() for the device. That makes sure that
the device is accessible when ->probe() is called.
>
> > > Given that it's relatively common for devices to have both I2C and SPI
> > > control it seems like it'd be sensible to keep the policy common between
> > > the two buses to simplify driver implementation.
>
> > Yes and IMHO if I2C and SPI follows what has already been done for other
> > buses it should make the driver writer's job easier as the usage is similar
> > from one bus to another.
>
> So then the obvious followup question is why this is even something that
> needs to be implemented per bus? Shouldn't we be enhancing the driver
> core to do this, or is that the long term plan and this is a step on the
> road to doing that?
If we end up all buses implementing the same mechanism, I think it makes
sense to move it to the driver core.
next prev parent reply other threads:[~2013-09-10 14:26 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-09 13:34 [PATCH RESEND 0/2] runtime PM support for I2C clients Mika Westerberg
2013-09-09 13:34 ` [PATCH RESEND 1/2] i2c: prepare runtime PM support for I2C client devices Mika Westerberg
2013-09-09 15:40 ` Mark Brown
2013-09-10 7:51 ` Mika Westerberg
[not found] ` <20130910075100.GK7393-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-09-10 11:38 ` Rafael J. Wysocki
2013-09-10 12:27 ` Mark Brown
[not found] ` <20130910122754.GK29403-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-09-10 14:26 ` Mika Westerberg [this message]
2013-09-10 16:13 ` Mark Brown
[not found] ` <20130910161321.GM29403-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-09-10 20:04 ` Rafael J. Wysocki
[not found] ` <3397524.g9aUWuArnm-sKB8Sp2ER+y1GS7QM15AGw@public.gmane.org>
2013-09-10 21:35 ` Mark Brown
[not found] ` <20130910213522.GG29403-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-09-10 22:32 ` Rafael J. Wysocki
2013-09-11 1:01 ` Aaron Lu
2013-09-11 9:55 ` Mark Brown
[not found] ` <20130911095552.GI29403-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-09-11 11:05 ` Mika Westerberg
2013-09-11 11:14 ` Mark Brown
2013-09-11 11:24 ` Mika Westerberg
[not found] ` <522FC0DC.9030708-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-09-12 21:07 ` Kevin Hilman
[not found] ` <87eh8trbob.fsf-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-09-12 22:01 ` Mark Brown
2013-09-09 13:34 ` [PATCH RESEND 2/2] i2c: attach/detach I2C client device to the ACPI power domain Mika Westerberg
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=20130910142631.GL7393@intel.com \
--to=mika.westerberg-vuqaysv1563yd54fqh9/ca@public.gmane.org \
--cc=aaron.lu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=lv.zheng-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=rafael.j.wysocki-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org \
/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;
as well as URLs for NNTP newsgroup(s).