[Ce-android-mainline] timed gpio and timed output drivers

Andy Green andy.green at linaro.org
Wed Feb 29 23:18:11 UTC 2012


On 03/01/2012 06:02 AM, Somebody in the thread at some point said:

> Adding a one shot trigger, while nice, it not actually needed.
> 
>   cd /sys/class/leds/WHATEVER
>   echo timer > trigger
>   echo 2147483648 > delay_off
>   echo 100 > delay_on
> 
> will give you a 100ms plus in the relevant GPIO.  You then have 3 weeks to
> clear the trigger so you don't get another one - not too hard (cron job
> maybe).

When the device is under load, that kind of approach delivers uselessly
variable actual durations.  I've dealt with this issue driving a vib on
an embedded device and it's very obvious when there is even a small
unexpected latency in turnoff.  For sure any kind of timing like that
needs to be done in-kernel.

>> Hence, I am proposing going ahead with integrating timed-goio and
>> timed-output drivers under drivers/gpio.
> 
> So the choice is between:
>  A/ small enhancement to a current interface to make it useful for you,
>     and more useful for others, or
>  B/ current interface isn't quite perfect, so create a completely new one,
> 
> and you choose B!!!!!
> I think this is known as "the platform problem".  You should read up on that.

It seems quite a subtle issue if LEDs or generic GPIO would benefit more
from a timed-output scheme adding on it.

LEDs are kind of downstream from generic GPIO... if we say it should
belong on LEDs, then we are saying there's no legit use for generic gpio
to benefit from a controllable period.  I'm not sure that's fair to
conclude.

Another option to think about... how about putting it in as a generic
GPIO - generic PWM bridge and providing one-shot as a degenerate case of
that?  Then you can get low latency timed gpio events that's needed and
with only very little more code get bitbanged PWM on generic GPIO for
low rate DAC action etc.

How

-- 
Andy Green | TI Landing Team Leader
Linaro.org │ Open source software for ARM SoCs | Follow Linaro
http://facebook.com/pages/Linaro/155974581091106  -
http://twitter.com/#!/linaroorg - http://linaro.org/linaro-blog


More information about the Ce-android-mainline mailing list