Lines Matching full:gadget

3  * <linux/usb/gadget.h>
5 * We call the USB code inside a Linux-based peripheral device a "gadget"
65 * @list: For use by the gadget driver.
198 * @ep_list:the gadget's ep_list holds all of its endpoints
212 * @driver_data:for use by the gadget driver.
221 * gadget->ep_list. the control endpoint (gadget->ep0) is not in that list,
313 int (*func_wakeup)(struct usb_gadget *gadget, int intf_id);
327 void (*udc_set_ssp_rate)(struct usb_gadget *gadget,
329 void (*udc_async_callbacks)(struct usb_gadget *gadget, bool enable);
333 int (*check_config)(struct usb_gadget *gadget);
339 * @udc: struct usb_udc pointer for this gadget
359 * @otg_caps: OTG capabilities of this gadget.
362 * gadget driver must provide a USB OTG descriptor.
383 * @is_selfpowered: if the gadget is self-powered.
384 * @deactivated: True if gadget is deactivated - in deactivated state it cannot
386 * @connected: True if gadget is connected.
387 * @lpm_capable: If the gadget max_speed is FULL or HIGH, this flag
389 * @wakeup_capable: True if gadget is capable of sending remote wakeup.
390 * @wakeup_armed: True if gadget is armed by the host for remote wakeup.
392 * @id_number: a unique ID number for ensuring that gadget names are distinct
394 * Gadgets have a mostly-portable "gadget driver" implementing device
395 * functions, handling all usb configurations and interfaces. Gadget
397 * That insulates the gadget driver from hardware details, and packages
402 * read-only to the gadget driver. That driver data is part of the
415 /* readonly to gadget driver */
460 static inline void set_gadget_data(struct usb_gadget *gadget, void *data) in set_gadget_data() argument
461 { dev_set_drvdata(&gadget->dev, data); } in set_gadget_data()
462 static inline void *get_gadget_data(struct usb_gadget *gadget) in get_gadget_data() argument
463 { return dev_get_drvdata(&gadget->dev); } in get_gadget_data()
468 static inline struct usb_gadget *usb_get_gadget(struct usb_gadget *gadget) in usb_get_gadget() argument
470 get_device(&gadget->dev); in usb_get_gadget()
471 return gadget; in usb_get_gadget()
473 static inline void usb_put_gadget(struct usb_gadget *gadget) in usb_put_gadget() argument
475 put_device(&gadget->dev); in usb_put_gadget()
478 struct usb_gadget *gadget, void (*release)(struct device *dev));
479 extern int usb_add_gadget(struct usb_gadget *gadget);
480 extern void usb_del_gadget(struct usb_gadget *gadget);
484 struct usb_gadget *gadget, void (*release)(struct device *dev));
485 extern int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget);
486 extern void usb_del_gadget_udc(struct usb_gadget *gadget);
490 #define gadget_for_each_ep(tmp, gadget) \ argument
491 list_for_each_entry(tmp, &(gadget)->ep_list, ep_list)
508 * usb_ep_align_maybe - returns @len aligned to ep's maxpacketsize if gadget
608 int usb_gadget_frame_number(struct usb_gadget *gadget);
609 int usb_gadget_wakeup(struct usb_gadget *gadget);
610 int usb_gadget_set_remote_wakeup(struct usb_gadget *gadget, int set);
611 int usb_gadget_set_selfpowered(struct usb_gadget *gadget);
612 int usb_gadget_clear_selfpowered(struct usb_gadget *gadget);
613 int usb_gadget_vbus_connect(struct usb_gadget *gadget);
614 int usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA);
615 int usb_gadget_vbus_disconnect(struct usb_gadget *gadget);
616 int usb_gadget_connect(struct usb_gadget *gadget);
617 int usb_gadget_disconnect(struct usb_gadget *gadget);
618 int usb_gadget_deactivate(struct usb_gadget *gadget);
619 int usb_gadget_activate(struct usb_gadget *gadget);
620 int usb_gadget_check_config(struct usb_gadget *gadget);
622 static inline int usb_gadget_frame_number(struct usb_gadget *gadget) in usb_gadget_frame_number() argument
624 static inline int usb_gadget_wakeup(struct usb_gadget *gadget) in usb_gadget_wakeup() argument
626 static inline int usb_gadget_set_remote_wakeup(struct usb_gadget *gadget, int set) in usb_gadget_set_remote_wakeup() argument
628 static inline int usb_gadget_set_selfpowered(struct usb_gadget *gadget) in usb_gadget_set_selfpowered() argument
630 static inline int usb_gadget_clear_selfpowered(struct usb_gadget *gadget) in usb_gadget_clear_selfpowered() argument
632 static inline int usb_gadget_vbus_connect(struct usb_gadget *gadget) in usb_gadget_vbus_connect() argument
634 static inline int usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA) in usb_gadget_vbus_draw() argument
636 static inline int usb_gadget_vbus_disconnect(struct usb_gadget *gadget) in usb_gadget_vbus_disconnect() argument
638 static inline int usb_gadget_connect(struct usb_gadget *gadget) in usb_gadget_connect() argument
640 static inline int usb_gadget_disconnect(struct usb_gadget *gadget) in usb_gadget_disconnect() argument
642 static inline int usb_gadget_deactivate(struct usb_gadget *gadget) in usb_gadget_deactivate() argument
644 static inline int usb_gadget_activate(struct usb_gadget *gadget) in usb_gadget_activate() argument
646 static inline int usb_gadget_check_config(struct usb_gadget *gadget) in usb_gadget_check_config() argument
653 * struct usb_gadget_driver - driver for usb gadget devices
654 * @function: String describing the gadget's function
658 * the gadget driver, including descriptor and configuration
667 * @unbind: Invoked when the driver is unbound from a gadget,
672 * @reset: Invoked on USB bus reset. It is mandatory for all gadget drivers
679 * @is_bound: Allow a driver to be bound to only one gadget
681 * Devices are disabled till a gadget driver successfully bind()s, which
685 * If gadget->is_otg is true, the gadget driver must provide an OTG
714 * The gadget driver's setup() callback does not have to queue a response to
737 int (*bind)(struct usb_gadget *gadget,
762 * A gadget driver can be bound to only one gadget at a time.
766 * usb_gadget_register_driver_owner - register a gadget driver
772 * Call this in your gadget driver's module initialization function,
774 * The @bind() function will be called to bind it to a gadget before this
788 * usb_gadget_unregister_driver - unregister a gadget driver
792 * Call this in your gadget driver's module cleanup function,
887 struct usb_gadget *gadget);
888 int usb_otg_descriptor_init(struct usb_gadget *gadget,
897 extern int usb_gadget_map_request(struct usb_gadget *gadget,
902 extern void usb_gadget_unmap_request(struct usb_gadget *gadget,
907 static inline int usb_gadget_map_request(struct usb_gadget *gadget, in usb_gadget_map_request() argument
912 static inline void usb_gadget_unmap_request(struct usb_gadget *gadget, in usb_gadget_unmap_request() argument
918 /* utility to set gadget state properly */
920 extern void usb_gadget_set_state(struct usb_gadget *gadget,
926 extern void usb_gadget_udc_reset(struct usb_gadget *gadget,
931 /* utility to give requests back to the gadget layer */
947 extern int usb_gadget_ep_match_desc(struct usb_gadget *gadget,
954 extern void usb_udc_vbus_handler(struct usb_gadget *gadget, bool status);