public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <rpurdie@rpsys.net>
To: David Vrabel <dvrabel@cantab.net>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Russell King <rmk@arm.linux.org.uk>, John Lenz <lenz@cs.wisc.edu>,
	Pavel Machek <pavel@suse.cz>
Subject: Re: [RFC PATCH 1/8] LED: Add LED Class
Date: Mon, 05 Dec 2005 15:38:26 +0000	[thread overview]
Message-ID: <1133797107.8101.191.camel@localhost.localdomain> (raw)
In-Reply-To: <439455BC.4080908@cantab.net>

On Mon, 2005-12-05 at 14:59 +0000, David Vrabel wrote: 
> This LED subsystem isn't usable with LEDs that are controlled by I2C
> GPIO devices.  Getting rid of (struct led_device).lock would go some way
> to making it work.  It's not clear to me why it's needed anyway.

The lock is so no two code paths try and change led_device at once. This
is particularly apparent when triggers are considered as you could
otherwise end up with two calls trying to change an led to different
triggers or other equally bizarre circumstances. We need to guarantee
any trigger init and exit calls are made, other wise we'd have memory
leaks (and worse). Locking the brightness calls is just an extension of
that so the practise is fully evident.

For i2c devices to use this, the devices will have to use a workqueue
for brightness changes, lock or no lock. The reason is that trigger
events can come from undetermined kernel contexts and therefore the
brightness changing function should not sleep.

> Suspend and resume probably needs to be LED specific.

The core functions are probably applicable in 95% of cases and any LED
driver has the option of not using them if it so wishes.

Out of interest, what would an LED device wish to do instead of this?
Corgi/Spitz already don't suspend one of the leds under certain
circumstances as a device specific trigger (charging) is know to be
suspend aware.

> > +
> > +menu "LED devices"
> > +
> > +config NEW_LEDS
> 
> Is there a better name than NEW_LEDS?  It won't be 'new' for very long...

I'd prefer LEDS but this will clash with ARM. I'll wait for Russell's
comments but I'm open to alternative suggestions.


> 0-255 is probably a better range to use.  Might be worth having an enum
> like.
> 
> enum led_brightness {
> 	LED_OFF = 0, LED_HALF_BRIGHT = 127, LED_FULL_BRIGHT = 255,
> };

Yes, that's probably not a bad idea.

Cheers,

Richard


  reply	other threads:[~2005-12-05 15:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-05 13:09 [RFC PATCH 1/8] LED: Add LED Class Richard Purdie
2005-12-05 14:59 ` David Vrabel
2005-12-05 15:38   ` Richard Purdie [this message]
2005-12-05 17:02   ` Pavel Machek
2005-12-06 21:20 ` Greg KH

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=1133797107.8101.191.camel@localhost.localdomain \
    --to=rpurdie@rpsys.net \
    --cc=dvrabel@cantab.net \
    --cc=lenz@cs.wisc.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@suse.cz \
    --cc=rmk@arm.linux.org.uk \
    /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