Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Xu Yang <xu.yang_2@nxp.com>
Cc: gregkh@linuxfoundation.org, andre.draszik@linaro.org,
	m.felsch@pengutronix.de, rdbabiera@google.com,
	emanuele.ghidoli@toradex.com, linux-usb@vger.kernel.org,
	imx@lists.linux.dev, jun.li@nxp.com,
	Badhri Jagan Sridharan <badhri@google.com>
Subject: Re: [PATCH] usb: typec: tcpci: set local CC to Rd only when cc1/cc2 status is Rp
Date: Mon, 16 Dec 2024 11:47:07 +0200	[thread overview]
Message-ID: <Z1_3G1Iqz-A01FJr@kuha.fi.intel.com> (raw)
In-Reply-To: <20241211105753.1205312-1-xu.yang_2@nxp.com>

On Wed, Dec 11, 2024 at 06:57:53PM +0800, Xu Yang wrote:
> The cc1 and cc2 status returned by tcpci_get_cc() may be TYPEC_CC_OPEN
> or TYPEC_CC_RA. So don't assume it's just TYPEC_CC_RD or TYPEC_CC_RP_*.
> This will let local port present Rd on CC only when cc1/cc2 status is
> TYPEC_CC_RP_*.
> 
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>

Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  drivers/usb/typec/tcpm/tcpci.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
> index ed32583829be..2f15734a5043 100644
> --- a/drivers/usb/typec/tcpm/tcpci.c
> +++ b/drivers/usb/typec/tcpm/tcpci.c
> @@ -282,7 +282,7 @@ static int tcpci_set_polarity(struct tcpc_dev *tcpc,
>  			if (cc2 == TYPEC_CC_RD)
>  				/* Role control would have the Rp setting when DRP was enabled */
>  				reg |= FIELD_PREP(TCPC_ROLE_CTRL_CC2, TCPC_ROLE_CTRL_CC_RP);
> -			else
> +			else if (cc2 >= TYPEC_CC_RP_DEF)
>  				reg |= FIELD_PREP(TCPC_ROLE_CTRL_CC2, TCPC_ROLE_CTRL_CC_RD);
>  		} else {
>  			reg &= ~TCPC_ROLE_CTRL_CC1;
> @@ -290,7 +290,7 @@ static int tcpci_set_polarity(struct tcpc_dev *tcpc,
>  			if (cc1 == TYPEC_CC_RD)
>  				/* Role control would have the Rp setting when DRP was enabled */
>  				reg |= FIELD_PREP(TCPC_ROLE_CTRL_CC1, TCPC_ROLE_CTRL_CC_RP);
> -			else
> +			else if (cc1 >= TYPEC_CC_RP_DEF)
>  				reg |= FIELD_PREP(TCPC_ROLE_CTRL_CC1, TCPC_ROLE_CTRL_CC_RD);
>  		}
>  	}

-- 
heikki

      reply	other threads:[~2024-12-16  9:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-11 10:57 [PATCH] usb: typec: tcpci: set local CC to Rd only when cc1/cc2 status is Rp Xu Yang
2024-12-16  9:47 ` Heikki Krogerus [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z1_3G1Iqz-A01FJr@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=andre.draszik@linaro.org \
    --cc=badhri@google.com \
    --cc=emanuele.ghidoli@toradex.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=imx@lists.linux.dev \
    --cc=jun.li@nxp.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=m.felsch@pengutronix.de \
    --cc=rdbabiera@google.com \
    --cc=xu.yang_2@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox