public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stefan Smietanowski <stesmi@stesmi.com>
To: Pavel Machek <pavel@suse.cz>
Cc: John Lenz <lenz@cs.wisc.edu>,
	Robert Schwebel <robert@schwebel.de>,
	Robert Schwebel <r.schwebel@pengutronix.de>,
	vojtech@suse.cz, rpurdie@rpsys.net,
	kernel list <linux-kernel@vger.kernel.org>
Subject: Re: best way to handle LEDs
Date: Fri, 04 Nov 2005 01:41:22 +0100	[thread overview]
Message-ID: <436AAE32.5080108@stesmi.com> (raw)
In-Reply-To: <20051103163532.GC24846@elf.ucw.cz>

-----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-----

  reply	other threads:[~2005-11-04  0:41 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-01 23:44 best way to handle LEDs Pavel Machek
2005-11-02  0:39 ` Richard Purdie
2005-11-02  1:03   ` John Lenz
2005-11-02  8:01   ` Chase Venters
2005-11-02 13:56   ` Pavel Machek
2005-11-02 14:38     ` Richard Purdie
2005-11-02 21:11       ` Pavel Machek
2005-11-02 22:05         ` Richard Purdie
2005-11-02  1:57 ` root
2005-11-02 11:40   ` Geert Uytterhoeven
2005-11-02  2:47 ` Ben Dooks
2005-11-02  9:48   ` Alessandro Zummo
2005-11-02  9:51   ` Pavel Machek
2005-11-03  2:31     ` John Lenz
2005-11-07 23:30       ` Pavel Machek
2005-11-08  0:27         ` John Lenz
2005-11-08  9:28           ` Pavel Machek
2005-11-08 12:07             ` Richard Purdie
2005-11-08 13:14               ` Pavel Machek
2005-11-02 10:18 ` Paul Mundt
2005-11-02 20:26 ` Robert Schwebel
2005-11-02 21:13   ` Pavel Machek
2005-11-02 21:33     ` Robert Schwebel
2005-11-03  2:52       ` John Lenz
2005-11-03  6:21         ` Robert Schwebel
2005-11-03  8:15         ` Russell King
2005-11-03  9:57           ` Pavel Machek
2005-11-03 14:49             ` Russell King
2005-11-03 15:34               ` Vojtech Pavlik
2005-11-03 16:01                 ` Russell King
2005-11-03 16:11                   ` Vojtech Pavlik
2005-11-03 16:38                   ` linux-os (Dick Johnson)
2005-11-03 16:35               ` Pavel Machek
2005-11-04  0:41                 ` Stefan Smietanowski [this message]
2005-11-03 14:26           ` Rich Walker
2005-11-03  3:09       ` Rob Landley
2005-11-03  8:37     ` Geert Uytterhoeven
2005-11-03  9:59       ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=436AAE32.5080108@stesmi.com \
    --to=stesmi@stesmi.com \
    --cc=lenz@cs.wisc.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@suse.cz \
    --cc=r.schwebel@pengutronix.de \
    --cc=robert@schwebel.de \
    --cc=rpurdie@rpsys.net \
    --cc=vojtech@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox