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

Pull USB fixes from Greg KH:
"Here are some small USB driver fixes and new device ids for 6.13-rc7.
Included in here are:

- usb serial new device ids

- typec bugfixes for reported issues

- dwc3 driver fixes

- chipidea driver fixes

- gadget driver fixes

- other minor fixes for reported problems.

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

* tag 'usb-6.13-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
USB: serial: option: add Neoway N723-EA support
USB: serial: option: add MeiG Smart SRM815
USB: serial: cp210x: add Phoenix Contact UPS Device
usb: typec: fix pm usage counter imbalance in ucsi_ccg_sync_control()
usb-storage: Add max sectors quirk for Nokia 208
usb: gadget: midi2: Reverse-select at the right place
usb: gadget: f_fs: Remove WARN_ON in functionfs_bind
USB: core: Disable LPM only for non-suspended ports
usb: fix reference leak in usb_new_device()
usb: typec: tcpci: fix NULL pointer issue on shared irq case
usb: gadget: u_serial: Disable ep before setting port to null to fix the crash caused by port being null
usb: chipidea: ci_hdrc_imx: decrement device's refcount in .remove() and in the error path of .probe()
usb: typec: ucsi: Set orientation as none when connector is unplugged
usb: gadget: configfs: Ignore trailing LF for user strings to cdev
USB: usblp: return error when setting unsupported protocol
usb: gadget: f_uac2: Fix incorrect setting of bNumEndpoints
usb: typec: tcpm/tcpci_maxim: fix error code in max_contaminant_read_resistance_kohm()
usb: host: xhci-plat: set skip_phy_initialization if software node has XHCI_SKIP_PHY_INIT property
usb: dwc3-am62: Disable autosuspend during remove
usb: dwc3: gadget: fix writing NYET threshold

Changed files
+84 -41
drivers
+17 -8
drivers/usb/chipidea/ci_hdrc_imx.c
··· 370 370 data->pinctrl = devm_pinctrl_get(dev); 371 371 if (PTR_ERR(data->pinctrl) == -ENODEV) 372 372 data->pinctrl = NULL; 373 - else if (IS_ERR(data->pinctrl)) 374 - return dev_err_probe(dev, PTR_ERR(data->pinctrl), 373 + else if (IS_ERR(data->pinctrl)) { 374 + ret = dev_err_probe(dev, PTR_ERR(data->pinctrl), 375 375 "pinctrl get failed\n"); 376 + goto err_put; 377 + } 376 378 377 379 data->hsic_pad_regulator = 378 380 devm_regulator_get_optional(dev, "hsic"); 379 381 if (PTR_ERR(data->hsic_pad_regulator) == -ENODEV) { 380 382 /* no pad regulator is needed */ 381 383 data->hsic_pad_regulator = NULL; 382 - } else if (IS_ERR(data->hsic_pad_regulator)) 383 - return dev_err_probe(dev, PTR_ERR(data->hsic_pad_regulator), 384 + } else if (IS_ERR(data->hsic_pad_regulator)) { 385 + ret = dev_err_probe(dev, PTR_ERR(data->hsic_pad_regulator), 384 386 "Get HSIC pad regulator error\n"); 387 + goto err_put; 388 + } 385 389 386 390 if (data->hsic_pad_regulator) { 387 391 ret = regulator_enable(data->hsic_pad_regulator); 388 392 if (ret) { 389 393 dev_err(dev, 390 394 "Failed to enable HSIC pad regulator\n"); 391 - return ret; 395 + goto err_put; 392 396 } 393 397 } 394 398 } ··· 406 402 dev_err(dev, 407 403 "pinctrl_hsic_idle lookup failed, err=%ld\n", 408 404 PTR_ERR(pinctrl_hsic_idle)); 409 - return PTR_ERR(pinctrl_hsic_idle); 405 + ret = PTR_ERR(pinctrl_hsic_idle); 406 + goto err_put; 410 407 } 411 408 412 409 ret = pinctrl_select_state(data->pinctrl, pinctrl_hsic_idle); 413 410 if (ret) { 414 411 dev_err(dev, "hsic_idle select failed, err=%d\n", ret); 415 - return ret; 412 + goto err_put; 416 413 } 417 414 418 415 data->pinctrl_hsic_active = pinctrl_lookup_state(data->pinctrl, ··· 422 417 dev_err(dev, 423 418 "pinctrl_hsic_active lookup failed, err=%ld\n", 424 419 PTR_ERR(data->pinctrl_hsic_active)); 425 - return PTR_ERR(data->pinctrl_hsic_active); 420 + ret = PTR_ERR(data->pinctrl_hsic_active); 421 + goto err_put; 426 422 } 427 423 } 428 424 ··· 533 527 if (pdata.flags & CI_HDRC_PMQOS) 534 528 cpu_latency_qos_remove_request(&data->pm_qos_req); 535 529 data->ci_pdev = NULL; 530 + err_put: 531 + put_device(data->usbmisc_data->dev); 536 532 return ret; 537 533 } 538 534 ··· 559 551 if (data->hsic_pad_regulator) 560 552 regulator_disable(data->hsic_pad_regulator); 561 553 } 554 + put_device(data->usbmisc_data->dev); 562 555 } 563 556 564 557 static void ci_hdrc_imx_shutdown(struct platform_device *pdev)
+4 -3
drivers/usb/class/usblp.c
··· 1337 1337 if (protocol < USBLP_FIRST_PROTOCOL || protocol > USBLP_LAST_PROTOCOL) 1338 1338 return -EINVAL; 1339 1339 1340 + alts = usblp->protocol[protocol].alt_setting; 1341 + if (alts < 0) 1342 + return -EINVAL; 1343 + 1340 1344 /* Don't unnecessarily set the interface if there's a single alt. */ 1341 1345 if (usblp->intf->num_altsetting > 1) { 1342 - alts = usblp->protocol[protocol].alt_setting; 1343 - if (alts < 0) 1344 - return -EINVAL; 1345 1346 r = usb_set_interface(usblp->dev, usblp->ifnum, alts); 1346 1347 if (r < 0) { 1347 1348 printk(KERN_ERR "usblp: can't set desired altsetting %d on interface %d\n",
+4 -2
drivers/usb/core/hub.c
··· 2663 2663 err = sysfs_create_link(&udev->dev.kobj, 2664 2664 &port_dev->dev.kobj, "port"); 2665 2665 if (err) 2666 - goto fail; 2666 + goto out_del_dev; 2667 2667 2668 2668 err = sysfs_create_link(&port_dev->dev.kobj, 2669 2669 &udev->dev.kobj, "device"); 2670 2670 if (err) { 2671 2671 sysfs_remove_link(&udev->dev.kobj, "port"); 2672 - goto fail; 2672 + goto out_del_dev; 2673 2673 } 2674 2674 2675 2675 if (!test_and_set_bit(port1, hub->child_usage_bits)) ··· 2683 2683 pm_runtime_put_sync_autosuspend(&udev->dev); 2684 2684 return err; 2685 2685 2686 + out_del_dev: 2687 + device_del(&udev->dev); 2686 2688 fail: 2687 2689 usb_set_device_state(udev, USB_STATE_NOTATTACHED); 2688 2690 pm_runtime_disable(&udev->dev);
+4 -3
drivers/usb/core/port.c
··· 453 453 static void usb_port_shutdown(struct device *dev) 454 454 { 455 455 struct usb_port *port_dev = to_usb_port(dev); 456 + struct usb_device *udev = port_dev->child; 456 457 457 - if (port_dev->child) { 458 - usb_disable_usb2_hardware_lpm(port_dev->child); 459 - usb_unlocked_disable_lpm(port_dev->child); 458 + if (udev && !udev->port_is_suspended) { 459 + usb_disable_usb2_hardware_lpm(udev); 460 + usb_unlocked_disable_lpm(udev); 460 461 } 461 462 } 462 463
+1
drivers/usb/dwc3/core.h
··· 464 464 #define DWC3_DCTL_TRGTULST_SS_INACT (DWC3_DCTL_TRGTULST(6)) 465 465 466 466 /* These apply for core versions 1.94a and later */ 467 + #define DWC3_DCTL_NYET_THRES_MASK (0xf << 20) 467 468 #define DWC3_DCTL_NYET_THRES(n) (((n) & 0xf) << 20) 468 469 469 470 #define DWC3_DCTL_KEEP_CONNECT BIT(19)
+1
drivers/usb/dwc3/dwc3-am62.c
··· 309 309 310 310 pm_runtime_put_sync(dev); 311 311 pm_runtime_disable(dev); 312 + pm_runtime_dont_use_autosuspend(dev); 312 313 pm_runtime_set_suspended(dev); 313 314 } 314 315
+3 -1
drivers/usb/dwc3/gadget.c
··· 4195 4195 WARN_ONCE(DWC3_VER_IS_PRIOR(DWC3, 240A) && dwc->has_lpm_erratum, 4196 4196 "LPM Erratum not available on dwc3 revisions < 2.40a\n"); 4197 4197 4198 - if (dwc->has_lpm_erratum && !DWC3_VER_IS_PRIOR(DWC3, 240A)) 4198 + if (dwc->has_lpm_erratum && !DWC3_VER_IS_PRIOR(DWC3, 240A)) { 4199 + reg &= ~DWC3_DCTL_NYET_THRES_MASK; 4199 4200 reg |= DWC3_DCTL_NYET_THRES(dwc->lpm_nyet_threshold); 4201 + } 4200 4202 4201 4203 dwc3_gadget_dctl_write_safe(dwc, reg); 4202 4204 } else {
+2 -2
drivers/usb/gadget/Kconfig
··· 211 211 212 212 config USB_F_MIDI2 213 213 tristate 214 + select SND_UMP 215 + select SND_UMP_LEGACY_RAWMIDI 214 216 215 217 config USB_F_HID 216 218 tristate ··· 447 445 depends on USB_CONFIGFS 448 446 depends on SND 449 447 select USB_LIBCOMPOSITE 450 - select SND_UMP 451 - select SND_UMP_LEGACY_RAWMIDI 452 448 select USB_F_MIDI2 453 449 help 454 450 The MIDI 2.0 function driver provides the generic emulated
+5 -1
drivers/usb/gadget/configfs.c
··· 827 827 { 828 828 struct gadget_string *string = to_gadget_string(item); 829 829 int size = min(sizeof(string->string), len + 1); 830 + ssize_t cpy_len; 830 831 831 832 if (len > USB_MAX_STRING_LEN) 832 833 return -EINVAL; 833 834 834 - return strscpy(string->string, page, size); 835 + cpy_len = strscpy(string->string, page, size); 836 + if (cpy_len > 0 && string->string[cpy_len - 1] == '\n') 837 + string->string[cpy_len - 1] = 0; 838 + return len; 835 839 } 836 840 CONFIGFS_ATTR(gadget_string_, s); 837 841
+1 -1
drivers/usb/gadget/function/f_fs.c
··· 2285 2285 struct usb_gadget_strings **lang; 2286 2286 int first_id; 2287 2287 2288 - if (WARN_ON(ffs->state != FFS_ACTIVE 2288 + if ((ffs->state != FFS_ACTIVE 2289 2289 || test_and_set_bit(FFS_FL_BOUND, &ffs->flags))) 2290 2290 return -EBADFD; 2291 2291
+1
drivers/usb/gadget/function/f_uac2.c
··· 1185 1185 uac2->as_in_alt = 0; 1186 1186 } 1187 1187 1188 + std_ac_if_desc.bNumEndpoints = 0; 1188 1189 if (FUOUT_EN(uac2_opts) || FUIN_EN(uac2_opts)) { 1189 1190 uac2->int_ep = usb_ep_autoconfig(gadget, &fs_ep_int_desc); 1190 1191 if (!uac2->int_ep) {
+4 -4
drivers/usb/gadget/function/u_serial.c
··· 1420 1420 /* REVISIT as above: how best to track this? */ 1421 1421 port->port_line_coding = gser->port_line_coding; 1422 1422 1423 + /* disable endpoints, aborting down any active I/O */ 1424 + usb_ep_disable(gser->out); 1425 + usb_ep_disable(gser->in); 1426 + 1423 1427 port->port_usb = NULL; 1424 1428 gser->ioport = NULL; 1425 1429 if (port->port.count > 0) { ··· 1434 1430 port->suspended = false; 1435 1431 spin_unlock(&port->port_lock); 1436 1432 spin_unlock_irqrestore(&serial_port_lock, flags); 1437 - 1438 - /* disable endpoints, aborting down any active I/O */ 1439 - usb_ep_disable(gser->out); 1440 - usb_ep_disable(gser->in); 1441 1433 1442 1434 /* finally, free any unused/unusable I/O buffers */ 1443 1435 spin_lock_irqsave(&port->port_lock, flags);
+2 -1
drivers/usb/host/xhci-plat.c
··· 290 290 291 291 hcd->tpl_support = of_usb_host_tpl_support(sysdev->of_node); 292 292 293 - if (priv && (priv->quirks & XHCI_SKIP_PHY_INIT)) 293 + if ((priv && (priv->quirks & XHCI_SKIP_PHY_INIT)) || 294 + (xhci->quirks & XHCI_SKIP_PHY_INIT)) 294 295 hcd->skip_phy_initialization = 1; 295 296 296 297 if (priv && (priv->quirks & XHCI_SG_TRB_CACHE_SIZE_QUIRK))
+1
drivers/usb/serial/cp210x.c
··· 223 223 { USB_DEVICE(0x19CF, 0x3000) }, /* Parrot NMEA GPS Flight Recorder */ 224 224 { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */ 225 225 { USB_DEVICE(0x1B1C, 0x1C00) }, /* Corsair USB Dongle */ 226 + { USB_DEVICE(0x1B93, 0x1013) }, /* Phoenix Contact UPS Device */ 226 227 { USB_DEVICE(0x1BA4, 0x0002) }, /* Silicon Labs 358x factory default */ 227 228 { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ 228 229 { USB_DEVICE(0x1D6F, 0x0010) }, /* Seluxit ApS RF Dongle */
+3 -1
drivers/usb/serial/option.c
··· 621 621 622 622 /* MeiG Smart Technology products */ 623 623 #define MEIGSMART_VENDOR_ID 0x2dee 624 - /* MeiG Smart SRM825L based on Qualcomm 315 */ 624 + /* MeiG Smart SRM815/SRM825L based on Qualcomm 315 */ 625 625 #define MEIGSMART_PRODUCT_SRM825L 0x4d22 626 626 /* MeiG Smart SLM320 based on UNISOC UIS8910 */ 627 627 #define MEIGSMART_PRODUCT_SLM320 0x4d41 ··· 2405 2405 { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, LUAT_PRODUCT_AIR720U, 0xff, 0, 0) }, 2406 2406 { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SLM320, 0xff, 0, 0) }, 2407 2407 { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SLM770A, 0xff, 0, 0) }, 2408 + { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0, 0) }, 2408 2409 { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x30) }, 2409 2410 { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x40) }, 2410 2411 { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x60) }, ··· 2413 2412 .driver_info = NCTRL(1) }, 2414 2413 { USB_DEVICE_INTERFACE_CLASS(0x1bbb, 0x0640, 0xff), /* TCL IK512 ECM */ 2415 2414 .driver_info = NCTRL(3) }, 2415 + { USB_DEVICE_INTERFACE_CLASS(0x2949, 0x8700, 0xff) }, /* Neoway N723-EA */ 2416 2416 { } /* Terminating entry */ 2417 2417 }; 2418 2418 MODULE_DEVICE_TABLE(usb, option_ids);
+7
drivers/usb/storage/unusual_devs.h
··· 255 255 USB_SC_DEVICE, USB_PR_DEVICE, NULL, 256 256 US_FL_MAX_SECTORS_64 ), 257 257 258 + /* Added by Lubomir Rintel <lkundrak@v3.sk>, a very fine chap */ 259 + UNUSUAL_DEV( 0x0421, 0x06c2, 0x0000, 0x0406, 260 + "Nokia", 261 + "Nokia 208", 262 + USB_SC_DEVICE, USB_PR_DEVICE, NULL, 263 + US_FL_MAX_SECTORS_64 ), 264 + 258 265 #ifdef NO_SDDR09 259 266 UNUSUAL_DEV( 0x0436, 0x0005, 0x0100, 0x0100, 260 267 "Microtech",
+2 -2
drivers/usb/typec/tcpm/maxim_contaminant.c
··· 135 135 136 136 mv = max_contaminant_read_adc_mv(chip, channel, sleep_msec, raw, true); 137 137 if (mv < 0) 138 - return ret; 138 + return mv; 139 139 140 140 /* OVP enable */ 141 141 ret = regmap_update_bits(regmap, TCPC_VENDOR_CC_CTRL2, CCOVPDIS, 0); ··· 157 157 158 158 mv = max_contaminant_read_adc_mv(chip, channel, sleep_msec, raw, true); 159 159 if (mv < 0) 160 - return ret; 160 + return mv; 161 161 /* Disable current source */ 162 162 ret = regmap_update_bits(regmap, TCPC_VENDOR_CC_CTRL2, SBURPCTRL, 0); 163 163 if (ret < 0)
+15 -10
drivers/usb/typec/tcpm/tcpci.c
··· 700 700 701 701 tcpci->alert_mask = reg; 702 702 703 - return tcpci_write16(tcpci, TCPC_ALERT_MASK, reg); 703 + return 0; 704 704 } 705 705 706 706 irqreturn_t tcpci_irq(struct tcpci *tcpci) ··· 923 923 924 924 chip->data.set_orientation = err; 925 925 926 + chip->tcpci = tcpci_register_port(&client->dev, &chip->data); 927 + if (IS_ERR(chip->tcpci)) 928 + return PTR_ERR(chip->tcpci); 929 + 926 930 err = devm_request_threaded_irq(&client->dev, client->irq, NULL, 927 931 _tcpci_irq, 928 932 IRQF_SHARED | IRQF_ONESHOT, 929 933 dev_name(&client->dev), chip); 930 934 if (err < 0) 931 - return err; 935 + goto unregister_port; 932 936 933 - /* 934 - * Disable irq while registering port. If irq is configured as an edge 935 - * irq this allow to keep track and process the irq as soon as it is enabled. 936 - */ 937 - disable_irq(client->irq); 938 - chip->tcpci = tcpci_register_port(&client->dev, &chip->data); 939 - enable_irq(client->irq); 937 + /* Enable chip interrupts at last */ 938 + err = tcpci_write16(chip->tcpci, TCPC_ALERT_MASK, chip->tcpci->alert_mask); 939 + if (err < 0) 940 + goto unregister_port; 940 941 941 - return PTR_ERR_OR_ZERO(chip->tcpci); 942 + return 0; 943 + 944 + unregister_port: 945 + tcpci_unregister_port(chip->tcpci); 946 + return err; 942 947 } 943 948 944 949 static void tcpci_remove(struct i2c_client *client)
+2 -2
drivers/usb/typec/ucsi/ucsi_ccg.c
··· 646 646 UCSI_CMD_CONNECTOR_MASK; 647 647 if (con_index == 0) { 648 648 ret = -EINVAL; 649 - goto unlock; 649 + goto err_put; 650 650 } 651 651 con = &uc->ucsi->connector[con_index - 1]; 652 652 ucsi_ccg_update_set_new_cam_cmd(uc, con, &command); ··· 654 654 655 655 ret = ucsi_sync_control_common(ucsi, command); 656 656 657 + err_put: 657 658 pm_runtime_put_sync(uc->dev); 658 - unlock: 659 659 mutex_unlock(&uc->lock); 660 660 661 661 return ret;
+5
drivers/usb/typec/ucsi/ucsi_glink.c
··· 185 185 struct pmic_glink_ucsi *ucsi = ucsi_get_drvdata(con->ucsi); 186 186 int orientation; 187 187 188 + if (!UCSI_CONSTAT(con, CONNECTED)) { 189 + typec_set_orientation(con->port, TYPEC_ORIENTATION_NONE); 190 + return; 191 + } 192 + 188 193 if (con->num > PMIC_GLINK_MAX_PORTS || 189 194 !ucsi->port_orientation[con->num - 1]) 190 195 return;