All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Jun Li <jun.li-3arQi8VN3Tc@public.gmane.org>,
	Baolin Wang <baolin.wang-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Peter Chen <hzpeterchen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Greg KH
	<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
	Sebastian Reichel <sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Dmitry Eremin-Solenikov
	<dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	David Woodhouse <dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
	Peter Chen <peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org>,
	Alan Stern
	<stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org>,
	"r.baldyga@samsung.com"
	<r.baldyga-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Yoshihiro Shimoda
	<yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>,
	Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Charles Keepax
	<ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>,
	"patches@opensource.wolfsonmicro.com"
	<patches-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>,
	Linux PM list <linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	USB <linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"device-mainlining@lists.linuxfoundation.org"
	<device-mainlining-cunTk1MwBs98uUxBSJOaYoYkZiVZrdSR2LY78lusg7I@public.gmane.org>,
	LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: RE: [PATCH v9 2/4] gadget: Support for the usb charger framework
Date: Wed, 06 Apr 2016 15:55:55 +0300	[thread overview]
Message-ID: <87oa9m28x0.fsf@intel.com> (raw)
In-Reply-To: <AM4PR04MB213054CF3F597CE2E6FE976F899F0-WOempg8NbQQzjTQnahXoOs9NdZoXdze2vxpqHgZTriW3zl9H0oFU5g@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 2694 bytes --]


Hi,

Jun Li <jun.li-3arQi8VN3Tc@public.gmane.org> writes:
>> >> On 6 April 2016 at 15:19, Peter Chen <hzpeterchen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>> >> > On Fri, Apr 01, 2016 at 03:21:50PM +0800, Baolin Wang wrote:
>> >> >>
>> >> >> @@ -563,6 +564,8 @@ struct usb_gadget_ops {
>> >> >>       struct usb_ep *(*match_ep)(struct usb_gadget *,
>> >> >>                       struct usb_endpoint_descriptor *,
>> >> >>                       struct usb_ss_ep_comp_descriptor *);
>> >> >> +     /* get the charger type */
>> >> >> +     enum usb_charger_type (*get_charger_type)(struct usb_gadget
>> >> >> + *);
>> >> >>  };
>> >> >
>> >> > Since we already have get_charger_type callback at usb_charger
>> >> > structure, why we still need this API at usb_gadget_ops?
>> >>
>> >> In case some users want to get charger type at gadget level.
>> >>
>> > Why gadget needs to know charger type? I also don't catch the intent
>> > of
>> 
>> because some gadgets need to call usb_gadget_vbus_draw(), although for
>> that they need power in mA rather.
>
> In below change of usb_gadget_vbus_draw(), already can get charger type
> via usb_charger_get_type().
>
> static inline int usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
>  {
> +       enum usb_charger_type type;
> +
> +       if (gadget->charger) {
> +               type = usb_charger_get_type(gadget->charger);
> +               usb_charger_set_cur_limit_by_type(gadget->charger, type, mA);
> +       }
> +
>         if (!gadget->ops->vbus_draw)
>                 return -EOPNOTSUPP;
>         return gadget->ops->vbus_draw(gadget, mA);
>
> Could you detail in what situation gadget->ops-> get_charger_type() is used?

isn't it right there in the code ? Isn't usb_gadget_vbus_draw() calling
it ? What did I miss here ?

>> > This api, as my understanding, gadget only need report gadget state
>> changes.
>> > All information required for usb charger is charger type and gadget
>> state.
>> 
>> you're making an assumption about how the HW is laid out which might not
>> be true.
>> 
>
> What other information you refer to here? Or what I am not aware of?

what I'm trying to say is that you're assuming gadgets don't need to
know anything other than charger type and gadget state (suspended,
resume, enumerated, default state, addressed, etc), but that might not
be true for all UDCs. You can't make that assumption that charger type
and gadget state is enough. The real question is what do we need *now*,
but still keep in mind that what we need *now* might be valid 2 years
from now, so API needs to be a little flexible.

cheers

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Felipe Balbi <balbi@kernel.org>
To: Jun Li <jun.li@nxp.com>, Baolin Wang <baolin.wang@linaro.org>,
	Peter Chen <hzpeterchen@gmail.com>
Cc: Greg KH <gregkh@linuxfoundation.org>,
	Sebastian Reichel <sre@kernel.org>,
	Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Peter Chen <peter.chen@freescale.com>,
	Alan Stern <stern@rowland.harvard.edu>,
	"r.baldyga\@samsung.com" <r.baldyga@samsung.com>,
	Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
	Lee Jones <lee.jones@linaro.org>, Mark Brown <broonie@kernel.org>,
	Charles Keepax <ckeepax@opensource.wolfsonmicro.com>,
	"patches\@opensource.wolfsonmicro.com" 
	<patches@opensource.wolfsonmicro.com>,
	Linux PM list <linux-pm@vger.kernel.org>,
	USB <linux-usb@vger.kernel.org>,
	"device-mainlining\@lists.linuxfoundation.org" 
	<device-mainlining@lists.linuxfoundation.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v9 2/4] gadget: Support for the usb charger framework
Date: Wed, 06 Apr 2016 15:55:55 +0300	[thread overview]
Message-ID: <87oa9m28x0.fsf@intel.com> (raw)
In-Reply-To: <AM4PR04MB213054CF3F597CE2E6FE976F899F0@AM4PR04MB2130.eurprd04.prod.outlook.com>

[-- Attachment #1: Type: text/plain, Size: 2643 bytes --]


Hi,

Jun Li <jun.li@nxp.com> writes:
>> >> On 6 April 2016 at 15:19, Peter Chen <hzpeterchen@gmail.com> wrote:
>> >> > On Fri, Apr 01, 2016 at 03:21:50PM +0800, Baolin Wang wrote:
>> >> >>
>> >> >> @@ -563,6 +564,8 @@ struct usb_gadget_ops {
>> >> >>       struct usb_ep *(*match_ep)(struct usb_gadget *,
>> >> >>                       struct usb_endpoint_descriptor *,
>> >> >>                       struct usb_ss_ep_comp_descriptor *);
>> >> >> +     /* get the charger type */
>> >> >> +     enum usb_charger_type (*get_charger_type)(struct usb_gadget
>> >> >> + *);
>> >> >>  };
>> >> >
>> >> > Since we already have get_charger_type callback at usb_charger
>> >> > structure, why we still need this API at usb_gadget_ops?
>> >>
>> >> In case some users want to get charger type at gadget level.
>> >>
>> > Why gadget needs to know charger type? I also don't catch the intent
>> > of
>> 
>> because some gadgets need to call usb_gadget_vbus_draw(), although for
>> that they need power in mA rather.
>
> In below change of usb_gadget_vbus_draw(), already can get charger type
> via usb_charger_get_type().
>
> static inline int usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
>  {
> +       enum usb_charger_type type;
> +
> +       if (gadget->charger) {
> +               type = usb_charger_get_type(gadget->charger);
> +               usb_charger_set_cur_limit_by_type(gadget->charger, type, mA);
> +       }
> +
>         if (!gadget->ops->vbus_draw)
>                 return -EOPNOTSUPP;
>         return gadget->ops->vbus_draw(gadget, mA);
>
> Could you detail in what situation gadget->ops-> get_charger_type() is used?

isn't it right there in the code ? Isn't usb_gadget_vbus_draw() calling
it ? What did I miss here ?

>> > This api, as my understanding, gadget only need report gadget state
>> changes.
>> > All information required for usb charger is charger type and gadget
>> state.
>> 
>> you're making an assumption about how the HW is laid out which might not
>> be true.
>> 
>
> What other information you refer to here? Or what I am not aware of?

what I'm trying to say is that you're assuming gadgets don't need to
know anything other than charger type and gadget state (suspended,
resume, enumerated, default state, addressed, etc), but that might not
be true for all UDCs. You can't make that assumption that charger type
and gadget state is enough. The real question is what do we need *now*,
but still keep in mind that what we need *now* might be valid 2 years
from now, so API needs to be a little flexible.

cheers

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

  parent reply	other threads:[~2016-04-06 12:55 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-01  7:21 [PATCH v9 0/4] Introduce usb charger framework to deal with the usb gadget power negotation Baolin Wang
2016-04-01  7:21 ` [PATCH v9 2/4] gadget: Support for the usb charger framework Baolin Wang
2016-04-06  7:19   ` Peter Chen
2016-04-06 10:46     ` Baolin Wang
2016-04-06 12:03       ` Jun Li
     [not found]         ` <AM4PR04MB2130F58AA1018FFD367C89E0899F0-WOempg8NbQQzjTQnahXoOs9NdZoXdze2vxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-04-06 12:21           ` Felipe Balbi
2016-04-06 12:21             ` Felipe Balbi
2016-04-06 12:51             ` Jun Li
     [not found]               ` <AM4PR04MB213054CF3F597CE2E6FE976F899F0-WOempg8NbQQzjTQnahXoOs9NdZoXdze2vxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-04-06 12:55                 ` Felipe Balbi [this message]
2016-04-06 12:55                   ` Felipe Balbi
     [not found]                   ` <87oa9m28x0.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-04-06 13:49                     ` Jun Li
2016-04-06 13:49                       ` Jun Li
2016-04-06 13:58                       ` Felipe Balbi
2016-04-06 13:58                         ` Felipe Balbi
2016-04-07  3:03                         ` Peter Chen
2016-04-07  4:58                           ` Felipe Balbi
2016-04-07  4:58                             ` Felipe Balbi
     [not found] ` <cover.1459494743.git.baolin.wang-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-04-01  7:21   ` [PATCH v9 1/4] gadget: Introduce " Baolin Wang
2016-04-01  7:21     ` Baolin Wang
2016-04-05  7:56     ` Peter Chen
     [not found]       ` <20160405075612.GB31351-Fb7DQEYuewWctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2016-04-05  9:41         ` Baolin Wang
2016-04-05  9:41           ` Baolin Wang
2016-04-06  7:25     ` Peter Chen
2016-04-06  7:38       ` Felipe Balbi
2016-04-06  7:43         ` Peter Chen
2016-04-06  8:05           ` Felipe Balbi
2016-04-06  8:10             ` Peter Chen
2016-04-06 10:25               ` Felipe Balbi
2016-04-07  2:39                 ` Peter Chen
2016-04-07  4:56                   ` Felipe Balbi
2016-04-07  6:11                     ` Baolin Wang
2016-04-06  8:11             ` Peter Chen
2016-04-06 10:25               ` Felipe Balbi
2016-04-06  8:26     ` Jun Li
2016-04-06 11:31       ` Baolin Wang
2016-04-06 11:31         ` Baolin Wang
2016-04-06 11:55         ` Jun Li
2016-04-06 11:55           ` Jun Li
2016-04-01  7:21   ` [PATCH v9 3/4] gadget: Integrate with the usb gadget supporting for usb charger Baolin Wang
2016-04-01  7:21     ` Baolin Wang
2016-04-01  7:21 ` [PATCH v9 4/4] power: wm831x_power: Support USB charger current limit management Baolin Wang
2016-04-05  6:46 ` [PATCH v9 0/4] Introduce usb charger framework to deal with the usb gadget power negotation Peter Chen
2016-04-05  7:54   ` Baolin Wang
2016-04-05  8:12     ` Peter Chen
2016-04-05  9:34       ` Baolin Wang
2016-04-05  9:43         ` Peter Chen
2016-04-05 11:06           ` Baolin Wang
2016-04-05 17:01           ` Mark Brown
2016-04-05 16:53       ` Mark Brown
2016-04-06  1:15         ` Peter Chen
2016-04-06 17:01           ` 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=87oa9m28x0.fsf@intel.com \
    --to=balbi-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=baolin.wang-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=ckeepax-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org \
    --cc=dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=device-mainlining-cunTk1MwBs98uUxBSJOaYoYkZiVZrdSR2LY78lusg7I@public.gmane.org \
    --cc=dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=hzpeterchen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=jun.li-3arQi8VN3Tc@public.gmane.org \
    --cc=lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=patches-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org \
    --cc=peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
    --cc=r.baldyga-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org \
    --cc=yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@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 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.