Merge tag 'usb-6.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB fixes from Greg KH:
"A few small USB fixes for 6.1-rc3. Include in here are:

- MAINTAINERS update, including a big one for the USB gadget
subsystem. Many thanks to Felipe for all of the years of hard work
he has done on this codebase, it was greatly appreciated.

- dwc3 driver fixes for reported problems.

- xhci driver fixes for reported problems.

- typec driver fixes for minor issues

- uvc gadget driver change, and then revert as it wasn't relevant for
6.1-final, as it is a new feature and people are still reviewing
and modifying it.

All of these have been in the linux-next tree with no reported issues"

* tag 'usb-6.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
usb: dwc3: gadget: Don't set IMI for no_interrupt
usb: dwc3: gadget: Stop processing more requests on IMI
Revert "usb: gadget: uvc: limit isoc_sg to super speed gadgets"
xhci: Remove device endpoints from bandwidth list when freeing the device
xhci-pci: Set runtime PM as default policy on all xHC 1.2 or later devices
xhci: Add quirk to reset host back to default state at shutdown
usb: xhci: add XHCI_SPURIOUS_SUCCESS to ASM1042 despite being a V0.96 controller
usb: dwc3: st: Rely on child's compatible instead of name
usb: gadget: uvc: limit isoc_sg to super speed gadgets
usb: bdc: change state when port disconnected
usb: typec: ucsi: acpi: Implement resume callback
usb: typec: ucsi: Check the connection on resume
usb: gadget: aspeed: Fix probe regression
usb: gadget: uvc: fix sg handling during video encode
usb: gadget: uvc: fix sg handling in error case
usb: gadget: uvc: fix dropped frame after missed isoc
usb: dwc3: gadget: Don't delay End Transfer on delayed_status
usb: dwc3: Don't switch OTG -> peripheral if extcon is present
MAINTAINERS: Update maintainers for broadcom USB
MAINTAINERS: move USB gadget and phy entries under the main USB entry

Changed files
+169 -133
drivers
usb
+3 -16
MAINTAINERS
··· 4101 4101 N: bcm7120 4102 4102 4103 4103 BROADCOM BDC DRIVER 4104 + M: Justin Chen <justinpopo6@gmail.com> 4104 4105 M: Al Cooper <alcooperx@gmail.com> 4105 4106 L: linux-usb@vger.kernel.org 4106 4107 R: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com> ··· 4208 4207 F: drivers/tty/serial/8250/8250_bcm7271.c 4209 4208 4210 4209 BROADCOM BRCMSTB USB EHCI DRIVER 4210 + M: Justin Chen <justinpopo6@gmail.com> 4211 4211 M: Al Cooper <alcooperx@gmail.com> 4212 4212 R: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com> 4213 4213 L: linux-usb@vger.kernel.org ··· 4225 4223 F: drivers/usb/misc/brcmstb-usb-pinmap.c 4226 4224 4227 4225 BROADCOM BRCMSTB USB2 and USB3 PHY DRIVER 4226 + M: Justin Chen <justinpopo6@gmail.com> 4228 4227 M: Al Cooper <alcooperx@gmail.com> 4229 4228 R: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com> 4230 4229 L: linux-kernel@vger.kernel.org ··· 21182 21179 F: Documentation/usb/ehci.rst 21183 21180 F: drivers/usb/host/ehci* 21184 21181 21185 - USB GADGET/PERIPHERAL SUBSYSTEM 21186 - M: Felipe Balbi <balbi@kernel.org> 21187 - L: linux-usb@vger.kernel.org 21188 - S: Maintained 21189 - W: http://www.linux-usb.org/gadget 21190 - T: git git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git 21191 - F: drivers/usb/gadget/ 21192 - F: include/linux/usb/gadget* 21193 - 21194 21182 USB HID/HIDBP DRIVERS (USB KEYBOARDS, MICE, REMOTE CONTROLS, ...) 21195 21183 M: Jiri Kosina <jikos@kernel.org> 21196 21184 M: Benjamin Tissoires <benjamin.tissoires@redhat.com> ··· 21287 21293 W: https://github.com/petkan/pegasus 21288 21294 T: git https://github.com/petkan/pegasus.git 21289 21295 F: drivers/net/usb/pegasus.* 21290 - 21291 - USB PHY LAYER 21292 - M: Felipe Balbi <balbi@kernel.org> 21293 - L: linux-usb@vger.kernel.org 21294 - S: Maintained 21295 - T: git git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git 21296 - F: drivers/usb/phy/ 21297 21296 21298 21297 USB PRINTER DRIVER (usblp) 21299 21298 M: Pete Zaitcev <zaitcev@redhat.com>
+48 -1
drivers/usb/dwc3/core.c
··· 23 23 #include <linux/delay.h> 24 24 #include <linux/dma-mapping.h> 25 25 #include <linux/of.h> 26 + #include <linux/of_graph.h> 26 27 #include <linux/acpi.h> 27 28 #include <linux/pinctrl/consumer.h> 28 29 #include <linux/reset.h> ··· 86 85 * mode. If the controller supports DRD but the dr_mode is not 87 86 * specified or set to OTG, then set the mode to peripheral. 88 87 */ 89 - if (mode == USB_DR_MODE_OTG && 88 + if (mode == USB_DR_MODE_OTG && !dwc->edev && 90 89 (!IS_ENABLED(CONFIG_USB_ROLE_SWITCH) || 91 90 !device_property_read_bool(dwc->dev, "usb-role-switch")) && 92 91 !DWC3_VER_IS_PRIOR(DWC3, 330A)) ··· 1691 1690 } 1692 1691 } 1693 1692 1693 + static struct extcon_dev *dwc3_get_extcon(struct dwc3 *dwc) 1694 + { 1695 + struct device *dev = dwc->dev; 1696 + struct device_node *np_phy; 1697 + struct extcon_dev *edev = NULL; 1698 + const char *name; 1699 + 1700 + if (device_property_read_bool(dev, "extcon")) 1701 + return extcon_get_edev_by_phandle(dev, 0); 1702 + 1703 + /* 1704 + * Device tree platforms should get extcon via phandle. 1705 + * On ACPI platforms, we get the name from a device property. 1706 + * This device property is for kernel internal use only and 1707 + * is expected to be set by the glue code. 1708 + */ 1709 + if (device_property_read_string(dev, "linux,extcon-name", &name) == 0) 1710 + return extcon_get_extcon_dev(name); 1711 + 1712 + /* 1713 + * Try to get an extcon device from the USB PHY controller's "port" 1714 + * node. Check if it has the "port" node first, to avoid printing the 1715 + * error message from underlying code, as it's a valid case: extcon 1716 + * device (and "port" node) may be missing in case of "usb-role-switch" 1717 + * or OTG mode. 1718 + */ 1719 + np_phy = of_parse_phandle(dev->of_node, "phys", 0); 1720 + if (of_graph_is_present(np_phy)) { 1721 + struct device_node *np_conn; 1722 + 1723 + np_conn = of_graph_get_remote_node(np_phy, -1, -1); 1724 + if (np_conn) 1725 + edev = extcon_find_edev_by_node(np_conn); 1726 + of_node_put(np_conn); 1727 + } 1728 + of_node_put(np_phy); 1729 + 1730 + return edev; 1731 + } 1732 + 1694 1733 static int dwc3_probe(struct platform_device *pdev) 1695 1734 { 1696 1735 struct device *dev = &pdev->dev; ··· 1879 1838 dev_err(dwc->dev, "failed to allocate event buffers\n"); 1880 1839 ret = -ENOMEM; 1881 1840 goto err2; 1841 + } 1842 + 1843 + dwc->edev = dwc3_get_extcon(dwc); 1844 + if (IS_ERR(dwc->edev)) { 1845 + ret = dev_err_probe(dwc->dev, PTR_ERR(dwc->edev), "failed to get extcon\n"); 1846 + goto err3; 1882 1847 } 1883 1848 1884 1849 ret = dwc3_get_dr_mode(dwc);
-50
drivers/usb/dwc3/drd.c
··· 8 8 */ 9 9 10 10 #include <linux/extcon.h> 11 - #include <linux/of_graph.h> 12 11 #include <linux/of_platform.h> 13 12 #include <linux/platform_device.h> 14 13 #include <linux/property.h> ··· 438 439 return NOTIFY_DONE; 439 440 } 440 441 441 - static struct extcon_dev *dwc3_get_extcon(struct dwc3 *dwc) 442 - { 443 - struct device *dev = dwc->dev; 444 - struct device_node *np_phy; 445 - struct extcon_dev *edev = NULL; 446 - const char *name; 447 - 448 - if (device_property_read_bool(dev, "extcon")) 449 - return extcon_get_edev_by_phandle(dev, 0); 450 - 451 - /* 452 - * Device tree platforms should get extcon via phandle. 453 - * On ACPI platforms, we get the name from a device property. 454 - * This device property is for kernel internal use only and 455 - * is expected to be set by the glue code. 456 - */ 457 - if (device_property_read_string(dev, "linux,extcon-name", &name) == 0) { 458 - edev = extcon_get_extcon_dev(name); 459 - if (!edev) 460 - return ERR_PTR(-EPROBE_DEFER); 461 - 462 - return edev; 463 - } 464 - 465 - /* 466 - * Try to get an extcon device from the USB PHY controller's "port" 467 - * node. Check if it has the "port" node first, to avoid printing the 468 - * error message from underlying code, as it's a valid case: extcon 469 - * device (and "port" node) may be missing in case of "usb-role-switch" 470 - * or OTG mode. 471 - */ 472 - np_phy = of_parse_phandle(dev->of_node, "phys", 0); 473 - if (of_graph_is_present(np_phy)) { 474 - struct device_node *np_conn; 475 - 476 - np_conn = of_graph_get_remote_node(np_phy, -1, -1); 477 - if (np_conn) 478 - edev = extcon_find_edev_by_node(np_conn); 479 - of_node_put(np_conn); 480 - } 481 - of_node_put(np_phy); 482 - 483 - return edev; 484 - } 485 - 486 442 #if IS_ENABLED(CONFIG_USB_ROLE_SWITCH) 487 443 #define ROLE_SWITCH 1 488 444 static int dwc3_usb_role_switch_set(struct usb_role_switch *sw, ··· 541 587 if (ROLE_SWITCH && 542 588 device_property_read_bool(dwc->dev, "usb-role-switch")) 543 589 return dwc3_setup_role_switch(dwc); 544 - 545 - dwc->edev = dwc3_get_extcon(dwc); 546 - if (IS_ERR(dwc->edev)) 547 - return PTR_ERR(dwc->edev); 548 590 549 591 if (dwc->edev) { 550 592 dwc->edev_nb.notifier_call = dwc3_drd_notifier;
+1 -1
drivers/usb/dwc3/dwc3-st.c
··· 251 251 /* Manage SoftReset */ 252 252 reset_control_deassert(dwc3_data->rstc_rst); 253 253 254 - child = of_get_child_by_name(node, "usb"); 254 + child = of_get_compatible_child(node, "snps,dwc3"); 255 255 if (!child) { 256 256 dev_err(&pdev->dev, "failed to find dwc3 core node\n"); 257 257 ret = -ENODEV;
+17 -3
drivers/usb/dwc3/gadget.c
··· 1292 1292 trb->ctrl = DWC3_TRBCTL_ISOCHRONOUS; 1293 1293 } 1294 1294 1295 - /* always enable Interrupt on Missed ISOC */ 1296 - trb->ctrl |= DWC3_TRB_CTRL_ISP_IMI; 1295 + if (!no_interrupt && !chain) 1296 + trb->ctrl |= DWC3_TRB_CTRL_ISP_IMI; 1297 1297 break; 1298 1298 1299 1299 case USB_ENDPOINT_XFER_BULK: ··· 1698 1698 cmd |= DWC3_DEPCMD_PARAM(dep->resource_index); 1699 1699 memset(&params, 0, sizeof(params)); 1700 1700 ret = dwc3_send_gadget_ep_cmd(dep, cmd, &params); 1701 + /* 1702 + * If the End Transfer command was timed out while the device is 1703 + * not in SETUP phase, it's possible that an incoming Setup packet 1704 + * may prevent the command's completion. Let's retry when the 1705 + * ep0state returns to EP0_SETUP_PHASE. 1706 + */ 1707 + if (ret == -ETIMEDOUT && dep->dwc->ep0state != EP0_SETUP_PHASE) { 1708 + dep->flags |= DWC3_EP_DELAY_STOP; 1709 + return 0; 1710 + } 1701 1711 WARN_ON_ONCE(ret); 1702 1712 dep->resource_index = 0; 1703 1713 ··· 3248 3238 if (event->status & DEPEVT_STATUS_SHORT && !chain) 3249 3239 return 1; 3250 3240 3241 + if ((trb->ctrl & DWC3_TRB_CTRL_ISP_IMI) && 3242 + DWC3_TRB_SIZE_TRBSTS(trb->size) == DWC3_TRBSTS_MISSED_ISOC) 3243 + return 1; 3244 + 3251 3245 if ((trb->ctrl & DWC3_TRB_CTRL_IOC) || 3252 3246 (trb->ctrl & DWC3_TRB_CTRL_LST)) 3253 3247 return 1; ··· 3733 3719 * timeout. Delay issuing the End Transfer command until the Setup TRB is 3734 3720 * prepared. 3735 3721 */ 3736 - if (dwc->ep0state != EP0_SETUP_PHASE) { 3722 + if (dwc->ep0state != EP0_SETUP_PHASE && !dwc->delayed_status) { 3737 3723 dep->flags |= DWC3_EP_DELAY_STOP; 3738 3724 return; 3739 3725 }
+5 -3
drivers/usb/gadget/function/uvc_queue.c
··· 304 304 305 305 queue->sequence = 0; 306 306 queue->buf_used = 0; 307 + queue->flags &= ~UVC_QUEUE_DROP_INCOMPLETE; 307 308 } else { 308 309 ret = vb2_streamoff(&queue->queue, queue->queue.type); 309 310 if (ret < 0) ··· 330 329 void uvcg_complete_buffer(struct uvc_video_queue *queue, 331 330 struct uvc_buffer *buf) 332 331 { 333 - if ((queue->flags & UVC_QUEUE_DROP_INCOMPLETE) && 334 - buf->length != buf->bytesused) { 335 - buf->state = UVC_BUF_STATE_QUEUED; 332 + if (queue->flags & UVC_QUEUE_DROP_INCOMPLETE) { 333 + queue->flags &= ~UVC_QUEUE_DROP_INCOMPLETE; 334 + buf->state = UVC_BUF_STATE_ERROR; 336 335 vb2_set_plane_payload(&buf->buf.vb2_buf, 0, 0); 336 + vb2_buffer_done(&buf->buf.vb2_buf, VB2_BUF_STATE_ERROR); 337 337 return; 338 338 } 339 339
+18 -7
drivers/usb/gadget/function/uvc_video.c
··· 88 88 struct uvc_buffer *buf) 89 89 { 90 90 void *mem = req->buf; 91 + struct uvc_request *ureq = req->context; 91 92 int len = video->req_size; 92 93 int ret; 93 94 ··· 114 113 video->queue.buf_used = 0; 115 114 buf->state = UVC_BUF_STATE_DONE; 116 115 list_del(&buf->queue); 117 - uvcg_complete_buffer(&video->queue, buf); 118 116 video->fid ^= UVC_STREAM_FID; 117 + ureq->last_buf = buf; 119 118 120 119 video->payload_size = 0; 121 120 } 122 121 123 122 if (video->payload_size == video->max_payload_size || 123 + video->queue.flags & UVC_QUEUE_DROP_INCOMPLETE || 124 124 buf->bytesused == video->queue.buf_used) 125 125 video->payload_size = 0; 126 126 } ··· 157 155 sg = sg_next(sg); 158 156 159 157 for_each_sg(sg, iter, ureq->sgt.nents - 1, i) { 160 - if (!len || !buf->sg || !sg_dma_len(buf->sg)) 158 + if (!len || !buf->sg || !buf->sg->length) 161 159 break; 162 160 163 - sg_left = sg_dma_len(buf->sg) - buf->offset; 161 + sg_left = buf->sg->length - buf->offset; 164 162 part = min_t(unsigned int, len, sg_left); 165 163 166 164 sg_set_page(iter, sg_page(buf->sg), part, buf->offset); ··· 182 180 req->length -= len; 183 181 video->queue.buf_used += req->length - header_len; 184 182 185 - if (buf->bytesused == video->queue.buf_used || !buf->sg) { 183 + if (buf->bytesused == video->queue.buf_used || !buf->sg || 184 + video->queue.flags & UVC_QUEUE_DROP_INCOMPLETE) { 186 185 video->queue.buf_used = 0; 187 186 buf->state = UVC_BUF_STATE_DONE; 188 187 buf->offset = 0; ··· 198 195 struct uvc_buffer *buf) 199 196 { 200 197 void *mem = req->buf; 198 + struct uvc_request *ureq = req->context; 201 199 int len = video->req_size; 202 200 int ret; 203 201 ··· 213 209 214 210 req->length = video->req_size - len; 215 211 216 - if (buf->bytesused == video->queue.buf_used) { 212 + if (buf->bytesused == video->queue.buf_used || 213 + video->queue.flags & UVC_QUEUE_DROP_INCOMPLETE) { 217 214 video->queue.buf_used = 0; 218 215 buf->state = UVC_BUF_STATE_DONE; 219 216 list_del(&buf->queue); 220 - uvcg_complete_buffer(&video->queue, buf); 221 217 video->fid ^= UVC_STREAM_FID; 218 + ureq->last_buf = buf; 222 219 } 223 220 } 224 221 ··· 258 253 259 254 switch (req->status) { 260 255 case 0: 256 + break; 257 + 258 + case -EXDEV: 259 + uvcg_dbg(&video->uvc->func, "VS request missed xfer.\n"); 260 + queue->flags |= UVC_QUEUE_DROP_INCOMPLETE; 261 261 break; 262 262 263 263 case -ESHUTDOWN: /* disconnect from host. */ ··· 441 431 442 432 /* Endpoint now owns the request */ 443 433 req = NULL; 444 - video->req_int_count++; 434 + if (buf->state != UVC_BUF_STATE_DONE) 435 + video->req_int_count++; 445 436 } 446 437 447 438 if (!req)
+1
drivers/usb/gadget/udc/aspeed-vhub/dev.c
··· 591 591 d->gadget.max_speed = USB_SPEED_HIGH; 592 592 d->gadget.speed = USB_SPEED_UNKNOWN; 593 593 d->gadget.dev.of_node = vhub->pdev->dev.of_node; 594 + d->gadget.dev.of_node_reused = true; 594 595 595 596 rc = usb_add_gadget_udc(d->port_dev, &d->gadget); 596 597 if (rc != 0)
+1
drivers/usb/gadget/udc/bdc/bdc_udc.c
··· 151 151 bdc->delayed_status = false; 152 152 bdc->reinit = reinit; 153 153 bdc->test_mode = false; 154 + usb_gadget_set_state(&bdc->gadget, USB_STATE_NOTATTACHED); 154 155 } 155 156 156 157 /* TNotify wkaeup timer */
+12 -8
drivers/usb/host/xhci-mem.c
··· 889 889 if (dev->eps[i].stream_info) 890 890 xhci_free_stream_info(xhci, 891 891 dev->eps[i].stream_info); 892 - /* Endpoints on the TT/root port lists should have been removed 893 - * when usb_disable_device() was called for the device. 894 - * We can't drop them anyway, because the udev might have gone 895 - * away by this point, and we can't tell what speed it was. 892 + /* 893 + * Endpoints are normally deleted from the bandwidth list when 894 + * endpoints are dropped, before device is freed. 895 + * If host is dying or being removed then endpoints aren't 896 + * dropped cleanly, so delete the endpoint from list here. 897 + * Only applicable for hosts with software bandwidth checking. 896 898 */ 897 - if (!list_empty(&dev->eps[i].bw_endpoint_list)) 898 - xhci_warn(xhci, "Slot %u endpoint %u " 899 - "not removed from BW list!\n", 900 - slot_id, i); 899 + 900 + if (!list_empty(&dev->eps[i].bw_endpoint_list)) { 901 + list_del_init(&dev->eps[i].bw_endpoint_list); 902 + xhci_dbg(xhci, "Slot %u endpoint %u not removed from BW list!\n", 903 + slot_id, i); 904 + } 901 905 } 902 906 /* If this is a hub, free the TT(s) from the TT list */ 903 907 xhci_free_tt_info(xhci, dev, slot_id);
+15 -29
drivers/usb/host/xhci-pci.c
··· 58 58 #define PCI_DEVICE_ID_INTEL_CML_XHCI 0xa3af 59 59 #define PCI_DEVICE_ID_INTEL_TIGER_LAKE_XHCI 0x9a13 60 60 #define PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI 0x1138 61 - #define PCI_DEVICE_ID_INTEL_ALDER_LAKE_XHCI 0x461e 62 - #define PCI_DEVICE_ID_INTEL_ALDER_LAKE_N_XHCI 0x464e 63 - #define PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI 0x51ed 64 - #define PCI_DEVICE_ID_INTEL_RAPTOR_LAKE_XHCI 0xa71e 65 - #define PCI_DEVICE_ID_INTEL_METEOR_LAKE_XHCI 0x7ec0 61 + #define PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI 0x51ed 66 62 67 63 #define PCI_DEVICE_ID_AMD_RENOIR_XHCI 0x1639 68 64 #define PCI_DEVICE_ID_AMD_PROMONTORYA_4 0x43b9 69 65 #define PCI_DEVICE_ID_AMD_PROMONTORYA_3 0x43ba 70 66 #define PCI_DEVICE_ID_AMD_PROMONTORYA_2 0x43bb 71 67 #define PCI_DEVICE_ID_AMD_PROMONTORYA_1 0x43bc 72 - #define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_1 0x161a 73 - #define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_2 0x161b 74 - #define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_3 0x161d 75 - #define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_4 0x161e 76 - #define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_5 0x15d6 77 - #define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_6 0x15d7 78 - #define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_7 0x161c 79 - #define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_8 0x161f 80 68 81 69 #define PCI_DEVICE_ID_ASMEDIA_1042_XHCI 0x1042 82 70 #define PCI_DEVICE_ID_ASMEDIA_1042A_XHCI 0x1142 ··· 246 258 xhci->quirks |= XHCI_MISSING_CAS; 247 259 248 260 if (pdev->vendor == PCI_VENDOR_ID_INTEL && 261 + pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI) 262 + xhci->quirks |= XHCI_RESET_TO_DEFAULT; 263 + 264 + if (pdev->vendor == PCI_VENDOR_ID_INTEL && 249 265 (pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_2C_XHCI || 250 266 pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_4C_XHCI || 251 267 pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_LP_XHCI || ··· 260 268 pdev->device == PCI_DEVICE_ID_INTEL_TITAN_RIDGE_DD_XHCI || 261 269 pdev->device == PCI_DEVICE_ID_INTEL_ICE_LAKE_XHCI || 262 270 pdev->device == PCI_DEVICE_ID_INTEL_TIGER_LAKE_XHCI || 263 - pdev->device == PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI || 264 - pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_XHCI || 265 - pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_N_XHCI || 266 - pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI || 267 - pdev->device == PCI_DEVICE_ID_INTEL_RAPTOR_LAKE_XHCI || 268 - pdev->device == PCI_DEVICE_ID_INTEL_METEOR_LAKE_XHCI)) 271 + pdev->device == PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI)) 269 272 xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW; 270 273 271 274 if (pdev->vendor == PCI_VENDOR_ID_ETRON && ··· 293 306 } 294 307 295 308 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && 296 - pdev->device == PCI_DEVICE_ID_ASMEDIA_1042_XHCI) 309 + pdev->device == PCI_DEVICE_ID_ASMEDIA_1042_XHCI) { 310 + /* 311 + * try to tame the ASMedia 1042 controller which reports 0.96 312 + * but appears to behave more like 1.0 313 + */ 314 + xhci->quirks |= XHCI_SPURIOUS_SUCCESS; 297 315 xhci->quirks |= XHCI_BROKEN_STREAMS; 316 + } 298 317 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && 299 318 pdev->device == PCI_DEVICE_ID_ASMEDIA_1042A_XHCI) { 300 319 xhci->quirks |= XHCI_TRUST_TX_LENGTH; ··· 329 336 pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_4)) 330 337 xhci->quirks |= XHCI_NO_SOFT_RETRY; 331 338 332 - if (pdev->vendor == PCI_VENDOR_ID_AMD && 333 - (pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_1 || 334 - pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_2 || 335 - pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_3 || 336 - pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_4 || 337 - pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_5 || 338 - pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_6 || 339 - pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_7 || 340 - pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_8)) 339 + /* xHC spec requires PCI devices to support D3hot and D3cold */ 340 + if (xhci->hci_version >= 0x120) 341 341 xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW; 342 342 343 343 if (xhci->quirks & XHCI_RESET_ON_RESUME)
+8 -2
drivers/usb/host/xhci.c
··· 810 810 811 811 spin_lock_irq(&xhci->lock); 812 812 xhci_halt(xhci); 813 - /* Workaround for spurious wakeups at shutdown with HSW */ 814 - if (xhci->quirks & XHCI_SPURIOUS_WAKEUP) 813 + 814 + /* 815 + * Workaround for spurious wakeps at shutdown with HSW, and for boot 816 + * firmware delay in ADL-P PCH if port are left in U3 at shutdown 817 + */ 818 + if (xhci->quirks & XHCI_SPURIOUS_WAKEUP || 819 + xhci->quirks & XHCI_RESET_TO_DEFAULT) 815 820 xhci_reset(xhci, XHCI_RESET_SHORT_USEC); 821 + 816 822 spin_unlock_irq(&xhci->lock); 817 823 818 824 xhci_cleanup_msix(xhci);
+1
drivers/usb/host/xhci.h
··· 1897 1897 #define XHCI_BROKEN_D3COLD BIT_ULL(41) 1898 1898 #define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(42) 1899 1899 #define XHCI_SUSPEND_RESUME_CLKS BIT_ULL(43) 1900 + #define XHCI_RESET_TO_DEFAULT BIT_ULL(44) 1900 1901 1901 1902 unsigned int num_active_eps; 1902 1903 unsigned int limit_active_eps;
+29 -13
drivers/usb/typec/ucsi/ucsi.c
··· 183 183 } 184 184 EXPORT_SYMBOL_GPL(ucsi_send_command); 185 185 186 - int ucsi_resume(struct ucsi *ucsi) 187 - { 188 - u64 command; 189 - 190 - /* Restore UCSI notification enable mask after system resume */ 191 - command = UCSI_SET_NOTIFICATION_ENABLE | ucsi->ntfy; 192 - 193 - return ucsi_send_command(ucsi, command, NULL, 0); 194 - } 195 - EXPORT_SYMBOL_GPL(ucsi_resume); 196 186 /* -------------------------------------------------------------------------- */ 197 187 198 188 struct ucsi_work { ··· 734 744 735 745 static int ucsi_check_connection(struct ucsi_connector *con) 736 746 { 747 + u8 prev_flags = con->status.flags; 737 748 u64 command; 738 749 int ret; 739 750 ··· 745 754 return ret; 746 755 } 747 756 757 + if (con->status.flags == prev_flags) 758 + return 0; 759 + 748 760 if (con->status.flags & UCSI_CONSTAT_CONNECTED) { 749 - if (UCSI_CONSTAT_PWR_OPMODE(con->status.flags) == 750 - UCSI_CONSTAT_PWR_OPMODE_PD) 751 - ucsi_partner_task(con, ucsi_check_altmodes, 30, 0); 761 + ucsi_register_partner(con); 762 + ucsi_pwr_opmode_change(con); 763 + ucsi_partner_change(con); 752 764 } else { 753 765 ucsi_partner_change(con); 754 766 ucsi_port_psy_changed(con); ··· 1269 1275 err: 1270 1276 return ret; 1271 1277 } 1278 + 1279 + int ucsi_resume(struct ucsi *ucsi) 1280 + { 1281 + struct ucsi_connector *con; 1282 + u64 command; 1283 + int ret; 1284 + 1285 + /* Restore UCSI notification enable mask after system resume */ 1286 + command = UCSI_SET_NOTIFICATION_ENABLE | ucsi->ntfy; 1287 + ret = ucsi_send_command(ucsi, command, NULL, 0); 1288 + if (ret < 0) 1289 + return ret; 1290 + 1291 + for (con = ucsi->connector; con->port; con++) { 1292 + mutex_lock(&con->lock); 1293 + ucsi_check_connection(con); 1294 + mutex_unlock(&con->lock); 1295 + } 1296 + 1297 + return 0; 1298 + } 1299 + EXPORT_SYMBOL_GPL(ucsi_resume); 1272 1300 1273 1301 static void ucsi_init_work(struct work_struct *work) 1274 1302 {
+10
drivers/usb/typec/ucsi/ucsi_acpi.c
··· 185 185 return 0; 186 186 } 187 187 188 + static int ucsi_acpi_resume(struct device *dev) 189 + { 190 + struct ucsi_acpi *ua = dev_get_drvdata(dev); 191 + 192 + return ucsi_resume(ua->ucsi); 193 + } 194 + 195 + static DEFINE_SIMPLE_DEV_PM_OPS(ucsi_acpi_pm_ops, NULL, ucsi_acpi_resume); 196 + 188 197 static const struct acpi_device_id ucsi_acpi_match[] = { 189 198 { "PNP0CA0", 0 }, 190 199 { }, ··· 203 194 static struct platform_driver ucsi_acpi_platform_driver = { 204 195 .driver = { 205 196 .name = "ucsi_acpi", 197 + .pm = pm_ptr(&ucsi_acpi_pm_ops), 206 198 .acpi_match_table = ACPI_PTR(ucsi_acpi_match), 207 199 }, 208 200 .probe = ucsi_acpi_probe,