Re: [PATCH v3] mfd: ch341: add driver for the WCH CH341 in I2C/GPIO mode

From: Lee Jones
Date: Tue Mar 15 2022 - 10:59:03 EST


On Sun, 13 Mar 2022, frank zago wrote:

> The CH341 is a multifunction chip, presenting 3 different USB PID. One
> of these functions is for I2C/SPI/GPIO. This new driver manages I2C
> and GPIO.
>
> The I2C interface can run at 4 different speeds. This driver currently
> only offer 100MHz. Tested with a variety of I2C sensors, and the IIO
> subsystem.
>
> The GPIO interface offers 16 GPIOs. 6 are read/write, and 10 are
> read-only.
>
> Signed-off-by: frank zago <frank@xxxxxxxx>
> ---
>
> Changes from v2:
> - bug fixes
> - more robust USB enumeration
> - Changed to an MFD driver as suggested

Perhaps you should have engaged with me before potentially wasting
your valuable time.

MFD is designed to take a parent platform driver and split it out into
various sub-systems. If you don't use the MFD Core API (which is the
case here) it is not an MFD. MFD is not a dumping ground for
collections of random device drivers.

I have no problem with you placing registration and core code inside
MFD (that *is* what it was designed for), but the leaf 'functionality'
should be placed in more appropriate locations.

I2C => drivers/i2c
SPI => drivers/spi
GPIO => drivers/gpio (or perhaps drivers/pinctrl)
USB => drivers/usb
UART => drivers/tty/serial

Etc ... Find places for everything.

Anything left over, give to Greg (drivers/misc). :)

--
Lee Jones [李琼斯]
Principal Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog