linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] Proposal: common kernel-wide GPIO interface
@ 2006-07-28 20:44 Chris Boot
  2006-07-29 19:41 ` Bill Davidsen
  2006-07-30 13:08 ` Robert Schwebel
  0 siblings, 2 replies; 17+ messages in thread
From: Chris Boot @ 2006-07-28 20:44 UTC (permalink / raw)
  To: kernel list

Hello all,

More and more devices these days come with some sort of GPIO interface, and more 
and more drivers within the kernel could make use of a common way of accessing 
pins on such an interface, not to mention userspace apps. For example, we have 
the I2C, LED, and SPI subsystems that each could drive a device that's actually 
connected to some GPIO pins somewhere.

I propose to develop a common way of registering and accessing GPIO pins on 
various devices. Now I'm no hardware expert, but I do like to dabble a bit and 
would love to see such a system be developed. Most people tend to attach stuff 
like LCD displays to their parallel ports, but GPIOs are much better suited to 
such a purpose than a parallel port. Some (out of tree) drivers even emulate a 
parallel interface in order that userspace software can be fooled to use the 
GPIO pins as a parallel port. In my view, this is ugly.

As far as I can tell, GPIO interfaces all share the following attributes:
- One or more ports made up of one or more individual pins
- Value on input or output depending on configuration
- Various configuration bits might be available to influence the pin's behaviour
   - Direction
   - Push-pull / Open drain
   - Pull-up enable
   - Possibly others

We'll need some way of assigning pins to different functions I'm guessing as 
well, especially when we come to write drivers for the interface. It might not 
fit right into the GPIO driver, but as far as I can see the I2C, LED, and SPI 
subsystem drivers would need such a method to create generic 
GPIO<=>{I2C,LED,SPI} drivers.

As well as a kernel interface I propose a userspace interface of some kind. I'm 
not entirely sure what might be the most efficient way of doing this, but the 
current standard way seems to be to create a sysfs class interface, although an 
old-fashioned device interface with IOCTLs and so on might be the best way 
forward. Any suggestions?

As for drivers, to start with I suggest a parallel port driver as well as 
drivers for the NSC SCx200 and PC8736x (since I own a board with both of those).

So, if anyone likes this idea and/or has some comments, please voice your 
opinions! With a little guidance from the masters, I'm willing to put the effort 
in to code such a system, but I'd really like to hear what people involved both 
in the hardware side and software side of GPIOs and the kernel have to say about 
such an interface.

Many thanks,
Chris

-- 
Chris Boot
bootc@bootc.net
http://www.bootc.net/

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2006-08-09 17:11 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-28 20:44 [RFC] Proposal: common kernel-wide GPIO interface Chris Boot
2006-07-29 19:41 ` Bill Davidsen
2006-07-30 13:08 ` Robert Schwebel
2006-07-30 22:02   ` Ben Dooks
2006-07-31 16:10     ` Chris Boot
2006-07-31 20:17       ` Robert Schwebel
2006-07-31 21:23         ` Chris Boot
2006-08-01  7:40           ` Juergen Beisert
2006-08-01 15:53     ` Jim Cromie
2006-08-01 21:25   ` Jim Cromie
2006-08-02  7:28     ` Robert Schwebel
2006-08-02 17:58     ` Lennart Sorensen
2006-08-02 20:48       ` Jim Cromie
2006-08-03 13:55         ` Lennart Sorensen
2006-08-03 15:42           ` Robert Schwebel
2006-08-08 23:01         ` [RFC - patch] add a gpio-sysfs interface - was: " Jim Cromie
2006-08-09 17:12           ` Jim Cromie

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).