All of lore.kernel.org
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linaro.org>
To: NeilBrown <neilb@suse.com>
Cc: NeilBrown <nfbrown@novell.com>, Felipe Balbi <balbi@kernel.org>,
	Greg KH <gregkh@linuxfoundation.org>,
	Sebastian Reichel <sre@kernel.org>,
	Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	robh@kernel.org, Jun Li <jun.li@nxp.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Ruslan Bilovol <ruslan.bilovol@gmail.com>,
	Peter Chen <peter.chen@freescale.com>,
	Alan Stern <stern@rowland.harvard.edu>,
	r.baldyga@samsung.com, grygorii.strashko@ti.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,
	Linux PM list <linux-pm@vger.kernel.org>,
	USB <linux-usb@vger.kernel.org>,
	device-mainlining@lists.linuxfoundation.org,
	LKML <linux-kernel@vger.kernel.org>,
	"Bird, Timothy" <Tim.Bird@am.sony.com>
Subject: Re: [PATCH v16 0/4] Introduce usb charger framework to deal with the usb gadget power negotation
Date: Fri, 9 Sep 2016 14:46:33 +0800	[thread overview]
Message-ID: <CAMz4ku+wWcSPCA1_UYKNqJv4rRDEm5WYUc8AVT6xPJ651-rzmg@mail.gmail.com> (raw)
In-Reply-To: <87y4326l44.fsf@notabene.neil.brown.name>

On 9 September 2016 at 07:13, NeilBrown <neilb@suse.com> wrote:
> On Thu, Sep 08 2016, Baolin Wang wrote:
>
>> On 8 September 2016 at 15:31, NeilBrown <neilb@suse.com> wrote:
>>> On Thu, Sep 08 2016, Baolin Wang wrote:
>>>>
>>>> Now the usb charger will not get charger type from 'extcon' subsystem,
>>>> we get the charger type from 'power_supply' and calllback
>>>> 'get_charger_type' for users.
>>>
>>> I understand this.  I think it is wrong because, in general, the
>>> power_supply doesn't know what the charger_type is (it might know it is
>>> USB, but most don't know which sort of USB).  The PHY knows that, not
>>> the power_supply.
>>
>> I don't think so. Now many platforms will detect the charger type by
>> PMIC hardware, and we can get the charger type by PMIC hardware
>> register. Then power supply driver can access the PMIC register to get
>> the charger type. Here USB charger just considers if the accessing the
>> PMIC register to get charger type is implemented in power supply, it
>> is optional depending on what your platform designed.
>>
>
> In practice, the USB PHY and the Power manager will often be in the same
> IC (the PMIC) so the driver for one could look at the registers for the
> other.
> But there is no guarantee that the hardware works like that.  It is
> best to create a generally design.

Yes, we hope to create one generally design, so we need to consider
this situation: the power supply getting the charger type by accessing
PMIC registers. The registers which save the charger type are not
always belong to the USB PHY, may be just some registers on PMIC.

Now in mainline kernel, there are 3 methods can get the charger type
which need to integrate with USB charger framework:
1. power supply
2. extcon (need to add as you suggested)
3. others (by 'get_charger_type' callback of USB charger)

> Conceptually, the PHY is separate from the power manager and a solution
> which recognises that will be more universal.
>
> If the power manager can always just look at that phy registers to know
> what sort of charger is connected, why does you framework need to work
> with charger types at all?
>
>>>>
>>>> Yes, but you must think about some special cases on some platforms.
>>>> Users may need to change the current in some situations, thus we
>>>> should export one API for users to change the current. (I think you
>>>> misunderstand the current limit here, that is the current for power
>>>> driver  to draw).
>>>
>>> Can you be specific about these "special cases" please?
>>> I cannot think of any.
>>
>> Suppose the USB configuration requests 100mA, then we should set the
>> USB charger current is 100mA by __usb_charger_set_cur_limit_by_type()
>> funtion, then notify this to power driver.
>
> ahh.... I had missed something there.  It's a while since I looked
> closely at these patches.
>
> Only.... this usage of usb_charger_set_cur_limit_by_type() is really
> nonsensical.
>
> If the cable is detected as being DCP or CDP or ACA (or ACA/DOCK) then
> the number negotiated with the USB configuration is not relevant and
> should be ignored.  There is a guaranteed minimum which is at least the
> maximum that *can* be negotiated.

Yes. If it is not relevant, we will no't set the current from USB
configuration. Just when your charger type is SDP and the USB
enumeration is done, we can get the USB configuration from host to set
current.

>
> It is only when the cable appears to be a SDP (standard downstream
> port) that the usb-config negotiation is relevant.  That is because the
> minimum guaranteed for SDP is only 100mA.
>
> NeilBrown



-- 
Baolin.wang
Best Regards

WARNING: multiple messages have this Message-ID (diff)
From: Baolin Wang <baolin.wang@linaro.org>
To: NeilBrown <neilb@suse.com>
Cc: NeilBrown <nfbrown@novell.com>, Felipe Balbi <balbi@kernel.org>,
	Greg KH <gregkh@linuxfoundation.org>,
	Sebastian Reichel <sre@kernel.org>,
	Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	robh@kernel.org, Jun Li <jun.li@nxp.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Ruslan Bilovol <ruslan.bilovol@gmail.com>,
	Peter Chen <peter.chen@freescale.com>,
	Alan Stern <stern@rowland.harvard.edu>,
	r.baldyga@samsung.com, grygorii.strashko@ti.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,
	Linux PM list <linux-pm@vger.kernel.org>, USB <linux-usb@vger.ke>
Subject: Re: [PATCH v16 0/4] Introduce usb charger framework to deal with the usb gadget power negotation
Date: Fri, 9 Sep 2016 14:46:33 +0800	[thread overview]
Message-ID: <CAMz4ku+wWcSPCA1_UYKNqJv4rRDEm5WYUc8AVT6xPJ651-rzmg@mail.gmail.com> (raw)
In-Reply-To: <87y4326l44.fsf@notabene.neil.brown.name>

On 9 September 2016 at 07:13, NeilBrown <neilb@suse.com> wrote:
> On Thu, Sep 08 2016, Baolin Wang wrote:
>
>> On 8 September 2016 at 15:31, NeilBrown <neilb@suse.com> wrote:
>>> On Thu, Sep 08 2016, Baolin Wang wrote:
>>>>
>>>> Now the usb charger will not get charger type from 'extcon' subsystem,
>>>> we get the charger type from 'power_supply' and calllback
>>>> 'get_charger_type' for users.
>>>
>>> I understand this.  I think it is wrong because, in general, the
>>> power_supply doesn't know what the charger_type is (it might know it is
>>> USB, but most don't know which sort of USB).  The PHY knows that, not
>>> the power_supply.
>>
>> I don't think so. Now many platforms will detect the charger type by
>> PMIC hardware, and we can get the charger type by PMIC hardware
>> register. Then power supply driver can access the PMIC register to get
>> the charger type. Here USB charger just considers if the accessing the
>> PMIC register to get charger type is implemented in power supply, it
>> is optional depending on what your platform designed.
>>
>
> In practice, the USB PHY and the Power manager will often be in the same
> IC (the PMIC) so the driver for one could look at the registers for the
> other.
> But there is no guarantee that the hardware works like that.  It is
> best to create a generally design.

Yes, we hope to create one generally design, so we need to consider
this situation: the power supply getting the charger type by accessing
PMIC registers. The registers which save the charger type are not
always belong to the USB PHY, may be just some registers on PMIC.

Now in mainline kernel, there are 3 methods can get the charger type
which need to integrate with USB charger framework:
1. power supply
2. extcon (need to add as you suggested)
3. others (by 'get_charger_type' callback of USB charger)

> Conceptually, the PHY is separate from the power manager and a solution
> which recognises that will be more universal.
>
> If the power manager can always just look at that phy registers to know
> what sort of charger is connected, why does you framework need to work
> with charger types at all?
>
>>>>
>>>> Yes, but you must think about some special cases on some platforms.
>>>> Users may need to change the current in some situations, thus we
>>>> should export one API for users to change the current. (I think you
>>>> misunderstand the current limit here, that is the current for power
>>>> driver  to draw).
>>>
>>> Can you be specific about these "special cases" please?
>>> I cannot think of any.
>>
>> Suppose the USB configuration requests 100mA, then we should set the
>> USB charger current is 100mA by __usb_charger_set_cur_limit_by_type()
>> funtion, then notify this to power driver.
>
> ahh.... I had missed something there.  It's a while since I looked
> closely at these patches.
>
> Only.... this usage of usb_charger_set_cur_limit_by_type() is really
> nonsensical.
>
> If the cable is detected as being DCP or CDP or ACA (or ACA/DOCK) then
> the number negotiated with the USB configuration is not relevant and
> should be ignored.  There is a guaranteed minimum which is at least the
> maximum that *can* be negotiated.

Yes. If it is not relevant, we will no't set the current from USB
configuration. Just when your charger type is SDP and the USB
enumeration is done, we can get the USB configuration from host to set
current.

>
> It is only when the cable appears to be a SDP (standard downstream
> port) that the usb-config negotiation is relevant.  That is because the
> minimum guaranteed for SDP is only 100mA.
>
> NeilBrown



-- 
Baolin.wang
Best Regards

  reply	other threads:[~2016-09-09  6:46 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-01  7:09 [PATCH v16 0/4] Introduce usb charger framework to deal with the usb gadget power negotation Baolin Wang
2016-08-01  7:09 ` [PATCH v16 1/4] usb: gadget: Introduce the usb charger framework Baolin Wang
2016-08-01  7:09 ` [PATCH v16 2/4] usb: gadget: Support for " Baolin Wang
2016-08-01  7:09 ` [PATCH v16 3/4] usb: gadget: Integrate with the usb gadget supporting for usb charger Baolin Wang
2016-08-01  7:09 ` [PATCH v16 4/4] power: wm831x_power: Support USB charger current limit management Baolin Wang
2016-08-11  3:14 ` [PATCH v16 0/4] Introduce usb charger framework to deal with the usb gadget power negotation Baolin Wang
2016-08-11  3:14   ` Baolin Wang
2016-08-29  9:02   ` Baolin Wang
2016-09-06  5:40     ` NeilBrown
2016-09-06  5:40       ` NeilBrown
2016-09-06  7:40       ` Felipe Balbi
2016-09-06  7:40         ` Felipe Balbi
2016-09-08  6:55       ` Baolin Wang
2016-09-08  6:55         ` Baolin Wang
2016-09-08  7:31         ` NeilBrown
2016-09-08  7:31           ` NeilBrown
2016-09-08  8:12           ` Baolin Wang
2016-09-08  8:12             ` Baolin Wang
2016-09-08 23:13             ` NeilBrown
2016-09-08 23:13               ` NeilBrown
2016-09-09  6:46               ` Baolin Wang [this message]
2016-09-09  6:46                 ` Baolin Wang
2016-09-09 21:19                 ` NeilBrown
2016-09-09 21:19                   ` NeilBrown
2016-09-18  9:39                   ` Baolin Wang
2016-09-18  9:39                     ` Baolin Wang
2016-10-05  7:26                     ` Baolin Wang
2016-10-05  7:26                       ` Baolin Wang
2016-10-05  7:47                       ` Felipe Balbi
2016-10-05  7:47                         ` Felipe Balbi
2016-10-05  7:57                         ` Baolin Wang
2016-10-05  7:57                           ` Baolin Wang
2016-10-05 10:44                         ` NeilBrown
2016-10-05 10:44                           ` NeilBrown
2016-10-08  3:18                           ` Baolin Wang
2016-10-08  3:18                             ` Baolin Wang
2016-09-09 11:07               ` Mark Brown
2016-09-09 11:07                 ` Mark Brown
2016-09-09 21:57                 ` NeilBrown
2016-09-09 21:57                   ` NeilBrown
2016-09-12 12:25                   ` Mark Brown
2016-09-12 12:25                     ` Mark Brown
2016-09-12 13:27                     ` NeilBrown
2016-09-12 13:27                       ` NeilBrown
2016-09-12 15:26                       ` Mark Brown
2016-09-12 15:26                         ` Mark Brown
2016-09-13  8:00                         ` NeilBrown
2016-09-13  8:00                           ` NeilBrown
2016-09-14 11:16                           ` Mark Brown
2016-09-14 11:16                             ` Mark Brown
2016-09-14 14:11                             ` NeilBrown
2016-09-14 14:11                               ` NeilBrown
2016-09-14 14:57                               ` Mark Brown
2016-09-14 14:57                                 ` Mark Brown
2016-09-14 17:50                                 ` NeilBrown
2016-09-14 17:50                                   ` NeilBrown
2016-09-14 18:02                                   ` Mark Brown
2016-09-14 18:02                                     ` Mark Brown
2016-09-15 10:33                           ` Pavel Machek
2016-09-15 10:33                             ` Pavel Machek

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=CAMz4ku+wWcSPCA1_UYKNqJv4rRDEm5WYUc8AVT6xPJ651-rzmg@mail.gmail.com \
    --to=baolin.wang@linaro.org \
    --cc=Tim.Bird@am.sony.com \
    --cc=balbi@kernel.org \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.wolfsonmicro.com \
    --cc=dbaryshkov@gmail.com \
    --cc=device-mainlining@lists.linuxfoundation.org \
    --cc=dwmw2@infradead.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=grygorii.strashko@ti.com \
    --cc=jun.li@nxp.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=neilb@suse.com \
    --cc=nfbrown@novell.com \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=peter.chen@freescale.com \
    --cc=r.baldyga@samsung.com \
    --cc=robh@kernel.org \
    --cc=ruslan.bilovol@gmail.com \
    --cc=sre@kernel.org \
    --cc=stern@rowland.harvard.edu \
    --cc=yoshihiro.shimoda.uh@renesas.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.