Skip to content

Commit aa0b3b2

Browse files
committed
Merge branch 'for-3.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds
Pull LED subsystem update from Bryan Wu. * 'for-3.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds: (50 commits) leds-lp8788: forgotten unlock at lp8788_led_work LEDS: propagate error codes in blinkm_detect() LEDS: memory leak in blinkm_led_common_set() leds: add new lp8788 led driver LEDS: add BlinkM RGB LED driver, documentation and update MAINTAINERS leds: max8997: Simplify max8997_led_set_mode implementation leds/leds-s3c24xx: use devm_gpio_request leds: convert Network Space v2 LED driver to devm_kzalloc() and cleanup error exit path leds: convert DAC124S085 LED driver to devm_kzalloc() leds: convert LM3530 LED driver to devm_kzalloc() and cleanup error exit path leds: convert TCA6507 LED driver to devm_kzalloc() leds: convert Freescale MC13783 LED driver to devm_kzalloc() and cleanup error exit path leds: convert ADP5520 LED driver to devm_kzalloc() and cleanup error exit path leds: convert PCA955x LED driver to devm_kzalloc() and cleanup error exit path leds: convert Sun Fire LED driver to devm_kzalloc() and cleanup error exit path leds: convert PCA9532 LED driver to devm_kzalloc() leds: convert LT3593 LED driver to devm_kzalloc() leds: convert Renesas TPU LED driver to devm_kzalloc() and cleanup error exit path leds: convert LP5523 LED driver to devm_kzalloc() and cleanup error exit path leds: convert PCA9633 LED driver to devm_kzalloc() ...
2 parents 6ee127b + d45bb11 commit aa0b3b2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2376
-413
lines changed

Documentation/leds/00-INDEX

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ leds-lp5521.txt
66
- notes on how to use the leds-lp5521 driver.
77
leds-lp5523.txt
88
- notes on how to use the leds-lp5523 driver.
9+
leds-lm3556.txt
10+
- notes on how to use the leds-lm3556 driver.

Documentation/leds/leds-blinkm.txt

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
The leds-blinkm driver supports the devices of the BlinkM family.
2+
3+
They are RGB-LED modules driven by a (AT)tiny microcontroller and
4+
communicate through I2C. The default address of these modules is
5+
0x09 but this can be changed through a command. By this you could
6+
dasy-chain up to 127 BlinkMs on an I2C bus.
7+
8+
The device accepts RGB and HSB color values through separate commands.
9+
Also you can store blinking sequences as "scripts" in
10+
the controller and run them. Also fading is an option.
11+
12+
The interface this driver provides is 2-fold:
13+
14+
a) LED class interface for use with triggers
15+
############################################
16+
17+
The registration follows the scheme:
18+
blinkm-<i2c-bus-nr>-<i2c-device-nr>-<color>
19+
20+
$ ls -h /sys/class/leds/blinkm-6-*
21+
/sys/class/leds/blinkm-6-9-blue:
22+
brightness device max_brightness power subsystem trigger uevent
23+
24+
/sys/class/leds/blinkm-6-9-green:
25+
brightness device max_brightness power subsystem trigger uevent
26+
27+
/sys/class/leds/blinkm-6-9-red:
28+
brightness device max_brightness power subsystem trigger uevent
29+
30+
(same is /sys/bus/i2c/devices/6-0009/leds)
31+
32+
We can control the colors separated into red, green and blue and
33+
assign triggers on each color.
34+
35+
E.g.:
36+
37+
$ cat blinkm-6-9-blue/brightness
38+
05
39+
40+
$ echo 200 > blinkm-6-9-blue/brightness
41+
$
42+
43+
$ modprobe ledtrig-heartbeat
44+
$ echo heartbeat > blinkm-6-9-green/trigger
45+
$
46+
47+
48+
b) Sysfs group to control rgb, fade, hsb, scripts ...
49+
#####################################################
50+
51+
This extended interface is available as folder blinkm
52+
in the sysfs folder of the I2C device.
53+
E.g. below /sys/bus/i2c/devices/6-0009/blinkm
54+
55+
$ ls -h /sys/bus/i2c/devices/6-0009/blinkm/
56+
blue green red test
57+
58+
Currently supported is just setting red, green, blue
59+
and a test sequence.
60+
61+
E.g.:
62+
63+
$ cat *
64+
00
65+
00
66+
00
67+
#Write into test to start test sequence!#
68+
69+
$ echo 1 > test
70+
$
71+
72+
$ echo 255 > red
73+
$
74+
75+
76+
77+
as of 6/2012
78+
79+
dl9pf <at> gmx <dot> de
80+

Documentation/leds/leds-lm3556.txt

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
Kernel driver for lm3556
2+
========================
3+
4+
*Texas Instrument:
5+
1.5 A Synchronous Boost LED Flash Driver w/ High-Side Current Source
6+
* Datasheet: http://www.national.com/ds/LM/LM3556.pdf
7+
8+
Authors:
9+
Daniel Jeong
10+
Contact:Daniel Jeong(daniel.jeong-at-ti.com, gshark.jeong-at-gmail.com)
11+
12+
Description
13+
-----------
14+
There are 3 functions in LM3556, Flash, Torch and Indicator.
15+
16+
FLASH MODE
17+
In Flash Mode, the LED current source(LED) provides 16 target current levels
18+
from 93.75 mA to 1500 mA.The Flash currents are adjusted via the CURRENT
19+
CONTROL REGISTER(0x09).Flash mode is activated by the ENABLE REGISTER(0x0A),
20+
or by pulling the STROBE pin HIGH.
21+
LM3556 Flash can be controlled through sys/class/leds/flash/brightness file
22+
* if STROBE pin is enabled, below example control brightness only, and
23+
ON / OFF will be controlled by STROBE pin.
24+
25+
Flash Example:
26+
OFF : #echo 0 > sys/class/leds/flash/brightness
27+
93.75 mA: #echo 1 > sys/class/leds/flash/brightness
28+
... .....
29+
1500 mA: #echo 16 > sys/class/leds/flash/brightness
30+
31+
TORCH MODE
32+
In Torch Mode, the current source(LED) is programmed via the CURRENT CONTROL
33+
REGISTER(0x09).Torch Mode is activated by the ENABLE REGISTER(0x0A) or by the
34+
hardware TORCH input.
35+
LM3556 torch can be controlled through sys/class/leds/torch/brightness file.
36+
* if TORCH pin is enabled, below example control brightness only,
37+
and ON / OFF will be controlled by TORCH pin.
38+
39+
Torch Example:
40+
OFF : #echo 0 > sys/class/leds/torch/brightness
41+
46.88 mA: #echo 1 > sys/class/leds/torch/brightness
42+
... .....
43+
375 mA : #echo 8 > sys/class/leds/torch/brightness
44+
45+
INDICATOR MODE
46+
Indicator pattern can be set through sys/class/leds/indicator/pattern file,
47+
and 4 patterns are pre-defined in indicator_pattern array.
48+
According to N-lank, Pulse time and N Period values, different pattern wiill
49+
be generated.If you want new patterns for your own device, change
50+
indicator_pattern array with your own values and INDIC_PATTERN_SIZE.
51+
Please refer datasheet for more detail about N-Blank, Pulse time and N Period.
52+
53+
Indicator pattern example:
54+
pattern 0: #echo 0 > sys/class/leds/indicator/pattern
55+
....
56+
pattern 3: #echo 3 > sys/class/leds/indicator/pattern
57+
58+
Indicator brightness can be controlled through
59+
sys/class/leds/indicator/brightness file.
60+
61+
Example:
62+
OFF : #echo 0 > sys/class/leds/indicator/brightness
63+
5.86 mA : #echo 1 > sys/class/leds/indicator/brightness
64+
........
65+
46.875mA : #echo 8 > sys/class/leds/indicator/brightness
66+
67+
Notes
68+
-----
69+
Driver expects it is registered using the i2c_board_info mechanism.
70+
To register the chip at address 0x63 on specific adapter, set the platform data
71+
according to include/linux/platform_data/leds-lm3556.h, set the i2c board info
72+
73+
Example:
74+
static struct i2c_board_info __initdata board_i2c_ch4[] = {
75+
{
76+
I2C_BOARD_INFO(LM3556_NAME, 0x63),
77+
.platform_data = &lm3556_pdata,
78+
},
79+
};
80+
81+
and register it in the platform init function
82+
83+
Example:
84+
board_register_i2c_bus(4, 400,
85+
board_i2c_ch4, ARRAY_SIZE(board_i2c_ch4));
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
One-shot LED Trigger
2+
====================
3+
4+
This is a LED trigger useful for signaling the user of an event where there are
5+
no clear trap points to put standard led-on and led-off settings. Using this
6+
trigger, the application needs only to signal the trigger when an event has
7+
happened, than the trigger turns the LED on and than keeps it off for a
8+
specified amount of time.
9+
10+
This trigger is meant to be usable both for sporadic and dense events. In the
11+
first case, the trigger produces a clear single controlled blink for each
12+
event, while in the latter it keeps blinking at constant rate, as to signal
13+
that the events are arriving continuously.
14+
15+
A one-shot LED only stays in a constant state when there are no events. An
16+
additional "invert" property specifies if the LED has to stay off (normal) or
17+
on (inverted) when not rearmed.
18+
19+
The trigger can be activated from user space on led class devices as shown
20+
below:
21+
22+
echo oneshot > trigger
23+
24+
This adds the following sysfs attributes to the LED:
25+
26+
delay_on - specifies for how many milliseconds the LED has to stay at
27+
LED_FULL brightness after it has been armed.
28+
Default to 100 ms.
29+
30+
delay_off - specifies for how many milliseconds the LED has to stay at
31+
LED_OFF brightness after it has been armed.
32+
Default to 100 ms.
33+
34+
invert - reverse the blink logic. If set to 0 (default) blink on for delay_on
35+
ms, then blink off for delay_off ms, leaving the LED normally off. If
36+
set to 1, blink off for delay_off ms, then blink on for delay_on ms,
37+
leaving the LED normally on.
38+
Setting this value also immediately change the LED state.
39+
40+
shot - write any non-empty string to signal an events, this starts a blink
41+
sequence if not already running.
42+
43+
Example use-case: network devices, initialization:
44+
45+
echo oneshot > trigger # set trigger for this led
46+
echo 33 > delay_on # blink at 1 / (33 + 33) Hz on continuous traffic
47+
echo 33 > delay_off
48+
49+
interface goes up:
50+
51+
echo 1 > invert # set led as normally-on, turn the led on
52+
53+
packet received/transmitted:
54+
55+
echo 1 > shot # led starts blinking, ignored if already blinking
56+
57+
interface goes down
58+
59+
echo 0 > invert # set led as normally-off, turn the led off

MAINTAINERS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,6 +1529,11 @@ W: http://blackfin.uclinux.org/
15291529
S: Supported
15301530
F: drivers/i2c/busses/i2c-bfin-twi.c
15311531

1532+
BLINKM RGB LED DRIVER
1533+
M: Jan-Simon Moeller <jansimon.moeller@gmx.de>
1534+
S: Maintained
1535+
F: drivers/leds/leds-blinkm.c
1536+
15321537
BLOCK LAYER
15331538
M: Jens Axboe <axboe@kernel.dk>
15341539
T: git git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git

drivers/leds/Kconfig

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,13 @@ config LEDS_LP5523
200200
Driver provides direct control via LED class and interface for
201201
programming the engines.
202202

203+
config LEDS_LP8788
204+
tristate "LED support for the TI LP8788 PMIC"
205+
depends on LEDS_CLASS
206+
depends on MFD_LP8788
207+
help
208+
This option enables support for the Keyboard LEDs on the LP8788 PMIC.
209+
203210
config LEDS_CLEVO_MAIL
204211
tristate "Mail LED on Clevo notebook"
205212
depends on LEDS_CLASS
@@ -415,13 +422,29 @@ config LEDS_MAX8997
415422
This option enables support for on-chip LED drivers on
416423
MAXIM MAX8997 PMIC.
417424

425+
config LEDS_LM3556
426+
tristate "LED support for LM3556 Chip"
427+
depends on LEDS_CLASS && I2C
428+
select REGMAP_I2C
429+
help
430+
This option enables support for LEDs connected to LM3556.
431+
LM3556 includes Torch, Flash and Indicator functions.
432+
418433
config LEDS_OT200
419434
tristate "LED support for the Bachmann OT200"
420435
depends on LEDS_CLASS && HAS_IOMEM
421436
help
422437
This option enables support for the LEDs on the Bachmann OT200.
423438
Say Y to enable LEDs on the Bachmann OT200.
424439

440+
config LEDS_BLINKM
441+
tristate "LED support for the BlinkM I2C RGB LED"
442+
depends on LEDS_CLASS
443+
depends on I2C
444+
help
445+
This option enables support for the BlinkM RGB LED connected
446+
through I2C. Say Y to enable support for the BlinkM LED.
447+
425448
config LEDS_TRIGGERS
426449
bool "LED Trigger support"
427450
depends on LEDS_CLASS
@@ -443,6 +466,20 @@ config LEDS_TRIGGER_TIMER
443466

444467
If unsure, say Y.
445468

469+
config LEDS_TRIGGER_ONESHOT
470+
tristate "LED One-shot Trigger"
471+
depends on LEDS_TRIGGERS
472+
help
473+
This allows LEDs to blink in one-shot pulses with parameters
474+
controlled via sysfs. It's useful to notify the user on
475+
sporadic events, when there are no clear begin and end trap points,
476+
or on dense events, where this blinks the LED at constant rate if
477+
rearmed continuously.
478+
479+
It also shows how to use the led_blink_set_oneshot() function.
480+
481+
If unsure, say Y.
482+
446483
config LEDS_TRIGGER_IDE_DISK
447484
bool "LED IDE Disk Trigger"
448485
depends on IDE_GD_ATA
@@ -497,7 +534,7 @@ config LEDS_TRIGGER_TRANSIENT
497534
depends on LEDS_TRIGGERS
498535
help
499536
This allows one time activation of a transient state on
500-
GPIO/PWM based hadrware.
537+
GPIO/PWM based hardware.
501538
If unsure, say Y.
502539

503540
endif # NEW_LEDS

drivers/leds/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ obj-$(CONFIG_LEDS_GPIO) += leds-gpio.o
2424
obj-$(CONFIG_LEDS_LP3944) += leds-lp3944.o
2525
obj-$(CONFIG_LEDS_LP5521) += leds-lp5521.o
2626
obj-$(CONFIG_LEDS_LP5523) += leds-lp5523.o
27+
obj-$(CONFIG_LEDS_LP8788) += leds-lp8788.o
2728
obj-$(CONFIG_LEDS_TCA6507) += leds-tca6507.o
2829
obj-$(CONFIG_LEDS_CLEVO_MAIL) += leds-clevo-mail.o
2930
obj-$(CONFIG_LEDS_HP6XX) += leds-hp6xx.o
@@ -47,12 +48,15 @@ obj-$(CONFIG_LEDS_NETXBIG) += leds-netxbig.o
4748
obj-$(CONFIG_LEDS_ASIC3) += leds-asic3.o
4849
obj-$(CONFIG_LEDS_RENESAS_TPU) += leds-renesas-tpu.o
4950
obj-$(CONFIG_LEDS_MAX8997) += leds-max8997.o
51+
obj-$(CONFIG_LEDS_LM3556) += leds-lm3556.o
52+
obj-$(CONFIG_LEDS_BLINKM) += leds-blinkm.o
5053

5154
# LED SPI Drivers
5255
obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o
5356

5457
# LED Triggers
5558
obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o
59+
obj-$(CONFIG_LEDS_TRIGGER_ONESHOT) += ledtrig-oneshot.o
5660
obj-$(CONFIG_LEDS_TRIGGER_IDE_DISK) += ledtrig-ide-disk.o
5761
obj-$(CONFIG_LEDS_TRIGGER_HEARTBEAT) += ledtrig-heartbeat.o
5862
obj-$(CONFIG_LEDS_TRIGGER_BACKLIGHT) += ledtrig-backlight.o

drivers/leds/led-class.c

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static ssize_t led_brightness_store(struct device *dev,
5353

5454
if (state == LED_OFF)
5555
led_trigger_remove(led_cdev);
56-
led_set_brightness(led_cdev, state);
56+
__led_set_brightness(led_cdev, state);
5757

5858
return size;
5959
}
@@ -82,7 +82,12 @@ static void led_timer_function(unsigned long data)
8282
unsigned long delay;
8383

8484
if (!led_cdev->blink_delay_on || !led_cdev->blink_delay_off) {
85-
led_set_brightness(led_cdev, LED_OFF);
85+
__led_set_brightness(led_cdev, LED_OFF);
86+
return;
87+
}
88+
89+
if (led_cdev->flags & LED_BLINK_ONESHOT_STOP) {
90+
led_cdev->flags &= ~LED_BLINK_ONESHOT_STOP;
8691
return;
8792
}
8893

@@ -100,7 +105,21 @@ static void led_timer_function(unsigned long data)
100105
delay = led_cdev->blink_delay_off;
101106
}
102107

103-
led_set_brightness(led_cdev, brightness);
108+
__led_set_brightness(led_cdev, brightness);
109+
110+
/* Return in next iteration if led is in one-shot mode and we are in
111+
* the final blink state so that the led is toggled each delay_on +
112+
* delay_off milliseconds in worst case.
113+
*/
114+
if (led_cdev->flags & LED_BLINK_ONESHOT) {
115+
if (led_cdev->flags & LED_BLINK_INVERT) {
116+
if (brightness)
117+
led_cdev->flags |= LED_BLINK_ONESHOT_STOP;
118+
} else {
119+
if (!brightness)
120+
led_cdev->flags |= LED_BLINK_ONESHOT_STOP;
121+
}
122+
}
104123

105124
mod_timer(&led_cdev->blink_timer, jiffies + msecs_to_jiffies(delay));
106125
}
@@ -203,7 +222,7 @@ void led_classdev_unregister(struct led_classdev *led_cdev)
203222
#endif
204223

205224
/* Stop blinking */
206-
led_brightness_set(led_cdev, LED_OFF);
225+
led_set_brightness(led_cdev, LED_OFF);
207226

208227
device_unregister(led_cdev->dev);
209228

0 commit comments

Comments
 (0)