aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/typec/mux/intel_pmc_mux.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/typec/mux/intel_pmc_mux.c')
-rw-r--r--drivers/usb/typec/mux/intel_pmc_mux.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c b/drivers/usb/typec/mux/intel_pmc_mux.c
index d7f63b74c6b1..cf37a59ce130 100644
--- a/drivers/usb/typec/mux/intel_pmc_mux.c
+++ b/drivers/usb/typec/mux/intel_pmc_mux.c
@@ -176,6 +176,7 @@ static int hsl_orientation(struct pmc_usb_port *port)
static int pmc_usb_command(struct pmc_usb_port *port, u8 *msg, u32 len)
{
u8 response[4];
+ u8 status_res;
int ret;
/*
@@ -189,9 +190,13 @@ static int pmc_usb_command(struct pmc_usb_port *port, u8 *msg, u32 len)
if (ret)
return ret;
- if (response[2] & PMC_USB_RESP_STATUS_FAILURE) {
- if (response[2] & PMC_USB_RESP_STATUS_FATAL)
+ status_res = (msg[0] & 0xf) < PMC_USB_SAFE_MODE ?
+ response[2] : response[1];
+
+ if (status_res & PMC_USB_RESP_STATUS_FAILURE) {
+ if (status_res & PMC_USB_RESP_STATUS_FATAL)
return -EIO;
+
return -EBUSY;
}
@@ -256,6 +261,7 @@ static int
pmc_usb_mux_tbt(struct pmc_usb_port *port, struct typec_mux_state *state)
{
struct typec_thunderbolt_data *data = state->data;
+ u8 cable_rounded = TBT_CABLE_ROUNDED_SUPPORT(data->cable_mode);
u8 cable_speed = TBT_CABLE_SPEED(data->cable_mode);
struct altmode_req req = { };
@@ -284,6 +290,8 @@ pmc_usb_mux_tbt(struct pmc_usb_port *port, struct typec_mux_state *state)
req.mode_data |= PMC_USB_ALTMODE_CABLE_SPD(cable_speed);
+ req.mode_data |= PMC_USB_ALTMODE_TBT_GEN(cable_rounded);
+
return pmc_usb_command(port, (void *)&req, sizeof(req));
}
@@ -319,6 +327,11 @@ pmc_usb_mux_usb4(struct pmc_usb_port *port, struct typec_mux_state *state)
fallthrough;
default:
req.mode_data |= PMC_USB_ALTMODE_ACTIVE_CABLE;
+
+ /* Configure data rate to rounded in the case of Active TBT3
+ * and USB4 cables.
+ */
+ req.mode_data |= PMC_USB_ALTMODE_TBT_GEN(1);
break;
}