All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Vivek Gautam <gautamvivek1987@gmail.com>
Cc: Felipe Balbi <balbi@ti.com>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	Vivek Gautam <gautam.vivek@samsung.com>,
	<linux-usb@vger.kernel.org>, <linux-samsung-soc@vger.kernel.org>,
	<linux-omap@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<gregkh@linuxfoundation.org>, <sarah.a.sharp@linux.intel.com>,
	<rob.herring@calxeda.com>, <kgene.kim@samsung.com>,
	<dianders@chromium.org>, <t.figa@samsung.com>,
	<p.paneri@samsung.com>
Subject: Re: [PATCH v3 01/11] usb: phy: Add APIs for runtime power management
Date: Tue, 23 Apr 2013 14:12:29 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.44L0.1304231408370.1679-100000@iolanthe.rowland.org> (raw)
In-Reply-To: <CAFp+6iECumogLo9Tf+4pMqRhtkGHf1CqA52YjL1tACTRyGO7jw@mail.gmail.com>

On Tue, 23 Apr 2013, Vivek Gautam wrote:

> Hi,
> 
> 
> On Tue, Apr 23, 2013 at 10:23 PM, Alan Stern <stern@rowland.harvard.edu> wrote:
> > On Tue, 23 Apr 2013, Vivek Gautam wrote:
> >
> >> >> Alright, so here's my understanding:
> >> >>
> >> >> I suggested letting e.g. DWC3 enable the PHY's runtime_pm; Alan said
> >> >> that it could be done before that so that DWC3 sees an enabled PHY
> >> >> during probe.
> >> >
> >> > Basically right.  Help me to understand the overall situation a little
> >> > better:
> >> >
> >> >         What code registers the PHY initially?
> >>            PHY is added to global list by PHY drivers (like
> >> phy-samsung-usb2.c/phy-omap-usb2.c)
> >>            by usb_add_phy() API
> >
> > Then this routine should initialize the PHY.  The initialized state
> > could be either active or suspended, your choice.  Suspended would be
> > best, in case the PHY never gets used.
> 
> Fair enough.
> 
> >
> >> >         What routine does the DWC3 driver call to register itself
> >> >         as a consumer of the PHY?
> >>            I think DWC3 doesn't registers itself as consumer of PHY,
> >> rather it gets that PHY from
> >>            the list using devm_usb_get_phy()/devm_usb_get_phy_by_phandle() API.
> >>            DWC3 can now call PHY's initialization sequence using usb_phy_init().
> >>            So, before DWC3 initializes the PHY, PHYs should be in active state.
> >
> > Then usb_phy_init should make sure the PHY is in the active state.  If
> > usb_add_phy() left the PHY suspended, then this routine should call
> > pm_runtime_get_sync().
> 
> Right
> 
> >
> > After DWC3 (or any other driver) has acquired the PHY, it can call
> > pm_runtime_put/get() however it likes, so long as the calls balance
> > properly.  If the driver isn't runtime-PM aware then it won't use any
> > of these calls, and the PHY will remain active the entire time.
> 
> Alright, so DWC3 (or any other consumer of PHY) should do minimal to
> handle runtime state of PHYs; get() when accessing PHY and put() when it's done
> with it.

Yes.  The first operation will generally be a put, because
usb_phy_init() will leave the PHY in an active state.

> >> >         Likewise, what routine does it call to unregister itself?
> >>            Once DWC3's remove() is called PHYs are put.
> >
> > Is there a routine analogous to usb_phy_init() that gets called when
> > PHY is released?  That routine would do the opposite of usb_phy_init(),
> > putting the PHY back into its initialized state.
> 
> Yes, ofcourse there's a routine usb_phy_shutdown(). So this will be
> calling put_sync()
> to put PHYs back to its initialized state. Right ?

Correct.

Alan Stern


WARNING: multiple messages have this Message-ID (diff)
From: Alan Stern <stern@rowland.harvard.edu>
To: Vivek Gautam <gautamvivek1987@gmail.com>
Cc: Felipe Balbi <balbi@ti.com>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	Vivek Gautam <gautam.vivek@samsung.com>,
	linux-usb@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org,
	gregkh@linuxfoundation.org, sarah.a.sharp@linux.intel.com,
	rob.herring@calxeda.com, kgene.kim@samsung.com,
	dianders@chromium.org, t.figa@samsung.com, p.paneri@samsung.com
Subject: Re: [PATCH v3 01/11] usb: phy: Add APIs for runtime power management
Date: Tue, 23 Apr 2013 14:12:29 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.44L0.1304231408370.1679-100000@iolanthe.rowland.org> (raw)
In-Reply-To: <CAFp+6iECumogLo9Tf+4pMqRhtkGHf1CqA52YjL1tACTRyGO7jw@mail.gmail.com>

On Tue, 23 Apr 2013, Vivek Gautam wrote:

> Hi,
> 
> 
> On Tue, Apr 23, 2013 at 10:23 PM, Alan Stern <stern@rowland.harvard.edu> wrote:
> > On Tue, 23 Apr 2013, Vivek Gautam wrote:
> >
> >> >> Alright, so here's my understanding:
> >> >>
> >> >> I suggested letting e.g. DWC3 enable the PHY's runtime_pm; Alan said
> >> >> that it could be done before that so that DWC3 sees an enabled PHY
> >> >> during probe.
> >> >
> >> > Basically right.  Help me to understand the overall situation a little
> >> > better:
> >> >
> >> >         What code registers the PHY initially?
> >>            PHY is added to global list by PHY drivers (like
> >> phy-samsung-usb2.c/phy-omap-usb2.c)
> >>            by usb_add_phy() API
> >
> > Then this routine should initialize the PHY.  The initialized state
> > could be either active or suspended, your choice.  Suspended would be
> > best, in case the PHY never gets used.
> 
> Fair enough.
> 
> >
> >> >         What routine does the DWC3 driver call to register itself
> >> >         as a consumer of the PHY?
> >>            I think DWC3 doesn't registers itself as consumer of PHY,
> >> rather it gets that PHY from
> >>            the list using devm_usb_get_phy()/devm_usb_get_phy_by_phandle() API.
> >>            DWC3 can now call PHY's initialization sequence using usb_phy_init().
> >>            So, before DWC3 initializes the PHY, PHYs should be in active state.
> >
> > Then usb_phy_init should make sure the PHY is in the active state.  If
> > usb_add_phy() left the PHY suspended, then this routine should call
> > pm_runtime_get_sync().
> 
> Right
> 
> >
> > After DWC3 (or any other driver) has acquired the PHY, it can call
> > pm_runtime_put/get() however it likes, so long as the calls balance
> > properly.  If the driver isn't runtime-PM aware then it won't use any
> > of these calls, and the PHY will remain active the entire time.
> 
> Alright, so DWC3 (or any other consumer of PHY) should do minimal to
> handle runtime state of PHYs; get() when accessing PHY and put() when it's done
> with it.

Yes.  The first operation will generally be a put, because
usb_phy_init() will leave the PHY in an active state.

> >> >         Likewise, what routine does it call to unregister itself?
> >>            Once DWC3's remove() is called PHYs are put.
> >
> > Is there a routine analogous to usb_phy_init() that gets called when
> > PHY is released?  That routine would do the opposite of usb_phy_init(),
> > putting the PHY back into its initialized state.
> 
> Yes, ofcourse there's a routine usb_phy_shutdown(). So this will be
> calling put_sync()
> to put PHYs back to its initialized state. Right ?

Correct.

Alan Stern


  reply	other threads:[~2013-04-23 18:12 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-01 13:53 [PATCH v3 00/11] usb: dwc3/xhci/phy: Enable runtime power management Vivek Gautam
2013-04-01 13:54 ` [PATCH v3 01/11] usb: phy: Add APIs for " Vivek Gautam
2013-04-02  8:23   ` Felipe Balbi
2013-04-02  8:23     ` Felipe Balbi
2013-04-02 10:34     ` Vivek Gautam
2013-04-02 12:10       ` Felipe Balbi
2013-04-02 12:10         ` Felipe Balbi
2013-04-02 12:40         ` Vivek Gautam
2013-04-18 11:50           ` Kishon Vijay Abraham I
2013-04-18 11:50             ` Kishon Vijay Abraham I
2013-04-23 11:15             ` Felipe Balbi
2013-04-23 11:15               ` Felipe Balbi
2013-04-03  5:08   ` Kishon Vijay Abraham I
2013-04-03  5:08     ` Kishon Vijay Abraham I
2013-04-03  6:18     ` Vivek Gautam
2013-04-03  8:15       ` Felipe Balbi
2013-04-03  8:15         ` Felipe Balbi
2013-04-03 13:12         ` Vivek Gautam
2013-04-03 13:54           ` Felipe Balbi
2013-04-03 13:54             ` Felipe Balbi
2013-04-03 13:56             ` Felipe Balbi
2013-04-03 13:56               ` Felipe Balbi
2013-04-03 14:10               ` Vivek Gautam
2013-04-03 14:18                 ` Felipe Balbi
2013-04-03 14:18                   ` Felipe Balbi
2013-04-03 14:42                   ` Vivek Gautam
2013-04-03 18:14                   ` Alan Stern
2013-04-03 18:14                     ` Alan Stern
2013-04-04  7:18                     ` Felipe Balbi
2013-04-04  7:18                       ` Felipe Balbi
2013-04-04  8:56                       ` Vivek Gautam
2013-04-04  9:26                         ` Felipe Balbi
2013-04-04  9:26                           ` Felipe Balbi
2013-04-04 14:46                           ` Alan Stern
2013-04-04 14:46                             ` Alan Stern
2013-04-23 12:42                             ` Vivek Gautam
2013-04-23 16:53                               ` Alan Stern
2013-04-23 16:53                                 ` Alan Stern
2013-04-23 18:05                                 ` Vivek Gautam
2013-04-23 18:05                                   ` Vivek Gautam
2013-04-23 18:12                                   ` Alan Stern [this message]
2013-04-23 18:12                                     ` Alan Stern
2013-04-24 13:12                                     ` Vivek Gautam
2013-04-01 13:54 ` [PATCH v3 02/11] USB: dwc3: Adjust runtime pm to allow autosuspend Vivek Gautam
2013-04-02  8:29   ` Felipe Balbi
2013-04-02  8:29     ` Felipe Balbi
2013-04-03  6:05     ` Vivek Gautam
2013-04-03  8:17       ` Felipe Balbi
2013-04-03  8:17         ` Felipe Balbi
2013-04-01 13:54 ` [PATCH v3 03/11] usb: dwc3: Enable runtime pm only after PHYs are initialized Vivek Gautam
2013-04-01 13:54 ` [PATCH v3 04/11] usb: dwc3: Add runtime power management callbacks Vivek Gautam
2013-04-02  8:32   ` Felipe Balbi
2013-04-02  8:32     ` Felipe Balbi
2013-04-03  4:59     ` Vivek Gautam
2013-04-01 13:54 ` [PATCH v3 05/11] usb: dwc3: exynos: Enable runtime power management Vivek Gautam
2013-04-02  8:33   ` Felipe Balbi
2013-04-02  8:33     ` Felipe Balbi
2013-04-01 13:54 ` [PATCH v3 06/11] usb: xhci: Enable runtime pm in xhci-plat Vivek Gautam
2013-04-01 13:54 ` [PATCH v3 07/11] usb: phy: samsung: Enable runtime power management on usb2phy Vivek Gautam
2013-04-01 13:54 ` [PATCH v3 08/11] usb: phy: samsung: Enable runtime power management on usb3phy Vivek Gautam
2013-04-01 13:54 ` [PATCH v3 09/11] usb: phy: samsung: Add support for external reference clock Vivek Gautam
2013-04-03 17:27 ` [PATCH v3 00/11] usb: dwc3/xhci/phy: Enable runtime power management Sarah Sharp
2013-04-04  5:04   ` Vivek Gautam
2013-04-04  7:10     ` Felipe Balbi
2013-04-04  7:10       ` Felipe Balbi
2013-04-04  7:32       ` Vivek Gautam
2013-04-04 16:40         ` Sarah Sharp

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=Pine.LNX.4.44L0.1304231408370.1679-100000@iolanthe.rowland.org \
    --to=stern@rowland.harvard.edu \
    --cc=balbi@ti.com \
    --cc=dianders@chromium.org \
    --cc=gautam.vivek@samsung.com \
    --cc=gautamvivek1987@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kgene.kim@samsung.com \
    --cc=kishon@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=p.paneri@samsung.com \
    --cc=rob.herring@calxeda.com \
    --cc=sarah.a.sharp@linux.intel.com \
    --cc=t.figa@samsung.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.