LWN.net Logo

Bringing Android closer to the mainline

Bringing Android closer to the mainline

Posted Dec 20, 2011 23:18 UTC (Tue) by neilbrown (subscriber, #359)
In reply to: Bringing Android closer to the mainline by alvieboy
Parent article: Bringing Android closer to the mainline

Certainly GPIOs can do a lot more than LEDs can do, though many actually do a lot less :-)

In the example use-case of turning a vibrator off, it seems very similar to a LED. There may be other use-cases that I'm not aware of of course. If you wanted a timed GPIO for bit-banging you wouldn't use a LED device. Maybe an SPI device or an I2C device?

GPIO pins can be exported to user-space, and then can be controlled by setting the direction, the value, and the edges on which an interrupt it triggered. The interrupt can be sensed by using 'poll' on the relevant sysfs file.

gpiolib provides "gpio_export" which will export a given gpio, and it appears as e.g. /sys/class/gpio/gpio47/{value,direction,....}

I agree that it can be very useful to export raw gpios to user-space, but where possible I think it is best to hide them behind some higher-level abstraction, such as LED.


(Log in to post comments)

Bringing Android closer to the mainline

Posted Dec 21, 2011 7:25 UTC (Wed) by hrw (subscriber, #44826) [Link]

Some Linux phones exports vibrator using LED class. IIRC this was a case with Nokia N900.

Bringing Android closer to the mainline

Posted Jan 6, 2012 19:14 UTC (Fri) by navaati (subscriber, #82114) [Link]

The Neo Freerunner does the same way

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds