Skip to content

Commit 85724ed

Browse files
committed
Merge tag 'leds_for_4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds
Pull LED updates from Jacek Anaszewski: "New drivers: - add LED support for MT6323 PMIC - add LED support for Motorola CPCAP PMIC New features and improvements: - add LED trigger for all CPUs aggregated which is useful on tiny boards with more CPU cores than LED pins - add OF variants of LED registering functions as a preparation for adding generic support for Device Tree parsing - dell-led improvements and cleanups, followed by moving it to the x86 platform driver subsystem which is a more appropriate place for it - extend pca9532 Device Tree support by adding the LEDs 'default-state' property - extend pca963x Device Tree support by adding nxp,inverted-out property for inverting the polarity of the output - remove ACPI support for lp3952 since it relied on a non-official ACPI IDs" * tag 'leds_for_4.12' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds: leds: pca9532: Extend pca9532 device tree support leds: cpcap: new driver mfd: cpcap: Add missing include dependencies leds: lp3952: Use 'if (ret)' pattern leds: lp3952: Remove ACPI support for lp3952 leds: mt6323: Fix an off by one bug in probe dt-bindings: leds: Add document bindings for leds-mt6323 leds: Add LED support for MT6323 PMIC leds: gpio: use OF variant of LED registering function leds: core: add OF variants of LED registering functions platform/x86: dell-wmi-led: fix coding style issues dell-led: move driver to drivers/platform/x86/dell-wmi-led.c dell-led: remove code related to mic mute LED platform/x86: dell-laptop: import dell_micmute_led_set() from drivers/leds/dell-led.c ALSA: hda - rename dell_led_set_func to dell_micmute_led_set_func ALSA: hda - use dell_micmute_led_set() instead of dell_app_wmi_led_set() dell-led: remove GUID check from dell_micmute_led_set() leds/trigger/cpu: Add LED trigger for all CPUs aggregated
2 parents 477d7ca + 28c5fe9 commit 85724ed

21 files changed

Lines changed: 1043 additions & 178 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Motorola CPCAP PMIC LEDs
2+
------------------------
3+
4+
This module is part of the CPCAP. For more details about the whole
5+
chip see Documentation/devicetree/bindings/mfd/motorola-cpcap.txt.
6+
7+
Requires node properties:
8+
- compatible: should be one of
9+
* "motorola,cpcap-led-mdl" (Main Display Lighting)
10+
* "motorola,cpcap-led-kl" (Keyboard Lighting)
11+
* "motorola,cpcap-led-adl" (Aux Display Lighting)
12+
* "motorola,cpcap-led-red" (Red Triode)
13+
* "motorola,cpcap-led-green" (Green Triode)
14+
* "motorola,cpcap-led-blue" (Blue Triode)
15+
* "motorola,cpcap-led-cf" (Camera Flash)
16+
* "motorola,cpcap-led-bt" (Bluetooth)
17+
* "motorola,cpcap-led-cp" (Camera Privacy LED)
18+
- label: see Documentation/devicetree/bindings/leds/common.txt
19+
- vdd-supply: A phandle to the regulator powering the LED
20+
21+
Example:
22+
23+
&cpcap {
24+
cpcap_led_red: red-led {
25+
compatible = "motorola,cpcap-led-red";
26+
label = "cpcap:red";
27+
vdd-supply = <&sw5>;
28+
};
29+
};
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
Device Tree Bindings for LED support on MT6323 PMIC
2+
3+
MT6323 LED controller is subfunction provided by MT6323 PMIC, so the LED
4+
controllers are defined as the subnode of the function node provided by MT6323
5+
PMIC controller that is being defined as one kind of Muti-Function Device (MFD)
6+
using shared bus called PMIC wrapper for each subfunction to access remote
7+
MT6323 PMIC hardware.
8+
9+
For MT6323 MFD bindings see:
10+
Documentation/devicetree/bindings/mfd/mt6397.txt
11+
For MediaTek PMIC wrapper bindings see:
12+
Documentation/devicetree/bindings/soc/mediatek/pwrap.txt
13+
14+
Required properties:
15+
- compatible : Must be "mediatek,mt6323-led"
16+
- address-cells : Must be 1
17+
- size-cells : Must be 0
18+
19+
Each led is represented as a child node of the mediatek,mt6323-led that
20+
describes the initial behavior for each LED physically and currently only four
21+
LED child nodes can be supported.
22+
23+
Required properties for the LED child node:
24+
- reg : LED channel number (0..3)
25+
26+
Optional properties for the LED child node:
27+
- label : See Documentation/devicetree/bindings/leds/common.txt
28+
- linux,default-trigger : See Documentation/devicetree/bindings/leds/common.txt
29+
- default-state: See Documentation/devicetree/bindings/leds/common.txt
30+
31+
Example:
32+
33+
mt6323: pmic {
34+
compatible = "mediatek,mt6323";
35+
36+
...
37+
38+
mt6323led: leds {
39+
compatible = "mediatek,mt6323-led";
40+
#address-cells = <1>;
41+
#size-cells = <0>;
42+
43+
led@0 {
44+
reg = <0>;
45+
label = "LED0";
46+
linux,default-trigger = "timer";
47+
default-state = "on";
48+
};
49+
led@1 {
50+
reg = <1>;
51+
label = "LED1";
52+
default-state = "off";
53+
};
54+
led@2 {
55+
reg = <2>;
56+
label = "LED2";
57+
default-state = "on";
58+
};
59+
};
60+
};

‎Documentation/devicetree/bindings/leds/leds-pca9532.txt‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ Optional sub-node properties:
1717
- label: see Documentation/devicetree/bindings/leds/common.txt
1818
- type: Output configuration, see dt-bindings/leds/leds-pca9532.h (default NONE)
1919
- linux,default-trigger: see Documentation/devicetree/bindings/leds/common.txt
20+
- default-state: see Documentation/devicetree/bindings/leds/common.txt
21+
This property is only valid for sub-nodes of type <PCA9532_TYPE_LED>.
2022

2123
Example:
2224
#include <dt-bindings/leds/leds-pca9532.h>
@@ -33,6 +35,14 @@ Example:
3335
label = "pca:green:power";
3436
type = <PCA9532_TYPE_LED>;
3537
};
38+
kernel-booting {
39+
type = <PCA9532_TYPE_LED>;
40+
default-state = "on";
41+
};
42+
sys-stat {
43+
type = <PCA9532_TYPE_LED>;
44+
default-state = "keep"; // don't touch, was set by U-Boot
45+
};
3646
};
3747

3848
For more product information please see the link below:

‎drivers/leds/Kconfig‎

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,15 @@ config LEDS_BCM6358
7676
This option enables support for LEDs connected to the BCM6358
7777
LED HW controller accessed via MMIO registers.
7878

79+
config LEDS_CPCAP
80+
tristate "LED Support for Motorola CPCAP"
81+
depends on LEDS_CLASS
82+
depends on MFD_CPCAP
83+
depends on OF
84+
help
85+
This option enables support for LEDs offered by Motorola's
86+
CPCAP PMIC.
87+
7988
config LEDS_LM3530
8089
tristate "LCD Backlight driver for LM3530"
8190
depends on LEDS_CLASS
@@ -126,6 +135,14 @@ config LEDS_MIKROTIK_RB532
126135
This option enables support for the so called "User LED" of
127136
Mikrotik's Routerboard 532.
128137

138+
config LEDS_MT6323
139+
tristate "LED Support for Mediatek MT6323 PMIC"
140+
depends on LEDS_CLASS
141+
depends on MFD_MT6397
142+
help
143+
This option enables support for on-chip LED drivers found on
144+
Mediatek MT6323 PMIC.
145+
129146
config LEDS_S3C24XX
130147
tristate "LED Support for Samsung S3C24XX GPIO LEDs"
131148
depends on LEDS_CLASS
@@ -241,7 +258,6 @@ config LEDS_LP3952
241258
tristate "LED Support for TI LP3952 2 channel LED driver"
242259
depends on LEDS_CLASS
243260
depends on I2C
244-
depends on ACPI
245261
depends on GPIOLIB
246262
select REGMAP_I2C
247263
help
@@ -463,15 +479,6 @@ config LEDS_ADP5520
463479
To compile this driver as a module, choose M here: the module will
464480
be called leds-adp5520.
465481

466-
config LEDS_DELL_NETBOOKS
467-
tristate "External LED on Dell Business Netbooks"
468-
depends on LEDS_CLASS
469-
depends on X86 && ACPI_WMI
470-
depends on DELL_SMBIOS
471-
help
472-
This adds support for the Latitude 2100 and similar
473-
notebooks that have an external LED.
474-
475482
config LEDS_MC13783
476483
tristate "LED Support for MC13XXX PMIC"
477484
depends on LEDS_CLASS

‎drivers/leds/Makefile‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ obj-$(CONFIG_LEDS_AAT1290) += leds-aat1290.o
1111
obj-$(CONFIG_LEDS_BCM6328) += leds-bcm6328.o
1212
obj-$(CONFIG_LEDS_BCM6358) += leds-bcm6358.o
1313
obj-$(CONFIG_LEDS_BD2802) += leds-bd2802.o
14+
obj-$(CONFIG_LEDS_CPCAP) += leds-cpcap.o
1415
obj-$(CONFIG_LEDS_LOCOMO) += leds-locomo.o
1516
obj-$(CONFIG_LEDS_LM3530) += leds-lm3530.o
1617
obj-$(CONFIG_LEDS_LM3533) += leds-lm3533.o
@@ -52,7 +53,6 @@ obj-$(CONFIG_LEDS_REGULATOR) += leds-regulator.o
5253
obj-$(CONFIG_LEDS_INTEL_SS4200) += leds-ss4200.o
5354
obj-$(CONFIG_LEDS_LT3593) += leds-lt3593.o
5455
obj-$(CONFIG_LEDS_ADP5520) += leds-adp5520.o
55-
obj-$(CONFIG_LEDS_DELL_NETBOOKS) += dell-led.o
5656
obj-$(CONFIG_LEDS_MC13783) += leds-mc13783.o
5757
obj-$(CONFIG_LEDS_NS2) += leds-ns2.o
5858
obj-$(CONFIG_LEDS_NETXBIG) += leds-netxbig.o
@@ -72,6 +72,7 @@ obj-$(CONFIG_LEDS_IS31FL32XX) += leds-is31fl32xx.o
7272
obj-$(CONFIG_LEDS_PM8058) += leds-pm8058.o
7373
obj-$(CONFIG_LEDS_MLXCPLD) += leds-mlxcpld.o
7474
obj-$(CONFIG_LEDS_NIC78BX) += leds-nic78bx.o
75+
obj-$(CONFIG_LEDS_MT6323) += leds-mt6323.o
7576

7677
# LED SPI Drivers
7778
obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o

‎drivers/leds/led-class.c‎

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,14 @@ static int led_classdev_next_name(const char *init_name, char *name,
244244
}
245245

246246
/**
247-
* led_classdev_register - register a new object of led_classdev class.
248-
* @parent: The device to register.
247+
* of_led_classdev_register - register a new object of led_classdev class.
248+
*
249+
* @parent: parent of LED device
249250
* @led_cdev: the led_classdev structure for this device.
251+
* @np: DT node describing this LED
250252
*/
251-
int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
253+
int of_led_classdev_register(struct device *parent, struct device_node *np,
254+
struct led_classdev *led_cdev)
252255
{
253256
char name[LED_MAX_NAME_SIZE];
254257
int ret;
@@ -261,6 +264,7 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
261264
led_cdev, led_cdev->groups, "%s", name);
262265
if (IS_ERR(led_cdev->dev))
263266
return PTR_ERR(led_cdev->dev);
267+
led_cdev->dev->of_node = np;
264268

265269
if (ret)
266270
dev_warn(parent, "Led %s renamed to %s due to name collision",
@@ -303,7 +307,7 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
303307

304308
return 0;
305309
}
306-
EXPORT_SYMBOL_GPL(led_classdev_register);
310+
EXPORT_SYMBOL_GPL(of_led_classdev_register);
307311

308312
/**
309313
* led_classdev_unregister - unregisters a object of led_properties class.
@@ -348,12 +352,14 @@ static void devm_led_classdev_release(struct device *dev, void *res)
348352
}
349353

350354
/**
351-
* devm_led_classdev_register - resource managed led_classdev_register()
352-
* @parent: The device to register.
355+
* devm_of_led_classdev_register - resource managed led_classdev_register()
356+
*
357+
* @parent: parent of LED device
353358
* @led_cdev: the led_classdev structure for this device.
354359
*/
355-
int devm_led_classdev_register(struct device *parent,
356-
struct led_classdev *led_cdev)
360+
int devm_of_led_classdev_register(struct device *parent,
361+
struct device_node *np,
362+
struct led_classdev *led_cdev)
357363
{
358364
struct led_classdev **dr;
359365
int rc;
@@ -362,7 +368,7 @@ int devm_led_classdev_register(struct device *parent,
362368
if (!dr)
363369
return -ENOMEM;
364370

365-
rc = led_classdev_register(parent, led_cdev);
371+
rc = of_led_classdev_register(parent, np, led_cdev);
366372
if (rc) {
367373
devres_free(dr);
368374
return rc;
@@ -373,7 +379,7 @@ int devm_led_classdev_register(struct device *parent,
373379

374380
return 0;
375381
}
376-
EXPORT_SYMBOL_GPL(devm_led_classdev_register);
382+
EXPORT_SYMBOL_GPL(devm_of_led_classdev_register);
377383

378384
static int devm_led_classdev_match(struct device *dev, void *res, void *data)
379385
{

0 commit comments

Comments
 (0)