From: Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
To: Vishwanath BS <vishwanath.bs-l0cyMroinI0@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Partha Basak <p-basak2-l0cyMroinI0@public.gmane.org>,
"Rafael J. Wysocki" <rjw-KKrjLPT3xs0@public.gmane.org>,
Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>,
Mark Brown
<broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
Subject: Re: [PATCH] I2C: Fix for suspend/resume issue in i2c-core
Date: Mon, 30 Aug 2010 11:43:23 -0700 [thread overview]
Message-ID: <87wrr83pro.fsf@deeprootsystems.com> (raw)
In-Reply-To: <1283219414-8798-1-git-send-email-vishwanath.bs-l0cyMroinI0@public.gmane.org> (Vishwanath BS's message of "Tue, 31 Aug 2010 07:20:14 +0530")
Vishwanath BS <vishwanath.bs-l0cyMroinI0@public.gmane.org> writes:
> In current i2c core driver, pm_runtime_set_active call from i2c_device_pm_resume
> is not balanced by pm_runtime_set_suspended call from i2c_device_pm_suspend.
> pm_runtime_set_active called from resume path will increase the child_count of
> the device's parent. However, matching pm_runtime_set_suspended is not called
> in suspend routine because of which child_count of the device's parent
> is not balanced, preventing the parent device to idle.
> Issue has been fixed by adding pm_runtime_set_suspended call inside suspend
> reoutine which will make sure that child_counts are balanced.
> This fix has been tested on OMAP4430.
>
> Signed-off-by: Partha Basak <p-basak2-l0cyMroinI0@public.gmane.org>
> Signed-off-by: Vishwanath BS <vishwanath.bs-l0cyMroinI0@public.gmane.org>
>
> Cc: Rafael J. Wysocki <rjw-KKrjLPT3xs0@public.gmane.org>
> Cc: Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
> Cc: Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
Also Cc'ing Mark Brown as original author of runtime PM for i2-core.
Kevin
> ---
> drivers/i2c/i2c-core.c | 12 ++++++++++--
> 1 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> index 6649176..3146bff
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -196,14 +196,22 @@ static int i2c_legacy_resume(struct device *dev)
> static int i2c_device_pm_suspend(struct device *dev)
> {
> const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
> + int ret;
>
> if (pm_runtime_suspended(dev))
> return 0;
>
> if (pm)
> - return pm->suspend ? pm->suspend(dev) : 0;
> + ret = pm->suspend ? pm->suspend(dev) : 0;
> + else
> + ret = i2c_legacy_suspend(dev, PMSG_SUSPEND);
>
> - return i2c_legacy_suspend(dev, PMSG_SUSPEND);
> + if (!ret) {
> + pm_runtime_disable(dev);
> + pm_runtime_set_suspended(dev);
> + pm_runtime_enable(dev);
> + }
> + return ret;
> }
>
> static int i2c_device_pm_resume(struct device *dev)
next prev parent reply other threads:[~2010-08-30 18:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-31 1:50 [PATCH] I2C: Fix for suspend/resume issue in i2c-core Vishwanath BS
[not found] ` <1283219414-8798-1-git-send-email-vishwanath.bs-l0cyMroinI0@public.gmane.org>
2010-08-30 18:43 ` Kevin Hilman [this message]
2010-08-31 11:16 ` Mark Brown
[not found] ` <20100831111611.GF20849-HF5t3jzXg/6ND3a5+9QAFujbO/Zr0HzV@public.gmane.org>
2010-08-31 23:12 ` Rafael J. Wysocki
[not found] ` <201009010112.11834.rjw-KKrjLPT3xs0@public.gmane.org>
2010-09-01 8:40 ` Jean Delvare
[not found] ` <20100901104052.5967ca25-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2010-09-03 17:38 ` Sripathy, Vishwanath
[not found] ` <FCCFB4CDC6E5564B9182F639FC35608703114DA108-/tLxBxkBPtCIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2010-09-03 23:10 ` Rafael J. Wysocki
[not found] ` <201009040110.10858.rjw-KKrjLPT3xs0@public.gmane.org>
2010-09-04 6:49 ` Jean Delvare
-- strict thread matches above, loose matches on Subject: below --
2010-08-31 1:47 Vishwanath BS
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=87wrr83pro.fsf@deeprootsystems.com \
--to=khilman-1d3hcaltpluheniveurvkkeocmrvltnr@public.gmane.org \
--cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
--cc=broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=p-basak2-l0cyMroinI0@public.gmane.org \
--cc=rjw-KKrjLPT3xs0@public.gmane.org \
--cc=vishwanath.bs-l0cyMroinI0@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).