From: "Munegowda, Keshava" <keshava_mgowda-l0cyMroinI0@public.gmane.org>
To: Kevin Hilman <khilman-l0cyMroinI0@public.gmane.org>
Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
balbi-l0cyMroinI0@public.gmane.org,
gadiyar-l0cyMroinI0@public.gmane.org,
sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
parthab-PpE0FKYn9XJWk0Htik3J/w@public.gmane.org,
tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org,
b-cousson-l0cyMroinI0@public.gmane.org,
paul-DWxLp4Yu+b8AvxtiuMwx3w@public.gmane.org
Subject: Re: [PATCH 4/4] mfd: global Suspend and resume support of ehci and ohci
Date: Thu, 30 Jun 2011 18:10:40 +0530 [thread overview]
Message-ID: <BANLkTimcaRX0epF27ntGnK7rvrCgQ-zyBQ@mail.gmail.com> (raw)
In-Reply-To: <87pqlwqwb1.fsf-l0cyMroinI0@public.gmane.org>
On Thu, Jun 30, 2011 at 12:50 AM, Kevin Hilman <khilman-l0cyMroinI0@public.gmane.org> wrote:
> "Munegowda, Keshava" <keshava_mgowda-l0cyMroinI0@public.gmane.org> writes:
>
>> On Wed, Jun 29, 2011 at 8:52 PM, Munegowda, Keshava
>> <keshava_mgowda-l0cyMroinI0@public.gmane.org> wrote:
>>> On Thu, Jun 2, 2011 at 5:36 AM, Kevin Hilman <khilman-l0cyMroinI0@public.gmane.org> wrote:
>>>> Keshava Munegowda <keshava_mgowda-l0cyMroinI0@public.gmane.org> writes:
>>>>
>>>>> From: Keshava Munegowda <Keshava_mgowda-l0cyMroinI0@public.gmane.org>
>>>>>
>>>>> The global suspend and resume functions for usbhs core driver
>>>>> are implemented.These routine are called when the global suspend
>>>>> and resume occurs. Before calling these functions, the
>>>>> bus suspend and resume of ehci and ohci drivers are called
>>>>> from runtime pm.
>>>>>
>>>>> Signed-off-by: Keshava Munegowda <keshava_mgowda-l0cyMroinI0@public.gmane.org>
>>>>
>>>> First, from what I can see, this is only a partial implementation of
>>>> runtime PM. What I mean is that the runtime PM methods are used only
>>>> during the suspend path. The rest of the time the USB host IP block is
>>>> left enabled, even when nothing is connected.
>>>>
>>>> I tested this on my 3530/Overo board, and verified that indeed the
>>>> usbhost powerdomain hits retention on suspend, but while idle, when
>>>> nothing is connected, I would expect the driver could be clever enough
>>>> to use runtime PM (probably using autosuspend timeouts) to disable the
>>>> hardware as well.
>>>>
>>>>> ---
>>>>> drivers/mfd/omap-usb-host.c | 103 +++++++++++++++++++++++++++++++++++++++++++
>>>>> 1 files changed, 103 insertions(+), 0 deletions(-)
>>>>>
>>>>> diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
>>>>> index 43de12a..32d19e2 100644
>>>>> --- a/drivers/mfd/omap-usb-host.c
>>>>> +++ b/drivers/mfd/omap-usb-host.c
>>>>> @@ -146,6 +146,10 @@
>>>>> #define is_ehci_hsic_mode(x) (x == OMAP_EHCI_PORT_MODE_HSIC)
>>>>>
>>>>>
>>>>> +/* USBHS state bits */
>>>>> +#define OMAP_USBHS_INIT 0
>>>>> +#define OMAP_USBHS_SUSPEND 4
>>>>
>>>> These additional state bits don't seem to be necessary.
>>>>
>>>> For suspend, just check 'pm_runtime_is_suspended()'
>>>>
>>>> The init flag is only used in the suspend/resume hooks, but the need for
>>>> it is a side effect of not correctly using the runtime PM callbacks.
>>>>
>>>> Remember that the runtime PM get/put hooks have usage counting. Only
>>>> when the usage count transitions to/from zero is the actual
>>>> hardware-level enable/disable (via omap_hwmod) being done.
>>>>
>>>> The current code is making the assumption that every call to get/put is
>>>> going to result in an enable/disable of the hardware.
>>>>
>>>> Instead, all of the code that needs to be run only upon actual
>>>> enable/disable of the hardware should be done in the driver's
>>>> runtime_suspend/runtime_resume callbacks. These are only called when
>>>> the hardware actually changes state.
>>>>
>>>> Not knowing that much about the EHCI block, upon first glance, it looks
>>>> like mmuch of what is done in usbhs_enable() should actually be done in
>>>> the ->runtime_resume() callback, and similarily, much of what is done in
>>>> usbhs_disable() should be done in the ->runtime_suspend() callback.
>>>
>>> Kevin,
>>> do you mean driver->runtime_resume and driver->runtime_resume call backs.
>>> are these call backs from pm_runtime_get_sync and pm_runtime_put_sync?
>>
>> for usb host case , I am seeing that the pm_runtime_get_sync
>>
>>
>> static int rpm_resume(struct device *dev, int rpmflags)
>> {
>> ............
>> ..........
>> if (dev->pwr_domain) {
>> callback = dev->pwr_domain->ops.runtime_resume;
>> if(!strcmp(dev_name(dev),"usbhs_omap"))
>> pr_err("dev->pwr_domain->ops.runtime_resume");
>> }
>> else if (dev->type && dev->type->pm) {
>> callback = dev->type->pm->runtime_resume;
>> if(!strcmp(dev_name(dev),"usbhs_omap"))
>> pr_err("dev->type->pm->runtime_resume");
>> }
>> else if (dev->class && dev->class->pm) {
>> callback = dev->class->pm->runtime_resume;
>> if(!strcmp(dev_name(dev),"usbhs_omap"))
>> pr_err("ev->class->pm->runtime_resume");
>> }
>> else if (dev->bus && dev->bus->pm) {
>> callback = dev->bus->pm->runtime_resume;
>> if(!strcmp(dev_name(dev),"usbhs_omap"))
>> pr_err("dev->bus->pm->runtime_resume");
>> }
>> else
>> callback = NULL;
>> }
>>
>>
>> I am seeing that below if statement was hitting true:
>>
>> if (dev->pwr_domain) {
>> callback = dev->pwr_domain->ops.runtime_resume;
>> if(!strcmp(dev_name(dev),"usbhs_omap"))
>> pr_err("dev->pwr_domain->ops.runtime_resume");
>>
>>
>> due to this; the driver->runtime_resume was not getting called.
>>
>> Any idea on why I am seeing only the dev->pwr_domain is set not
>> dev->bus && dev->bus->pm is hitting here?
>
> Because that's how it was designed. :)
>
> On OMAP, for on-chip devices (omap_devices) we use PM domains
> (pwr_domain) and not the subsystem (bus) to implment runtime PM, and as
> Alan pointed out, PM domains have precedence over subsystem callbacks.
>
> I'm curious why you determined the driver's runtime resume was not
> getting called?
>
> The PM domain callback will call your driver's runtime_resume (assuming
> it exists.)
>
> rpm_resume()
> dev->pwr_domain->ops.runtime_resume()
> omap_device_enable()
> pm_generic_runtime_resume()
> dev->driver->pm->runtime_resume()
>
> Note that the PM domain implementation is done at the omap_device
> level. Specifically, see plat-omap/omap_device.c:_od_runtime_resume()
>
> Kevin
Thanks to partha and others
I was an rc issue; I migrated to latest kernel ; its working now.
driver runtime call backs are getting
called now. :-)
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2011-06-30 12:40 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-01 13:27 [PATCH 0/4] arm: omap: usb: Hwmod and Runtime PM support for EHCI & OHCI Keshava Munegowda
[not found] ` <1306934847-6098-1-git-send-email-keshava_mgowda-l0cyMroinI0@public.gmane.org>
2011-06-01 13:27 ` [PATCH 1/4] arm: omap: usb: ehci and ohci hwmod structures for omap3 and omap4 Keshava Munegowda
[not found] ` <1306934847-6098-2-git-send-email-keshava_mgowda-l0cyMroinI0@public.gmane.org>
2011-06-01 13:27 ` [PATCH 2/4] arm: omap: usb: register hwmods of usbhs Keshava Munegowda
[not found] ` <1306934847-6098-3-git-send-email-keshava_mgowda-l0cyMroinI0@public.gmane.org>
2011-06-01 13:27 ` [PATCH 3/4] arm: omap: usb: device name change for the clk names " Keshava Munegowda
2011-06-01 13:27 ` [PATCH 4/4] mfd: global Suspend and resume support of ehci and ohci Keshava Munegowda
2011-06-01 13:31 ` Felipe Balbi
2011-06-01 13:38 ` Munegowda, Keshava
2011-06-01 13:54 ` Rafael J. Wysocki
2011-06-01 14:32 ` Felipe Balbi
2011-06-05 17:19 ` Rafael J. Wysocki
2011-06-05 18:50 ` Felipe Balbi
2011-06-05 19:30 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1106051519560.5916-100000-pYrvlCTfrz9XsRXLowluHWD2FQJk+8+b@public.gmane.org>
2011-06-05 19:54 ` Felipe Balbi
[not found] ` <20110605195413.GC18731-UiBtZHVXSwEVvW8u9ZQWYwjfymiNCTlR@public.gmane.org>
2011-06-06 16:06 ` Alan Stern
2011-06-06 17:25 ` Felipe Balbi
2011-06-06 18:03 ` Alan Stern
2011-06-06 9:45 ` Mark Brown
2011-06-02 0:06 ` Kevin Hilman
2011-06-29 15:22 ` Munegowda, Keshava
[not found] ` <BANLkTim43pAKe1o-aFmgh79bNqSyZmW_Fg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-06-29 16:37 ` Munegowda, Keshava
2011-06-29 17:33 ` Alan Stern
2011-06-29 18:17 ` Partha Basak
2011-06-29 18:47 ` Alan Stern
[not found] ` <BANLkTi=pKL6RDBTDBStv+uhxVKp3-bwXbg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-06-29 19:20 ` Kevin Hilman
[not found] ` <87pqlwqwb1.fsf-l0cyMroinI0@public.gmane.org>
2011-06-30 12:40 ` Munegowda, Keshava [this message]
2011-06-01 20:05 ` [PATCH 3/4] arm: omap: usb: device name change for the clk names of usbhs Kevin Hilman
2011-06-01 20:01 ` [PATCH 2/4] arm: omap: usb: register hwmods " Kevin Hilman
2011-06-01 20:04 ` Kevin Hilman
2011-06-01 19:56 ` [PATCH 1/4] arm: omap: usb: ehci and ohci hwmod structures for omap3 and omap4 Kevin Hilman
2011-06-02 6:55 ` Munegowda, Keshava
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=BANLkTimcaRX0epF27ntGnK7rvrCgQ-zyBQ@mail.gmail.com \
--to=keshava_mgowda-l0cymroini0@public.gmane.org \
--cc=b-cousson-l0cyMroinI0@public.gmane.org \
--cc=balbi-l0cyMroinI0@public.gmane.org \
--cc=gadiyar-l0cyMroinI0@public.gmane.org \
--cc=khilman-l0cyMroinI0@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=parthab-PpE0FKYn9XJWk0Htik3J/w@public.gmane.org \
--cc=paul-DWxLp4Yu+b8AvxtiuMwx3w@public.gmane.org \
--cc=sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@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).