LWN.net Logo

Bringing Android closer to the mainline

Bringing Android closer to the mainline

Posted Dec 21, 2011 6:12 UTC (Wed) by neilbrown (subscriber, #359)
In reply to: Bringing Android closer to the mainline by alvieboy
Parent article: Bringing Android closer to the mainline

BTW I just had a look at the timed_gpio code.

There are really two things here: a "timed_output" class, and a "timed_gpio" driver that creates a "timed_output" device that drives a GPIO.

The "timed_output" class provides a single device attribute: "enable". It leaves the interpretation of that value to the driver.

Writing "0" de-asserts the gpio. Writing a number of milliseconds causes the gpio to be asserted for that long, then de-asserted.
Reading returns the remaining time before the output will be deasserted.

There are two things that timed_gpio provides that leds-gpio currently doesn't.

1/ high precision. leds-gpio uses jiffies-based timers so probably only to the nearest 4msecs. timed_gpio uses hrtimers, so give 1msec precision.

2/ read back of time remaining.

The only references to timed_gpio I can find on the web are for using it for the vibrator just like the above article says. I doubt that needs millisecond precision. If it did, a leds-hrgpio driver could be written (or an extension to the current driver) rather than a new class.

If the time-remaining was really important, then a 'one-shot' led-trigger could be written (rather than a whole new class) which reported the time remaining. That might be useful for other leds as well.

"full exploitation" is a good thing!


(Log in to post comments)

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