Skip to content

Commit

Permalink
usb: typec: intel_pmc_mux: Use correct response message bits
Browse files Browse the repository at this point in the history
When Intel PMC Mux agent driver receives the response message from PMC, it
checks for the same response bits for all the mux states.
Corrected it by checking correct response message bits, Bit 8 & 9 for the
SAFE Mode and Alternate Modes and Bit 16 & 17 for the Connect and
Disconnect Modes.

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Utkarsh Patel <utkarsh.h.patel@intel.com>
Link: https://lore.kernel.org/r/20201203220813.16281-1-utkarsh.h.patel@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Utkarsh Patel authored and Greg Kroah-Hartman committed Dec 9, 2020
1 parent d6ff324 commit 3a288ef
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/usb/typec/mux/intel_pmc_mux.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/*
Expand All @@ -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;
}

Expand Down

0 comments on commit 3a288ef

Please sign in to comment.