On Mon, Mar 22, 2021 at 10:22:54PM -0500, Frank Zago wrote: > The Winchiphead CH341 IC is more than a UART interface. Amongst other > things, it can talk to an I2C bus. > > Several people have contributed to an out of tree driver: Tse Lun > Bien, Marco Gittler and Till Harbaum. > > https://github.com/allanbian1017/i2c-ch341-usb.git > > This commit integrates the I2C portions into the CH341 serial driver > and exposes the I2C device. > > Tested with a CH341A, CH341B and CH341T. > > Signed-off-by: Frank Zago <frank@xxxxxxxx> > --- > > I didn't find a way to say a USB device has several functions. I > followed what the CP210x driver did with gpio, but I think it's a > hack. The private data for the I2C part should be linked to the USB > device, not the serial port. It works here and in the cp210x driver > because there is only 1 serial port in the device. If it had 2 or more > ports, I believe bad things would happen. So is there a better way to > handle USB devices like that? > > For info, the CH341A/B supports 3 different modes, each with a different > USB PID, usually selected by jumpers. All of them support I2C, but > only 2 support UART, one supports SPI and 2 support GPIOs. > > > drivers/usb/serial/Kconfig | 4 +- > drivers/usb/serial/ch341.c | 284 ++++++++++++++++++++++++++++++++++++- > 2 files changed, 283 insertions(+), 5 deletions(-) $ ./scripts/get_maintainer.pl --file drivers/usb/serial/ch341.c Johan Hovold <johan@xxxxxxxxxx> (maintainer:USB SERIAL SUBSYSTEM) Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> (supporter:USB SUBSYSTEM) linux-usb@xxxxxxxxxxxxxxx (open list:USB SERIAL SUBSYSTEM) linux-kernel@xxxxxxxxxxxxxxx (open list) Please always send patches to the proper people and mailing lists, otherwise it will be lost :( thanks, greg k-h