summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorXu Yang <xu.yang_2@nxp.com>2024-12-11 18:57:53 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-12-23 18:40:46 +0100
commit8534229375f8cc4422039fbad74c4ca01ef2f651 (patch)
tree853ec4d1dea385daef394577a66c72bf91b0715f /drivers/usb
parentc975c9b8f8204c34213e9a6821f597bbda021f8e (diff)
downloadlinux-stable-8534229375f8cc4422039fbad74c4ca01ef2f651.tar.gz
linux-stable-8534229375f8cc4422039fbad74c4ca01ef2f651.tar.bz2
linux-stable-8534229375f8cc4422039fbad74c4ca01ef2f651.zip
usb: typec: tcpci: set local CC to Rd only when cc1/cc2 status is Rp
The cc1 and cc2 status returned by tcpci_get_cc() may be TYPEC_CC_OPEN or TYPEC_CC_RA. So don't assume it's just TYPEC_CC_RD or TYPEC_CC_RP_*. This will let local port present Rd on CC only when cc1/cc2 status is TYPEC_CC_RP_*. Signed-off-by: Xu Yang <xu.yang_2@nxp.com> Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20241211105753.1205312-1-xu.yang_2@nxp.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/typec/tcpm/tcpci.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
index ed32583829be..2f15734a5043 100644
--- a/drivers/usb/typec/tcpm/tcpci.c
+++ b/drivers/usb/typec/tcpm/tcpci.c
@@ -282,7 +282,7 @@ static int tcpci_set_polarity(struct tcpc_dev *tcpc,
if (cc2 == TYPEC_CC_RD)
/* Role control would have the Rp setting when DRP was enabled */
reg |= FIELD_PREP(TCPC_ROLE_CTRL_CC2, TCPC_ROLE_CTRL_CC_RP);
- else
+ else if (cc2 >= TYPEC_CC_RP_DEF)
reg |= FIELD_PREP(TCPC_ROLE_CTRL_CC2, TCPC_ROLE_CTRL_CC_RD);
} else {
reg &= ~TCPC_ROLE_CTRL_CC1;
@@ -290,7 +290,7 @@ static int tcpci_set_polarity(struct tcpc_dev *tcpc,
if (cc1 == TYPEC_CC_RD)
/* Role control would have the Rp setting when DRP was enabled */
reg |= FIELD_PREP(TCPC_ROLE_CTRL_CC1, TCPC_ROLE_CTRL_CC_RP);
- else
+ else if (cc1 >= TYPEC_CC_RP_DEF)
reg |= FIELD_PREP(TCPC_ROLE_CTRL_CC1, TCPC_ROLE_CTRL_CC_RD);
}
}