Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: serial: ch341: change initial line-control settings

Some CH340 devices appear unable to change the initial LCR settings, so
set a sane 8N1 default during probe to enable basic support for such
devices.

Also drop a redundant LCR read during device initialisation.

Signed-off-by: Johan Hovold <johan@kernel.org>

+5 -9
+5 -9
drivers/usb/serial/ch341.c
··· 238 238 if (r < 0) 239 239 goto out; 240 240 241 - /* expect two bytes 0x56 0x00 */ 242 - r = ch341_control_in(dev, CH341_REQ_READ_REG, 0x2518, 0, buffer, size); 243 - if (r < 0) 244 - goto out; 245 - 246 - r = ch341_control_out(dev, CH341_REQ_WRITE_REG, 0x2518, 0x0050); 247 - if (r < 0) 248 - goto out; 249 - 250 241 r = ch341_set_baudrate_lcr(dev, priv, priv->lcr); 251 242 if (r < 0) 252 243 goto out; ··· 259 268 260 269 spin_lock_init(&priv->lock); 261 270 priv->baud_rate = DEFAULT_BAUD_RATE; 271 + /* 272 + * Some CH340 devices appear unable to change the initial LCR 273 + * settings, so set a sane 8N1 default. 274 + */ 275 + priv->lcr = CH341_LCR_ENABLE_RX | CH341_LCR_ENABLE_TX | CH341_LCR_CS8; 262 276 263 277 r = ch341_configure(port->serial->dev, priv); 264 278 if (r < 0)