staging: typec: tcpci: keep the not connecting cc line open
PATCH v3 10/12 staging: typec: tcpci: keep the not connecting cc line open
While set polarity, we should keep the not connecting cc line to be open when attached.
Signed-off-by Li Jun <[email protected]>
--- drivers/staging/typec/tcpci.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/staging/typec/tcpci.c +12 -1
@@ -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)