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

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

Pull USB fixes from Greg KH:
"Here are some small USB fixes for 5.15-rc5 that resolve a number of
reported issues:

- gadget driver fixes

- xhci build warning fixes

- build configuration fix

- cdc-acm tty handling fixes

- cdc-wdm fix

- typec fixes

All of these have been in linux-next for a while with no reported
issues"

* tag 'usb-5.15-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
USB: cdc-acm: fix break reporting
USB: cdc-acm: fix racy tty buffer accesses
usb: gadget: f_uac2: fixed EP-IN wMaxPacketSize
usb: cdc-wdm: Fix check for WWAN
usb: chipidea: ci_hdrc_imx: Also search for 'phys' phandle
usb: typec: tcpm: handle SRC_STARTUP state if cc changes
usb: typec: tcpci: don't handle vSafe0V event if it's not enabled
usb: typec: tipd: Remove dependency on "connector" child fwnode
Partially revert "usb: Kconfig: using select for USB_COMMON dependency"
usb: dwc3: gadget: Revert "set gadgets parent to the right controller"
usb: xhci: tegra: mark PM functions as __maybe_unused

+42 -29
+10 -5
drivers/usb/chipidea/ci_hdrc_imx.c
··· 420 420 data->phy = devm_usb_get_phy_by_phandle(dev, "fsl,usbphy", 0); 421 421 if (IS_ERR(data->phy)) { 422 422 ret = PTR_ERR(data->phy); 423 - /* Return -EINVAL if no usbphy is available */ 424 - if (ret == -ENODEV) 425 - data->phy = NULL; 426 - else 427 - goto err_clk; 423 + if (ret == -ENODEV) { 424 + data->phy = devm_usb_get_phy_by_phandle(dev, "phys", 0); 425 + if (IS_ERR(data->phy)) { 426 + ret = PTR_ERR(data->phy); 427 + if (ret == -ENODEV) 428 + data->phy = NULL; 429 + else 430 + goto err_clk; 431 + } 432 + } 428 433 } 429 434 430 435 pdata.usb_phy = data->phy;
+8
drivers/usb/class/cdc-acm.c
··· 340 340 acm->iocount.overrun++; 341 341 spin_unlock_irqrestore(&acm->read_lock, flags); 342 342 343 + if (newctrl & ACM_CTRL_BRK) 344 + tty_flip_buffer_push(&acm->port); 345 + 343 346 if (difference) 344 347 wake_up_all(&acm->wioctl); 345 348 ··· 478 475 479 476 static void acm_process_read_urb(struct acm *acm, struct urb *urb) 480 477 { 478 + unsigned long flags; 479 + 481 480 if (!urb->actual_length) 482 481 return; 483 482 483 + spin_lock_irqsave(&acm->read_lock, flags); 484 484 tty_insert_flip_string(&acm->port, urb->transfer_buffer, 485 485 urb->actual_length); 486 + spin_unlock_irqrestore(&acm->read_lock, flags); 487 + 486 488 tty_flip_buffer_push(&acm->port); 487 489 } 488 490
+3 -3
drivers/usb/class/cdc-wdm.c
··· 824 824 }; 825 825 826 826 /* --- WWAN framework integration --- */ 827 - #ifdef CONFIG_WWAN_CORE 827 + #ifdef CONFIG_WWAN 828 828 static int wdm_wwan_port_start(struct wwan_port *port) 829 829 { 830 830 struct wdm_device *desc = wwan_port_get_drvdata(port); ··· 963 963 /* inbuf has been copied, it is safe to check for outstanding data */ 964 964 schedule_work(&desc->service_outs_intr); 965 965 } 966 - #else /* CONFIG_WWAN_CORE */ 966 + #else /* CONFIG_WWAN */ 967 967 static void wdm_wwan_init(struct wdm_device *desc) {} 968 968 static void wdm_wwan_deinit(struct wdm_device *desc) {} 969 969 static void wdm_wwan_rx(struct wdm_device *desc, int length) {} 970 - #endif /* CONFIG_WWAN_CORE */ 970 + #endif /* CONFIG_WWAN */ 971 971 972 972 /* --- error handling --- */ 973 973 static void wdm_rxwork(struct work_struct *work)
+1 -2
drivers/usb/common/Kconfig
··· 6 6 7 7 config USB_LED_TRIG 8 8 bool "USB LED Triggers" 9 - depends on LEDS_CLASS && LEDS_TRIGGERS 10 - select USB_COMMON 9 + depends on LEDS_CLASS && USB_COMMON && LEDS_TRIGGERS 11 10 help 12 11 This option adds LED triggers for USB host and/or gadget activity. 13 12
+1 -1
drivers/usb/dwc3/gadget.c
··· 4243 4243 } 4244 4244 4245 4245 4246 - usb_initialize_gadget(dwc->sysdev, dwc->gadget, dwc_gadget_release); 4246 + usb_initialize_gadget(dwc->dev, dwc->gadget, dwc_gadget_release); 4247 4247 dev = &dwc->gadget->dev; 4248 4248 dev->platform_data = dwc; 4249 4249 dwc->gadget->ops = &dwc3_gadget_ops;
+10 -4
drivers/usb/gadget/function/f_uac2.c
··· 674 674 ssize = uac2_opts->c_ssize; 675 675 } 676 676 677 - if (!is_playback && (uac2_opts->c_sync == USB_ENDPOINT_SYNC_ASYNC)) 677 + if (!is_playback && (uac2_opts->c_sync == USB_ENDPOINT_SYNC_ASYNC)) { 678 + // Win10 requires max packet size + 1 frame 678 679 srate = srate * (1000 + uac2_opts->fb_max) / 1000; 679 - 680 - max_size_bw = num_channels(chmask) * ssize * 681 - DIV_ROUND_UP(srate, factor / (1 << (ep_desc->bInterval - 1))); 680 + // updated srate is always bigger, therefore DIV_ROUND_UP always yields +1 681 + max_size_bw = num_channels(chmask) * ssize * 682 + (DIV_ROUND_UP(srate, factor / (1 << (ep_desc->bInterval - 1)))); 683 + } else { 684 + // adding 1 frame provision for Win10 685 + max_size_bw = num_channels(chmask) * ssize * 686 + (DIV_ROUND_UP(srate, factor / (1 << (ep_desc->bInterval - 1))) + 1); 687 + } 682 688 ep_desc->wMaxPacketSize = cpu_to_le16(min_t(u16, max_size_bw, 683 689 max_size_ep)); 684 690
+4 -8
drivers/usb/host/xhci-tegra.c
··· 1787 1787 return 0; 1788 1788 } 1789 1789 1790 - #if IS_ENABLED(CONFIG_PM) || IS_ENABLED(CONFIG_PM_SLEEP) 1791 1790 static bool xhci_hub_ports_suspended(struct xhci_hub *hub) 1792 1791 { 1793 1792 struct device *dev = hub->hcd->self.controller; ··· 2101 2102 return err; 2102 2103 } 2103 2104 2104 - static int tegra_xusb_suspend(struct device *dev) 2105 + static __maybe_unused int tegra_xusb_suspend(struct device *dev) 2105 2106 { 2106 2107 struct tegra_xusb *tegra = dev_get_drvdata(dev); 2107 2108 int err; ··· 2143 2144 return err; 2144 2145 } 2145 2146 2146 - static int tegra_xusb_resume(struct device *dev) 2147 + static __maybe_unused int tegra_xusb_resume(struct device *dev) 2147 2148 { 2148 2149 struct tegra_xusb *tegra = dev_get_drvdata(dev); 2149 2150 int err; ··· 2173 2174 2174 2175 return 0; 2175 2176 } 2176 - #endif 2177 2177 2178 - #ifdef CONFIG_PM 2179 - static int tegra_xusb_runtime_suspend(struct device *dev) 2178 + static __maybe_unused int tegra_xusb_runtime_suspend(struct device *dev) 2180 2179 { 2181 2180 struct tegra_xusb *tegra = dev_get_drvdata(dev); 2182 2181 int ret; ··· 2187 2190 return ret; 2188 2191 } 2189 2192 2190 - static int tegra_xusb_runtime_resume(struct device *dev) 2193 + static __maybe_unused int tegra_xusb_runtime_resume(struct device *dev) 2191 2194 { 2192 2195 struct tegra_xusb *tegra = dev_get_drvdata(dev); 2193 2196 int err; ··· 2198 2201 2199 2202 return err; 2200 2203 } 2201 - #endif 2202 2204 2203 2205 static const struct dev_pm_ops tegra_xusb_pm_ops = { 2204 2206 SET_RUNTIME_PM_OPS(tegra_xusb_runtime_suspend,
+1 -1
drivers/usb/typec/tcpm/tcpci.c
··· 696 696 tcpm_pd_receive(tcpci->port, &msg); 697 697 } 698 698 699 - if (status & TCPC_ALERT_EXTENDED_STATUS) { 699 + if (tcpci->data->vbus_vsafe0v && (status & TCPC_ALERT_EXTENDED_STATUS)) { 700 700 ret = regmap_read(tcpci->regmap, TCPC_EXTENDED_STATUS, &raw); 701 701 if (!ret && (raw & TCPC_EXTENDED_STATUS_VSAFE0V)) 702 702 tcpm_vbus_change(tcpci->port);
+1
drivers/usb/typec/tcpm/tcpm.c
··· 4876 4876 tcpm_set_state(port, SRC_ATTACH_WAIT, 0); 4877 4877 break; 4878 4878 case SRC_ATTACHED: 4879 + case SRC_STARTUP: 4879 4880 case SRC_SEND_CAPABILITIES: 4880 4881 case SRC_READY: 4881 4882 if (tcpm_port_is_disconnected(port) ||
+3 -5
drivers/usb/typec/tipd/core.c
··· 625 625 if (ret < 0) 626 626 return ret; 627 627 628 - fwnode = device_get_named_child_node(&client->dev, "connector"); 629 - if (!fwnode) 630 - return -ENODEV; 631 - 632 628 /* 633 629 * This fwnode has a "compatible" property, but is never populated as a 634 630 * struct device. Instead we simply parse it to read the properties. ··· 632 636 * with existing DT files, we work around this by deleting any 633 637 * fwnode_links to/from this fwnode. 634 638 */ 635 - fw_devlink_purge_absent_suppliers(fwnode); 639 + fwnode = device_get_named_child_node(&client->dev, "connector"); 640 + if (fwnode) 641 + fw_devlink_purge_absent_suppliers(fwnode); 636 642 637 643 tps->role_sw = fwnode_usb_role_switch_get(fwnode); 638 644 if (IS_ERR(tps->role_sw)) {