Skip to content

Commit a998a62

Browse files
committed
Merge tag 'leds-5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds
Pull LED updates from Pavel Machek: "Usual driver changes, some documentation that should hopefully get LED names standartized, and many fixes" * tag 'leds-5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds: (32 commits) leds: pca955x: Switch to i2c probe_new leds: pca955x: Let the core process the fwnode leds: pca955x: Implement the default-state property leds: pca955x: Add brightness_get function leds: pca955x: Clean up code formatting leds: leds-core: Implement the retain-state-shutdown property dt-bindings: leds: Add retain-state-shutdown boolean Documentation: leds: standartizing LED names leds: trigger: remove reference to obsolete CONFIG_IDE_GD_ATA leds: lp50xx: Fix chip name in KConfig leds: pwm: add support for default-state device property leds: move default_state read from fwnode to core leds: flash: Remove redundant initialization of variable ret leds: lgm-sso: Propagate error codes from callee to caller leds: trigger: audio: Add an activate callback to ensure the initial brightness is set leds: rt8515: Put fwnode in any case during ->probe() leds: lt3593: Put fwnode in any case during ->probe() leds: lm3697: Make error handling more robust leds: lm3697: Update header block to reflect reality leds: lm3692x: Correct headers (of*.h -> mod_devicetable.h) ...
2 parents e7c1bbc + 239f32b commit a998a62

30 files changed

+441
-196
lines changed

Documentation/devicetree/bindings/leds/common.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@ properties:
128128
as a panic indicator.
129129
type: boolean
130130

131+
retain-state-shutdown:
132+
description:
133+
This property specifies that the LED should not be turned off or changed
134+
when the system shuts down.
135+
type: boolean
136+
131137
trigger-sources:
132138
description: |
133139
List of devices which should be used as a source triggering this LED
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
-*- org -*-
2+
3+
It is somehow important to provide consistent interface to the
4+
userland. LED devices have one problem there, and that is naming of
5+
directories in /sys/class/leds. It would be nice if userland would
6+
just know right "name" for given LED function, but situation got more
7+
complex.
8+
9+
Anyway, if backwards compatibility is not an issue, new code should
10+
use one of the "good" names from this list, and you should extend the
11+
list where applicable.
12+
13+
Legacy names are listed, too; in case you are writing application that
14+
wants to use particular feature, you should probe for good name, first,
15+
but then try the legacy ones, too.
16+
17+
Notice there's a list of functions in include/dt-bindings/leds/common.h .
18+
19+
* Keyboards
20+
21+
Good: "input*:*:capslock"
22+
Good: "input*:*:scrolllock"
23+
Good: "input*:*:numlock"
24+
Legacy: "shift-key-light" (Motorola Droid 4, capslock)
25+
26+
Set of common keyboard LEDs, going back to PC AT or so.
27+
28+
Legacy: "tpacpi::thinklight" (IBM/Lenovo Thinkpads)
29+
Legacy: "lp5523:kb{1,2,3,4,5,6}" (Nokia N900)
30+
31+
Frontlight/backlight of main keyboard.
32+
33+
Legacy: "button-backlight" (Motorola Droid 4)
34+
35+
Some phones have touch buttons below screen; it is different from main
36+
keyboard. And this is their backlight.
37+
38+
* Sound subsystem
39+
40+
Good: "platform:*:mute"
41+
Good: "platform:*:micmute"
42+
43+
LEDs on notebook body, indicating that sound input / output is muted.
44+
45+
* System notification
46+
47+
Legacy: "status-led:{red,green,blue}" (Motorola Droid 4)
48+
Legacy: "lp5523:{r,g,b}" (Nokia N900)
49+
50+
Phones usually have multi-color status LED.
51+
52+
* Power management
53+
54+
Good: "platform:*:charging" (allwinner sun50i)
55+
56+
* Screen
57+
58+
Good: ":backlight" (Motorola Droid 4)

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2849,7 +2849,7 @@ AS3645A LED FLASH CONTROLLER DRIVER
28492849
M: Sakari Ailus <[email protected]>
28502850
28512851
S: Maintained
2852-
F: drivers/leds/leds-as3645a.c
2852+
F: drivers/leds/flash/leds-as3645a.c
28532853

28542854
ASAHI KASEI AK7375 LENS VOICE COIL DRIVER
28552855
M: Tianshu Qiu <[email protected]>

drivers/leds/Kconfig

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,6 @@ config LEDS_88PM860X
5959
This option enables support for on-chip LED drivers found on Marvell
6060
Semiconductor 88PM8606 PMIC.
6161

62-
config LEDS_AAT1290
63-
tristate "LED support for the AAT1290"
64-
depends on LEDS_CLASS_FLASH
65-
depends on V4L2_FLASH_LED_CLASS || !V4L2_FLASH_LED_CLASS
66-
depends on GPIOLIB || COMPILE_TEST
67-
depends on OF
68-
depends on PINCTRL
69-
help
70-
This option enables support for the LEDs on the AAT1290.
71-
7262
config LEDS_AN30259A
7363
tristate "LED support for Panasonic AN30259A"
7464
depends on LEDS_CLASS && I2C && OF
@@ -104,15 +94,6 @@ config LEDS_ARIEL
10494

10595
Say Y to if your machine is a Dell Wyse 3020 thin client.
10696

107-
config LEDS_AS3645A
108-
tristate "AS3645A and LM3555 LED flash controllers support"
109-
depends on I2C && LEDS_CLASS_FLASH
110-
depends on V4L2_FLASH_LED_CLASS || !V4L2_FLASH_LED_CLASS
111-
help
112-
Enable LED flash class support for AS3645A LED flash
113-
controller. V4L2 flash API is provided as well if
114-
CONFIG_V4L2_FLASH_API is enabled.
115-
11697
config LEDS_AW2013
11798
tristate "LED support for Awinic AW2013"
11899
depends on LEDS_CLASS && I2C && OF
@@ -239,15 +220,6 @@ config LEDS_LM3692X
239220
This option enables support for the TI LM3692x family
240221
of white LED string drivers used for backlighting.
241222

242-
config LEDS_LM3601X
243-
tristate "LED support for LM3601x Chips"
244-
depends on LEDS_CLASS && I2C
245-
depends on LEDS_CLASS_FLASH
246-
select REGMAP_I2C
247-
help
248-
This option enables support for the TI LM3601x family
249-
of flash, torch and indicator classes.
250-
251223
config LEDS_LOCOMO
252224
tristate "LED Support for Locomo device"
253225
depends on LEDS_CLASS
@@ -397,7 +369,7 @@ config LEDS_LP3952
397369
module will be called leds-lp3952.
398370

399371
config LEDS_LP50XX
400-
tristate "LED Support for TI LP5036/30/24/18/12/9 LED driver chip"
372+
tristate "LED Support for TI LP5036/30/24/18/12/09 LED driver chip"
401373
depends on LEDS_CLASS && REGMAP_I2C
402374
depends on LEDS_CLASS_MULTICOLOR || !LEDS_CLASS_MULTICOLOR
403375
help
@@ -699,17 +671,6 @@ config LEDS_MAX77650
699671
help
700672
LEDs driver for MAX77650 family of PMICs from Maxim Integrated.
701673

702-
config LEDS_MAX77693
703-
tristate "LED support for MAX77693 Flash"
704-
depends on LEDS_CLASS_FLASH
705-
depends on V4L2_FLASH_LED_CLASS || !V4L2_FLASH_LED_CLASS
706-
depends on MFD_MAX77693
707-
depends on OF
708-
help
709-
This option enables support for the flash part of the MAX77693
710-
multifunction device. It has build in control for two leds in flash
711-
and torch mode.
712-
713674
config LEDS_MAX8997
714675
tristate "LED support for MAX8997 PMIC"
715676
depends on LEDS_CLASS && MFD_MAX8997
@@ -741,16 +702,6 @@ config LEDS_MENF21BMC
741702
This driver can also be built as a module. If so the module
742703
will be called leds-menf21bmc.
743704

744-
config LEDS_KTD2692
745-
tristate "LED support for KTD2692 flash LED controller"
746-
depends on LEDS_CLASS_FLASH && OF
747-
depends on GPIOLIB || COMPILE_TEST
748-
help
749-
This option enables support for KTD2692 LED flash connected
750-
through ExpressWire interface.
751-
752-
Say Y to enable this driver.
753-
754705
config LEDS_IS31FL319X
755706
tristate "LED Support for ISSI IS31FL319x I2C LED controller family"
756707
depends on LEDS_CLASS && I2C && OF
@@ -913,14 +864,6 @@ config LEDS_IP30
913864
To compile this driver as a module, choose M here: the module
914865
will be called leds-ip30.
915866

916-
config LEDS_SGM3140
917-
tristate "LED support for the SGM3140"
918-
depends on LEDS_CLASS_FLASH
919-
depends on V4L2_FLASH_LED_CLASS || !V4L2_FLASH_LED_CLASS
920-
help
921-
This option enables support for the SGM3140 500mA Buck/Boost Charge
922-
Pump LED Driver.
923-
924867
config LEDS_ACER_A500
925868
tristate "Power button LED support for Acer Iconia Tab A500"
926869
depends on LEDS_CLASS && MFD_ACER_A500_EC

drivers/leds/Makefile

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@ obj-$(CONFIG_LEDS_TRIGGERS) += led-triggers.o
99

1010
# LED Platform Drivers (keep this sorted, M-| sort)
1111
obj-$(CONFIG_LEDS_88PM860X) += leds-88pm860x.o
12-
obj-$(CONFIG_LEDS_AAT1290) += leds-aat1290.o
1312
obj-$(CONFIG_LEDS_ACER_A500) += leds-acer-a500.o
1413
obj-$(CONFIG_LEDS_ADP5520) += leds-adp5520.o
1514
obj-$(CONFIG_LEDS_AN30259A) += leds-an30259a.o
1615
obj-$(CONFIG_LEDS_APU) += leds-apu.o
1716
obj-$(CONFIG_LEDS_ARIEL) += leds-ariel.o
18-
obj-$(CONFIG_LEDS_AS3645A) += leds-as3645a.o
1917
obj-$(CONFIG_LEDS_ASIC3) += leds-asic3.o
2018
obj-$(CONFIG_LEDS_AW2013) += leds-aw2013.o
2119
obj-$(CONFIG_LEDS_BCM6328) += leds-bcm6328.o
@@ -37,12 +35,10 @@ obj-$(CONFIG_LEDS_IP30) += leds-ip30.o
3735
obj-$(CONFIG_LEDS_IPAQ_MICRO) += leds-ipaq-micro.o
3836
obj-$(CONFIG_LEDS_IS31FL319X) += leds-is31fl319x.o
3937
obj-$(CONFIG_LEDS_IS31FL32XX) += leds-is31fl32xx.o
40-
obj-$(CONFIG_LEDS_KTD2692) += leds-ktd2692.o
4138
obj-$(CONFIG_LEDS_LM3530) += leds-lm3530.o
4239
obj-$(CONFIG_LEDS_LM3532) += leds-lm3532.o
4340
obj-$(CONFIG_LEDS_LM3533) += leds-lm3533.o
4441
obj-$(CONFIG_LEDS_LM355x) += leds-lm355x.o
45-
obj-$(CONFIG_LEDS_LM3601X) += leds-lm3601x.o
4642
obj-$(CONFIG_LEDS_LM36274) += leds-lm36274.o
4743
obj-$(CONFIG_LEDS_LM3642) += leds-lm3642.o
4844
obj-$(CONFIG_LEDS_LM3692X) += leds-lm3692x.o
@@ -60,7 +56,6 @@ obj-$(CONFIG_LEDS_LP8788) += leds-lp8788.o
6056
obj-$(CONFIG_LEDS_LP8860) += leds-lp8860.o
6157
obj-$(CONFIG_LEDS_LT3593) += leds-lt3593.o
6258
obj-$(CONFIG_LEDS_MAX77650) += leds-max77650.o
63-
obj-$(CONFIG_LEDS_MAX77693) += leds-max77693.o
6459
obj-$(CONFIG_LEDS_MAX8997) += leds-max8997.o
6560
obj-$(CONFIG_LEDS_MC13783) += leds-mc13783.o
6661
obj-$(CONFIG_LEDS_MENF21BMC) += leds-menf21bmc.o
@@ -82,7 +77,6 @@ obj-$(CONFIG_LEDS_PWM) += leds-pwm.o
8277
obj-$(CONFIG_LEDS_REGULATOR) += leds-regulator.o
8378
obj-$(CONFIG_LEDS_S3C24XX) += leds-s3c24xx.o
8479
obj-$(CONFIG_LEDS_SC27XX_BLTC) += leds-sc27xx-bltc.o
85-
obj-$(CONFIG_LEDS_SGM3140) += leds-sgm3140.o
8680
obj-$(CONFIG_LEDS_SUNFIRE) += leds-sunfire.o
8781
obj-$(CONFIG_LEDS_SYSCON) += leds-syscon.o
8882
obj-$(CONFIG_LEDS_TCA6507) += leds-tca6507.o

drivers/leds/blink/leds-lgm-sso.c

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -611,9 +611,6 @@ static void sso_led_shutdown(struct sso_led *led)
611611
if (led->desc.hw_trig)
612612
regmap_update_bits(priv->mmap, SSO_CON3, BIT(led->desc.pin), 0);
613613

614-
if (led->gpiod)
615-
devm_gpiod_put(priv->dev, led->gpiod);
616-
617614
led->priv = NULL;
618615
}
619616

@@ -624,15 +621,16 @@ __sso_led_dt_parse(struct sso_led_priv *priv, struct fwnode_handle *fw_ssoled)
624621
struct device *dev = priv->dev;
625622
struct sso_led_desc *desc;
626623
struct sso_led *led;
627-
struct list_head *p;
628624
const char *tmp;
629625
u32 prop;
630626
int ret;
631627

632628
fwnode_for_each_child_node(fw_ssoled, fwnode_child) {
633629
led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL);
634-
if (!led)
635-
return -ENOMEM;
630+
if (!led) {
631+
ret = -ENOMEM;
632+
goto __dt_err;
633+
}
636634

637635
INIT_LIST_HEAD(&led->list);
638636
led->priv = priv;
@@ -642,7 +640,7 @@ __sso_led_dt_parse(struct sso_led_priv *priv, struct fwnode_handle *fw_ssoled)
642640
fwnode_child,
643641
GPIOD_ASIS, NULL);
644642
if (IS_ERR(led->gpiod)) {
645-
dev_err(dev, "led: get gpio fail!\n");
643+
ret = dev_err_probe(dev, PTR_ERR(led->gpiod), "led: get gpio fail!\n");
646644
goto __dt_err;
647645
}
648646

@@ -662,8 +660,11 @@ __sso_led_dt_parse(struct sso_led_priv *priv, struct fwnode_handle *fw_ssoled)
662660
desc->panic_indicator = 1;
663661

664662
ret = fwnode_property_read_u32(fwnode_child, "reg", &prop);
665-
if (ret != 0 || prop >= SSO_LED_MAX_NUM) {
663+
if (ret)
664+
goto __dt_err;
665+
if (prop >= SSO_LED_MAX_NUM) {
666666
dev_err(dev, "invalid LED pin:%u\n", prop);
667+
ret = -EINVAL;
667668
goto __dt_err;
668669
}
669670
desc->pin = prop;
@@ -699,21 +700,20 @@ __sso_led_dt_parse(struct sso_led_priv *priv, struct fwnode_handle *fw_ssoled)
699700
desc->brightness = LED_FULL;
700701
}
701702

702-
if (sso_create_led(priv, led, fwnode_child))
703+
ret = sso_create_led(priv, led, fwnode_child);
704+
if (ret)
703705
goto __dt_err;
704706
}
705-
fwnode_handle_put(fw_ssoled);
706707

707708
return 0;
709+
708710
__dt_err:
709-
fwnode_handle_put(fw_ssoled);
711+
fwnode_handle_put(fwnode_child);
710712
/* unregister leds */
711-
list_for_each(p, &priv->led_list) {
712-
led = list_entry(p, struct sso_led, list);
713+
list_for_each_entry(led, &priv->led_list, list)
713714
sso_led_shutdown(led);
714-
}
715715

716-
return -EINVAL;
716+
return ret;
717717
}
718718

719719
static int sso_led_dt_parse(struct sso_led_priv *priv)
@@ -731,6 +731,7 @@ static int sso_led_dt_parse(struct sso_led_priv *priv)
731731
fw_ssoled = fwnode_get_named_child_node(fwnode, "ssoled");
732732
if (fw_ssoled) {
733733
ret = __sso_led_dt_parse(priv, fw_ssoled);
734+
fwnode_handle_put(fw_ssoled);
734735
if (ret)
735736
return ret;
736737
}
@@ -841,14 +842,12 @@ static int intel_sso_led_probe(struct platform_device *pdev)
841842
static int intel_sso_led_remove(struct platform_device *pdev)
842843
{
843844
struct sso_led_priv *priv;
844-
struct list_head *pos, *n;
845-
struct sso_led *led;
845+
struct sso_led *led, *n;
846846

847847
priv = platform_get_drvdata(pdev);
848848

849-
list_for_each_safe(pos, n, &priv->led_list) {
850-
list_del(pos);
851-
led = list_entry(pos, struct sso_led, list);
849+
list_for_each_entry_safe(led, n, &priv->led_list, list) {
850+
list_del(&led->list);
852851
sso_led_shutdown(led);
853852
}
854853

0 commit comments

Comments
 (0)