Skip to content

Commit 5231804

Browse files
committed
Merge tag 'leds_for_4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds
Pull LED updates from Jacek Anaszewski: "This was quite a fruitful cycle, taking into account usual traffic on linux-leds list, as we managed to merge three new LED class drivers. New LED class drivers with related DT bindings: - add LED driver for CR0014114 board - add Spreadtrum SC27xx breathing light controller driver - introduce the lm3601x LED driver LED class fix: - ensure workqueue is initialized before setting brightness Improvements and fixes to existing LED class drivers: - fix return value check in sc27xx_led_probe() - use sysfs_match_string() helper in wm831x_status_src_store()" * tag 'leds_for_4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds: leds: class: ensure workqueue is initialized before setting brightness leds: lm3601x: Introduce the lm3601x LED driver dt: bindings: lm3601x: Introduce the lm3601x driver leds: sc27xx: Fix return value check in sc27xx_led_probe() leds: Add Spreadtrum SC27xx breathing light controller driver dt-bindings: leds: Add SC27xx breathing light controller documentation leds: wm831x-status: Use sysfs_match_string() helper leds: add LED driver for CR0014114 board dt-bindings: Add vendor prefix and docs for CR0014114
2 parents 2158091 + 6d71021 commit 5231804

File tree

11 files changed

+1237
-18
lines changed

11 files changed

+1237
-18
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
Crane Merchandising System - cr0014114 LED driver
2+
-------------------------------------------------
3+
4+
This LED Board is widely used in vending machines produced
5+
by Crane Merchandising Systems.
6+
7+
Required properties:
8+
- compatible: "crane,cr0014114"
9+
10+
Property rules described in Documentation/devicetree/bindings/spi/spi-bus.txt
11+
apply. In particular, "reg" and "spi-max-frequency" properties must be given.
12+
13+
LED sub-node properties:
14+
- label :
15+
see Documentation/devicetree/bindings/leds/common.txt
16+
- linux,default-trigger : (optional)
17+
see Documentation/devicetree/bindings/leds/common.txt
18+
19+
Example
20+
-------
21+
22+
led-controller@0 {
23+
compatible = "crane,cr0014114";
24+
reg = <0>;
25+
spi-max-frequency = <50000>;
26+
#address-cells = <1>;
27+
#size-cells = <0>;
28+
29+
led@0 {
30+
reg = <0>;
31+
label = "red:coin";
32+
};
33+
led@1 {
34+
reg = <1>;
35+
label = "green:coin";
36+
};
37+
led@2 {
38+
reg = <2>;
39+
label = "blue:coin";
40+
};
41+
led@3 {
42+
reg = <3>;
43+
label = "red:bill";
44+
};
45+
led@4 {
46+
reg = <4>;
47+
label = "green:bill";
48+
};
49+
led@5 {
50+
reg = <5>;
51+
label = "blue:bill";
52+
};
53+
...
54+
};
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
* Texas Instruments - lm3601x Single-LED Flash Driver
2+
3+
The LM3601X are ultra-small LED flash drivers that
4+
provide a high level of adjustability.
5+
6+
Required properties:
7+
- compatible : Can be one of the following
8+
"ti,lm36010"
9+
"ti,lm36011"
10+
- reg : I2C slave address
11+
- #address-cells : 1
12+
- #size-cells : 0
13+
14+
Required child properties:
15+
- reg : 0 - Indicates a IR mode
16+
1 - Indicates a Torch (white LED) mode
17+
18+
Required properties for flash LED child nodes:
19+
See Documentation/devicetree/bindings/leds/common.txt
20+
- flash-max-microamp : Range from 11mA - 1.5A
21+
- flash-max-timeout-us : Range from 40ms - 1600ms
22+
- led-max-microamp : Range from 2.4mA - 376mA
23+
24+
Optional child properties:
25+
- label : see Documentation/devicetree/bindings/leds/common.txt
26+
27+
Example:
28+
led-controller@64 {
29+
compatible = "ti,lm36010";
30+
#address-cells = <1>;
31+
#size-cells = <0>;
32+
reg = <0x64>;
33+
34+
led@0 {
35+
reg = <1>;
36+
label = "white:torch";
37+
led-max-microamp = <376000>;
38+
flash-max-microamp = <1500000>;
39+
flash-max-timeout-us = <1600000>;
40+
};
41+
}
42+
43+
For more product information please see the links below:
44+
http://www.ti.com/product/LM36010
45+
http://www.ti.com/product/LM36011
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
LEDs connected to Spreadtrum SC27XX PMIC breathing light controller
2+
3+
The SC27xx breathing light controller supports to 3 outputs:
4+
red LED, green LED and blue LED. Each LED can work at normal
5+
PWM mode or breath light mode.
6+
7+
Required properties:
8+
- compatible: Should be "sprd,sc2731-bltc".
9+
- #address-cells: Must be 1.
10+
- #size-cells: Must be 0.
11+
- reg: Specify the controller address.
12+
13+
Required child properties:
14+
- reg: Port this LED is connected to.
15+
16+
Optional child properties:
17+
- label: See Documentation/devicetree/bindings/leds/common.txt.
18+
19+
Examples:
20+
21+
led-controller@200 {
22+
compatible = "sprd,sc2731-bltc";
23+
#address-cells = <1>;
24+
#size-cells = <0>;
25+
reg = <0x200>;
26+
27+
led@0 {
28+
label = "red";
29+
reg = <0x0>;
30+
};
31+
32+
led@1 {
33+
label = "green";
34+
reg = <0x1>;
35+
};
36+
37+
led@2 {
38+
label = "blue";
39+
reg = <0x2>;
40+
};
41+
};

Documentation/devicetree/bindings/vendor-prefixes.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ cnxt Conexant Systems, Inc.
7575
compulab CompuLab Ltd.
7676
cortina Cortina Systems, Inc.
7777
cosmic Cosmic Circuits
78+
crane Crane Connectivity Solutions
7879
creative Creative Technology Ltd
7980
crystalfontz Crystalfontz America, Inc.
8081
cubietech Cubietech, Ltd.

drivers/leds/Kconfig

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,19 @@ config LEDS_CPCAP
104104
This option enables support for LEDs offered by Motorola's
105105
CPCAP PMIC.
106106

107+
config LEDS_CR0014114
108+
tristate "LED Support for Crane CR0014114"
109+
depends on LEDS_CLASS
110+
depends on SPI
111+
depends on OF
112+
help
113+
This option enables support for CR0014114 LED Board which
114+
is widely used in vending machines produced by
115+
Crane Merchandising Systems.
116+
117+
To compile this driver as a module, choose M here: the module
118+
will be called leds-cr0014114.
119+
107120
config LEDS_LM3530
108121
tristate "LCD Backlight driver for LM3530"
109122
depends on LEDS_CLASS
@@ -145,6 +158,15 @@ config LEDS_LM3692X
145158
This option enables support for the TI LM3692x family
146159
of white LED string drivers used for backlighting.
147160

161+
config LEDS_LM3601X
162+
tristate "LED support for LM3601x Chips"
163+
depends on LEDS_CLASS && I2C
164+
depends on LEDS_CLASS_FLASH
165+
select REGMAP_I2C
166+
help
167+
This option enables support for the TI LM3601x family
168+
of flash, torch and indicator classes.
169+
148170
config LEDS_LOCOMO
149171
tristate "LED Support for Locomo device"
150172
depends on LEDS_CLASS
@@ -647,6 +669,17 @@ config LEDS_IS31FL32XX
647669
LED controllers. They are I2C devices with multiple constant-current
648670
channels, each with independent 256-level PWM control.
649671

672+
config LEDS_SC27XX_BLTC
673+
tristate "LED support for the SC27xx breathing light controller"
674+
depends on LEDS_CLASS && MFD_SC27XX_PMIC
675+
depends on OF
676+
help
677+
Say Y here to include support for the SC27xx breathing light controller
678+
LEDs.
679+
680+
This driver can also be built as a module. If so the module will be
681+
called leds-sc27xx-bltc.
682+
650683
comment "LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM)"
651684

652685
config LEDS_BLINKM

drivers/leds/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,11 @@ obj-$(CONFIG_LEDS_MLXREG) += leds-mlxreg.o
7676
obj-$(CONFIG_LEDS_NIC78BX) += leds-nic78bx.o
7777
obj-$(CONFIG_LEDS_MT6323) += leds-mt6323.o
7878
obj-$(CONFIG_LEDS_LM3692X) += leds-lm3692x.o
79+
obj-$(CONFIG_LEDS_SC27XX_BLTC) += leds-sc27xx-bltc.o
80+
obj-$(CONFIG_LEDS_LM3601X) += leds-lm3601x.o
7981

8082
# LED SPI Drivers
83+
obj-$(CONFIG_LEDS_CR0014114) += leds-cr0014114.o
8184
obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o
8285

8386
# LED Userspace Drivers

drivers/leds/led-class.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,14 @@ int of_led_classdev_register(struct device *parent, struct device_node *np,
260260
if (ret < 0)
261261
return ret;
262262

263+
mutex_init(&led_cdev->led_access);
264+
mutex_lock(&led_cdev->led_access);
263265
led_cdev->dev = device_create_with_groups(leds_class, parent, 0,
264266
led_cdev, led_cdev->groups, "%s", name);
265-
if (IS_ERR(led_cdev->dev))
267+
if (IS_ERR(led_cdev->dev)) {
268+
mutex_unlock(&led_cdev->led_access);
266269
return PTR_ERR(led_cdev->dev);
270+
}
267271
led_cdev->dev->of_node = np;
268272

269273
if (ret)
@@ -274,6 +278,7 @@ int of_led_classdev_register(struct device *parent, struct device_node *np,
274278
ret = led_add_brightness_hw_changed(led_cdev);
275279
if (ret) {
276280
device_unregister(led_cdev->dev);
281+
mutex_unlock(&led_cdev->led_access);
277282
return ret;
278283
}
279284
}
@@ -285,7 +290,6 @@ int of_led_classdev_register(struct device *parent, struct device_node *np,
285290
#ifdef CONFIG_LEDS_BRIGHTNESS_HW_CHANGED
286291
led_cdev->brightness_hw_changed = -1;
287292
#endif
288-
mutex_init(&led_cdev->led_access);
289293
/* add to the list of leds */
290294
down_write(&leds_list_lock);
291295
list_add_tail(&led_cdev->node, &leds_list);
@@ -302,6 +306,8 @@ int of_led_classdev_register(struct device *parent, struct device_node *np,
302306
led_trigger_set_default(led_cdev);
303307
#endif
304308

309+
mutex_unlock(&led_cdev->led_access);
310+
305311
dev_dbg(parent, "Registered led device: %s\n",
306312
led_cdev->name);
307313

0 commit comments

Comments
 (0)