Reporting the error code via VDM back to the Type-C mode selection logic allows the detailed result to be propagated to user space. Signed-off-by: Andrei Kuchynski <akuchynski@xxxxxxxxxxxx> --- drivers/usb/typec/ucsi/displayport.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/usb/typec/ucsi/displayport.c b/drivers/usb/typec/ucsi/displayport.c index 8aae80b457d7..47c28646cfa9 100644 --- a/drivers/usb/typec/ucsi/displayport.c +++ b/drivers/usb/typec/ucsi/displayport.c @@ -234,14 +234,18 @@ static int ucsi_displayport_vdm(struct typec_altmode *alt, switch (cmd) { case DP_CMD_STATUS_UPDATE: - if (ucsi_displayport_status_update(dp)) + dp->data.error = ucsi_displayport_status_update(dp); + if (dp->data.error) { + dp->vdo_data = &dp->data.error; dp->header |= VDO_CMDT(CMDT_RSP_NAK); - else + } else dp->header |= VDO_CMDT(CMDT_RSP_ACK); break; case DP_CMD_CONFIGURE: dp->data.conf = *data; - if (ucsi_displayport_configure(dp)) { + dp->data.error = ucsi_displayport_configure(dp); + if (dp->data.error) { + dp->vdo_data = &dp->data.error; dp->header |= VDO_CMDT(CMDT_RSP_NAK); } else { dp->header |= VDO_CMDT(CMDT_RSP_ACK); -- 2.51.0.384.g4c02a37b29-goog