aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>2020-07-01 14:56:17 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-07-01 14:06:25 +0200
commitb7404a29cd3db0bf9537addf36b0fa33b58a645a (patch)
tree9cfa5bbdd0a83f5e4ecd03c6f766f99ca7c6dff9
parentusb: typec: Add data structure for Enter_USB message (diff)
downloadwireguard-linux-b7404a29cd3db0bf9537addf36b0fa33b58a645a.tar.xz
wireguard-linux-b7404a29cd3db0bf9537addf36b0fa33b58a645a.zip
usb: typec: intel_pmc_mux: Definitions for response status bits
Adding definitions for the two status bits that we have in the command response data structure. Also, from now on only considering the second status bit, which tells was the failure fatal or not, if the first bit is set. If the first bit is not set, then the command was successful, and we need to ignore the second bit. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20200701115618.22482-4-heikki.krogerus@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/typec/mux/intel_pmc_mux.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c b/drivers/usb/typec/mux/intel_pmc_mux.c
index 70ddc9d6d49e..31fa62f968fb 100644
--- a/drivers/usb/typec/mux/intel_pmc_mux.c
+++ b/drivers/usb/typec/mux/intel_pmc_mux.c
@@ -19,6 +19,10 @@
#define PMC_USBC_CMD 0xa7
+/* Response status bits */
+#define PMC_USB_RESP_STATUS_FAILURE BIT(0)
+#define PMC_USB_RESP_STATUS_FATAL BIT(1)
+
/* "Usage" OOB Message field values */
enum {
PMC_USB_CONNECT,
@@ -130,8 +134,8 @@ static int pmc_usb_command(struct pmc_usb_port *port, u8 *msg, u32 len)
*/
intel_scu_ipc_dev_command(port->pmc->ipc, PMC_USBC_CMD, 0, msg, len,
response, sizeof(response));
- if (response[2]) {
- if (response[2] & BIT(1))
+ if (response[2] & PMC_USB_RESP_STATUS_FAILURE) {
+ if (response[2] & PMC_USB_RESP_STATUS_FATAL)
return -EIO;
return -EBUSY;
}