From: Mika Westerberg <mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: Sylwester Nawrocki
<sylvester.nawrocki-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Sylwester Nawrocki
<s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
Kevin Hilman <khilman-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
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,
Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Dmitry Torokhov
<dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Mauro Carvalho Chehab
<m.chehab-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
Samuel Ortiz <sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>,
Greg Kroah-Hartman
<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
Liam Girdwood <lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Kyungmin Park
<kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Subject: Re: [PATCH v2 1/9] i2c: prepare runtime PM support for I2C client devices
Date: Mon, 16 Sep 2013 11:47:08 +0300 [thread overview]
Message-ID: <20130916084708.GN7393@intel.com> (raw)
In-Reply-To: <5235BA9C.1090509-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
On Sun, Sep 15, 2013 at 03:48:12PM +0200, Sylwester Nawrocki wrote:
> On 09/13/2013 05:40 PM, Mika Westerberg wrote:
> [...]
> >>>The call to pm_runtime_get_noresume() should make sure that the device is
> >>>in active state (at least in state where it can access the bus) if I'm
> >>>understanding this right.
> >>
> >>I can't see how this would happen. How runtime_resume/runtime_suspend
> >>callbacks would get invoked with this code, if, e.g. originally driver called
> >>pm_runtime_enable(), pm_runtime_get_sync(), pm_runtime_put_sync() in probe() ?
> >
> >The driver callbacks are not called but if the device has been attached to
> >a power domain (like we do with ACPI) the power domain callbacks get called
> >and it brings the "bus" to such state that we are able to access the
> >device. That also was the reason I used _noresume() but didn't look too
> >close the implementation.
>
> OK, but if a client driver assumes default inactive power state it
> will expect
> its callbacks to get called. Otherwise exisiting code might break. So, e.g.
> in case of s5p-tv it would rather need to be something like:
>
> pm_runtime_put()
>
> pm_runtime_get_sync()
> sii9234_verify_version()
> pm_runtime_put(dev)
Yes, or even call directly its runtime_resume callback to bring the device
to the active state.
> >>pm_runtime_get_noresume() merely increments usage counter of a device.
> >>It seems that these changes will break the s5p-tv driver. I might be missing
> >>something though.
> >
> >You are right and Kevin also mentioned this. It should be pm_runtime_get(),
> >if I'm not mistaken.
>
> Note that client drivers usually call pm_runtime_enable() only when
> it is safe
> to call their driver's runtime PM callbacks. By enabling runtime PM
> before the
> client's driver has completely initialized we may risk that the
> callbacks are
> executed with uninitialized data, if I understand things correctly.
I think that calling pm_runtime_enable() on behalf of the client driver
shouldn't cause any problems. There is no PM events queued for that device
yet (and we have prevented that from happening when we called
_get_noresume() for the device).
Only when the client driver calls _put() things start to happen and at that
phase the runtime PM hooks should be usable.
> >>As Mark pointed out this is currently unwanted behaviour to runtime PM
> >>activate a bus controller device manually in the core for when the client's
> >>probe() is executed, since i2c core will activate the bus controller for when
> >>transfer is being carried out.
> >>
> >>But I can understand this is needed for ACPI and it shouldn't break existing
> >>drivers, that do runtime PM activate the client device in probe().
> >
> >Indeed, we don't want to break anything (and we still need something like
> >this for ACPI).
> >
> >>Now I'm sure this will break power management of the drivers/media/exynos4-is
> >>driver, due to incorrect power sequence (power domain and clocks handling).
> >>I'll try to take care of it in separate patch, as I have some patches pending,
> >>that move most of code from drivers/media/exynos4-is/fimc-is-sensor.c to
> >>drivers/media/i2c/s5k6a3.c.
> >
> >I missed that code when I converted existing users to this method. Sorry
> >about that (I can handle that in the next version).
> >
> >I quickly looked at it and I don't see anything that could break (once
> >converted). What it does is this:
> >
> > pm_runtime_no_callbacks(dev);
> > pm_runtime_enable(dev);
> >
> >changing that to:
> >
> > pm_runtime_no_callbacks(dev);
> > pm_runtime_put(dev);
> >
> >shouldn't cause problems AFAICT.
>
> Yes, considering this driver in isolation it should be fine.
>
> However, I observed system suspend issues when the I2C bus controller was
> being activated (which would happen in the I2C core after your changes)
> before some other driver has initialized.
>
> So to ensure things continue to work the "fimc-isp-i2c" driver would need
> to be registered after the "exynos4-fimc-is" driver has initialized. Or the
> "exynos4-fimc-is" would need to call of_platform_populate() to instantiate
> its all children devices as specified in device tree (see arch/arm/boot/dts/
> exynos4x12.dtsi in -next). "simple-bus" would then have to be not listed in
> the compatible property of that top level device. So to avoid regressions
> some additional changes would be needed, outside of this particular I2C
> client driver. I guess this could be avoided by better design of the
> exynos4-is driver right from the beginning. But it's all some times tricky
> when there is some many IP blocks involved and the hardware behaviour/device
> interactions are not always well documented.
OK.
I'm actually thinking that it is probably better now if we don't touch the
client runtime PM at all in the I2C core.
I proposed a less intrusive solution in this same thread where we power the
I2C controller briefly at the client ->probe() (In order to have all the
ACPI power resources etc. and the controller on) and let the client driver
handle their own runtime PM as they do currently.
Do you think that would work better wrt. fimc-isp-i2c driver?
next prev parent reply other threads:[~2013-09-16 8:47 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-11 15:32 [PATCH v2 0/9] runtime PM support for I2C and SPI client devices Mika Westerberg
2013-09-11 15:32 ` [PATCH v2 1/9] i2c: prepare runtime PM support for I2C " Mika Westerberg
2013-09-12 21:34 ` Kevin Hilman
[not found] ` <87vc25pvvm.fsf-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-09-12 21:40 ` Kevin Hilman
2013-09-13 6:54 ` Mika Westerberg
2013-09-13 9:59 ` Mark Brown
[not found] ` <20130913095950.GA29403-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-09-13 10:16 ` Mika Westerberg
2013-09-13 10:31 ` Mark Brown
[not found] ` <20130913103152.GE29403-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-09-13 11:50 ` Mika Westerberg
[not found] ` <20130913115035.GB7393-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-09-13 12:10 ` Mark Brown
2013-09-13 14:30 ` Kevin Hilman
2013-09-13 14:50 ` Mika Westerberg
[not found] ` <20130913145022.GC7393-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-09-13 17:31 ` Mika Westerberg
2013-09-13 21:10 ` Kevin Hilman
2013-09-15 6:41 ` Mika Westerberg
2013-09-15 12:47 ` Mark Brown
[not found] ` <20130915124744.GW29403-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-09-15 13:28 ` Mika Westerberg
2013-09-16 10:12 ` Mark Brown
[not found] ` <20130916101249.GX29403-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-09-16 14:38 ` Mika Westerberg
[not found] ` <20130916143811.GP7393-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-09-16 14:46 ` Graeme Gregory
2013-09-16 15:13 ` Mika Westerberg
2013-09-13 15:14 ` Sylwester Nawrocki
[not found] ` <52332BF0.4060605-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-09-13 15:40 ` Mika Westerberg
[not found] ` <20130913154013.GD7393-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-09-15 13:48 ` Sylwester Nawrocki
[not found] ` <5235BA9C.1090509-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-09-16 8:47 ` Mika Westerberg [this message]
2013-09-16 19:07 ` Rafael J. Wysocki
[not found] ` <1861747.RtS0ZLgUUN-sKB8Sp2ER+y1GS7QM15AGw@public.gmane.org>
2013-09-16 23:31 ` Mark Brown
[not found] ` <20130916233111.GB21013-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-09-17 1:25 ` Rafael J. Wysocki
[not found] ` <1820315.QOOAzSjac3-sKB8Sp2ER+y1GS7QM15AGw@public.gmane.org>
2013-09-17 10:48 ` Mark Brown
2013-09-17 11:00 ` Mika Westerberg
[not found] ` <20130917110021.GU7393-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-09-17 21:38 ` Rafael J. Wysocki
[not found] ` <20130916084708.GN7393-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-09-17 11:07 ` Sylwester Nawrocki
2013-09-24 5:18 ` Mika Westerberg
2013-09-12 22:06 ` Sylwester Nawrocki
2013-09-13 1:14 ` Aaron Lu
[not found] ` <523266EC.1060501-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-09-13 10:02 ` Mark Brown
2013-09-11 15:32 ` [PATCH v2 2/9] i2c: attach/detach I2C client device to the ACPI power domain Mika Westerberg
2013-09-11 15:32 ` [PATCH v2 3/9] Input: misc - convert existing I2C client drivers to use I2C core runtime PM Mika Westerberg
2013-09-11 15:32 ` [PATCH v2 4/9] [media] s5p-tv: convert " Mika Westerberg
2013-09-11 15:32 ` [PATCH v2 5/9] drivers/misc: convert existing I2C clients driver " Mika Westerberg
2013-09-12 21:29 ` Greg Kroah-Hartman
2013-09-11 15:32 ` [PATCH v2 6/9] mfd: wm8994: convert " Mika Westerberg
2013-09-11 16:12 ` Samuel Ortiz
2013-09-12 9:24 ` Mika Westerberg
[not found] ` <20130912092447.GJ7393-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-09-12 9:28 ` Samuel Ortiz
2013-09-11 15:32 ` [PATCH v2 7/9] ASoC: codecs: convert existing I2C client drivers " Mika Westerberg
[not found] ` <1378913560-2752-8-git-send-email-mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2013-09-11 15:44 ` Mark Brown
2013-09-11 15:32 ` [PATCH v2 8/9] spi: prepare runtime PM support for SPI devices Mika Westerberg
[not found] ` <1378913560-2752-9-git-send-email-mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2013-09-11 15:51 ` Mark Brown
2013-09-12 9:27 ` Mika Westerberg
[not found] ` <20130912092743.GK7393-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-09-12 9:31 ` Mark Brown
[not found] ` <20130912093145.GA29403-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-09-12 9:43 ` Mika Westerberg
2013-09-12 11:04 ` Rafael J. Wysocki
2013-09-12 11:04 ` Wolfram Sang
2013-09-12 12:20 ` Mika Westerberg
[not found] ` <14222641.vVF4lKBqCB-sKB8Sp2ER+y1GS7QM15AGw@public.gmane.org>
2013-09-12 12:25 ` Mika Westerberg
2013-09-11 15:32 ` [PATCH v2 9/9] spi: attach/detach SPI device to the ACPI power domain Mika Westerberg
2013-09-11 15:51 ` Mark Brown
[not found] ` <1378913560-2752-1-git-send-email-mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2013-09-11 15:53 ` [PATCH v2 0/9] runtime PM support for I2C and SPI client devices Mark Brown
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=20130916084708.GN7393@intel.com \
--to=mika.westerberg-vuqaysv1563yd54fqh9/ca@public.gmane.org \
--cc=aaron.lu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=arnd-r2nGTMty4D4@public.gmane.org \
--cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
--cc=khilman-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@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=m.chehab-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=rafael.j.wysocki-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=s.nawrocki-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=sylvester.nawrocki-Re5JQEeQqe8AvxtiuMwx3w@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).