Re: [PATCH] usb: typec: tcpci: set local CC to Rd only when cc1/cc2 status is Rp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>

Acked-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>

> ---
>  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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux