Lines Matching refs:gadget
3 * <linux/usb/gadget.h>
5 * We call the USB code inside a Linux-based peripheral device a "gadget"
67 * @list: For use by the gadget driver.
204 * @ep_list:the gadget's ep_list holds all of its endpoints
218 * @driver_data:for use by the gadget driver.
228 * gadget->ep_list. the control endpoint (gadget->ep0) is not in that list,
337 void (*udc_set_ssp_rate)(struct usb_gadget *gadget,
339 void (*udc_async_callbacks)(struct usb_gadget *gadget, bool enable);
343 int (*check_config)(struct usb_gadget *gadget);
354 * @udc: struct usb_udc pointer for this gadget
374 * @otg_caps: OTG capabilities of this gadget.
377 * gadget driver must provide a USB OTG descriptor.
398 * @is_selfpowered: if the gadget is self-powered.
399 * @deactivated: True if gadget is deactivated - in deactivated state it cannot
401 * @connected: True if gadget is connected.
402 * @lpm_capable: If the gadget max_speed is FULL or HIGH, this flag
406 * Gadgets have a mostly-portable "gadget driver" implementing device
409 * That insulates the gadget driver from hardware details, and packages
414 * read-only to the gadget driver. That driver data is part of the
427 /* readonly to gadget driver */
474 static inline void set_gadget_data(struct usb_gadget *gadget, void *data)
475 { dev_set_drvdata(&gadget->dev, data); }
476 static inline void *get_gadget_data(struct usb_gadget *gadget)
477 { return dev_get_drvdata(&gadget->dev); }
482 static inline struct usb_gadget *usb_get_gadget(struct usb_gadget *gadget)
484 get_device(&gadget->dev);
485 return gadget;
487 static inline void usb_put_gadget(struct usb_gadget *gadget)
489 put_device(&gadget->dev);
492 struct usb_gadget *gadget, void (*release)(struct device *dev));
493 extern int usb_add_gadget(struct usb_gadget *gadget);
494 extern void usb_del_gadget(struct usb_gadget *gadget);
498 struct usb_gadget *gadget, void (*release)(struct device *dev));
499 extern int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget);
500 extern void usb_del_gadget_udc(struct usb_gadget *gadget);
504 #define gadget_for_each_ep(tmp, gadget) \
505 list_for_each_entry(tmp, &(gadget)->ep_list, ep_list)
522 * usb_ep_align_maybe - returns @len aligned to ep's maxpacketsize if gadget
622 int usb_gadget_frame_number(struct usb_gadget *gadget);
623 int usb_gadget_wakeup(struct usb_gadget *gadget);
624 int usb_gadget_set_selfpowered(struct usb_gadget *gadget);
625 int usb_gadget_clear_selfpowered(struct usb_gadget *gadget);
626 int usb_gadget_vbus_connect(struct usb_gadget *gadget);
627 int usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA);
628 int usb_gadget_vbus_disconnect(struct usb_gadget *gadget);
629 int usb_gadget_connect(struct usb_gadget *gadget);
630 int usb_gadget_disconnect(struct usb_gadget *gadget);
631 int usb_gadget_deactivate(struct usb_gadget *gadget);
632 int usb_gadget_activate(struct usb_gadget *gadget);
633 int usb_gadget_check_config(struct usb_gadget *gadget);
635 static inline int usb_gadget_frame_number(struct usb_gadget *gadget)
637 static inline int usb_gadget_wakeup(struct usb_gadget *gadget)
639 static inline int usb_gadget_set_selfpowered(struct usb_gadget *gadget)
641 static inline int usb_gadget_clear_selfpowered(struct usb_gadget *gadget)
643 static inline int usb_gadget_vbus_connect(struct usb_gadget *gadget)
645 static inline int usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
647 static inline int usb_gadget_vbus_disconnect(struct usb_gadget *gadget)
649 static inline int usb_gadget_connect(struct usb_gadget *gadget)
651 static inline int usb_gadget_disconnect(struct usb_gadget *gadget)
653 static inline int usb_gadget_deactivate(struct usb_gadget *gadget)
655 static inline int usb_gadget_activate(struct usb_gadget *gadget)
657 static inline int usb_gadget_check_config(struct usb_gadget *gadget)
664 * struct usb_gadget_driver - driver for usb gadget devices
665 * @function: String describing the gadget's function
669 * the gadget driver, including descriptor and configuration
678 * @unbind: Invoked when the driver is unbound from a gadget,
683 * @reset: Invoked on USB bus reset. It is mandatory for all gadget drivers
690 * gadget driver to list of pending driver
692 * Devices are disabled till a gadget driver successfully bind()s, which
696 * If gadget->is_otg is true, the gadget driver must provide an OTG
739 int (*bind)(struct usb_gadget *gadget,
769 * usb_gadget_probe_driver - probe a gadget driver
773 * Call this in your gadget driver's module initialization function,
775 * The @bind() function will be called to bind it to a gadget before this
782 * usb_gadget_unregister_driver - unregister a gadget driver
786 * Call this in your gadget driver's module cleanup function,
871 struct usb_gadget *gadget);
872 int usb_otg_descriptor_init(struct usb_gadget *gadget,
881 extern int usb_gadget_map_request(struct usb_gadget *gadget,
886 extern void usb_gadget_unmap_request(struct usb_gadget *gadget,
891 static inline int usb_gadget_map_request(struct usb_gadget *gadget,
896 static inline void usb_gadget_unmap_request(struct usb_gadget *gadget,
902 /* utility to set gadget state properly */
904 extern void usb_gadget_set_state(struct usb_gadget *gadget,
910 extern void usb_gadget_udc_reset(struct usb_gadget *gadget,
915 /* utility to give requests back to the gadget layer */
931 extern int usb_gadget_ep_match_desc(struct usb_gadget *gadget,
938 extern void usb_udc_vbus_handler(struct usb_gadget *gadget, bool status);