Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags   |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * zero.c -- Gadget Zero, for USB development
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (C) 2003-2008 David Brownell
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * Copyright (C) 2008 by Nokia Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  * Gadget Zero only needs two bulk endpoints, and is an example of how you
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  * can write a hardware-agnostic gadget driver running inside a USB device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  * Some hardware details are visible, but don't affect most of the driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  * Use it with the Linux host side "usbtest" driver to get a basic functional
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  * test of your device-side usb stack, or with "usb-skeleton".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * It supports two similar configurations.  One sinks whatever the usb host
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  * writes, and in return sources zeroes.  The other loops whatever the host
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  * writes back, so the host can read it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  * Many drivers will only have one configuration, letting them be much
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  * simpler if they also don't support high speed operation (like this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  * driver does).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  * Why is *this* driver using two configurations, rather than setting up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  * two interfaces with different functions?  To help verify that multiple
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  * configuration infrastructure is working correctly; also, so that it can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  * work with low capability USB controllers without four bulk endpoints.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  * driver assumes self-powered hardware, and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  * has no way for users to trigger remote wakeup.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) /* #define VERBOSE_DEBUG */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #include <linux/device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #include <linux/err.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) #include <linux/usb/composite.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) #include "g_zero.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) /*-------------------------------------------------------------------------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) USB_GADGET_COMPOSITE_OPTIONS();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) #define DRIVER_VERSION		"Cinco de Mayo 2008"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) static const char longname[] = "Gadget Zero";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54)  * Normally the "loopback" configuration is second (index 1) so
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55)  * it's not the default.  Here's where to change that order, to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56)  * work better with hosts where config changes are problematic or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57)  * controllers (like original superh) that only support one config.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) static bool loopdefault = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) module_param(loopdefault, bool, S_IRUGO|S_IWUSR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) static struct usb_zero_options gzero_options = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	.isoc_interval = GZERO_ISOC_INTERVAL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	.isoc_maxpacket = GZERO_ISOC_MAXPACKET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	.bulk_buflen = GZERO_BULK_BUFLEN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	.qlen = GZERO_QLEN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	.ss_bulk_qlen = GZERO_SS_BULK_QLEN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	.ss_iso_qlen = GZERO_SS_ISO_QLEN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) /*-------------------------------------------------------------------------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) /* Thanks to NetChip Technologies for donating this product ID.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75)  * DO NOT REUSE THESE IDs with a protocol-incompatible driver!!  Ever!!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76)  * Instead:  allocate your own, using normal USB-IF procedures.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) #ifndef	CONFIG_USB_ZERO_HNPTEST
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) #define DRIVER_VENDOR_NUM	0x0525		/* NetChip */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) #define DRIVER_PRODUCT_NUM	0xa4a0		/* Linux-USB "Gadget Zero" */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) #define DEFAULT_AUTORESUME	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) #define DRIVER_VENDOR_NUM	0x1a0a		/* OTG test device IDs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) #define DRIVER_PRODUCT_NUM	0xbadd
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) #define DEFAULT_AUTORESUME	5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) /* If the optional "autoresume" mode is enabled, it provides good
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89)  * functional coverage for the "USBCV" test harness from USB-IF.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90)  * It's always set if OTG mode is enabled.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) static unsigned autoresume = DEFAULT_AUTORESUME;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) module_param(autoresume, uint, S_IRUGO);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) MODULE_PARM_DESC(autoresume, "zero, or seconds before remote wakeup");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) /* Maximum Autoresume time */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) static unsigned max_autoresume;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) module_param(max_autoresume, uint, S_IRUGO);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) MODULE_PARM_DESC(max_autoresume, "maximum seconds before remote wakeup");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) /* Interval between two remote wakeups */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) static unsigned autoresume_interval_ms;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) module_param(autoresume_interval_ms, uint, S_IRUGO);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) MODULE_PARM_DESC(autoresume_interval_ms,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 		"milliseconds to increase successive wakeup delays");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) static unsigned autoresume_step_ms;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) /*-------------------------------------------------------------------------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) static struct usb_device_descriptor device_desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	.bLength =		sizeof device_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	.bDescriptorType =	USB_DT_DEVICE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	/* .bcdUSB = DYNAMIC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	.bDeviceClass =		USB_CLASS_VENDOR_SPEC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	.idVendor =		cpu_to_le16(DRIVER_VENDOR_NUM),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	.idProduct =		cpu_to_le16(DRIVER_PRODUCT_NUM),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	.bNumConfigurations =	2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) static const struct usb_descriptor_header *otg_desc[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) /* string IDs are assigned dynamically */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) /* default serial number takes at least two packets */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) static char serial[] = "0123456789.0123456789.0123456789";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) #define USB_GZERO_SS_DESC	(USB_GADGET_FIRST_AVAIL_IDX + 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) #define USB_GZERO_LB_DESC	(USB_GADGET_FIRST_AVAIL_IDX + 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) static struct usb_string strings_dev[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	[USB_GADGET_MANUFACTURER_IDX].s = "",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	[USB_GADGET_PRODUCT_IDX].s = longname,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	[USB_GADGET_SERIAL_IDX].s = serial,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	[USB_GZERO_SS_DESC].s	= "source and sink data",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	[USB_GZERO_LB_DESC].s	= "loop input to output",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	{  }			/* end of list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) static struct usb_gadget_strings stringtab_dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	.language	= 0x0409,	/* en-us */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	.strings	= strings_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) static struct usb_gadget_strings *dev_strings[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	&stringtab_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) /*-------------------------------------------------------------------------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) static struct timer_list	autoresume_timer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) static struct usb_composite_dev *autoresume_cdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) static void zero_autoresume(struct timer_list *unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	struct usb_composite_dev	*cdev = autoresume_cdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	struct usb_gadget		*g = cdev->gadget;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	/* unconfigured devices can't issue wakeups */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	if (!cdev->config)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	/* Normally the host would be woken up for something
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	 * more significant than just a timer firing; likely
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	 * because of some direct user request.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	if (g->speed != USB_SPEED_UNKNOWN) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 		int status = usb_gadget_wakeup(g);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 		INFO(cdev, "%s --> %d\n", __func__, status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) static void zero_suspend(struct usb_composite_dev *cdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	if (cdev->gadget->speed == USB_SPEED_UNKNOWN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	if (autoresume) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 		if (max_autoresume &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 			(autoresume_step_ms > max_autoresume * 1000))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 				autoresume_step_ms = autoresume * 1000;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 		mod_timer(&autoresume_timer, jiffies +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 			msecs_to_jiffies(autoresume_step_ms));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 		DBG(cdev, "suspend, wakeup in %d milliseconds\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 			autoresume_step_ms);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 		autoresume_step_ms += autoresume_interval_ms;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	} else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 		DBG(cdev, "%s\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) static void zero_resume(struct usb_composite_dev *cdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	DBG(cdev, "%s\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	del_timer(&autoresume_timer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) /*-------------------------------------------------------------------------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) static struct usb_configuration loopback_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	.label          = "loopback",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	.bConfigurationValue = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	.bmAttributes   = USB_CONFIG_ATT_SELFPOWER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	/* .iConfiguration = DYNAMIC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) static struct usb_function *func_ss;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) static struct usb_function_instance *func_inst_ss;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) static int ss_config_setup(struct usb_configuration *c,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 		const struct usb_ctrlrequest *ctrl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	switch (ctrl->bRequest) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	case 0x5b:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	case 0x5c:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 		return func_ss->setup(func_ss, ctrl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 		return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) static struct usb_configuration sourcesink_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	.label                  = "source/sink",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	.setup                  = ss_config_setup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	.bConfigurationValue    = 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	.bmAttributes           = USB_CONFIG_ATT_SELFPOWER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	/* .iConfiguration      = DYNAMIC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) module_param_named(buflen, gzero_options.bulk_buflen, uint, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) module_param_named(pattern, gzero_options.pattern, uint, S_IRUGO|S_IWUSR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) MODULE_PARM_DESC(pattern, "0 = all zeroes, 1 = mod63, 2 = none");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) module_param_named(isoc_interval, gzero_options.isoc_interval, uint,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 		S_IRUGO|S_IWUSR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) MODULE_PARM_DESC(isoc_interval, "1 - 16");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) module_param_named(isoc_maxpacket, gzero_options.isoc_maxpacket, uint,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 		S_IRUGO|S_IWUSR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) MODULE_PARM_DESC(isoc_maxpacket, "0 - 1023 (fs), 0 - 1024 (hs/ss)");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) module_param_named(isoc_mult, gzero_options.isoc_mult, uint, S_IRUGO|S_IWUSR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) MODULE_PARM_DESC(isoc_mult, "0 - 2 (hs/ss only)");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) module_param_named(isoc_maxburst, gzero_options.isoc_maxburst, uint,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 		S_IRUGO|S_IWUSR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) MODULE_PARM_DESC(isoc_maxburst, "0 - 15 (ss only)");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) static struct usb_function *func_lb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) static struct usb_function_instance *func_inst_lb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) module_param_named(qlen, gzero_options.qlen, uint, S_IRUGO|S_IWUSR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) MODULE_PARM_DESC(qlen, "depth of loopback queue");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) module_param_named(ss_bulk_qlen, gzero_options.ss_bulk_qlen, uint,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 		S_IRUGO|S_IWUSR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) MODULE_PARM_DESC(bulk_qlen, "depth of sourcesink queue for bulk transfer");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) module_param_named(ss_iso_qlen, gzero_options.ss_iso_qlen, uint,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 		S_IRUGO|S_IWUSR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) MODULE_PARM_DESC(iso_qlen, "depth of sourcesink queue for iso transfer");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) static int zero_bind(struct usb_composite_dev *cdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	struct f_ss_opts	*ss_opts;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 	struct f_lb_opts	*lb_opts;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 	int			status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 	/* Allocate string descriptor numbers ... note that string
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 	 * contents can be overridden by the composite_dev glue.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 	status = usb_string_ids_tab(cdev, strings_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 	if (status < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 		return status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 	device_desc.iManufacturer = strings_dev[USB_GADGET_MANUFACTURER_IDX].id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 	device_desc.iProduct = strings_dev[USB_GADGET_PRODUCT_IDX].id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 	device_desc.iSerialNumber = strings_dev[USB_GADGET_SERIAL_IDX].id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 	autoresume_cdev = cdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 	timer_setup(&autoresume_timer, zero_autoresume, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 	func_inst_ss = usb_get_function_instance("SourceSink");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 	if (IS_ERR(func_inst_ss))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 		return PTR_ERR(func_inst_ss);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 	ss_opts =  container_of(func_inst_ss, struct f_ss_opts, func_inst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 	ss_opts->pattern = gzero_options.pattern;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 	ss_opts->isoc_interval = gzero_options.isoc_interval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 	ss_opts->isoc_maxpacket = gzero_options.isoc_maxpacket;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 	ss_opts->isoc_mult = gzero_options.isoc_mult;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 	ss_opts->isoc_maxburst = gzero_options.isoc_maxburst;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 	ss_opts->bulk_buflen = gzero_options.bulk_buflen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 	ss_opts->bulk_qlen = gzero_options.ss_bulk_qlen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 	ss_opts->iso_qlen = gzero_options.ss_iso_qlen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 	func_ss = usb_get_function(func_inst_ss);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 	if (IS_ERR(func_ss)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 		status = PTR_ERR(func_ss);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 		goto err_put_func_inst_ss;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 	func_inst_lb = usb_get_function_instance("Loopback");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 	if (IS_ERR(func_inst_lb)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 		status = PTR_ERR(func_inst_lb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 		goto err_put_func_ss;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 	lb_opts = container_of(func_inst_lb, struct f_lb_opts, func_inst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 	lb_opts->bulk_buflen = gzero_options.bulk_buflen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 	lb_opts->qlen = gzero_options.qlen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 	func_lb = usb_get_function(func_inst_lb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 	if (IS_ERR(func_lb)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 		status = PTR_ERR(func_lb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 		goto err_put_func_inst_lb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 	sourcesink_driver.iConfiguration = strings_dev[USB_GZERO_SS_DESC].id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 	loopback_driver.iConfiguration = strings_dev[USB_GZERO_LB_DESC].id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 	/* support autoresume for remote wakeup testing */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 	sourcesink_driver.bmAttributes &= ~USB_CONFIG_ATT_WAKEUP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 	loopback_driver.bmAttributes &= ~USB_CONFIG_ATT_WAKEUP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 	sourcesink_driver.descriptors = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 	loopback_driver.descriptors = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) 	if (autoresume) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 		sourcesink_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 		loopback_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 		autoresume_step_ms = autoresume * 1000;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 	/* support OTG systems */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 	if (gadget_is_otg(cdev->gadget)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 		if (!otg_desc[0]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 			struct usb_descriptor_header *usb_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 			usb_desc = usb_otg_descriptor_alloc(cdev->gadget);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 			if (!usb_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 				status = -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 				goto err_conf_flb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 			usb_otg_descriptor_init(cdev->gadget, usb_desc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 			otg_desc[0] = usb_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 			otg_desc[1] = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 		sourcesink_driver.descriptors = otg_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 		sourcesink_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 		loopback_driver.descriptors = otg_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 		loopback_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 	/* Register primary, then secondary configuration.  Note that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 	 * SH3 only allows one config...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 	if (loopdefault) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 		usb_add_config_only(cdev, &loopback_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 		usb_add_config_only(cdev, &sourcesink_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 		usb_add_config_only(cdev, &sourcesink_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 		usb_add_config_only(cdev, &loopback_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 	status = usb_add_function(&sourcesink_driver, func_ss);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 	if (status)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 		goto err_free_otg_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 	usb_ep_autoconfig_reset(cdev->gadget);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) 	status = usb_add_function(&loopback_driver, func_lb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 	if (status)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 		goto err_free_otg_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) 	usb_ep_autoconfig_reset(cdev->gadget);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 	usb_composite_overwrite_options(cdev, &coverwrite);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 	INFO(cdev, "%s, version: " DRIVER_VERSION "\n", longname);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) err_free_otg_desc:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 	kfree(otg_desc[0]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 	otg_desc[0] = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) err_conf_flb:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 	usb_put_function(func_lb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) 	func_lb = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) err_put_func_inst_lb:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) 	usb_put_function_instance(func_inst_lb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 	func_inst_lb = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) err_put_func_ss:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 	usb_put_function(func_ss);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 	func_ss = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) err_put_func_inst_ss:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 	usb_put_function_instance(func_inst_ss);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 	func_inst_ss = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 	return status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) static int zero_unbind(struct usb_composite_dev *cdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 	del_timer_sync(&autoresume_timer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 	if (!IS_ERR_OR_NULL(func_ss))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 		usb_put_function(func_ss);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 	usb_put_function_instance(func_inst_ss);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 	if (!IS_ERR_OR_NULL(func_lb))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) 		usb_put_function(func_lb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) 	usb_put_function_instance(func_inst_lb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) 	kfree(otg_desc[0]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) 	otg_desc[0] = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) static struct usb_composite_driver zero_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 	.name		= "zero",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 	.dev		= &device_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 	.strings	= dev_strings,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) 	.max_speed	= USB_SPEED_SUPER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 	.bind		= zero_bind,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) 	.unbind		= zero_unbind,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) 	.suspend	= zero_suspend,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) 	.resume		= zero_resume,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) module_usb_composite_driver(zero_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) MODULE_AUTHOR("David Brownell");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) MODULE_LICENSE("GPL");