Re: [PATCH] USB: serial: cp210x: Make the CP210x driver work with GPIOs of CP2108

From: Johan Hovold
Date: Mon Mar 01 2021 - 04:04:50 EST


On Mon, Mar 01, 2021 at 08:13:46AM +0000, Pho Tran wrote:
> Similar to other CP210x devices, GPIO interfaces (gpiochip) should be supported for CP2108.
>
> CP2108 has 4 serial interfaces but only 1 set of GPIO pins are shared to all of those interfaces.
> So, just need to initialize GPIOs of CP2108 with only one interface (I use interface 0).
> It means just only 1 gpiochip device file will be created for CP2108.
>
> CP2108 has 16 GPIOs, So data types of several variables need to be is u16
> instead of u8(in struct cp210x_serial_private). This doesn't affect other CP210x devices.
>
> Because CP2108 has 16 GPIO pins, the parameter which is passed by cp210x functions
> will be different from other CP210x devices. So need to check part number of the device to use correct data format before sending commands to devices.
>
> Like CP2104, CP2108 have GPIO pins with configurable options. Therefore, in cp2108_gpio_init() function,
> Should be mask all pins which are not in GPIO mode.

Please break commit message lines at 72 cols or so (and try to keep code
< 80 cols).

There are still a few checkpatch.pl warnings on this one that look
legitimate, please fix those up (e.g. spaces at start of lines).

Also use the kernel u8 and u16 types instead of the c99 ones.

Johan