Message ID | ff4410e184539254039ffa8c7547995841029a67.1446807916.git.baolin.wang@linaro.org (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
Hi Baolin,
[auto build test WARNING on v4.3-rc7]
[also build test WARNING on next-20151106]
url: https://github.com/0day-ci/linux/commits/Baolin-Wang/Introduce-usb-charger-framework-to-deal-with-the-usb-gadget-power-negotation/20151106-194008
reproduce: make htmldocs
All warnings (new ones prefixed by >>):
include/linux/usb/gadget.h:227: warning: No description found for parameter 'claimed'
include/linux/usb/gadget.h:631: warning: No description found for parameter 'nh'
include/linux/usb/gadget.h:631: warning: No description found for parameter 'lock'
>> include/linux/usb/gadget.h:631: warning: No description found for parameter 'charger'
include/linux/usb/gadget.h:631: warning: No description found for parameter 'quirk_altset_not_supp'
include/linux/usb/gadget.h:631: warning: No description found for parameter 'quirk_stall_not_supp'
include/linux/usb/gadget.h:631: warning: No description found for parameter 'quirk_zlp_not_supp'
include/linux/usb/gadget.h:1202: warning: No description found for parameter 'gadget'
include/linux/usb/gadget.h:1202: warning: No description found for parameter 'nb'
include/linux/usb/composite.h:501: warning: Excess struct/union/enum/typedef member 'setup_pending' description in 'usb_composite_dev'
include/linux/usb/composite.h:501: warning: Excess struct/union/enum/typedef member 'os_desc_pending' description in 'usb_composite_dev'
drivers/usb/gadget/function/f_acm.c:1: warning: no structured comments found
drivers/usb/gadget/function/f_ecm.c:1: warning: no structured comments found
drivers/usb/gadget/function/f_subset.c:1: warning: no structured comments found
drivers/usb/gadget/function/f_obex.c:1: warning: no structured comments found
drivers/usb/gadget/function/f_serial.c:1: warning: no structured comments found
vim +/charger +631 include/linux/usb/gadget.h
a64cbb7e92 include/linux/usb/gadget.h Baolin Wang 2015-11-06 615 struct mutex lock;
a8d202b50d include/linux/usb/gadget.h Baolin Wang 2015-11-06 616 struct usb_charger *charger;
d8318d7f6b include/linux/usb/gadget.h David Cohen 2013-12-09 617
898c608678 include/linux/usb/gadget.h Felipe Balbi 2011-11-22 618 unsigned sg_supported:1;
^1da177e4c include/linux/usb_gadget.h Linus Torvalds 2005-04-16 619 unsigned is_otg:1;
^1da177e4c include/linux/usb_gadget.h Linus Torvalds 2005-04-16 620 unsigned is_a_peripheral:1;
^1da177e4c include/linux/usb_gadget.h Linus Torvalds 2005-04-16 621 unsigned b_hnp_enable:1;
^1da177e4c include/linux/usb_gadget.h Linus Torvalds 2005-04-16 622 unsigned a_hnp_support:1;
^1da177e4c include/linux/usb_gadget.h Linus Torvalds 2005-04-16 623 unsigned a_alt_hnp_support:1;
0b2d2bbade include/linux/usb/gadget.h David Cohen 2013-12-09 624 unsigned quirk_ep_out_aligned_size:1;
ffd9a0fcbb include/linux/usb/gadget.h Robert Baldyga 2015-07-28 625 unsigned quirk_altset_not_supp:1;
02ded1b0d8 include/linux/usb/gadget.h Robert Baldyga 2015-07-28 626 unsigned quirk_stall_not_supp:1;
ca1023c81d include/linux/usb/gadget.h Robert Baldyga 2015-07-28 627 unsigned quirk_zlp_not_supp:1;
80b2502cea include/linux/usb/gadget.h Peter Chen 2015-01-28 628 unsigned is_selfpowered:1;
ccdf138fe3 include/linux/usb/gadget.h Robert Baldyga 2015-05-04 629 unsigned deactivated:1;
ccdf138fe3 include/linux/usb/gadget.h Robert Baldyga 2015-05-04 630 unsigned connected:1;
^1da177e4c include/linux/usb_gadget.h Linus Torvalds 2005-04-16 @631 };
5702f75375 include/linux/usb/gadget.h Felipe Balbi 2013-07-17 632 #define work_to_gadget(w) (container_of((w), struct usb_gadget, work))
^1da177e4c include/linux/usb_gadget.h Linus Torvalds 2005-04-16 633
^1da177e4c include/linux/usb_gadget.h Linus Torvalds 2005-04-16 634 static inline void set_gadget_data(struct usb_gadget *gadget, void *data)
^1da177e4c include/linux/usb_gadget.h Linus Torvalds 2005-04-16 635 { dev_set_drvdata(&gadget->dev, data); }
^1da177e4c include/linux/usb_gadget.h Linus Torvalds 2005-04-16 636 static inline void *get_gadget_data(struct usb_gadget *gadget)
^1da177e4c include/linux/usb_gadget.h Linus Torvalds 2005-04-16 637 { return dev_get_drvdata(&gadget->dev); }
f48cf80f93 include/linux/usb/gadget.h Fabien Chouteau 2010-04-23 638 static inline struct usb_gadget *dev_to_usb_gadget(struct device *dev)
f48cf80f93 include/linux/usb/gadget.h Fabien Chouteau 2010-04-23 639 {
:::::: The code at line 631 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2
:::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
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..c2610c4 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -24,6 +24,7 @@ #include <linux/types.h> #include <linux/workqueue.h> #include <linux/usb/ch9.h> +#include <linux/usb/usb_charger.h> struct usb_ep; @@ -537,6 +538,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 +613,7 @@ struct usb_gadget { struct usb_otg_caps *otg_caps; struct raw_notifier_head nh; struct mutex lock; + struct usb_charger *charger; unsigned sg_supported:1; unsigned is_otg:1; @@ -815,10 +818,16 @@ static inline int usb_gadget_vbus_connect(struct usb_gadget *gadget) * reporting how much power the device may consume. For example, this * could affect how quickly batteries are recharged. * + * It will also notify the USB charger how much power the device may + * consume if there is a USB charger linking with the gadget. + * * Returns zero on success, else negative errno. */ static inline int usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA) { + if (gadget->charger) + usb_charger_set_cur_limit_by_type(gadget->charger, mA); + if (!gadget->ops->vbus_draw) return -EOPNOTSUPP; return gadget->ops->vbus_draw(gadget, mA);
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 | 9 +++++++++ 2 files changed, 17 insertions(+)