From: Peter Chen <peter.chen@freescale.com>
To: Sumit Semwal <sumit.semwal@linaro.org>
Cc: "Felipe Balbi" <balbi@ti.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"Android Kernel Team" <kernel-team@android.com>,
"Arve Hjønnevåg" <arve@android.com>,
"Benoit Goby" <benoit@android.com>,
"Todd Poynor" <toddpoynor@google.com>
Subject: Re: [PATCH v3 3/3] usb: phy: hold wakeupsource when USB is enumerated in peripheral mode
Date: Mon, 13 Jul 2015 15:00:03 +0800 [thread overview]
Message-ID: <20150713070002.GA12197@shlinux2> (raw)
In-Reply-To: <CAO_48GE1rvvFBqCAkHzRTfVqSVSbUqqO2w2pbg3+byJtchgDVw@mail.gmail.com>
On Mon, Jul 13, 2015 at 01:26:23PM +0530, Sumit Semwal wrote:
> Hi Peter,
>
> On 8 June 2015 at 14:02, Peter Chen <peter.chen@freescale.com> wrote:
> > On Mon, Jun 08, 2015 at 12:37:00PM +0530, Sumit Semwal wrote:
> >> H Peter, Felipe,
> >>
> >> On 14 January 2015 at 06:56, Peter Chen <peter.chen@freescale.com> wrote:
> >> > On Tue, Jan 13, 2015 at 10:18:02AM -0600, Felipe Balbi wrote:
> >> >> On Tue, Jan 13, 2015 at 04:02:20PM +0530, Kiran Raparthy wrote:
> >> >> > Hi Felipe,
> >> >> >
> >> >> > On 1 December 2014 at 11:09, Kiran Raparthy <kiran.kumar@linaro.org> wrote:
> >> >> > > Hi Felipe,
> >> >> > >
> >> >> > > On 25 November 2014 at 20:15, Felipe Balbi <balbi@ti.com> wrote:
> >> >> > >> On Tue, Nov 25, 2014 at 07:06:18AM +0000, Peter Chen wrote:
> >> >> > >>>
> >> >> > >>> >
> >> >> > >>> > usb: phy: hold wakeupsource when USB is enumerated in peripheral mode
> >> >> > >>> >
> >> >> > >>> > Some systems require a mechanism to prevent system to enter into suspend
> >> >> > >>> > state when USB is connected and enumerated in peripheral mode.
> >> >> > >>> >
> >> >> > >>> > This patch provides an interface to hold a wakeupsource to prevent suspend.
> >> >> > >>> > PHY drivers can use this interface when USB is connected and enumerated in
> >> >> > >>> > peripheral mode.
> >> >> > >>> >
> >> >> > >>> > A timed wakeupsource is temporarily held on USB disconnect events, to allow
> >> >> > >>> > the rest of the system to react to the USB disconnection (dropping host
> >> >> > >>> > sessions, updating charger status, etc.) prior to re-allowing suspend.
> >> >> > >>> >
> >> >> > >>>
> <snip>
> >>
> >> Kiran is unable to continue on this patch anymore, so despite my very
> >> limited usb experience, I would like to take this over and with your
> >> help, take it to closure.
> >>
> >> From what I understand, it might be possible to do this either at the
> >> usb controller driver (where it detects if it has enumerated in host
> >> mode or device mode) or in the extcon driver (where it detects VBUS
> >> etc..) - which would be a cleaner / more logical way to do it?
> >>
> >> Thanks for all your help!
> >
> > I added my suggestions below:
> >
> > My opinion is: if we need this feature, we should depend on gadget's
> > state, eg 'configured', not vbus level. The system suspend should be
> > allowed if the gadget state is 'suspended' even vbus is still there.
> >
> > And when the gadget goes to suspend or reset or disconnect state, we can
> > go to disable this wakeup source.
> >
> > At drivers/usb/gadget/composite.c, we can know the gadget's state.
> >
> Thanks very much for your suggestion, and apologies in the delay in response.
>
> I tried to study your suggestion and the code a little bit more, and
> while I liked your idea quite a bit, I also realised that for the case
> of letting the USB charger use cases, in gadget framework, there
> doesn't seem to be a way to get the USB_EVENT_CHARGER, since charger
> would likely not be a gadget.
>
> In this case, how'd we be able to enable / disable wakeup_source for
> charger events?
We may not prevent the system entering system if it is a charger, isn't
it, so don't need to consider USB charger.
>
> If indeed we can't handle charger events in the way suggested by you,
> may I propose the following:
>
> - implement this in USB-phy as proposed in Kiran's original patch,
> - keep it disabled by default, and add a module param to enable/disable it
> - for no vbus case, use another event (USB_EVENT_ENUMERATED /
> USB_EVENT_NONE? ) to identify connect / disconnect?
> (OR, maybe don't do anything for such cases, since most likely
> the chipidea kind of implementations would handle it themselves?)
>
In my opinion, we can do noop for wakeup source if it is a USB charger.
> Of course these are based on my limited reading of the USB code, so
> I'd be grateful if you'd let me know of any obvious gaps in my
> understanding!
>
> > --
> >
> > Best Regards,
> > Peter Chen
>
>
> Best regards,
> Sumit.
--
Best Regards,
Peter Chen
next prev parent reply other threads:[~2015-07-13 8:09 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-24 17:24 [PATCH v3 1/3] usb: phy: introduce usb_phy_set_event interface Kiran Raparthy
2014-11-24 17:24 ` [PATCH v3 2/3] usb: phy: Handle per-PHY event for connect and disconnect events Kiran Raparthy
2014-11-24 17:25 ` [PATCH v3 3/3] usb: phy: hold wakeupsource when USB is enumerated in peripheral mode Kiran Raparthy
2014-11-25 7:06 ` Peter Chen
2014-11-25 14:45 ` Felipe Balbi
2014-12-01 5:39 ` Kiran Raparthy
2015-01-13 10:32 ` Kiran Raparthy
2015-01-13 16:18 ` Felipe Balbi
2015-01-14 1:26 ` Peter Chen
2015-06-08 7:07 ` Sumit Semwal
2015-06-08 8:32 ` Peter Chen
2015-07-13 7:56 ` Sumit Semwal
2015-07-13 7:00 ` Peter Chen [this message]
2015-07-20 7:48 ` Sumit Semwal
2015-07-20 7:15 ` Peter Chen
2015-07-20 13:07 ` Sumit Semwal
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=20150713070002.GA12197@shlinux2 \
--to=peter.chen@freescale.com \
--cc=arve@android.com \
--cc=balbi@ti.com \
--cc=benoit@android.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=sumit.semwal@linaro.org \
--cc=toddpoynor@google.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.