From: Preston Fick <Preston.Fick@silabs.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>, Preston Fick <pffick@gmail.com>
Cc: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
"linux-arm-kernel@lists.arm.linux.org.uk"
<linux-arm-kernel@lists.arm.linux.org.uk>
Subject: RE: [PATCH] usb: cp210x: Added support for GPIO (CP2103/4/5)
Date: Fri, 4 May 2012 10:27:09 -0500 [thread overview]
Message-ID: <00374F755A5C474884D69FBCA77349D105227D97FB@EXCAUS002.silabs.com> (raw)
In-Reply-To: <20120503213456.77c55c51@pyramind.ukuu.org.uk>
Hi Alan -
Thanks for this detailed explanation - I'll continue to look deeper into this, a lot of this is new to me. If Greg is in agreement here, then I will work on this as a solution to our GPIO support and submit a series of patches for this when it's ready and tested.
Kind Regards -
Preston
-----Original Message-----
From: Alan Cox [mailto:alan@lxorguk.ukuu.org.uk]
Sent: Thursday, May 03, 2012 3:35 PM
To: Preston Fick
Cc: gregkh@linuxfoundation.org; linux-usb@vger.kernel.org; linux-kernel@vger.kernel.org; linux-serial@vger.kernel.org; Preston Fick; linux-arm-kernel@lists.arm.linux.org.uk
Subject: Re: [PATCH] usb: cp210x: Added support for GPIO (CP2103/4/5)
Ok this is my suggestion based on GregKH comments and a couple of others
plus some other driver and ldisc stuff that is pending
- register the gpio lines with the gpio layer dynamically
- put them in the right place in the device tree (I'll let Greg advise on
the best way to do that bit), plus make them visible via the ioctls for
convenience and as they will be needed anyway in kernel
That provides the user space API
After that I'll add the hooks to the core tty layer code which allow an
ldisc to adjust the gpio lines.
For that we'll need
struct tty_gpio {
u32 base;
u16 num;
u16 reserved;
#define NR_TTY_GPIOMAP 8
u16 map[NR_TTY_GPIOMAP];
u32 reserved2[4];
};
and
tty->gpiomap
which will be NULL for most users.
Plus
struct tty_gpio d;
ioctl(tty, TIOCGPIO, &d)
and
ioctl(tty, TIOCSGPIO, &d)
where the only bits that can be updated will be the map.
So the normal use case from user space would be
struct tty_gpio d;
int fd = open("/dev/ttyUSB0", O_RDWR);
ioctl(tty, TIOCSGPIO, &d);
stuff using the gpio driver interfaces
close(fd);
And setting up for a kernel ldisc something like
/* Set a GPIO to LDISC signal mapping for ISO7816 */
ioctl(tty, TIOCGPIO, &d);
d.map[TTY_GPIO_ISO7816_RESET] = d.base;
d.map]TTY_GPIO_ISO7816_VCC] = d.base + 1;
ioctl(tty, TIOCSGPIO, &d);
/* Switch to the ldisc */
ld = N_ISO7816;
ioctl(tty, TCSETD, &ld);
and we can then abstract all the wiring details away to keep the ldisc
portable.
Thoughts ?
Alan
This message (including any attachments) is intended only for the use of the individual or entity to which it is addressed and may contain information that is non-public, proprietary, privileged, confidential, and exempt from disclosure under applicable law or may constitute as attorney work product. If you are not the intended recipient, you are hereby notified that any use, dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, notify us immediately by telephone and (i) destroy this message if a facsimile or (ii) delete this message immediately if this is an electronic communication.
Thank you.
next prev parent reply other threads:[~2012-05-04 15:27 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-30 20:27 [PATCH] usb: cp210x: Added support for GPIO (CP2103/4/5) Preston Fick
2012-04-30 20:32 ` Greg KH
2012-05-03 20:34 ` Alan Cox
2012-05-04 15:27 ` Preston Fick [this message]
2012-05-05 0:32 ` Greg KH
2012-05-05 11:01 ` Alan Cox
2012-05-05 14:57 ` Greg KH
2012-05-16 15:33 ` Alan Cox
2012-05-16 23:41 ` Greg KH
2012-05-04 16:26 ` Alexander Stein
2012-05-04 16:33 ` Alan Cox
-- strict thread matches above, loose matches on Subject: below --
2012-04-28 16:55 Preston Fick
2012-04-28 18:05 ` Alan Cox
2012-04-28 18:17 ` Uwe Bonnes
2012-04-28 19:33 ` Alan Cox
2012-04-29 13:02 ` Uwe Bonnes
2012-04-29 14:35 ` Xiaofan Chen
2012-04-28 20:30 ` Preston Fick
2012-04-28 21:08 ` Alan Cox
2012-04-28 21:44 ` Preston Fick
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=00374F755A5C474884D69FBCA77349D105227D97FB@EXCAUS002.silabs.com \
--to=preston.fick@silabs.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=gregkh@linuxfoundation.org \
--cc=linux-arm-kernel@lists.arm.linux.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=pffick@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).