[lkml]   [2014]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] USB: ftdi_sio: add GPIO support
On Mon, Jun 9, 2014 at 3:21 PM, Sascha Silbe <> wrote:

> The chips can operate either in regular or in bitbang mode. Care was
> taken to prevent using GPIOs if the serial device is in use and vice
> versa.

Very interesting patch! I've seen USB-based GPIO things before
but never a dual-mode thing.

There was already a comment to move the implementation to a
separate file, which I won't repeat.

But I also want to bring the device model into question: normally
when a mother device spawns children across different subsystems
we model them as MFD devices (drivers/mfd) that instantiate
children for the different subsystems. So you could spawn a
serial and a GPIO device from a USB-based hub device there.

I do not know if that is really apropriate in this case. It seems the
device is first and foremost FTDI.

But it could still spawn a child platform device for the GPIO stuff
so that this can live as a separate driver under drivers/gpio/gpio-ftdi.c
or similar.

You could then use something like:

struct platform_device *gdev;

gdev = platform_device_alloc("gpio-ftdi", PLATFORM_DEVID_AUTO);
/* pdata contains communication cookie for callbacks etc */
ret = platform_device_add_data(gdev, pdata, sizeof(*pdata));
ret = platform_device_add(gdev);

Then we can probe that device normally in the GPIO subsystem
like any other driver, just that it needs some
<linux/usb/ftdi.h> header or similar to define the function
calls to communicate with the FTDI driver.

However Greg is device core maintainer and may have better
ideas about this!

Linus Walleij

 \ /
  Last update: 2014-06-13 10:01    [W:0.082 / U:2.688 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site