Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1209729 > unrolled thread
| Started by | Baolin Wang <baolin.wang@linaro.org> |
|---|---|
| First post | 2015-08-19 11:20 +0200 |
| Last post | 2015-08-20 03:50 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v4 3/5] gadget: Support for the usb charger framework Baolin Wang <baolin.wang@linaro.org> - 2015-08-19 11:20 +0200
Re: [PATCH v4 3/5] gadget: Support for the usb charger framework Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2015-08-19 15:00 +0200
Re: [PATCH v4 3/5] gadget: Support for the usb charger framework Baolin Wang <baolin.wang@linaro.org> - 2015-08-20 03:50 +0200
| From | Baolin Wang <baolin.wang@linaro.org> |
|---|---|
| Date | 2015-08-19 11:20 +0200 |
| Subject | [PATCH v4 3/5] gadget: Support for the usb charger framework |
| Message-ID | <pZ7Hk-1AV-15@gated-at.bofh.it> |
For supporting the usb charger, it adds the usb_charger_init() and
usb_charger_exit() functions for usb charger initialization and exit.
Introduce a callback 'get_charger_type' which will implemented by
user for usb gadget operations to get the usb charger type.
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
drivers/usb/gadget/udc/udc-core.c | 8 ++++++++
include/linux/usb/gadget.h | 2 ++
2 files changed, 10 insertions(+)
diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c
index 4238fc3..370376e 100644
--- a/drivers/usb/gadget/udc/udc-core.c
+++ b/drivers/usb/gadget/udc/udc-core.c
@@ -28,6 +28,7 @@
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
#include <linux/usb.h>
+#include <linux/usb/usb_charger.h>
/**
* struct usb_udc - describes one usb device controller
@@ -437,8 +438,14 @@ int usb_add_gadget_udc_release(struct device *parent, struct usb_gadget *gadget,
mutex_unlock(&udc_lock);
+ ret = usb_charger_init(gadget);
+ if (ret)
+ goto err5;
+
return 0;
+err5:
+ device_del(&udc->dev);
err4:
list_del(&udc->list);
mutex_unlock(&udc_lock);
@@ -513,6 +520,7 @@ void usb_del_gadget_udc(struct usb_gadget *gadget)
kobject_uevent(&udc->dev.kobj, KOBJ_REMOVE);
flush_work(&gadget->work);
device_unregister(&udc->dev);
+ usb_charger_exit(gadget);
device_unregister(&gadget->dev);
}
EXPORT_SYMBOL_GPL(usb_del_gadget_udc);
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 755e8bc..44d82f5 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -537,6 +537,7 @@ struct usb_gadget_ops {
struct usb_ep *(*match_ep)(struct usb_gadget *,
struct usb_endpoint_descriptor *,
struct usb_ss_ep_comp_descriptor *);
+ enum usb_charger_type (*get_charger_type)(struct usb_gadget *);
};
/**
@@ -611,6 +612,7 @@ struct usb_gadget {
struct usb_otg_caps *otg_caps;
struct raw_notifier_head nh;
struct mutex lock;
+ struct usb_charger *uchger;
unsigned sg_supported:1;
unsigned is_otg:1;
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> |
|---|---|
| Date | 2015-08-19 15:00 +0200 |
| Message-ID | <pZb8e-6mr-13@gated-at.bofh.it> |
| In reply to | #1209729 |
Hello.
On 8/19/2015 12:13 PM, Baolin Wang wrote:
> For supporting the usb charger, it adds the usb_charger_init() and
> usb_charger_exit() functions for usb charger initialization and exit.
>
> Introduce a callback 'get_charger_type' which will implemented by
> user for usb gadget operations to get the usb charger type.
>
> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
[...]
> diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
> index 755e8bc..44d82f5 100644
> --- a/include/linux/usb/gadget.h
> +++ b/include/linux/usb/gadget.h
> @@ -537,6 +537,7 @@ struct usb_gadget_ops {
> struct usb_ep *(*match_ep)(struct usb_gadget *,
> struct usb_endpoint_descriptor *,
> struct usb_ss_ep_comp_descriptor *);
> + enum usb_charger_type (*get_charger_type)(struct usb_gadget *);
^^^ please use space, not tab here
> };
>
> /**
> @@ -611,6 +612,7 @@ struct usb_gadget {
> struct usb_otg_caps *otg_caps;
> struct raw_notifier_head nh;
> struct mutex lock;
> + struct usb_charger *uchger;
Why not simply call the field 'charger'? :-)
[...]
WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Baolin Wang <baolin.wang@linaro.org> |
|---|---|
| Date | 2015-08-20 03:50 +0200 |
| Message-ID | <pZn9o-6St-3@gated-at.bofh.it> |
| In reply to | #1209823 |
On 19 August 2015 at 20:56, Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:
> Hello.
>
> On 8/19/2015 12:13 PM, Baolin Wang wrote:
>
>> For supporting the usb charger, it adds the usb_charger_init() and
>> usb_charger_exit() functions for usb charger initialization and exit.
>>
>> Introduce a callback 'get_charger_type' which will implemented by
>> user for usb gadget operations to get the usb charger type.
>>
>> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
>
> [...]
>
>> diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
>> index 755e8bc..44d82f5 100644
>> --- a/include/linux/usb/gadget.h
>> +++ b/include/linux/usb/gadget.h
>> @@ -537,6 +537,7 @@ struct usb_gadget_ops {
>> struct usb_ep *(*match_ep)(struct usb_gadget *,
>> struct usb_endpoint_descriptor *,
>> struct usb_ss_ep_comp_descriptor *);
>> + enum usb_charger_type (*get_charger_type)(struct usb_gadget *);
>
> ^^^ please use space, not tab here
OK.
>
>> };
>>
>> /**
>> @@ -611,6 +612,7 @@ struct usb_gadget {
>> struct usb_otg_caps *otg_caps;
>> struct raw_notifier_head nh;
>> struct mutex lock;
>> + struct usb_charger *uchger;
>
>
> Why not simply call the field 'charger'? :-)
I think 'uchger' is the abbreviation of 'usb charger' which is maybe a
little verbous, I'll change it. Thanks for your comments.
>
> [...]
>
> WBR, Sergei
>
--
Baolin.wang
Best Regards
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web