While set polarity, we should keep the not connecting cc line to be open when attached. Signed-off-by: Li Jun <jun.li@xxxxxxx> --- drivers/staging/typec/tcpci.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c index 9a230c6..6fdb179 100644 --- a/drivers/staging/typec/tcpci.c +++ b/drivers/staging/typec/tcpci.c @@ -185,6 +185,7 @@ static int tcpci_set_polarity(struct tcpc_dev *tcpc, enum typec_cc_polarity polarity) { struct tcpci *tcpci = tcpc_to_tcpci(tcpc); + unsigned int reg; int ret; ret = regmap_write(tcpci->regmap, TCPC_TCPC_CTRL, @@ -193,7 +194,17 @@ static int tcpci_set_polarity(struct tcpc_dev *tcpc, if (ret < 0) return ret; - return 0; + /* Set the not connected cc line open */ + ret = regmap_read(tcpci->regmap, TCPC_ROLE_CTRL, ®); + if (ret < 0) + return ret; + if (polarity == TYPEC_POLARITY_CC2) + ret = TCPC_ROLE_CTRL_CC1_SHIFT; + else + ret = TCPC_ROLE_CTRL_CC2_SHIFT; + reg |= TCPC_ROLE_CTRL_CC_OPEN << ret; + reg &= ~TCPC_ROLE_CTRL_DRP; + return regmap_write(tcpci->regmap, TCPC_ROLE_CTRL, reg); } static int tcpci_set_vconn(struct tcpc_dev *tcpc, bool enable) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html