summaryrefslogtreecommitdiff
path: root/drivers/leds/leds.h
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <lg@denx.de>2009-01-10 18:54:39 +0000
committerRichard Purdie <rpurdie@linux.intel.com>2009-04-06 16:06:25 +0100
commit1bd465e6b0e2b559db47420fea686507a01cfab0 (patch)
tree623c7a906e4ce117873a33f5b1717e150d5f9e59 /drivers/leds/leds.h
parenta7d878af94b223013a48078e0c8c0a654c24a057 (diff)
leds: allow led-drivers to use a variable range of brightness values
This patch allows drivers to override the default maximum brightness value of 255. We take care to preserve backwards-compatibility as much as possible, so that user-space ABI doesn't change for existing drivers. LED trigger code has also been updated to use the per-LED maximum. Signed-off-by: Guennadi Liakhovetski <lg@denx.de> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'drivers/leds/leds.h')
-rw-r--r--drivers/leds/leds.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/leds/leds.h b/drivers/leds/leds.h
index 5edbf52c4fa7..2dd8ecbfdc31 100644
--- a/drivers/leds/leds.h
+++ b/drivers/leds/leds.h
@@ -20,8 +20,8 @@
static inline void led_set_brightness(struct led_classdev *led_cdev,
enum led_brightness value)
{
- if (value > LED_FULL)
- value = LED_FULL;
+ if (value > led_cdev->max_brightness)
+ value = led_cdev->max_brightness;
led_cdev->brightness = value;
if (!(led_cdev->flags & LED_SUSPENDED))
led_cdev->brightness_set(led_cdev, value);