Linux USB
 help / color / mirror / Atom feed
* [PATCH] usb: typec: tcpm: Fix VDM type for Enter Mode commands
@ 2026-06-04 10:50 Andy Yan
  2026-06-05 12:54 ` Heikki Krogerus
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Yan @ 2026-06-04 10:50 UTC (permalink / raw)
  To: gregkh; +Cc: badhri, heikki.krogerus, linux-kernel, linux-usb, Andy Yan

VDO() second parameter is VDM type (bit 15): 1 for SVDM, 0 for UVDM.
Using 'vdo ? 2 : 1' corrupts SVID low bit when vdo is non-NULL
(2 << 15 = BIT(16)). Enter Mode is always SVDM, hardcode to 1.

Fixes: 8face9aa57c8 ("usb: typec: Add parameter for the VDO to typec_altmode_enter()")
Signed-off-by: Andy Yan <andyshrk@163.com>
---

 drivers/usb/typec/tcpm/tcpm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 55fee96d3342a..3674e1cdde57b 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -3061,7 +3061,7 @@ static int tcpm_altmode_enter(struct typec_altmode *altmode, u32 *vdo)
 	if (svdm_version < 0)
 		return svdm_version;
 
-	header = VDO(altmode->svid, vdo ? 2 : 1, svdm_version, CMD_ENTER_MODE);
+	header = VDO(altmode->svid, 1, svdm_version, CMD_ENTER_MODE);
 	header |= VDO_OPOS(altmode->mode);
 
 	return tcpm_queue_vdm_unlocked(port, header, vdo, vdo ? 1 : 0, TCPC_TX_SOP);
@@ -3109,7 +3109,7 @@ static int tcpm_cable_altmode_enter(struct typec_altmode *altmode, enum typec_pl
 	if (svdm_version < 0)
 		return svdm_version;
 
-	header = VDO(altmode->svid, vdo ? 2 : 1, svdm_version, CMD_ENTER_MODE);
+	header = VDO(altmode->svid, 1, svdm_version, CMD_ENTER_MODE);
 	header |= VDO_OPOS(altmode->mode);
 
 	return tcpm_queue_vdm_unlocked(port, header, vdo, vdo ? 1 : 0, TCPC_TX_SOP_PRIME);
-- 
2.43.0


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

* Re: [PATCH] usb: typec: tcpm: Fix VDM type for Enter Mode commands
  2026-06-04 10:50 [PATCH] usb: typec: tcpm: Fix VDM type for Enter Mode commands Andy Yan
@ 2026-06-05 12:54 ` Heikki Krogerus
  2026-07-04  9:41   ` Andy Yan
  0 siblings, 1 reply; 4+ messages in thread
From: Heikki Krogerus @ 2026-06-05 12:54 UTC (permalink / raw)
  To: Andy Yan; +Cc: gregkh, badhri, linux-kernel, linux-usb

On Thu, Jun 04, 2026 at 06:50:24PM +0800, Andy Yan wrote:
> VDO() second parameter is VDM type (bit 15): 1 for SVDM, 0 for UVDM.
> Using 'vdo ? 2 : 1' corrupts SVID low bit when vdo is non-NULL
> (2 << 15 = BIT(16)). Enter Mode is always SVDM, hardcode to 1.
> 
> Fixes: 8face9aa57c8 ("usb: typec: Add parameter for the VDO to typec_altmode_enter()")
> Signed-off-by: Andy Yan <andyshrk@163.com>

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

> ---
> 
>  drivers/usb/typec/tcpm/tcpm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 55fee96d3342a..3674e1cdde57b 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -3061,7 +3061,7 @@ static int tcpm_altmode_enter(struct typec_altmode *altmode, u32 *vdo)
>  	if (svdm_version < 0)
>  		return svdm_version;
>  
> -	header = VDO(altmode->svid, vdo ? 2 : 1, svdm_version, CMD_ENTER_MODE);
> +	header = VDO(altmode->svid, 1, svdm_version, CMD_ENTER_MODE);
>  	header |= VDO_OPOS(altmode->mode);
>  
>  	return tcpm_queue_vdm_unlocked(port, header, vdo, vdo ? 1 : 0, TCPC_TX_SOP);
> @@ -3109,7 +3109,7 @@ static int tcpm_cable_altmode_enter(struct typec_altmode *altmode, enum typec_pl
>  	if (svdm_version < 0)
>  		return svdm_version;
>  
> -	header = VDO(altmode->svid, vdo ? 2 : 1, svdm_version, CMD_ENTER_MODE);
> +	header = VDO(altmode->svid, 1, svdm_version, CMD_ENTER_MODE);
>  	header |= VDO_OPOS(altmode->mode);
>  
>  	return tcpm_queue_vdm_unlocked(port, header, vdo, vdo ? 1 : 0, TCPC_TX_SOP_PRIME);
> -- 
> 2.43.0

-- 
heikki

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

* Re: [PATCH] usb: typec: tcpm: Fix VDM type for Enter Mode commands
  2026-06-05 12:54 ` Heikki Krogerus
@ 2026-07-04  9:41   ` Andy Yan
  2026-07-04 11:09     ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Yan @ 2026-07-04  9:41 UTC (permalink / raw)
  To: Heikki Krogerus; +Cc: Andy Yan, gregkh, badhri, linux-kernel, linux-usb

Hello,

Heikki Krogerus <heikki.krogerus@linux.intel.com> 于2026年6月5日周五 20:58写道:
>
> On Thu, Jun 04, 2026 at 06:50:24PM +0800, Andy Yan wrote:
> > VDO() second parameter is VDM type (bit 15): 1 for SVDM, 0 for UVDM.
> > Using 'vdo ? 2 : 1' corrupts SVID low bit when vdo is non-NULL
> > (2 << 15 = BIT(16)). Enter Mode is always SVDM, hardcode to 1.
> >
> > Fixes: 8face9aa57c8 ("usb: typec: Add parameter for the VDO to typec_altmode_enter()")
> > Signed-off-by: Andy Yan <andyshrk@163.com>
>
> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>


  Gentle ping....
  Which maintainer can take this patch ?


>
> > ---
> >
> >  drivers/usb/typec/tcpm/tcpm.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> > index 55fee96d3342a..3674e1cdde57b 100644
> > --- a/drivers/usb/typec/tcpm/tcpm.c
> > +++ b/drivers/usb/typec/tcpm/tcpm.c
> > @@ -3061,7 +3061,7 @@ static int tcpm_altmode_enter(struct typec_altmode *altmode, u32 *vdo)
> >       if (svdm_version < 0)
> >               return svdm_version;
> >
> > -     header = VDO(altmode->svid, vdo ? 2 : 1, svdm_version, CMD_ENTER_MODE);
> > +     header = VDO(altmode->svid, 1, svdm_version, CMD_ENTER_MODE);
> >       header |= VDO_OPOS(altmode->mode);
> >
> >       return tcpm_queue_vdm_unlocked(port, header, vdo, vdo ? 1 : 0, TCPC_TX_SOP);
> > @@ -3109,7 +3109,7 @@ static int tcpm_cable_altmode_enter(struct typec_altmode *altmode, enum typec_pl
> >       if (svdm_version < 0)
> >               return svdm_version;
> >
> > -     header = VDO(altmode->svid, vdo ? 2 : 1, svdm_version, CMD_ENTER_MODE);
> > +     header = VDO(altmode->svid, 1, svdm_version, CMD_ENTER_MODE);
> >       header |= VDO_OPOS(altmode->mode);
> >
> >       return tcpm_queue_vdm_unlocked(port, header, vdo, vdo ? 1 : 0, TCPC_TX_SOP_PRIME);
> > --
> > 2.43.0
>
> --
> heikki
>

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

* Re: [PATCH] usb: typec: tcpm: Fix VDM type for Enter Mode commands
  2026-07-04  9:41   ` Andy Yan
@ 2026-07-04 11:09     ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2026-07-04 11:09 UTC (permalink / raw)
  To: Andy Yan; +Cc: Heikki Krogerus, Andy Yan, badhri, linux-kernel, linux-usb

On Sat, Jul 04, 2026 at 05:41:53PM +0800, Andy Yan wrote:
> Hello,
> 
> Heikki Krogerus <heikki.krogerus@linux.intel.com> 于2026年6月5日周五 20:58写道:
> >
> > On Thu, Jun 04, 2026 at 06:50:24PM +0800, Andy Yan wrote:
> > > VDO() second parameter is VDM type (bit 15): 1 for SVDM, 0 for UVDM.
> > > Using 'vdo ? 2 : 1' corrupts SVID low bit when vdo is non-NULL
> > > (2 << 15 = BIT(16)). Enter Mode is always SVDM, hardcode to 1.
> > >
> > > Fixes: 8face9aa57c8 ("usb: typec: Add parameter for the VDO to typec_altmode_enter()")
> > > Signed-off-by: Andy Yan <andyshrk@163.com>
> >
> > Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> 
> 
>   Gentle ping....
>   Which maintainer can take this patch ?

Please relax, it was just reviewed yesterday.  There is obviously no
rush here as it wasn't tagged for stable backports, so it will show up
in the 7.3 kernel release, right?

And as always, if you want patches to get accepted sooner, help out in
reviews to reduce our load.

thanks,

greg k-h

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

end of thread, other threads:[~2026-07-04 11:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-04 10:50 [PATCH] usb: typec: tcpm: Fix VDM type for Enter Mode commands Andy Yan
2026-06-05 12:54 ` Heikki Krogerus
2026-07-04  9:41   ` Andy Yan
2026-07-04 11:09     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox