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.
200 * @ep_list:the gadget's ep_list holds all of its endpoints
214 * @driver_data:for use by the gadget driver.
223 * gadget->ep_list. the control endpoint (gadget->ep0) is not in that list,
315 int (*func_wakeup)(struct usb_gadget *gadget, int intf_id);
329 void (*udc_set_ssp_rate)(struct usb_gadget *gadget,
331 void (*udc_async_callbacks)(struct usb_gadget *gadget, bool enable);
335 int (*check_config)(struct usb_gadget *gadget);
341 * @udc: struct usb_udc pointer for this gadget
361 * @otg_caps: OTG capabilities of this gadget.
364 * gadget driver must provide a USB OTG descriptor.
385 * @is_selfpowered: if the gadget is self-powered.
386 * @deactivated: True if gadget is deactivated - in deactivated state it cannot
388 * @connected: True if gadget is connected.
389 * @lpm_capable: If the gadget max_speed is FULL or HIGH, this flag
391 * @wakeup_capable: True if gadget is capable of sending remote wakeup.
392 * @wakeup_armed: True if gadget is armed by the host for remote wakeup.
394 * @id_number: a unique ID number for ensuring that gadget names are distinct
396 * Gadgets have a mostly-portable "gadget driver" implementing device
397 * functions, handling all usb configurations and interfaces. Gadget
399 * That insulates the gadget driver from hardware details, and packages
404 * read-only to the gadget driver. That driver data is part of the
417 /* readonly to gadget driver */
462 static inline void set_gadget_data(struct usb_gadget *gadget, void *data) in set_gadget_data() argument
463 { dev_set_drvdata(&gadget->dev, data); } in set_gadget_data()
464 static inline void *get_gadget_data(struct usb_gadget *gadget) in get_gadget_data() argument
465 { return dev_get_drvdata(&gadget->dev); } in get_gadget_data()
470 static inline struct usb_gadget *usb_get_gadget(struct usb_gadget *gadget) in usb_get_gadget() argument
472 get_device(&gadget->dev); in usb_get_gadget()
473 return gadget; in usb_get_gadget()
475 static inline void usb_put_gadget(struct usb_gadget *gadget) in usb_put_gadget() argument
477 put_device(&gadget->dev); in usb_put_gadget()
480 struct usb_gadget *gadget, void (*release)(struct device *dev));
481 extern int usb_add_gadget(struct usb_gadget *gadget);
482 extern void usb_del_gadget(struct usb_gadget *gadget);
486 struct usb_gadget *gadget, void (*release)(struct device *dev));
487 extern int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget);
488 extern void usb_del_gadget_udc(struct usb_gadget *gadget);
492 #define gadget_for_each_ep(tmp, gadget) \ argument
493 list_for_each_entry(tmp, &(gadget)->ep_list, ep_list)
510 * usb_ep_align_maybe - returns @len aligned to ep's maxpacketsize if gadget
610 int usb_gadget_frame_number(struct usb_gadget *gadget);
611 int usb_gadget_wakeup(struct usb_gadget *gadget);
612 int usb_gadget_set_remote_wakeup(struct usb_gadget *gadget, int set);
613 int usb_gadget_set_selfpowered(struct usb_gadget *gadget);
614 int usb_gadget_clear_selfpowered(struct usb_gadget *gadget);
615 int usb_gadget_vbus_connect(struct usb_gadget *gadget);
616 int usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA);
617 int usb_gadget_vbus_disconnect(struct usb_gadget *gadget);
618 int usb_gadget_connect(struct usb_gadget *gadget);
619 int usb_gadget_disconnect(struct usb_gadget *gadget);
620 int usb_gadget_deactivate(struct usb_gadget *gadget);
621 int usb_gadget_activate(struct usb_gadget *gadget);
622 int usb_gadget_check_config(struct usb_gadget *gadget);
624 static inline int usb_gadget_frame_number(struct usb_gadget *gadget) in usb_gadget_frame_number() argument
626 static inline int usb_gadget_wakeup(struct usb_gadget *gadget) in usb_gadget_wakeup() argument
628 static inline int usb_gadget_set_remote_wakeup(struct usb_gadget *gadget, int set) in usb_gadget_set_remote_wakeup() argument
630 static inline int usb_gadget_set_selfpowered(struct usb_gadget *gadget) in usb_gadget_set_selfpowered() argument
632 static inline int usb_gadget_clear_selfpowered(struct usb_gadget *gadget) in usb_gadget_clear_selfpowered() argument
634 static inline int usb_gadget_vbus_connect(struct usb_gadget *gadget) in usb_gadget_vbus_connect() argument
636 static inline int usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA) in usb_gadget_vbus_draw() argument
638 static inline int usb_gadget_vbus_disconnect(struct usb_gadget *gadget) in usb_gadget_vbus_disconnect() argument
640 static inline int usb_gadget_connect(struct usb_gadget *gadget) in usb_gadget_connect() argument
642 static inline int usb_gadget_disconnect(struct usb_gadget *gadget) in usb_gadget_disconnect() argument
644 static inline int usb_gadget_deactivate(struct usb_gadget *gadget) in usb_gadget_deactivate() argument
646 static inline int usb_gadget_activate(struct usb_gadget *gadget) in usb_gadget_activate() argument
648 static inline int usb_gadget_check_config(struct usb_gadget *gadget) in usb_gadget_check_config() argument
655 * struct usb_gadget_driver - driver for usb gadget devices
656 * @function: String describing the gadget's function
660 * the gadget driver, including descriptor and configuration
669 * @unbind: Invoked when the driver is unbound from a gadget,
674 * @reset: Invoked on USB bus reset. It is mandatory for all gadget drivers
681 * @is_bound: Allow a driver to be bound to only one gadget
683 * Devices are disabled till a gadget driver successfully bind()s, which
687 * If gadget->is_otg is true, the gadget driver must provide an OTG
716 * The gadget driver's setup() callback does not have to queue a response to
739 int (*bind)(struct usb_gadget *gadget,
764 * A gadget driver can be bound to only one gadget at a time.
768 * usb_gadget_register_driver_owner - register a gadget driver
774 * Call this in your gadget driver's module initialization function,
776 * The @bind() function will be called to bind it to a gadget before this
790 * usb_gadget_unregister_driver - unregister a gadget driver
794 * Call this in your gadget driver's module cleanup function,
889 struct usb_gadget *gadget);
890 int usb_otg_descriptor_init(struct usb_gadget *gadget,
899 extern int usb_gadget_map_request(struct usb_gadget *gadget,
904 extern void usb_gadget_unmap_request(struct usb_gadget *gadget,
909 static inline int usb_gadget_map_request(struct usb_gadget *gadget, in usb_gadget_map_request() argument
914 static inline void usb_gadget_unmap_request(struct usb_gadget *gadget, in usb_gadget_unmap_request() argument
920 /* utility to set gadget state properly */
922 extern void usb_gadget_set_state(struct usb_gadget *gadget,
928 extern void usb_gadget_udc_reset(struct usb_gadget *gadget,
933 /* utility to give requests back to the gadget layer */
949 extern int usb_gadget_ep_match_desc(struct usb_gadget *gadget,
956 extern void usb_udc_vbus_handler(struct usb_gadget *gadget, bool status);