From: Philipp Hachtmann <hachti@hachti.de>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: jhovold@gmail.com, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] usb/ftdi_sio: Add support for setting CBUS pins on FT232H
Date: Mon, 02 Jun 2014 02:57:39 +0200 [thread overview]
Message-ID: <538BCC03.3090606@hachti.de> (raw)
In-Reply-To: <20140601023106.GA4961@kroah.com>
On 01.06.2014 04:31, Greg KH wrote:
> As they are GPIO pins on this device, it should be the subsystem that
> controls it. That way, userspace programs that are used to talk to a
> GPIO device will "just work", and not have to be customized just for
> this specific device and sysfs file.
> So please use the GPIO subsystem instead of creating your own interface.
Yes but... I should have avoided the term "GPIO".
The FT232H (and other chips of the family) are communication controller ICs that
support several operation modes. The usb-serial driver partially supports the
chips' functionalities by supplying a tty device to the system.
At least the FT232H has something called CBUS: Four (!) bits of GPIO that
*might* be available depending on the device's configuration stored in an EEPROM
attached to the chip. For example if the chip is in sync FIFO mode, only two of
those bits reach the chip's surface.
I'll try to discuss two use cases:
1. Someone builds hardware with an FT chip and some general functionality
attached to the four usable CBUS lines, totally unrelated to the chip's
FIFO/UART etc. functionality.
In that case I would strongly recommend to register the CBUS stuff with the GPIO
subsystem. The user then could - as you noted - run any program used to deal
with official GPIO pins on top of the four lines.
But I think that this use case is one of the less likely ones.
2. Someone builds hardware which uses some CBUS pins to control external
circuitry that also uses the UART/FIFO interface. Both with tight functional
integration. The CBUS pins become something in the rank of modem status lines.
An application that uses the port also wants to easily access the CBUS pins. And
it really knows what it does because it knows what it is doing. From my point of
view this is the more common use case.
Consequently the best way to cover the CBUS pins would be via the device's
ioctls. But as the device is driven by common tty and usb-serial code which
handles the ioctls I currently see how to achieve that without breaking a lot.
The second best way I see is adding a property to sysfs. This would already help
a lot. A program knowing about the hardware then *can* sanely play with the CBUS.
Adding the functionality to sysfs should not interfere with a possible provision
of an "official" GPIO device (struct gpio_chip).
For me personally it's most important to get access to CBUS in any way where the
relation of the tty and the CBUS is *not* lost. I see no point in exposing the
CBUS to any userspace application that thinks it can play blinkenlights on them.
But I also see no problem if someone wants the possibility and adds general GPIO
support. The patch will provide a stable base to do so.
So please consider the patches as a starting point.
next prev parent reply other threads:[~2014-06-02 0:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-31 23:31 [PATCH 0/2] Add synchronous FIFO and CBUS support for FT232H Philipp Hachtmann
2014-05-31 23:31 ` [PATCH 1/2] usb/ftdi_sio: Add synchronous FIFO mode " Philipp Hachtmann
2014-05-31 23:31 ` [PATCH 2/2] usb/ftdi_sio: Add support for setting CBUS pins on FT232H Philipp Hachtmann
2014-06-01 0:00 ` Peter Stuge
2014-06-01 0:14 ` Philipp Hachtmann
2014-06-01 2:31 ` Greg KH
2014-06-02 0:57 ` Philipp Hachtmann [this message]
2014-06-02 1:38 ` Greg KH
2014-06-02 1:48 ` Philipp Hachtmann
2014-06-01 0:04 ` Philipp Hachtmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=538BCC03.3090606@hachti.de \
--to=hachti@hachti.de \
--cc=gregkh@linuxfoundation.org \
--cc=jhovold@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox