From: Felipe Balbi <balbi@kernel.org>
To: Baolin Wang <baolin.wang@linaro.org>
Cc: 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>
Subject: Re: [PATCH v12 1/4] gadget: Introduce the usb charger framework
Date: Tue, 21 Jun 2016 17:50:16 +0300 [thread overview]
Message-ID: <871t3qmw9j.fsf@linux.intel.com> (raw)
In-Reply-To: <CAMz4kuJHPqvYiUGi8Ar5cR_8dENddvVjNEuG1wJVt3E3vp1UOQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3589 bytes --]
Hi,
Baolin Wang <baolin.wang@linaro.org> writes:
>>> This patch introduces the usb charger driver based on usb gadget that
>>> makes an enhancement to a power driver. It works well in practice but
>>> that requires a system with suitable hardware.
>>>
>>> The basic conception of the usb charger is that, when one usb charger
>>> is added or removed by reporting from the usb gadget state change or
>>> the extcon device state change, the usb charger will report to power
>>> user to set the current limitation.
>>>
>>> The usb charger will register notifiees on the usb gadget or the extcon
>>> device to get notified the usb charger state. It also supplies the
>>> notification mechanism to userspace When the usb charger state is changed.
>>>
>>> Power user will register a notifiee on the usb charger to get notified
>>> by status changes from the usb charger. It will report to power user
>>> to set the current limitation when detecting the usb charger is added
>>> or removed from extcon device state or usb gadget state.
>>>
>>> This patch doesn't yet integrate with the gadget code, so some functions
>>> which rely on the 'gadget' are not completed, that will be implemented
>>> in the following patches.
>>>
>>> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
>>> Reviewed-by: Li Jun <jun.li@nxp.com>
>>> Tested-by: Li Jun <jun.li@nxp.com>
>>> ---
>>> drivers/usb/gadget/Kconfig | 7 +
>>> drivers/usb/gadget/udc/Makefile | 1 +
>>> drivers/usb/gadget/udc/charger.c | 770 ++++++++++++++++++++++++++++++++++++++
>>> include/linux/usb/charger.h | 191 ++++++++++
>>> include/uapi/linux/usb/charger.h | 31 ++
>>> 5 files changed, 1000 insertions(+)
>>> create mode 100644 drivers/usb/gadget/udc/charger.c
>>> create mode 100644 include/linux/usb/charger.h
>>> create mode 100644 include/uapi/linux/usb/charger.h
>>>
>>> diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
>>> index 2057add..89f4e9b 100644
>>> --- a/drivers/usb/gadget/Kconfig
>>> +++ b/drivers/usb/gadget/Kconfig
>>> @@ -134,6 +134,13 @@ config U_SERIAL_CONSOLE
>>> help
>>> It supports the serial gadget can be used as a console.
>>>
>>> +config USB_CHARGER
>>> + bool "USB charger support"
>>
>> you didn't build test all possibilities, did you?
>>
>> I have a feeling this won't link if USB_GADGET=m. Can you test that?
>
> OK.
>
>>
>>> diff --git a/drivers/usb/gadget/udc/charger.c b/drivers/usb/gadget/udc/charger.c
>> [...]
>>> +struct class *usb_charger_class;
>>
>> We already have a UDC class, do we really, really need another class
>> here?
>
> We want to manage the usb charger devices by this class and one usb
> charger device is not equal with one usb device which managed by UDC
Can you explain this statement? If charging is done via a USB peripheral
port, why don't we have a 1:1 mapping between charger and UDC?
> class, so can we use UDC class to manage charger devices?
> By the way, you also suggested to use the 'class' things instead of
> 'bus' in previous mail.
true, I did say that. It seems clearer, however, that we don't need this
virtual device here.
>>> +subsys_initcall(usb_charger_class_init);
>>
>> this should always work as module_init(). Please make sure that's the
>> case.
>
> we should make sure the charger class has been allocated before user
> try to add a new gadget to the udc class. So it should be issued
> before 'module_init()' (many usb drivers are at module_init level).
-EPROBE_DEFER?
--
balbi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
next prev parent reply other threads:[~2016-06-21 14:51 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-21 8:39 [PATCH v12 0/4] Introduce usb charger framework to deal with the usb gadget power negotation Baolin Wang
2016-06-21 8:39 ` [PATCH v12 1/4] gadget: Introduce the usb charger framework Baolin Wang
2016-06-21 10:25 ` Felipe Balbi
2016-06-21 11:23 ` Baolin Wang
2016-06-21 14:50 ` Felipe Balbi [this message]
2016-06-22 1:49 ` Baolin Wang
2016-06-21 8:39 ` [PATCH v12 2/4] gadget: Support for " Baolin Wang
2016-06-21 10:27 ` Felipe Balbi
2016-06-21 11:29 ` Baolin Wang
2016-06-21 11:49 ` Felipe Balbi
2016-06-21 12:05 ` Baolin Wang
2016-06-21 12:27 ` Felipe Balbi
2016-06-21 12:34 ` Baolin Wang
2016-06-21 12:36 ` Felipe Balbi
2016-06-21 12:43 ` Baolin Wang
2016-06-21 12:53 ` Felipe Balbi
2016-06-21 12:54 ` Felipe Balbi
2016-06-22 1:45 ` Baolin Wang
2016-06-23 8:56 ` Baolin Wang
2016-06-29 8:20 ` Felipe Balbi
2016-06-29 8:31 ` Baolin Wang
2016-06-29 8:34 ` Felipe Balbi
2016-06-29 8:38 ` Baolin Wang
2016-06-29 12:06 ` Felipe Balbi
2016-06-29 12:16 ` Baolin Wang
2016-06-29 12:30 ` Felipe Balbi
2016-06-21 8:39 ` [PATCH v12 3/4] gadget: Integrate with the usb gadget supporting for usb charger Baolin Wang
2016-06-21 8:39 ` [PATCH v12 4/4] power: wm831x_power: Support USB charger current limit management Baolin Wang
2016-06-21 10:30 ` Felipe Balbi
2016-06-21 11:03 ` Mark Brown
2016-06-21 11:45 ` Baolin Wang
2016-06-21 11:53 ` Felipe Balbi
2016-06-21 11:57 ` Baolin Wang
2016-06-21 11:50 ` Felipe Balbi
2016-06-21 14:53 ` 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=871t3qmw9j.fsf@linux.intel.com \
--to=balbi@kernel.org \
--cc=baolin.wang@linaro.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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox