RE: [PATCH v3 08/12] staging: typec: tcpci: enable vbus detection

2018-03-19 Thread Jun Li
Hi
> -Original Message-
> From: Guenter Roeck [mailto:groe...@gmail.com] On Behalf Of Guenter
> Roeck
> Sent: 2018年3月15日 12:47
> To: Jun Li <jun...@nxp.com>
> Cc: robh...@kernel.org; mark.rutl...@arm.com;
> gre...@linuxfoundation.org; heikki.kroge...@linux.intel.com;
> a.ha...@samsung.com; yue...@google.com; shufan_...@richtek.com;
> o_leve...@orange.fr; linux-usb@vger.kernel.org; dl-linux-imx
> <linux-...@nxp.com>
> Subject: Re: [PATCH v3 08/12] staging: typec: tcpci: enable vbus detection
> 
> On Tue, Mar 13, 2018 at 05:34:34PM +0800, Li Jun wrote:
> > TCPCI implementation may need SW to enable VBUS detection to generate
> > power status events.
> >
> > Signed-off-by: Li Jun <jun...@nxp.com>
> 
> Makes sense to me. Only question might be if this should be dones before
> checking the power status at the beginnng of the function. Any thoughts ?
> 
Per spec, that power status checking is to make sure the tcpc has completed
Initialization and all registers are valid, I think it may not safe to issue 
tcpc
command before that.

Thanks
Jun

> Otherwise
> 
> Reviewed-by: Guenter Roeck <li...@roeck-us.net>
> 
> > ---
> >  drivers/staging/typec/tcpci.c | 6 ++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/staging/typec/tcpci.c
> > b/drivers/staging/typec/tcpci.c index f5a3bf5..9a230c6 100644
> > --- a/drivers/staging/typec/tcpci.c
> > +++ b/drivers/staging/typec/tcpci.c
> > @@ -373,6 +373,12 @@ static int tcpci_init(struct tcpc_dev *tcpc)
> > if (ret < 0)
> > return ret;
> >
> > +   /* Enable Vbus detection */
> > +   ret = regmap_write(tcpci->regmap, TCPC_COMMAND,
> > +  TCPC_CMD_ENABLE_VBUS_DETECT);
> > +   if (ret < 0)
> > +   return ret;
> > +
> > reg = TCPC_ALERT_TX_SUCCESS | TCPC_ALERT_TX_FAILED |
> > TCPC_ALERT_TX_DISCARDED | TCPC_ALERT_RX_STATUS |
> > TCPC_ALERT_RX_HARD_RST | TCPC_ALERT_CC_STATUS;
> > --
> > 2.7.4
> >


Re: [PATCH v3 08/12] staging: typec: tcpci: enable vbus detection

2018-03-14 Thread Guenter Roeck
On Tue, Mar 13, 2018 at 05:34:34PM +0800, Li Jun wrote:
> TCPCI implementation may need SW to enable VBUS detection to generate
> power status events.
> 
> Signed-off-by: Li Jun 

Makes sense to me. Only question might be if this should be dones before
checking the power status at the beginnng of the function. Any thoughts ?

Otherwise

Reviewed-by: Guenter Roeck 

> ---
>  drivers/staging/typec/tcpci.c | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c
> index f5a3bf5..9a230c6 100644
> --- a/drivers/staging/typec/tcpci.c
> +++ b/drivers/staging/typec/tcpci.c
> @@ -373,6 +373,12 @@ static int tcpci_init(struct tcpc_dev *tcpc)
>   if (ret < 0)
>   return ret;
>  
> + /* Enable Vbus detection */
> + ret = regmap_write(tcpci->regmap, TCPC_COMMAND,
> +TCPC_CMD_ENABLE_VBUS_DETECT);
> + if (ret < 0)
> + return ret;
> +
>   reg = TCPC_ALERT_TX_SUCCESS | TCPC_ALERT_TX_FAILED |
>   TCPC_ALERT_TX_DISCARDED | TCPC_ALERT_RX_STATUS |
>   TCPC_ALERT_RX_HARD_RST | TCPC_ALERT_CC_STATUS;
> -- 
> 2.7.4
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 08/12] staging: typec: tcpci: enable vbus detection

2018-03-13 Thread Li Jun
TCPCI implementation may need SW to enable VBUS detection to generate
power status events.

Signed-off-by: Li Jun 
---
 drivers/staging/typec/tcpci.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c
index f5a3bf5..9a230c6 100644
--- a/drivers/staging/typec/tcpci.c
+++ b/drivers/staging/typec/tcpci.c
@@ -373,6 +373,12 @@ static int tcpci_init(struct tcpc_dev *tcpc)
if (ret < 0)
return ret;
 
+   /* Enable Vbus detection */
+   ret = regmap_write(tcpci->regmap, TCPC_COMMAND,
+  TCPC_CMD_ENABLE_VBUS_DETECT);
+   if (ret < 0)
+   return ret;
+
reg = TCPC_ALERT_TX_SUCCESS | TCPC_ALERT_TX_FAILED |
TCPC_ALERT_TX_DISCARDED | TCPC_ALERT_RX_STATUS |
TCPC_ALERT_RX_HARD_RST | TCPC_ALERT_CC_STATUS;
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html