Re: [RFC] Proposal: common kernel-wide GPIO interface



Ben Dooks wrote:
On Sun, Jul 30, 2006 at 03:08:11PM +0200, Robert Schwebel wrote:
Chris,

On Fri, Jul 28, 2006 at 09:44:40PM +0100, Chris Boot wrote:
I propose to develop a common way of registering and accessing GPIO pins on various devices.
I've attached the gpio framework we have developed a while ago; it is
not ready for upstream, only tested on pxa and has probably several
other drawbacks, but may be a start for your activities. One of the
problems we've recently seen is that for example on PowerPCs you don't
have such a clear "this is gpio pin x" nomenclature, so the question
would be how to do the mapping here.

Right, my $0.02 worth:

[snip]

Some very interesting comments and suggestions! Thanks very much for all the
info, that's exactly the sort of stuff I needed.

3) The sysfs interface should be configurable, as systems
with lots of GPIO would end up with large numbers of
files and directories in sysfs.

My current idea is to divide the interfaces by GPIO device and port. I've so far
not seen a GPIO device that couldn't be divided into ports of <= 32 bits. How
wide can a 'port' actually become?

Somehow I think that a separate device/file for each pin or possibly even port might not be a wise idea. For example, twiddling individual pins on a GPIO when you connect an LCD, I2C, or SPI interface seems extremely inefficient...

4) you probably want to ensure pull-up resistors are off if the
output is being driven.

Yes, very good idea! So far I haven't managed to fry any chips by driving a pulled up/down output, but it's so easy to make the mistake...

Chris

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


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: [patch -mm 20/20 RFC] chardev: GPIO for SCx200 & PC-8736x: add sysfs-GPIO interf
    ... We need a standard rep for GPIO in sysfs, ... GPIO hardware design appears to have 2 top-level factors; ... change will also exhibit in the port attr too. ... if a pin is output only, it shouldnt have an _output_enabled attr. ...
    (Linux-Kernel)
  • [patch -mm 20/20 RFC] chardev: GPIO for SCx200 & PC-8736x: add sysfs-GPIO interface
    ... We need a standard rep for GPIO in sysfs, ... GPIO hardware design appears to have 2 top-level factors; ... change will also exhibit in the port attr too. ... if a pin is input only, it shouldnt have an _output_enabled attr. ...
    (Linux-Kernel)
  • Re: I2C on TMS320C5510
    ... Sure you can use GPIO for I2C. ... If you want to send '0' to the bus, you configure the pin as output. ... I was looking at bit banging the GPIO port to do this and I am not sure ...
    (comp.dsp)
  • Re: gpio api
    ... I think that implementing a GPIO interface is a must-have. ... the port and the pin. ... We should be able to change several pins on the same port simultaneously ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: OT: DOS programming EPP
    ... There seems to be *no* specifications or equivalent circuits for the parallel port as implemented on the ASICs used in modern PCs. ... it is completely unknown as to the maximum safe sink current to a logic low pin or the maximum source current from a logic high pin. ... The EPP page assumes you did. ... CONTROL bit 5 defaults low. ...
    (sci.electronics.design)