All of lore.kernel.org
 help / color / mirror / Atom feed
* [v3,08/12] staging: typec: tcpci: enable vbus detection
@ 2018-03-15  4:47 Guenter Roeck
  0 siblings, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2018-03-15  4:47 UTC (permalink / raw)
  To: Li Jun
  Cc: robh+dt, mark.rutland, gregkh, heikki.krogerus, a.hajda, yueyao,
	shufan_lee, o_leveque, linux-usb, linux-imx

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.li@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 ?

Otherwise

Reviewed-by: Guenter Roeck <linux@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
>
---
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [v3,08/12] staging: typec: tcpci: enable vbus detection
@ 2018-03-19  9:59 Jun Li
  0 siblings, 0 replies; 3+ messages in thread
From: Jun Li @ 2018-03-19  9:59 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: robh+dt, mark.rutland, gregkh, heikki.krogerus, a.hajda, yueyao,
	shufan_lee, o_leveque, linux-usb, dl-linux-imx

Hi
> -----Original Message-----
> From: Guenter Roeck [mailto:groeck7@gmail.com] On Behalf Of Guenter
> Roeck
> Sent: 2018年3月15日 12:47
> To: Jun Li <jun.li@nxp.com>
> Cc: robh+dt@kernel.org; mark.rutland@arm.com;
> gregkh@linuxfoundation.org; heikki.krogerus@linux.intel.com;
> a.hajda@samsung.com; yueyao@google.com; shufan_lee@richtek.com;
> o_leveque@orange.fr; linux-usb@vger.kernel.org; dl-linux-imx
> <linux-imx@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.li@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 <linux@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
> >

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [v3,08/12] staging: typec: tcpci: enable vbus detection
@ 2018-03-13  9:34 Jun Li
  0 siblings, 0 replies; 3+ messages in thread
From: Jun Li @ 2018-03-13  9:34 UTC (permalink / raw)
  To: robh+dt, mark.rutland, gregkh, heikki.krogerus
  Cc: a.hajda, jun.li, linux, yueyao, shufan_lee, o_leveque, linux-usb,
	linux-imx

TCPCI implementation may need SW to enable VBUS detection to generate
power status events.

Signed-off-by: Li Jun <jun.li@nxp.com>
---
 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;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-19  9:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-15  4:47 [v3,08/12] staging: typec: tcpci: enable vbus detection Guenter Roeck
  -- strict thread matches above, loose matches on Subject: below --
2018-03-19  9:59 Jun Li
2018-03-13  9:34 Jun Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.