Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1374158
| From | Baolin Wang <baolin.wang@linaro.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v10 1/4] gadget: Introduce the usb charger framework |
| Date | 2016-04-08 13:10 +0200 |
| Message-ID | <rlCsx-2SG-3@gated-at.bofh.it> (permalink) |
| References | <rlgBI-3br-21@gated-at.bofh.it> <rlgLp-3f5-29@gated-at.bofh.it> <rlzEm-Px-11@gated-at.bofh.it> <rlBmO-1PG-7@gated-at.bofh.it> <rlCsx-2SG-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi Jun,
>> >> +/*
>> >> + * usb_charger_detect_type() - detect the charger type manually.
>> >> + * @uchger - usb charger device
>> >> + *
>> >> + * Note: You should ensure you need to detect the charger type
>> >> +manually on your
>> >> + * platform.
>> >> + * You should call it at the right gadget state to avoid affecting
>> >> +gadget
>> >> + * enumeration.
>> >> + */
>> >> +int usb_charger_detect_type(struct usb_charger *uchger) {
>> >> + enum usb_charger_type type;
>> >> +
>> >> + if (WARN(!uchger->charger_detect,
>> >> + "charger detection method should not be NULL"))
>> >> + return -EINVAL;
>> >> +
>> >> + type = uchger->charger_detect(uchger);
>> >> +
>> >> + mutex_lock(&uchger->lock);
>> >> + uchger->type = type;
>> >> + mutex_unlock(&uchger->lock);
>> >> +
>> >> + return 0;
>> >> +}
>> >> +EXPORT_SYMBOL_GPL(usb_charger_detect_type);
>> >
>> > I still recommend have a central place to call
>> > usb_charger_detect_type() to cover real charger detection instead of
>> > leaving this question open to diff users. This can be done after
>> > vbus-on is detected and before do gadget connect. I don't think this
>> will make your framework complicated.
>>
>> This API is used for detecting the charger type manually (software charger
>> detection), so if user's udc driver is needed to do this, then they can
>> issue it at their right place to make it more flexible. But let us see
>> other people's suggestion. Thanks.
>
> Ok, actually this API can be used for what ever charger detection
> type, user can implement any method(manual detection, directly read
> result from some HW...what ever) in uchger->charger_detect(), target is
But reading result from some HW dose not means *detect*, actually is
*get*. We can not mix them together with the different semantics.
> to have the charger type and set uchger->type, then you no need to add the comments/description to limit it usage. Also I do see there is possible
> central place to do this.
>
--
Baolin.wang
Best Regards
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v10 0/4] Introduce usb charger framework to deal with the usb gadget power negotation Baolin Wang <baolin.wang@linaro.org> - 2016-04-07 13:50 +0200
[PATCH v10 4/4] power: wm831x_power: Support USB charger current limit management Baolin Wang <baolin.wang@linaro.org> - 2016-04-07 14:00 +0200
[PATCH v10 3/4] gadget: Integrate with the usb gadget supporting for usb charger Baolin Wang <baolin.wang@linaro.org> - 2016-04-07 14:00 +0200
[PATCH v10 1/4] gadget: Introduce the usb charger framework Baolin Wang <baolin.wang@linaro.org> - 2016-04-07 14:00 +0200
RE: [PATCH v10 1/4] gadget: Introduce the usb charger framework Jun Li <jun.li@nxp.com> - 2016-04-08 10:10 +0200
Re: [PATCH v10 1/4] gadget: Introduce the usb charger framework Baolin Wang <baolin.wang@linaro.org> - 2016-04-08 12:00 +0200
Re: [PATCH v10 1/4] gadget: Introduce the usb charger framework Baolin Wang <baolin.wang@linaro.org> - 2016-04-08 13:10 +0200
RE: [PATCH v10 1/4] gadget: Introduce the usb charger framework Jun Li <jun.li@nxp.com> - 2016-04-08 13:50 +0200
Re: [PATCH v10 1/4] gadget: Introduce the usb charger framework Baolin Wang <baolin.wang@linaro.org> - 2016-04-08 14:00 +0200
RE: [PATCH v10 1/4] gadget: Introduce the usb charger framework Jun Li <jun.li@nxp.com> - 2016-04-11 03:40 +0200
Re: [PATCH v10 1/4] gadget: Introduce the usb charger framework Baolin Wang <baolin.wang@linaro.org> - 2016-04-11 13:20 +0200
RE: [PATCH v10 1/4] gadget: Introduce the usb charger framework Jun Li <jun.li@nxp.com> - 2016-04-08 15:00 +0200
[PATCH v10 2/4] gadget: Support for the usb charger framework Baolin Wang <baolin.wang@linaro.org> - 2016-04-07 14:00 +0200
csiph-web