Skip to content

USB: ftdio_sio: GPIO validity fixes

Marc Zyngier linux-gpio linux-usb lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 18 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4gpiolib: cdev: Flag invalid GPIOs as useddrivers/gpio/gpiolib-cdev.c+1 -03 replies
2/4USB: serial: ftdi_sio: Report the valid GPIO lines to gpiolibdrivers/usb/serial/ftdi_sio.c+14 -01 reply
3/4USB: serial: ftdi_sio: Log the CBUS GPIO validitydrivers/usb/serial/ftdi_sio.c+9 -06 replies
4/4USB: serial: ftdi_sio: Drop GPIO line checking dead codedrivers/usb/serial/ftdi_sio.c+0 -30 replies

Reviews trailers per patch

1 of 4 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchAndy ShevchenkoLinus Walleij
SeriesR-b
1/4
2/4R-b
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/4] USB: ftdio_sio: GPIO validity fixes

Having recently tried to use the CBUS GPIOs that come thanks to the ftdio_sio driver, it occurred to me that the driver has a couple of usability issues:

- it advertises potential GPIOs that are reserved to other uses (LED control, or something else)

- it returns an odd error (-ENODEV), instead of the expected -EINVAL when a line is unavailable, leading to a difficult diagnostic

We address the issues in a number of ways:

- Stop reporting invalid GPIO lines as valid to userspace. It definitely seems odd to do so. Instead, report the line as being used, making the userspace interface a bit more consistent.

- Implement the init_valid_mask() callback in the ftdi_sio driver, allowing it to report which lines are actually valid.

- As suggested by Linus, give an indication to the user of why some of the GPIO lines are unavailable, and point them to a useful tool (once per boot). It is a bit sad that there next to no documentation on how to use these CBUS pins.

- Drop the error reporting code, which has become useless at this point.

Tested with a couple of FTDI devices (FT230X and FT231X) and various CBUS configurations.

Marc Zyngier (4):
gpiolib: cdev: Flag invalid GPIOs as used
USB: serial: ftdi_sio: Report the valid GPIO lines to gpiolib
USB: serial: ftdi_sio: Log the CBUS GPIO validity
USB: serial: ftdi_sio: Drop GPIO line checking dead code

 drivers/gpio/gpiolib-cdev.c   |  1 +
 drivers/usb/serial/ftdi_sio.c | 26 +++++++++++++++++++++++---
 2 files changed, 24 insertions(+), 3 deletions(-)
Signature · 1 line
2.28.0