Message ID | 1525307094-27402-13-git-send-email-jun.li@nxp.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
> > While set polarity, we should keep the not connecting cc line to be open. > keep the disconnected cc line open? Peter > Signed-off-by: Li Jun <jun.li@nxp.com> > --- > drivers/staging/typec/tcpci.c | 18 ++++++++++++++---- > 1 file changed, 14 insertions(+), 4 deletions(-) > > diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c index > 5c48810..5c0c5e3 100644 > --- a/drivers/staging/typec/tcpci.c > +++ b/drivers/staging/typec/tcpci.c > @@ -185,15 +185,25 @@ 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, > - (polarity == TYPEC_POLARITY_CC2) ? > - TCPC_TCPC_CTRL_ORIENTATION : 0); > + /* Keep the disconnect cc line open */ > + ret = regmap_read(tcpci->regmap, TCPC_ROLE_CTRL, ®); > if (ret < 0) > return ret; > > - return 0; > + if (polarity == TYPEC_POLARITY_CC2) > + reg |= TCPC_ROLE_CTRL_CC_OPEN << > TCPC_ROLE_CTRL_CC1_SHIFT; > + else > + reg |= TCPC_ROLE_CTRL_CC_OPEN << > TCPC_ROLE_CTRL_CC2_SHIFT; > + ret = regmap_write(tcpci->regmap, TCPC_ROLE_CTRL, reg); > + if (ret < 0) > + return ret; > + > + return regmap_write(tcpci->regmap, TCPC_TCPC_CTRL, > + (polarity == TYPEC_POLARITY_CC2) ? > + TCPC_TCPC_CTRL_ORIENTATION : 0); > } > > 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> -----Original Message----- > From: Peter Chen > Sent: 2018年5月16日 16:36 > To: Jun Li <jun.li@nxp.com>; robh+dt@kernel.org; gregkh@linuxfoundation.org; > heikki.krogerus@linux.intel.com; linux@roeck-us.net > Cc: a.hajda@samsung.com; cw00.choi@samsung.com; > shufan_lee@richtek.com; gsomlo@gmail.com; devicetree@vger.kernel.org; > linux-usb@vger.kernel.org; dl-linux-imx <linux-imx@nxp.com> > Subject: RE: [PATCH v5 12/14] staging: typec: tcpci: keep the not connecting cc > line open > > > > > > While set polarity, we should keep the not connecting cc line to be open. > > > > keep the disconnected cc line open? Okay, I will change. Thanks Li Jun > > Peter > > > Signed-off-by: Li Jun <jun.li@nxp.com> > > --- > > drivers/staging/typec/tcpci.c | 18 ++++++++++++++---- > > 1 file changed, 14 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c index > > 5c48810..5c0c5e3 100644 > > --- a/drivers/staging/typec/tcpci.c > > +++ b/drivers/staging/typec/tcpci.c > > @@ -185,15 +185,25 @@ 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, > > - (polarity == TYPEC_POLARITY_CC2) ? > > - TCPC_TCPC_CTRL_ORIENTATION : 0); > > + /* Keep the disconnect cc line open */ > > + ret = regmap_read(tcpci->regmap, TCPC_ROLE_CTRL, ®); > > if (ret < 0) > > return ret; > > > > - return 0; > > + if (polarity == TYPEC_POLARITY_CC2) > > + reg |= TCPC_ROLE_CTRL_CC_OPEN << > > TCPC_ROLE_CTRL_CC1_SHIFT; > > + else > > + reg |= TCPC_ROLE_CTRL_CC_OPEN << > > TCPC_ROLE_CTRL_CC2_SHIFT; > > + ret = regmap_write(tcpci->regmap, TCPC_ROLE_CTRL, reg); > > + if (ret < 0) > > + return ret; > > + > > + return regmap_write(tcpci->regmap, TCPC_TCPC_CTRL, > > + (polarity == TYPEC_POLARITY_CC2) ? > > + TCPC_TCPC_CTRL_ORIENTATION : 0); > > } > > > > static int tcpci_set_vconn(struct tcpc_dev *tcpc, bool enable) > > -- > > 2.7.4
diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c index 5c48810..5c0c5e3 100644 --- a/drivers/staging/typec/tcpci.c +++ b/drivers/staging/typec/tcpci.c @@ -185,15 +185,25 @@ 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, - (polarity == TYPEC_POLARITY_CC2) ? - TCPC_TCPC_CTRL_ORIENTATION : 0); + /* Keep the disconnect cc line open */ + ret = regmap_read(tcpci->regmap, TCPC_ROLE_CTRL, ®); if (ret < 0) return ret; - return 0; + if (polarity == TYPEC_POLARITY_CC2) + reg |= TCPC_ROLE_CTRL_CC_OPEN << TCPC_ROLE_CTRL_CC1_SHIFT; + else + reg |= TCPC_ROLE_CTRL_CC_OPEN << TCPC_ROLE_CTRL_CC2_SHIFT; + ret = regmap_write(tcpci->regmap, TCPC_ROLE_CTRL, reg); + if (ret < 0) + return ret; + + return regmap_write(tcpci->regmap, TCPC_TCPC_CTRL, + (polarity == TYPEC_POLARITY_CC2) ? + TCPC_TCPC_CTRL_ORIENTATION : 0); } static int tcpci_set_vconn(struct tcpc_dev *tcpc, bool enable)
While set polarity, we should keep the not connecting cc line to be open. Signed-off-by: Li Jun <jun.li@nxp.com> --- drivers/staging/typec/tcpci.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)