public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] USB: serial: pl2303: add support for more HXN (G) types
@ 2022-06-21  8:58 Johan Hovold
  2022-06-21  9:06 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Johan Hovold @ 2022-06-21  8:58 UTC (permalink / raw)
  To: Johan Hovold; +Cc: linux-usb, linux-kernel, charles-yeh, Charles Yeh, stable

Add support for further HXN (G) type devices (GT variant, GL variant, GS
variant and GR) and document the bcdDevice mapping.

Note that the TA and TB types use the same bcdDevice as some GT and GE
variants, respectively, but that the HX status request can be used to
determine which is which.

Also note that we currently do not distinguish between the various HXN
(G) types in the driver but that this may change eventually (e.g. when
adding GPIO support).

Reported-by: Charles Yeh <charlesyeh522@gmail.com>
Link: https://lore.kernel.org/r/YrF77b9DdeumUAee@hovoldconsulting.com
Cc: stable@vger.kernel.org	# 5.13
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/usb/serial/pl2303.c | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 3506c47e1eef..40b1ab3d284d 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -436,22 +436,27 @@ static int pl2303_detect_type(struct usb_serial *serial)
 		break;
 	case 0x200:
 		switch (bcdDevice) {
-		case 0x100:
+		case 0x100:	/* GC */
 		case 0x105:
+			return TYPE_HXN;
+		case 0x300:	/* GT / TA */
+			if (pl2303_supports_hx_status(serial))
+				return TYPE_TA;
+			fallthrough;
 		case 0x305:
+		case 0x400:	/* GL */
 		case 0x405:
+			return TYPE_HXN;
+		case 0x500:	/* GE / TB */
+			if (pl2303_supports_hx_status(serial))
+				return TYPE_TB;
+			fallthrough;
+		case 0x505:
+		case 0x600:	/* GS */
 		case 0x605:
-			/*
-			 * Assume it's an HXN-type if the device doesn't
-			 * support the old read request value.
-			 */
-			if (!pl2303_supports_hx_status(serial))
-				return TYPE_HXN;
-			break;
-		case 0x300:
-			return TYPE_TA;
-		case 0x500:
-			return TYPE_TB;
+		case 0x700:	/* GR */
+		case 0x705:
+			return TYPE_HXN;
 		}
 		break;
 	}
-- 
2.35.1


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

* Re: [PATCH] USB: serial: pl2303: add support for more HXN (G) types
  2022-06-21  8:58 [PATCH] USB: serial: pl2303: add support for more HXN (G) types Johan Hovold
@ 2022-06-21  9:06 ` Greg KH
  2022-06-22  6:53   ` Johan Hovold
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2022-06-21  9:06 UTC (permalink / raw)
  To: Johan Hovold; +Cc: linux-usb, linux-kernel, charles-yeh, Charles Yeh, stable

On Tue, Jun 21, 2022 at 10:58:55AM +0200, Johan Hovold wrote:
> Add support for further HXN (G) type devices (GT variant, GL variant, GS
> variant and GR) and document the bcdDevice mapping.
> 
> Note that the TA and TB types use the same bcdDevice as some GT and GE
> variants, respectively, but that the HX status request can be used to
> determine which is which.
> 
> Also note that we currently do not distinguish between the various HXN
> (G) types in the driver but that this may change eventually (e.g. when
> adding GPIO support).
> 
> Reported-by: Charles Yeh <charlesyeh522@gmail.com>
> Link: https://lore.kernel.org/r/YrF77b9DdeumUAee@hovoldconsulting.com
> Cc: stable@vger.kernel.org	# 5.13
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
>  drivers/usb/serial/pl2303.c | 29 +++++++++++++++++------------
>  1 file changed, 17 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
> index 3506c47e1eef..40b1ab3d284d 100644
> --- a/drivers/usb/serial/pl2303.c
> +++ b/drivers/usb/serial/pl2303.c
> @@ -436,22 +436,27 @@ static int pl2303_detect_type(struct usb_serial *serial)
>  		break;
>  	case 0x200:
>  		switch (bcdDevice) {
> -		case 0x100:
> +		case 0x100:	/* GC */
>  		case 0x105:
> +			return TYPE_HXN;
> +		case 0x300:	/* GT / TA */
> +			if (pl2303_supports_hx_status(serial))
> +				return TYPE_TA;
> +			fallthrough;
>  		case 0x305:
> +		case 0x400:	/* GL */
>  		case 0x405:
> +			return TYPE_HXN;
> +		case 0x500:	/* GE / TB */
> +			if (pl2303_supports_hx_status(serial))
> +				return TYPE_TB;
> +			fallthrough;
> +		case 0x505:
> +		case 0x600:	/* GS */
>  		case 0x605:
> -			/*
> -			 * Assume it's an HXN-type if the device doesn't
> -			 * support the old read request value.
> -			 */
> -			if (!pl2303_supports_hx_status(serial))
> -				return TYPE_HXN;
> -			break;
> -		case 0x300:
> -			return TYPE_TA;
> -		case 0x500:
> -			return TYPE_TB;
> +		case 0x700:	/* GR */
> +		case 0x705:
> +			return TYPE_HXN;
>  		}
>  		break;
>  	}
> -- 
> 2.35.1
> 

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

* Re: [PATCH] USB: serial: pl2303: add support for more HXN (G) types
  2022-06-21  9:06 ` Greg KH
@ 2022-06-22  6:53   ` Johan Hovold
  0 siblings, 0 replies; 3+ messages in thread
From: Johan Hovold @ 2022-06-22  6:53 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-usb, linux-kernel, charles-yeh, Charles Yeh, stable

On Tue, Jun 21, 2022 at 11:06:51AM +0200, Greg Kroah-Hartman wrote:
> On Tue, Jun 21, 2022 at 10:58:55AM +0200, Johan Hovold wrote:
> > Add support for further HXN (G) type devices (GT variant, GL variant, GS
> > variant and GR) and document the bcdDevice mapping.
> > 
> > Note that the TA and TB types use the same bcdDevice as some GT and GE
> > variants, respectively, but that the HX status request can be used to
> > determine which is which.
> > 
> > Also note that we currently do not distinguish between the various HXN
> > (G) types in the driver but that this may change eventually (e.g. when
> > adding GPIO support).
> > 
> > Reported-by: Charles Yeh <charlesyeh522@gmail.com>
> > Link: https://lore.kernel.org/r/YrF77b9DdeumUAee@hovoldconsulting.com
> > Cc: stable@vger.kernel.org	# 5.13
> > Signed-off-by: Johan Hovold <johan@kernel.org>

> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Thanks for reviewing. Now applied.

Johan

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

end of thread, other threads:[~2022-06-22  6:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-21  8:58 [PATCH] USB: serial: pl2303: add support for more HXN (G) types Johan Hovold
2022-06-21  9:06 ` Greg KH
2022-06-22  6:53   ` Johan Hovold

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