Re: best way to handle LEDs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Pavel Machek wrote:
> Hi!
> 
> 
>>>>>Except the led code that is being proposed CAN sit on top of a generic
>>>>>GPIO layer.
>>>>
>>>>I also have issues with a generic GPIO layer.  As I mentioned in the
>>>>past, there's serious locking issues with any generic abstraction of
>>>>GPIOs.
>>>>
>>>>1. You want to be able to change GPIO state from interrupts.  This
>>>>   implies you can not sleep in GPIO state changing functions.
>>>>
>>>>2. Some GPIOs are implemented on I2C devices.  This means that to
>>>>   change state, you must sleep.
>>>
>>>Can't you just busywait? Yes, it is ugly in general, but perhaps it
>>>is better than alternatives...
>>
>>Does the i2c layer support busy waiting or are you suggesting something
>>else?
> 
> 
> I'm suggesting that adding busy wait support to i2c is probably good
> idea. GPIOs are on many small machines, and there are machine
> (spitz/akita?) that differ mainly in "where GPIO lines are
> connected". That cries for GPIO layer.
> 							Pavel

Wouldn't it make sense to make either two register functions or one
that takes an extra argument?

register_led(.., .., ..)
and
register_led_irq(.., .., ..)
?

Then register_led() will call register_gpio() and
register_led_irq() will call register_gpio_irq().

If the low level driver (and everything else) can't
be put into busywaiting mode the register_gpio_irq()
will fail which will make register_led_irq() fail.

Naturally it can be
register_led(.., .., ..., use_irq)
and
register_gpio(.., .., .., use_irq)

I haven't looked at the API's so this is just theoretical
on my behalf, but it should solve some issues.

If a driver really really can't be busywait for some reason
then it will fail, otherwise it will switch to busywaiting
instead of sleeping.

Or am I just talking out of my ass?

// Stefan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFDaq4yBrn2kJu9P78RAuh7AJ4wK/+xoMYyfdOXEtY0+LqMNxYuuACgtuDH
GhjBeXxbnW2SaQ4x7hlZg6w=
=hl/m
-----END PGP SIGNATURE-----
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux