[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161109013316.GA27425@b29397-desktop>
Date: Wed, 9 Nov 2016 09:33:16 +0800
From: Peter Chen <hzpeterchen@...il.com>
To: NeilBrown <neilb@...e.com>
Cc: Baolin Wang <baolin.wang@...aro.org>,
Felipe Balbi <balbi@...nel.org>,
Greg KH <gregkh@...uxfoundation.org>,
Sebastian Reichel <sre@...nel.org>,
Dmitry Eremin-Solenikov <dbaryshkov@...il.com>,
David Woodhouse <dwmw2@...radead.org>, robh@...nel.org,
Jun Li <jun.li@....com>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Ruslan Bilovol <ruslan.bilovol@...il.com>,
Peter Chen <peter.chen@...escale.com>,
Alan Stern <stern@...land.harvard.edu>,
grygorii.strashko@...com,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>,
Lee Jones <lee.jones@...aro.org>,
Mark Brown <broonie@...nel.org>,
John Stultz <john.stultz@...aro.org>,
Charles Keepax <ckeepax@...nsource.wolfsonmicro.com>,
patches@...nsource.wolfsonmicro.com,
Linux PM list <linux-pm@...r.kernel.org>,
USB <linux-usb@...r.kernel.org>,
device-mainlining@...ts.linuxfoundation.org,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v18 0/4] Introduce usb charger framework to deal with the
usb gadget power negotation
On Wed, Nov 09, 2016 at 07:38:36AM +1100, NeilBrown wrote:
> On Tue, Nov 08 2016, Peter Chen wrote:
>
> > On Thu, Nov 03, 2016 at 12:25:42PM +1100, NeilBrown wrote:
> >>
> >>
> >>
> >> 2/ Change all usb phys to register an extcon and to send appropriate
> >> notifications. Many already do, but I don't think it is universal.
> >> It is probable that the extcon should be registered using common code
> >> instead of each phy driver having its own
> >> extcon_get_edev_by_phandle()
> >> or whatever.
> >> If the usb phy driver needs to look at battery charger registers to
> >> know what sort of cable was connected (which I believe is the case
> >> for the chips you are interested in), then it should do that.
> >
> > Not only USB PHY to register an extcon, but also for the drivers which
> > can detect USB charger type, it may be USB controller driver, USB type-c
> > driver, pmic driver, and these drivers may not have an extcon device
> > since the internal part can finish the vbus detect.
>
> Can you point to an example of the sort of hardware/driver you are
> referring to, preferably in the mainline kernel. Concrete examples make
> this sort of thing much easier to understand.
>
Eg, the nxp/fsl USB charger detector part, the register used to begin
the detection is in USB controller register region, and we also need to
use controller register to pull up dp to begin the secondary detect.
Since there is no USB charger framework, the code is not in mainline.
It finished an upstream version based on patch set in this thread [1]
Some SoCs uses chipidea IP doesn't need to use extcon to detect plugging
in/out, since the vbus pin connects to SoC's vbus pin.
The pmic has abilities to charger detection, eg, drivers/mfd/axp20x.c
and drivers/extcon/extcon-axp288.c.
> I think I would argue that if some piece of hardware can detect the USB
> charger type, then that piece of hardware is part of the "USB PHY", even
> if the hardware manufacturer has chosen to partition the register set in
> a way which doesn't make that obvious.
I agree with that the charger detect hardware is in the USB PHY part,
but some USB PHY's control is integrated in USB controller (eg, some
controller uses drivers/usb/phy/phy-generic.c as its PHY driver), so
we have to use controller register to finish some PHY function, eg
charger detection.
[1] https://www.spinics.net/lists/linux-usb/msg139425.html
--
Best Regards,
Peter Chen
Powered by blists - more mailing lists