Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: gadget: zero: add function wakeup support

When the device working at enhanced superspeed, it needs to send function
remote wakeup signal to the host instead of device remote wakeup. Add
function wakeup support for the purpose.

Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://lore.kernel.org/r/20250916020544.1301866-1-xu.yang_2@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Xu Yang and committed by
Greg Kroah-Hartman
ed9dd907 87653d54

+18 -9
+18 -9
drivers/usb/gadget/legacy/zero.c
··· 147 147 NULL, 148 148 }; 149 149 150 + static struct usb_function *func_lb; 151 + static struct usb_function_instance *func_inst_lb; 152 + 153 + static struct usb_function *func_ss; 154 + static struct usb_function_instance *func_inst_ss; 155 + 150 156 /*-------------------------------------------------------------------------*/ 151 157 152 158 static struct timer_list autoresume_timer; ··· 162 156 { 163 157 struct usb_composite_dev *cdev = autoresume_cdev; 164 158 struct usb_gadget *g = cdev->gadget; 159 + int status; 165 160 166 161 /* unconfigured devices can't issue wakeups */ 167 162 if (!cdev->config) ··· 172 165 * more significant than just a timer firing; likely 173 166 * because of some direct user request. 174 167 */ 175 - if (g->speed != USB_SPEED_UNKNOWN) { 176 - int status = usb_gadget_wakeup(g); 177 - INFO(cdev, "%s --> %d\n", __func__, status); 168 + if (g->speed == USB_SPEED_UNKNOWN) 169 + return; 170 + 171 + if (g->speed >= USB_SPEED_SUPER) { 172 + if (loopdefault) 173 + status = usb_func_wakeup(func_lb); 174 + else 175 + status = usb_func_wakeup(func_ss); 176 + } else { 177 + status = usb_gadget_wakeup(g); 178 178 } 179 + INFO(cdev, "%s --> %d\n", __func__, status); 179 180 } 180 181 181 182 static void zero_suspend(struct usb_composite_dev *cdev) ··· 220 205 .bmAttributes = USB_CONFIG_ATT_SELFPOWER, 221 206 /* .iConfiguration = DYNAMIC */ 222 207 }; 223 - 224 - static struct usb_function *func_ss; 225 - static struct usb_function_instance *func_inst_ss; 226 208 227 209 static int ss_config_setup(struct usb_configuration *c, 228 210 const struct usb_ctrlrequest *ctrl) ··· 259 247 module_param_named(isoc_maxburst, gzero_options.isoc_maxburst, uint, 260 248 S_IRUGO|S_IWUSR); 261 249 MODULE_PARM_DESC(isoc_maxburst, "0 - 15 (ss only)"); 262 - 263 - static struct usb_function *func_lb; 264 - static struct usb_function_instance *func_inst_lb; 265 250 266 251 module_param_named(qlen, gzero_options.qlen, uint, S_IRUGO|S_IWUSR); 267 252 MODULE_PARM_DESC(qlen, "depth of loopback queue");