All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Charles Yeh <charlesyeh522@gmail.com>
Cc: gregkh@linuxfoundation.org, johan@kernel.org,
	linux-usb@vger.kernel.org, charles-yeh@prolific.com.tw
Subject: USB:Serial:pl2303:Add new Pull-UP Mode to support PL2303HXD(TYPE_HX)
Date: Wed, 16 Jan 2019 12:18:46 +0100	[thread overview]
Message-ID: <20190116111846.GT3691@localhost> (raw)

On Tue, Jan 15, 2019 at 11:15:36PM +0800, Charles Yeh wrote:
> The Pull-UP mode only support PL2303HXD,it needs to use addition
> schematic design.

I need a better explain of why this is needed here.

Your are also enabling this for all current devices, which seems to just
fine without this.

> Signed-off-by: Charles Yeh <charlesyeh522@gmail.com>
> ---
>  drivers/usb/serial/pl2303.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
> index 98e7a5df0f6d..72544e5c928d 100644
> --- a/drivers/usb/serial/pl2303.c
> +++ b/drivers/usb/serial/pl2303.c
> @@ -144,6 +144,9 @@ MODULE_DEVICE_TABLE(usb, id_table);
>  #define UART_OVERRUN_ERROR		0x40
>  #define UART_CTS			0x80
>  
> +#define TYPE_HX_PULLUP_MODE_DATA	0x08
> +#define TYPE_HX_PULLUP_MODE_REG		0x09
> +
>  static void pl2303_set_break(struct usb_serial_port *port, bool enable);
>  
>  enum pl2303_type {
> @@ -687,6 +690,15 @@ static void pl2303_set_termios(struct tty_struct *tty,
>  		pl2303_vendor_write(serial, 0x0, 0x0);
>  	}
>  
> +	pl2303_vendor_read(serial, 0x8484, buf);
> +	pl2303_vendor_write(serial, 0x0404, TYPE_HX_PULLUP_MODE_REG);
> +	pl2303_vendor_read(serial, 0x8484, buf);
> +	pl2303_vendor_read(serial, 0x8383, buf);
> +	if (*buf == TYPE_HX_PULLUP_MODE_DATA) {
> +		pl2303_vendor_write(serial, 0x0, 0x31);
> +		pl2303_vendor_write(serial, 0x1, 0x01);
> +	}

There are more magic constants in the above, which needs a define.

> +
>  	kfree(buf);
>  }

Thanks,
Johan

             reply	other threads:[~2019-01-16 11:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-16 11:18 Johan Hovold [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-01-17 16:48 USB:Serial:pl2303:Add new Pull-UP Mode to support PL2303HXD(TYPE_HX) Johan Hovold
2019-01-17  6:19 Yeh.Charles [葉榮鑫]
2019-01-15 15:15 Charles Yeh

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=20190116111846.GT3691@localhost \
    --to=johan@kernel.org \
    --cc=charles-yeh@prolific.com.tw \
    --cc=charlesyeh522@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    /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 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.