Lines Matching full:gadget
3 * <linux/usb/gadget.h>
5 * We call the USB code inside a Linux-based peripheral device a "gadget"
66 * @list: For use by the gadget driver.
199 * @ep_list:the gadget's ep_list holds all of its endpoints
213 * @driver_data:for use by the gadget driver.
222 * gadget->ep_list. the control endpoint (gadget->ep0) is not in that list,
329 int (*check_config)(struct usb_gadget *gadget);
335 * @udc: struct usb_udc pointer for this gadget
351 * @otg_caps: OTG capabilities of this gadget.
354 * gadget driver must provide a USB OTG descriptor.
375 * @is_selfpowered: if the gadget is self-powered.
376 * @deactivated: True if gadget is deactivated - in deactivated state it cannot
378 * @connected: True if gadget is connected.
379 * @lpm_capable: If the gadget max_speed is FULL or HIGH, this flag
383 * Gadgets have a mostly-portable "gadget driver" implementing device
384 * functions, handling all usb configurations and interfaces. Gadget
386 * That insulates the gadget driver from hardware details, and packages
391 * read-only to the gadget driver. That driver data is part of the
404 /* readonly to gadget driver */
441 static inline void set_gadget_data(struct usb_gadget *gadget, void *data) in set_gadget_data() argument
442 { dev_set_drvdata(&gadget->dev, data); } in set_gadget_data()
443 static inline void *get_gadget_data(struct usb_gadget *gadget) in get_gadget_data() argument
444 { return dev_get_drvdata(&gadget->dev); } in get_gadget_data()
449 static inline struct usb_gadget *usb_get_gadget(struct usb_gadget *gadget) in usb_get_gadget() argument
451 get_device(&gadget->dev); in usb_get_gadget()
452 return gadget; in usb_get_gadget()
454 static inline void usb_put_gadget(struct usb_gadget *gadget) in usb_put_gadget() argument
456 put_device(&gadget->dev); in usb_put_gadget()
459 struct usb_gadget *gadget, void (*release)(struct device *dev));
460 extern int usb_add_gadget(struct usb_gadget *gadget);
461 extern void usb_del_gadget(struct usb_gadget *gadget);
465 struct usb_gadget *gadget, void (*release)(struct device *dev));
466 extern int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget);
467 extern void usb_del_gadget_udc(struct usb_gadget *gadget);
471 #define gadget_for_each_ep(tmp, gadget) \ argument
472 list_for_each_entry(tmp, &(gadget)->ep_list, ep_list)
489 * usb_ep_align_maybe - returns @len aligned to ep's maxpacketsize if gadget
589 int usb_gadget_frame_number(struct usb_gadget *gadget);
590 int usb_gadget_wakeup(struct usb_gadget *gadget);
591 int usb_gadget_set_selfpowered(struct usb_gadget *gadget);
592 int usb_gadget_clear_selfpowered(struct usb_gadget *gadget);
593 int usb_gadget_vbus_connect(struct usb_gadget *gadget);
594 int usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA);
595 int usb_gadget_vbus_disconnect(struct usb_gadget *gadget);
596 int usb_gadget_connect(struct usb_gadget *gadget);
597 int usb_gadget_disconnect(struct usb_gadget *gadget);
598 int usb_gadget_deactivate(struct usb_gadget *gadget);
599 int usb_gadget_activate(struct usb_gadget *gadget);
600 int usb_gadget_check_config(struct usb_gadget *gadget);
602 static inline int usb_gadget_frame_number(struct usb_gadget *gadget) in usb_gadget_frame_number() argument
604 static inline int usb_gadget_wakeup(struct usb_gadget *gadget) in usb_gadget_wakeup() argument
606 static inline int usb_gadget_set_selfpowered(struct usb_gadget *gadget) in usb_gadget_set_selfpowered() argument
608 static inline int usb_gadget_clear_selfpowered(struct usb_gadget *gadget) in usb_gadget_clear_selfpowered() argument
610 static inline int usb_gadget_vbus_connect(struct usb_gadget *gadget) in usb_gadget_vbus_connect() argument
612 static inline int usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA) in usb_gadget_vbus_draw() argument
614 static inline int usb_gadget_vbus_disconnect(struct usb_gadget *gadget) in usb_gadget_vbus_disconnect() argument
616 static inline int usb_gadget_connect(struct usb_gadget *gadget) in usb_gadget_connect() argument
618 static inline int usb_gadget_disconnect(struct usb_gadget *gadget) in usb_gadget_disconnect() argument
620 static inline int usb_gadget_deactivate(struct usb_gadget *gadget) in usb_gadget_deactivate() argument
622 static inline int usb_gadget_activate(struct usb_gadget *gadget) in usb_gadget_activate() argument
624 static inline int usb_gadget_check_config(struct usb_gadget *gadget) in usb_gadget_check_config() argument
631 * struct usb_gadget_driver - driver for usb gadget devices
632 * @function: String describing the gadget's function
636 * the gadget driver, including descriptor and configuration
645 * @unbind: Invoked when the driver is unbound from a gadget,
650 * @reset: Invoked on USB bus reset. It is mandatory for all gadget drivers
657 * gadget driver to list of pending driver
659 * Devices are disabled till a gadget driver successfully bind()s, which
663 * If gadget->is_otg is true, the gadget driver must provide an OTG
706 int (*bind)(struct usb_gadget *gadget,
736 * usb_gadget_probe_driver - probe a gadget driver
740 * Call this in your gadget driver's module initialization function,
742 * The @bind() function will be called to bind it to a gadget before this
749 * usb_gadget_unregister_driver - unregister a gadget driver
753 * Call this in your gadget driver's module cleanup function,
838 struct usb_gadget *gadget);
839 int usb_otg_descriptor_init(struct usb_gadget *gadget,
848 extern int usb_gadget_map_request(struct usb_gadget *gadget,
853 extern void usb_gadget_unmap_request(struct usb_gadget *gadget,
858 static inline int usb_gadget_map_request(struct usb_gadget *gadget, in usb_gadget_map_request() argument
863 static inline void usb_gadget_unmap_request(struct usb_gadget *gadget, in usb_gadget_unmap_request() argument
869 /* utility to set gadget state properly */
871 extern void usb_gadget_set_state(struct usb_gadget *gadget,
877 extern void usb_gadget_udc_reset(struct usb_gadget *gadget,
882 /* utility to give requests back to the gadget layer */
898 extern int usb_gadget_ep_match_desc(struct usb_gadget *gadget,
905 extern void usb_udc_vbus_handler(struct usb_gadget *gadget, bool status);