Pull USB/Thunderbolt fixes from Greg KH: "Here are some small USB and Thunderbolt driver fixes for 5.9-rc5. Nothing huge, just a number of bugfixes and new device ids for problems reported: - new USB serial driver ids - bug fixes for syzbot reported problems - typec driver fixes - thunderbolt driver fixes - revert of reported broken commit All of these have been in linux-next with no reported issues" * tag 'usb-5.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: usb: typec: intel_pmc_mux: Do not configure SBU and HSL Orientation in Alternate modes usb: typec: intel_pmc_mux: Do not configure Altmode HPD High usb: core: fix slab-out-of-bounds Read in read_descriptors Revert "usb: dwc3: meson-g12a: fix shared reset control use" usb: typec: ucsi: acpi: Check the _DEP dependencies usb: typec: intel_pmc_mux: Un-register the USB role switch usb: Fix out of sync data toggle if a configured device is reconfigured USB: serial: option: support dynamic Quectel USB compositions USB: serial: option: add support for SIM7070/SIM7080/SIM7090 modules thunderbolt: Use maximum USB3 link rate when reclaiming if link is not up thunderbolt: Disable ports that are not implemented USB: serial: ftdi_sio: add IDs for Xsens Mti USB converter
Unified · Split
| @@ -684,6 +684,7 @@ static int tb_init_port(struct tb_port *port) · 683 unmodified lines | ||
| 684 | 684 | if (res == -ENODEV) { |
| 685 | 685 | tb_dbg(port->sw->tb, " Port %d: not implemented\n", |
| 686 | 686 | port->port); |
| 687 | + port->disabled = true; | |
| 687 | 688 | return 0; |
| 688 | 689 | } |
| 689 | 690 | return res; |
| @@ -186,7 +186,7 @@ struct tb_switch { · 185 unmodified lines | ||
| 186 | 186 | * @cap_adap: Offset of the adapter specific capability (%0 if not present) |
| 187 | 187 | * @cap_usb4: Offset to the USB4 port capability (%0 if not present) |
| 188 | 188 | * @port: Port number on switch |
| 189 | − * @disabled: Disabled by eeprom | |
| 189 | + * @disabled: Disabled by eeprom or enabled but not implemented | |
| 190 | 190 | * @bonded: true if the port is bonded (two lanes combined as one) |
| 191 | 191 | * @dual_link_port: If the switch is connected using two ports, points |
| 192 | 192 | * to the other port. |
| @@ -951,10 +951,18 @@ static void tb_usb3_reclaim_available_bandwidth(struct tb_tunnel *tunnel, · 950 unmodified lines | ||
| 951 | 951 | int ret, max_rate, allocate_up, allocate_down; |
| 952 | 952 | |
| 953 | 953 | ret = usb4_usb3_port_actual_link_rate(tunnel->src_port); |
| 954 | − if (ret <= 0) { | |
| 955 | − tb_tunnel_warn(tunnel, "tunnel is not up\n"); | |
| 954 | + if (ret < 0) { | |
| 955 | + tb_tunnel_warn(tunnel, "failed to read actual link rate\n"); | |
| 956 | 956 | return; |
| 957 | + } else if (!ret) { | |
| 958 | + /* Use maximum link rate if the link valid is not set */ | |
| 959 | + ret = usb4_usb3_port_max_link_rate(tunnel->src_port); | |
| 960 | + if (ret < 0) { | |
| 961 | + tb_tunnel_warn(tunnel, "failed to read maximum link rate\n"); | |
| 962 | + return; | |
| 963 | + } | |
| 957 | 964 | } |
| 965 | + | |
| 958 | 966 | /* |
| 959 | 967 | * 90% of the max rate can be allocated for isochronous |
| 960 | 968 | * transfers. |
| @@ -1205,6 +1205,34 @@ void usb_disable_interface(struct usb_device *dev, struct usb_interface *intf, · 1204 unmodified lines | ||
| 1205 | 1205 | } |
| 1206 | 1206 | } |
| 1207 | 1207 | |
| 1208 | +/* | |
| 1209 | + * usb_disable_device_endpoints -- Disable all endpoints for a device | |
| 1210 | + * @dev: the device whose endpoints are being disabled | |
| 1211 | + * @skip_ep0: 0 to disable endpoint 0, 1 to skip it. | |
| 1212 | + */ | |
| 1213 | +static void usb_disable_device_endpoints(struct usb_device *dev, int skip_ep0) | |
| 1214 | +{ | |
| 1215 | + struct usb_hcd *hcd = bus_to_hcd(dev->bus); | |
| 1216 | + int i; | |
| 1217 | + | |
| 1218 | + if (hcd->driver->check_bandwidth) { | |
| 1219 | + /* First pass: Cancel URBs, leave endpoint pointers intact. */ | |
| 1220 | + for (i = skip_ep0; i < 16; ++i) { | |
| 1221 | + usb_disable_endpoint(dev, i, false); | |
| 1222 | + usb_disable_endpoint(dev, i + USB_DIR_IN, false); | |
| 1223 | + } | |
| 1224 | + /* Remove endpoints from the host controller internal state */ | |
| 1225 | + mutex_lock(hcd->bandwidth_mutex); | |
| 1226 | + usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); | |
| 1227 | + mutex_unlock(hcd->bandwidth_mutex); | |
| 1228 | + } | |
| 1229 | + /* Second pass: remove endpoint pointers */ | |
| 1230 | + for (i = skip_ep0; i < 16; ++i) { | |
| 1231 | + usb_disable_endpoint(dev, i, true); | |
| 1232 | + usb_disable_endpoint(dev, i + USB_DIR_IN, true); | |
| 1233 | + } | |
| 1234 | +} | |
| 1235 | + | |
| 1208 | 1236 | /** |
| 1209 | 1237 | * usb_disable_device - Disable all the endpoints for a USB device |
| 1210 | 1238 | * @dev: the device whose endpoints are being disabled |
| @@ -1218,7 +1246,6 @@ void usb_disable_interface(struct usb_device *dev, struct usb_interface *intf, · 7 unmodified lines | ||
| 1218 | 1246 | void usb_disable_device(struct usb_device *dev, int skip_ep0) |
| 1219 | 1247 | { |
| 1220 | 1248 | int i; |
| 1221 | − struct usb_hcd *hcd = bus_to_hcd(dev->bus); | |
| 1222 | 1249 | |
| 1223 | 1250 | /* getting rid of interfaces will disconnect |
| 1224 | 1251 | * any drivers bound to them (a key side effect) |
| @@ -1264,22 +1291,8 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) · 39 unmodified lines | ||
| 1264 | 1291 | |
| 1265 | 1292 | dev_dbg(&dev->dev, "%s nuking %s URBs\n", __func__, |
| 1266 | 1293 | skip_ep0 ? "non-ep0" : "all"); |
| 1267 | − if (hcd->driver->check_bandwidth) { | |
| 1268 | − /* First pass: Cancel URBs, leave endpoint pointers intact. */ | |
| 1269 | − for (i = skip_ep0; i < 16; ++i) { | |
| 1270 | − usb_disable_endpoint(dev, i, false); | |
| 1271 | − usb_disable_endpoint(dev, i + USB_DIR_IN, false); | |
| 1272 | − } | |
| 1273 | − /* Remove endpoints from the host controller internal state */ | |
| 1274 | − mutex_lock(hcd->bandwidth_mutex); | |
| 1275 | − usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); | |
| 1276 | − mutex_unlock(hcd->bandwidth_mutex); | |
| 1277 | − /* Second pass: remove endpoint pointers */ | |
| 1278 | − } | |
| 1279 | − for (i = skip_ep0; i < 16; ++i) { | |
| 1280 | − usb_disable_endpoint(dev, i, true); | |
| 1281 | − usb_disable_endpoint(dev, i + USB_DIR_IN, true); | |
| 1282 | − } | |
| 1294 | + | |
| 1295 | + usb_disable_device_endpoints(dev, skip_ep0); | |
| 1283 | 1296 | } |
| 1284 | 1297 | |
| 1285 | 1298 | /** |
| @@ -1522,6 +1535,9 @@ EXPORT_SYMBOL_GPL(usb_set_interface); · 236 unmodified lines | ||
| 1522 | 1535 | * The caller must own the device lock. |
| 1523 | 1536 | * |
| 1524 | 1537 | * Return: Zero on success, else a negative error code. |
| 1538 | + * | |
| 1539 | + * If this routine fails the device will probably be in an unusable state | |
| 1540 | + * with endpoints disabled, and interfaces only partially enabled. | |
| 1525 | 1541 | */ |
| 1526 | 1542 | int usb_reset_configuration(struct usb_device *dev) |
| 1527 | 1543 | { |
| @@ -1537,10 +1553,7 @@ int usb_reset_configuration(struct usb_device *dev) · 9 unmodified lines | ||
| 1537 | 1553 | * calls during probe() are fine |
| 1538 | 1554 | */ |
| 1539 | 1555 | |
| 1540 | − for (i = 1; i < 16; ++i) { | |
| 1541 | − usb_disable_endpoint(dev, i, true); | |
| 1542 | − usb_disable_endpoint(dev, i + USB_DIR_IN, true); | |
| 1543 | − } | |
| 1556 | + usb_disable_device_endpoints(dev, 1); /* skip ep0*/ | |
| 1544 | 1557 | |
| 1545 | 1558 | config = dev->actconfig; |
| 1546 | 1559 | retval = 0; |
| @@ -1553,34 +1566,10 @@ int usb_reset_configuration(struct usb_device *dev) · 6 unmodified lines | ||
| 1553 | 1566 | mutex_unlock(hcd->bandwidth_mutex); |
| 1554 | 1567 | return -ENOMEM; |
| 1555 | 1568 | } |
| 1556 | − /* Make sure we have enough bandwidth for each alternate setting 0 */ | |
| 1557 | − for (i = 0; i < config->desc.bNumInterfaces; i++) { | |
| 1558 | − struct usb_interface *intf = config->interface[i]; | |
| 1559 | − struct usb_host_interface *alt; | |
| 1560 | 1569 | |
| 1561 | − alt = usb_altnum_to_altsetting(intf, 0); | |
| 1562 | − if (!alt) | |
| 1563 | − alt = &intf->altsetting[0]; | |
| 1564 | − if (alt != intf->cur_altsetting) | |
| 1565 | − retval = usb_hcd_alloc_bandwidth(dev, NULL, | |
| 1566 | − intf->cur_altsetting, alt); | |
| 1567 | − if (retval < 0) | |
| 1568 | − break; | |
| 1569 | − } | |
| 1570 | − /* If not, reinstate the old alternate settings */ | |
| 1570 | + /* xHCI adds all endpoints in usb_hcd_alloc_bandwidth */ | |
| 1571 | + retval = usb_hcd_alloc_bandwidth(dev, config, NULL, NULL); | |
| 1571 | 1572 | if (retval < 0) { |
| 1572 | −reset_old_alts: | |
| 1573 | − for (i--; i >= 0; i--) { | |
| 1574 | − struct usb_interface *intf = config->interface[i]; | |
| 1575 | − struct usb_host_interface *alt; | |
| 1576 | − | |
| 1577 | − alt = usb_altnum_to_altsetting(intf, 0); | |
| 1578 | − if (!alt) | |
| 1579 | − alt = &intf->altsetting[0]; | |
| 1580 | − if (alt != intf->cur_altsetting) | |
| 1581 | − usb_hcd_alloc_bandwidth(dev, NULL, | |
| 1582 | − alt, intf->cur_altsetting); | |
| 1583 | − } | |
| 1584 | 1573 | usb_enable_lpm(dev); |
| 1585 | 1574 | mutex_unlock(hcd->bandwidth_mutex); |
| 1586 | 1575 | return retval; |
| @@ -1589,8 +1578,12 @@ reset_old_alts: · 2 unmodified lines | ||
| 1589 | 1578 | USB_REQ_SET_CONFIGURATION, 0, |
| 1590 | 1579 | config->desc.bConfigurationValue, 0, |
| 1591 | 1580 | NULL, 0, USB_CTRL_SET_TIMEOUT); |
| 1592 | − if (retval < 0) | |
| 1593 | − goto reset_old_alts; | |
| 1581 | + if (retval < 0) { | |
| 1582 | + usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); | |
| 1583 | + usb_enable_lpm(dev); | |
| 1584 | + mutex_unlock(hcd->bandwidth_mutex); | |
| 1585 | + return retval; | |
| 1586 | + } | |
| 1594 | 1587 | mutex_unlock(hcd->bandwidth_mutex); |
| 1595 | 1588 | |
| 1596 | 1589 | /* re-init hc/hcd interface/endpoint state */ |
| @@ -889,7 +889,11 @@ read_descriptors(struct file *filp, struct kobject *kobj, · 888 unmodified lines | ||
| 889 | 889 | size_t srclen, n; |
| 890 | 890 | int cfgno; |
| 891 | 891 | void *src; |
| 892 | + int retval; | |
| 892 | 893 | |
| 894 | + retval = usb_lock_device_interruptible(udev); | |
| 895 | + if (retval < 0) | |
| 896 | + return -EINTR; | |
| 893 | 897 | /* The binary attribute begins with the device descriptor. |
| 894 | 898 | * Following that are the raw descriptor entries for all the |
| 895 | 899 | * configurations (config plus subsidiary descriptors). |
| @@ -914,6 +918,7 @@ read_descriptors(struct file *filp, struct kobject *kobj, · 18 unmodified lines | ||
| 914 | 918 | off -= srclen; |
| 915 | 919 | } |
| 916 | 920 | } |
| 921 | + usb_unlock_device(udev); | |
| 917 | 922 | return count - nleft; |
| 918 | 923 | } |
| 919 | 924 | |
| @@ -737,13 +737,13 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) · 736 unmodified lines | ||
| 737 | 737 | goto err_disable_clks; |
| 738 | 738 | } |
| 739 | 739 | |
| 740 | − ret = reset_control_deassert(priv->reset); | |
| 740 | + ret = reset_control_reset(priv->reset); | |
| 741 | 741 | if (ret) |
| 742 | − goto err_assert_reset; | |
| 742 | + goto err_disable_clks; | |
| 743 | 743 | |
| 744 | 744 | ret = dwc3_meson_g12a_get_phys(priv); |
| 745 | 745 | if (ret) |
| 746 | − goto err_assert_reset; | |
| 746 | + goto err_disable_clks; | |
| 747 | 747 | |
| 748 | 748 | ret = priv->drvdata->setup_regmaps(priv, base); |
| 749 | 749 | if (ret) |
| @@ -752,7 +752,7 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) · 2 unmodified lines | ||
| 752 | 752 | if (priv->vbus) { |
| 753 | 753 | ret = regulator_enable(priv->vbus); |
| 754 | 754 | if (ret) |
| 755 | − goto err_assert_reset; | |
| 755 | + goto err_disable_clks; | |
| 756 | 756 | } |
| 757 | 757 | |
| 758 | 758 | /* Get dr_mode */ |
| @@ -765,13 +765,13 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) · 6 unmodified lines | ||
| 765 | 765 | |
| 766 | 766 | ret = priv->drvdata->usb_init(priv); |
| 767 | 767 | if (ret) |
| 768 | − goto err_assert_reset; | |
| 768 | + goto err_disable_clks; | |
| 769 | 769 | |
| 770 | 770 | /* Init PHYs */ |
| 771 | 771 | for (i = 0 ; i < PHY_COUNT ; ++i) { |
| 772 | 772 | ret = phy_init(priv->phys[i]); |
| 773 | 773 | if (ret) |
| 774 | − goto err_assert_reset; | |
| 774 | + goto err_disable_clks; | |
| 775 | 775 | } |
| 776 | 776 | |
| 777 | 777 | /* Set PHY Power */ |
| @@ -809,9 +809,6 @@ err_phys_exit: · 31 unmodified lines | ||
| 809 | 809 | for (i = 0 ; i < PHY_COUNT ; ++i) |
| 810 | 810 | phy_exit(priv->phys[i]); |
| 811 | 811 | |
| 812 | −err_assert_reset: | |
| 813 | − reset_control_assert(priv->reset); | |
| 814 | − | |
| 815 | 812 | err_disable_clks: |
| 816 | 813 | clk_bulk_disable_unprepare(priv->drvdata->num_clks, |
| 817 | 814 | priv->drvdata->clks); |
| @@ -713,6 +713,7 @@ static const struct usb_device_id id_table_combined[] = { · 712 unmodified lines | ||
| 713 | 713 | { USB_DEVICE(XSENS_VID, XSENS_AWINDA_STATION_PID) }, |
| 714 | 714 | { USB_DEVICE(XSENS_VID, XSENS_CONVERTER_PID) }, |
| 715 | 715 | { USB_DEVICE(XSENS_VID, XSENS_MTDEVBOARD_PID) }, |
| 716 | + { USB_DEVICE(XSENS_VID, XSENS_MTIUSBCONVERTER_PID) }, | |
| 716 | 717 | { USB_DEVICE(XSENS_VID, XSENS_MTW_PID) }, |
| 717 | 718 | { USB_DEVICE(FTDI_VID, FTDI_OMNI1509) }, |
| 718 | 719 | { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) }, |
| @@ -160,6 +160,7 @@ · 159 unmodified lines | ||
| 160 | 160 | #define XSENS_AWINDA_DONGLE_PID 0x0102 |
| 161 | 161 | #define XSENS_MTW_PID 0x0200 /* Xsens MTw */ |
| 162 | 162 | #define XSENS_MTDEVBOARD_PID 0x0300 /* Motion Tracker Development Board */ |
| 163 | +#define XSENS_MTIUSBCONVERTER_PID 0x0301 /* MTi USB converter */ | |
| 163 | 164 | #define XSENS_CONVERTER_PID 0xD00D /* Xsens USB-serial converter */ |
| 164 | 165 | |
| 165 | 166 | /* Xsens devices using FTDI VID */ |
| @@ -1094,14 +1094,18 @@ static const struct usb_device_id option_ids[] = { · 1093 unmodified lines | ||
| 1094 | 1094 | { USB_DEVICE(QUALCOMM_VENDOR_ID, UBLOX_PRODUCT_R410M), |
| 1095 | 1095 | .driver_info = RSVD(1) | RSVD(3) }, |
| 1096 | 1096 | /* Quectel products using Quectel vendor ID */ |
| 1097 | − { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21), | |
| 1098 | − .driver_info = RSVD(4) }, | |
| 1099 | − { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25), | |
| 1100 | − .driver_info = RSVD(4) }, | |
| 1101 | − { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95), | |
| 1102 | − .driver_info = RSVD(4) }, | |
| 1103 | − { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96), | |
| 1104 | − .driver_info = RSVD(4) }, | |
| 1097 | + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21, 0xff, 0xff, 0xff), | |
| 1098 | + .driver_info = NUMEP2 }, | |
| 1099 | + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21, 0xff, 0, 0) }, | |
| 1100 | + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25, 0xff, 0xff, 0xff), | |
| 1101 | + .driver_info = NUMEP2 }, | |
| 1102 | + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25, 0xff, 0, 0) }, | |
| 1103 | + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0xff, 0xff), | |
| 1104 | + .driver_info = NUMEP2 }, | |
| 1105 | + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0, 0) }, | |
| 1106 | + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96, 0xff, 0xff, 0xff), | |
| 1107 | + .driver_info = NUMEP2 }, | |
| 1108 | + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96, 0xff, 0, 0) }, | |
| 1105 | 1109 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0xff, 0xff), |
| 1106 | 1110 | .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 }, |
| 1107 | 1111 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) }, |
| @@ -1819,6 +1823,8 @@ static const struct usb_device_id option_ids[] = { · 711 unmodified lines | ||
| 1819 | 1823 | { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9003, 0xff) }, /* Simcom SIM7500/SIM7600 MBIM mode */ |
| 1820 | 1824 | { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9011, 0xff), /* Simcom SIM7500/SIM7600 RNDIS mode */ |
| 1821 | 1825 | .driver_info = RSVD(7) }, |
| 1826 | + { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9205, 0xff) }, /* Simcom SIM7070/SIM7080/SIM7090 AT+ECM mode */ | |
| 1827 | + { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9206, 0xff) }, /* Simcom SIM7070/SIM7080/SIM7090 AT-only mode */ | |
| 1822 | 1828 | { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S_X200), |
| 1823 | 1829 | .driver_info = NCTRL(0) | NCTRL(1) | RSVD(4) }, |
| 1824 | 1830 | { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X220_X500D), |
| @@ -61,14 +61,11 @@ enum { · 60 unmodified lines | ||
| 61 | 61 | |
| 62 | 62 | #define PMC_USB_ALTMODE_ORI_SHIFT 1 |
| 63 | 63 | #define PMC_USB_ALTMODE_UFP_SHIFT 3 |
| 64 | −#define PMC_USB_ALTMODE_ORI_AUX_SHIFT 4 | |
| 65 | −#define PMC_USB_ALTMODE_ORI_HSL_SHIFT 5 | |
| 66 | 64 | |
| 67 | 65 | /* DP specific Mode Data bits */ |
| 68 | 66 | #define PMC_USB_ALTMODE_DP_MODE_SHIFT 8 |
| 69 | 67 | |
| 70 | 68 | /* TBT specific Mode Data bits */ |
| 71 | −#define PMC_USB_ALTMODE_HPD_HIGH BIT(14) | |
| 72 | 69 | #define PMC_USB_ALTMODE_TBT_TYPE BIT(17) |
| 73 | 70 | #define PMC_USB_ALTMODE_CABLE_TYPE BIT(18) |
| 74 | 71 | #define PMC_USB_ALTMODE_ACTIVE_LINK BIT(20) |
| @@ -179,15 +176,9 @@ pmc_usb_mux_dp(struct pmc_usb_port *port, struct typec_mux_state *state) · 104 unmodified lines | ||
| 179 | 176 | req.mode_data = (port->orientation - 1) << PMC_USB_ALTMODE_ORI_SHIFT; |
| 180 | 177 | req.mode_data |= (port->role - 1) << PMC_USB_ALTMODE_UFP_SHIFT; |
| 181 | 178 | |
| 182 | − req.mode_data |= sbu_orientation(port) << PMC_USB_ALTMODE_ORI_AUX_SHIFT; | |
| 183 | − req.mode_data |= hsl_orientation(port) << PMC_USB_ALTMODE_ORI_HSL_SHIFT; | |
| 184 | − | |
| 185 | 179 | req.mode_data |= (state->mode - TYPEC_STATE_MODAL) << |
| 186 | 180 | PMC_USB_ALTMODE_DP_MODE_SHIFT; |
| 187 | 181 | |
| 188 | − if (data->status & DP_STATUS_HPD_STATE) | |
| 189 | − req.mode_data |= PMC_USB_ALTMODE_HPD_HIGH; | |
| 190 | − | |
| 191 | 182 | ret = pmc_usb_command(port, (void *)&req, sizeof(req)); |
| 192 | 183 | if (ret) |
| 193 | 184 | return ret; |
| @@ -212,9 +203,6 @@ pmc_usb_mux_tbt(struct pmc_usb_port *port, struct typec_mux_state *state) · 18 unmodified lines | ||
| 212 | 203 | req.mode_data = (port->orientation - 1) << PMC_USB_ALTMODE_ORI_SHIFT; |
| 213 | 204 | req.mode_data |= (port->role - 1) << PMC_USB_ALTMODE_UFP_SHIFT; |
| 214 | 205 | |
| 215 | − req.mode_data |= sbu_orientation(port) << PMC_USB_ALTMODE_ORI_AUX_SHIFT; | |
| 216 | − req.mode_data |= hsl_orientation(port) << PMC_USB_ALTMODE_ORI_HSL_SHIFT; | |
| 217 | − | |
| 218 | 206 | if (TBT_ADAPTER(data->device_mode) == TBT_ADAPTER_TBT3) |
| 219 | 207 | req.mode_data |= PMC_USB_ALTMODE_TBT_TYPE; |
| 220 | 208 | |
| @@ -497,6 +485,7 @@ err_remove_ports: · 276 unmodified lines | ||
| 497 | 485 | for (i = 0; i < pmc->num_ports; i++) { |
| 498 | 486 | typec_switch_unregister(pmc->port[i].typec_sw); |
| 499 | 487 | typec_mux_unregister(pmc->port[i].typec_mux); |
| 488 | + usb_role_switch_unregister(pmc->port[i].usb_sw); | |
| 500 | 489 | } |
| 501 | 490 | |
| 502 | 491 | return ret; |
| @@ -510,6 +499,7 @@ static int pmc_usb_remove(struct platform_device *pdev) · 7 unmodified lines | ||
| 510 | 499 | for (i = 0; i < pmc->num_ports; i++) { |
| 511 | 500 | typec_switch_unregister(pmc->port[i].typec_sw); |
| 512 | 501 | typec_mux_unregister(pmc->port[i].typec_mux); |
| 502 | + usb_role_switch_unregister(pmc->port[i].usb_sw); | |
| 513 | 503 | } |
| 514 | 504 | |
| 515 | 505 | return 0; |
| @@ -112,11 +112,15 @@ static void ucsi_acpi_notify(acpi_handle handle, u32 event, void *data) · 111 unmodified lines | ||
| 112 | 112 | |
| 113 | 113 | static int ucsi_acpi_probe(struct platform_device *pdev) |
| 114 | 114 | { |
| 115 | + struct acpi_device *adev = ACPI_COMPANION(&pdev->dev); | |
| 115 | 116 | struct ucsi_acpi *ua; |
| 116 | 117 | struct resource *res; |
| 117 | 118 | acpi_status status; |
| 118 | 119 | int ret; |
| 119 | 120 | |
| 121 | + if (adev->dep_unmet) | |
| 122 | + return -EPROBE_DEFER; | |
| 123 | + | |
| 120 | 124 | ua = devm_kzalloc(&pdev->dev, sizeof(*ua), GFP_KERNEL); |
| 121 | 125 | if (!ua) |
| 122 | 126 | return -ENOMEM; |