<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/usb/serial/ch341.c, branch linux-5.8.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.8.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.8.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2020-06-23T08:57:27Z</updated>
<entry>
<title>USB: serial: ch341: add new Product ID for CH340</title>
<updated>2020-06-23T08:57:27Z</updated>
<author>
<name>Igor Moura</name>
</author>
<published>2020-06-23T08:11:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5d0136f8e79f8287e6a36780601f0ce797cf11c2'/>
<id>urn:sha1:5d0136f8e79f8287e6a36780601f0ce797cf11c2</id>
<content type='text'>
Add PID for CH340 that's found on some ESP8266 dev boards made by
LilyGO. The specific device that contains such serial converter can be
seen here: https://github.com/LilyGO/LILYGO-T-OI.

Apparently, it's a regular CH340, but I've confirmed with others that
also bought this board that the PID found on this device (0x7522)
differs from other devices with the "same" converter (0x7523).
Simply adding its PID to the driver and rebuilding it made it work
as expected.

Signed-off-by: Igor Moura &lt;imphilippini@gmail.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
</content>
</entry>
<entry>
<title>USB: serial: ch341: fix lockup of devices with limited prescaler</title>
<updated>2020-05-27T13:01:05Z</updated>
<author>
<name>Johan Hovold</name>
</author>
<published>2020-05-14T09:36:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c432df155919582a3cefa35a8f86256c830fa9a4'/>
<id>urn:sha1:c432df155919582a3cefa35a8f86256c830fa9a4</id>
<content type='text'>
Michael Hanselmann reports that

	[a] subset of all CH341 devices stop responding to bulk
	transfers, usually after the third byte, when the highest
	prescaler bit (0b100) is set. There is one exception, namely a
	prescaler of exactly 0b111 (fact=1, ps=3).

Fix this by forcing a lower base clock (fact = 0) whenever needed.

This specifically makes the standard rates 110, 134 and 200 bps work
again with these devices.

Fixes: 35714565089e ("USB: serial: ch341: reimplement line-speed handling")
Cc: stable &lt;stable@vger.kernel.org&gt;	# 5.5
Reported-by: Michael Hanselmann &lt;public@hansmi.ch&gt;
Link: https://lore.kernel.org/r/20200514141743.GE25962@localhost
Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
</content>
</entry>
<entry>
<title>USB: serial: ch341: add basis for quirk detection</title>
<updated>2020-05-27T13:00:56Z</updated>
<author>
<name>Michael Hanselmann</name>
</author>
<published>2020-03-31T23:37:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c404bf4aa9236cb4d1068e499ae42acf48a6ff97'/>
<id>urn:sha1:c404bf4aa9236cb4d1068e499ae42acf48a6ff97</id>
<content type='text'>
A subset of CH341 devices does not support all features, namely the
prescaler is limited to a reduced precision and there is no support for
sending a RS232 break condition. This patch adds a detection function
which will be extended to set quirk flags as they're implemented.

The author's affected device has an imprint of "340" on the
turquoise-colored plug, but not all such devices appear to be affected.

Signed-off-by: Michael Hanselmann &lt;public@hansmi.ch&gt;
Link: https://lore.kernel.org/r/1e1ae0da6082bb528a44ef323d4e1d3733d38858.1585697281.git.public@hansmi.ch
[ johan: use long type for quirks; rephrase and use port device for
	 messages; handle short reads; set quirk flags directly in
	 helper function ]
Cc: stable &lt;stable@vger.kernel.org&gt;	# 5.5
Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
</content>
</entry>
<entry>
<title>USB: serial: ch341: fix receiver regression</title>
<updated>2020-02-10T09:10:35Z</updated>
<author>
<name>Johan Hovold</name>
</author>
<published>2020-02-06T11:18:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7c3d02285ad558691f27fde760bcd841baa27eab'/>
<id>urn:sha1:7c3d02285ad558691f27fde760bcd841baa27eab</id>
<content type='text'>
While assumed not to make a difference, not using the factor-2 prescaler
makes the receiver more susceptible to errors.

Specifically, there have been reports of problems with devices that
cannot generate a 115200 rate with a smaller error than 2.1% (e.g.
117647 bps). But this can also be reproduced with a low-speed RS232
tranceiver at 115200 when the input rate matches the nominal rate.

So whenever possible, enable the factor-2 prescaler and halve the
divisor in order to use settings closer to that of the previous
algorithm.

Fixes: 35714565089e ("USB: serial: ch341: reimplement line-speed handling")
Cc: stable &lt;stable@vger.kernel.org&gt;	# 5.5
Reported-by: Jakub Nantl &lt;jn@forever.cz&gt;
Tested-by: Jakub Nantl &lt;jn@forever.cz&gt;
Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
</content>
</entry>
<entry>
<title>USB: serial: ch341: handle unbound port at reset_resume</title>
<updated>2020-01-17T15:22:45Z</updated>
<author>
<name>Johan Hovold</name>
</author>
<published>2020-01-17T09:50:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4d5ef53f75c22d28f490bcc5c771fcc610a9afa4'/>
<id>urn:sha1:4d5ef53f75c22d28f490bcc5c771fcc610a9afa4</id>
<content type='text'>
Check for NULL port data in reset_resume() to avoid dereferencing a NULL
pointer in case the port device isn't bound to a driver (e.g. after a
failed control request at port probe).

Fixes: 1ded7ea47b88 ("USB: ch341 serial: fix port number changed after resume")
Cc: stable &lt;stable@vger.kernel.org&gt;     # 2.6.30
Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
</content>
</entry>
<entry>
<title>USB: serial: ch341: reimplement line-speed handling</title>
<updated>2019-11-04T11:49:51Z</updated>
<author>
<name>Johan Hovold</name>
</author>
<published>2019-11-01T17:24:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=35714565089e5e8b091c1155517b67e29118f09d'/>
<id>urn:sha1:35714565089e5e8b091c1155517b67e29118f09d</id>
<content type='text'>
The current ch341 divisor algorithm was known to give inaccurate results
for certain higher line speeds. Jonathan Olds &lt;jontio@i4free.co.nz&gt;
investigated this, determined the basic equations used to derive the
divisors and confirmed them experimentally [1].

The equations Jonathan used could be generalised further to:

	baudrate = 48000000 / (2^(12 - 3 * ps - fact) * div), where

		0 &lt;= ps &lt;= 3,
		0 &lt;= fact &lt;= 1,
		2 &lt;= div &lt;= 256 if fact = 0, or
		9 &lt;= div &lt;= 256 if fact = 1

which will also give better results for lower rates.

Notably the error is reduced for the following standard rates:

	1152000	(4.0% instead of 15% error)
	 921600	(0.16% instead of -7.5% error)
	 576000	(-0.80% instead of -5.6% error)
	    200	(0.16% instead of -0.69% error)
	    134	(-0.05% instead of -0.63% error)
	    110	(0.03% instead of -0.44% error)

but also for many non-standard ones.

The current algorithm also suffered from rounding issues (e.g.
requesting 2950000 Bd resulted in a rate of 2 MBd instead of 3 MBd and
thus a -32% instead of 1.7% error).

The new algorithm was inspired by the current vendor driver even if that
one only handles two higher rates that require fact=1 by hard coding the
corresponding divisors [2].

Michael Dreher &lt;michael@5dot1.de&gt; also did a similar generalisation of
Jonathan's work and has published his results with a very good summary
that provides further insights into how this device works [3].

[1] https://lkml.kernel.org/r/000001d51f34$bad6afd0$30840f70$@co.nz
[2] http://www.wch.cn/download/CH341SER_LINUX_ZIP.html
[3] https://github.com/nospam2000/ch341-baudrate-calculation

Reported-by: Jonathan Olds &lt;jontio@i4free.co.nz&gt;
Tested-by: Jonathan Olds &lt;jontio@i4free.co.nz&gt;
Cc: Michael Dreher &lt;michael@5dot1.de&gt;
Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
</content>
</entry>
<entry>
<title>USB: serial: ch341: fix type promotion bug in ch341_control_in()</title>
<updated>2018-07-04T13:40:54Z</updated>
<author>
<name>Dan Carpenter</name>
</author>
<published>2018-07-04T09:29:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e33eab9ded328ccc14308afa51b5be7cbe78d30b'/>
<id>urn:sha1:e33eab9ded328ccc14308afa51b5be7cbe78d30b</id>
<content type='text'>
The "r" variable is an int and "bufsize" is an unsigned int so the
comparison is type promoted to unsigned.  If usb_control_msg() returns a
negative that is treated as a high positive value and the error handling
doesn't work.

Fixes: 2d5a9c72d0c4 ("USB: serial: ch341: fix control-message error handling")
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Cc: stable &lt;stable@vger.kernel.org&gt;
Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
</content>
</entry>
<entry>
<title>USB: serial: fix module-license macros</title>
<updated>2017-11-04T10:58:00Z</updated>
<author>
<name>Johan Hovold</name>
</author>
<published>2017-11-03T17:12:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=627cfa89b1fe8d189ee71718fe9eb607026db301'/>
<id>urn:sha1:627cfa89b1fe8d189ee71718fe9eb607026db301</id>
<content type='text'>
Several GPL-2.0 drivers used "GPL" rather than "GPL v2" in their
MODULE_LICENSE macros; fix the macros to match the licenses.

Signed-off-by: Johan Hovold &lt;johan@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>USB: serial: Remove redundant license text</title>
<updated>2017-11-04T10:55:38Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
</author>
<published>2017-11-03T11:40:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6ca98bc2843e0bc4c2745ff6be7d46694c1398d1'/>
<id>urn:sha1:6ca98bc2843e0bc4c2745ff6be7d46694c1398d1</id>
<content type='text'>
Now that the SPDX tag is in all USB files, that identifies the license
in a specific and legally-defined manner.  So the extra GPL text wording
can be removed as it is no longer needed at all.

This is done on a quest to remove the 700+ different ways that files in
the kernel describe the GPL license text.  And there's unneeded stuff
like the address (sometimes incorrect) for the FSF which is never
needed.

No copyright headers or other non-license-description text was removed.

Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Acked-by: Johan Hovold &lt;johan@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>USB: add SPDX identifiers to all remaining files in drivers/usb/</title>
<updated>2017-11-04T10:48:02Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
</author>
<published>2017-11-03T10:28:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460'/>
<id>urn:sha1:5fd54ace4721fc5ce2bb5aef6318fcf17f421460</id>
<content type='text'>
It's good to have SPDX identifiers in all files to make it easier to
audit the kernel tree for correct licenses.

Update the drivers/usb/ and include/linux/usb* files with the correct
SPDX license identifier based on the license text in the file itself.
The SPDX identifier is a legally binding shorthand, which can be used
instead of the full boiler plate text.

This work is based on a script and data from Thomas Gleixner, Philippe
Ombredanne, and Kate Stewart.

Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Kate Stewart &lt;kstewart@linuxfoundation.org&gt;
Cc: Philippe Ombredanne &lt;pombredanne@nexb.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Acked-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
Acked-by: Johan Hovold &lt;johan@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
