tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Polymorphic devices



Greg Troxel <gdt%lexort.com@localhost> writes:

> Brad Spencer <brad%anduin.eldar.org@localhost> writes:
>
>> The first is enhancements to ufdti to support the MPSSE engine that some
>> of the FTDI chip variants have.  This engine allows the chip to be a I2C
>> bus, SPI bus and provides some simple GPIO, and a bunch of other stuff,
>> as well as the normal USB UART.  It is not possible to use all of the
>> modes at the same time.  That is, these are not separate devices, but
>> modes within one device.  Or another way, depending on the mode of the
>> chip you get different child devices attached to it.  I am curious on
>> what the thoughts are on how this might be modeled.
>
> My reaction without much thought is to attach them all and to have the
> non-selected one return ENXIO or similar.  And to have another device on
> which you call the ioctl to choose which device to enable.
>
> Or perhaps, to let you open any of them, flipping the mode, and to fail
> the 2nd simultaenous open.



Those techniques and models have occured to be too, except I probably
would still elect to use use a sysctl instead of another device with a
ioctl.

I don't know just yet, but there might be unwanted device reset the "use
the one you open" technique.  That is, you might have to reset the chip
to change mode and if you support say, I2C and GPIO at the same time
(which is possible), but then change to just GPIO the chip has to be
reset and that will disrupt any setting you might have set (I think, I
am am still working out what needs to happen with the mode switches).
This may not matter in the bigger picture and it wouldn't matter as much
if the mode switch was a sysctl, which one can say will reset the chip
anyway.

In any case, thanks for the comments...






-- 
Brad Spencer - brad%anduin.eldar.org@localhost - KC8VKS - http://anduin.eldar.org


Home | Main Index | Thread Index | Old Index