Skip to content

Commit

Permalink
Merge tag 'leds-5.15-rc1' of git://git.kernel.org/pub/scm/linux/kerne…
Browse files Browse the repository at this point in the history
…l/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)
  ...
  • Loading branch information
torvalds committed Aug 31, 2021
2 parents e7c1bbc + 239f32b commit a998a62
Show file tree
Hide file tree
Showing 30 changed files with 441 additions and 196 deletions.
6 changes: 6 additions & 0 deletions Documentation/devicetree/bindings/leds/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ properties:
as a panic indicator.
type: boolean

retain-state-shutdown:
description:
This property specifies that the LED should not be turned off or changed
when the system shuts down.
type: boolean

trigger-sources:
description: |
List of devices which should be used as a source triggering this LED
Expand Down
58 changes: 58 additions & 0 deletions Documentation/leds/well-known-leds.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
-*- org -*-

It is somehow important to provide consistent interface to the
userland. LED devices have one problem there, and that is naming of
directories in /sys/class/leds. It would be nice if userland would
just know right "name" for given LED function, but situation got more
complex.

Anyway, if backwards compatibility is not an issue, new code should
use one of the "good" names from this list, and you should extend the
list where applicable.

Legacy names are listed, too; in case you are writing application that
wants to use particular feature, you should probe for good name, first,
but then try the legacy ones, too.

Notice there's a list of functions in include/dt-bindings/leds/common.h .

* Keyboards

Good: "input*:*:capslock"
Good: "input*:*:scrolllock"
Good: "input*:*:numlock"
Legacy: "shift-key-light" (Motorola Droid 4, capslock)

Set of common keyboard LEDs, going back to PC AT or so.

Legacy: "tpacpi::thinklight" (IBM/Lenovo Thinkpads)
Legacy: "lp5523:kb{1,2,3,4,5,6}" (Nokia N900)

Frontlight/backlight of main keyboard.

Legacy: "button-backlight" (Motorola Droid 4)

Some phones have touch buttons below screen; it is different from main
keyboard. And this is their backlight.

* Sound subsystem

Good: "platform:*:mute"
Good: "platform:*:micmute"

LEDs on notebook body, indicating that sound input / output is muted.

* System notification

Legacy: "status-led:{red,green,blue}" (Motorola Droid 4)
Legacy: "lp5523:{r,g,b}" (Nokia N900)

Phones usually have multi-color status LED.

* Power management

Good: "platform:*:charging" (allwinner sun50i)

* Screen

Good: ":backlight" (Motorola Droid 4)
2 changes: 1 addition & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -2849,7 +2849,7 @@ AS3645A LED FLASH CONTROLLER DRIVER
M: Sakari Ailus <[email protected]>
L: [email protected]
S: Maintained
F: drivers/leds/leds-as3645a.c
F: drivers/leds/flash/leds-as3645a.c

ASAHI KASEI AK7375 LENS VOICE COIL DRIVER
M: Tianshu Qiu <[email protected]>
Expand Down
59 changes: 1 addition & 58 deletions drivers/leds/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,6 @@ config LEDS_88PM860X
This option enables support for on-chip LED drivers found on Marvell
Semiconductor 88PM8606 PMIC.

config LEDS_AAT1290
tristate "LED support for the AAT1290"
depends on LEDS_CLASS_FLASH
depends on V4L2_FLASH_LED_CLASS || !V4L2_FLASH_LED_CLASS
depends on GPIOLIB || COMPILE_TEST
depends on OF
depends on PINCTRL
help
This option enables support for the LEDs on the AAT1290.

config LEDS_AN30259A
tristate "LED support for Panasonic AN30259A"
depends on LEDS_CLASS && I2C && OF
Expand Down Expand Up @@ -104,15 +94,6 @@ config LEDS_ARIEL

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

config LEDS_AS3645A
tristate "AS3645A and LM3555 LED flash controllers support"
depends on I2C && LEDS_CLASS_FLASH
depends on V4L2_FLASH_LED_CLASS || !V4L2_FLASH_LED_CLASS
help
Enable LED flash class support for AS3645A LED flash
controller. V4L2 flash API is provided as well if
CONFIG_V4L2_FLASH_API is enabled.

config LEDS_AW2013
tristate "LED support for Awinic AW2013"
depends on LEDS_CLASS && I2C && OF
Expand Down Expand Up @@ -239,15 +220,6 @@ config LEDS_LM3692X
This option enables support for the TI LM3692x family
of white LED string drivers used for backlighting.

config LEDS_LM3601X
tristate "LED support for LM3601x Chips"
depends on LEDS_CLASS && I2C
depends on LEDS_CLASS_FLASH
select REGMAP_I2C
help
This option enables support for the TI LM3601x family
of flash, torch and indicator classes.

config LEDS_LOCOMO
tristate "LED Support for Locomo device"
depends on LEDS_CLASS
Expand Down Expand Up @@ -397,7 +369,7 @@ config LEDS_LP3952
module will be called leds-lp3952.

config LEDS_LP50XX
tristate "LED Support for TI LP5036/30/24/18/12/9 LED driver chip"
tristate "LED Support for TI LP5036/30/24/18/12/09 LED driver chip"
depends on LEDS_CLASS && REGMAP_I2C
depends on LEDS_CLASS_MULTICOLOR || !LEDS_CLASS_MULTICOLOR
help
Expand Down Expand Up @@ -699,17 +671,6 @@ config LEDS_MAX77650
help
LEDs driver for MAX77650 family of PMICs from Maxim Integrated.

config LEDS_MAX77693
tristate "LED support for MAX77693 Flash"
depends on LEDS_CLASS_FLASH
depends on V4L2_FLASH_LED_CLASS || !V4L2_FLASH_LED_CLASS
depends on MFD_MAX77693
depends on OF
help
This option enables support for the flash part of the MAX77693
multifunction device. It has build in control for two leds in flash
and torch mode.

config LEDS_MAX8997
tristate "LED support for MAX8997 PMIC"
depends on LEDS_CLASS && MFD_MAX8997
Expand Down Expand Up @@ -741,16 +702,6 @@ config LEDS_MENF21BMC
This driver can also be built as a module. If so the module
will be called leds-menf21bmc.

config LEDS_KTD2692
tristate "LED support for KTD2692 flash LED controller"
depends on LEDS_CLASS_FLASH && OF
depends on GPIOLIB || COMPILE_TEST
help
This option enables support for KTD2692 LED flash connected
through ExpressWire interface.

Say Y to enable this driver.

config LEDS_IS31FL319X
tristate "LED Support for ISSI IS31FL319x I2C LED controller family"
depends on LEDS_CLASS && I2C && OF
Expand Down Expand Up @@ -913,14 +864,6 @@ config LEDS_IP30
To compile this driver as a module, choose M here: the module
will be called leds-ip30.

config LEDS_SGM3140
tristate "LED support for the SGM3140"
depends on LEDS_CLASS_FLASH
depends on V4L2_FLASH_LED_CLASS || !V4L2_FLASH_LED_CLASS
help
This option enables support for the SGM3140 500mA Buck/Boost Charge
Pump LED Driver.

config LEDS_ACER_A500
tristate "Power button LED support for Acer Iconia Tab A500"
depends on LEDS_CLASS && MFD_ACER_A500_EC
Expand Down
6 changes: 0 additions & 6 deletions drivers/leds/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ obj-$(CONFIG_LEDS_TRIGGERS) += led-triggers.o

# LED Platform Drivers (keep this sorted, M-| sort)
obj-$(CONFIG_LEDS_88PM860X) += leds-88pm860x.o
obj-$(CONFIG_LEDS_AAT1290) += leds-aat1290.o
obj-$(CONFIG_LEDS_ACER_A500) += leds-acer-a500.o
obj-$(CONFIG_LEDS_ADP5520) += leds-adp5520.o
obj-$(CONFIG_LEDS_AN30259A) += leds-an30259a.o
obj-$(CONFIG_LEDS_APU) += leds-apu.o
obj-$(CONFIG_LEDS_ARIEL) += leds-ariel.o
obj-$(CONFIG_LEDS_AS3645A) += leds-as3645a.o
obj-$(CONFIG_LEDS_ASIC3) += leds-asic3.o
obj-$(CONFIG_LEDS_AW2013) += leds-aw2013.o
obj-$(CONFIG_LEDS_BCM6328) += leds-bcm6328.o
Expand All @@ -37,12 +35,10 @@ obj-$(CONFIG_LEDS_IP30) += leds-ip30.o
obj-$(CONFIG_LEDS_IPAQ_MICRO) += leds-ipaq-micro.o
obj-$(CONFIG_LEDS_IS31FL319X) += leds-is31fl319x.o
obj-$(CONFIG_LEDS_IS31FL32XX) += leds-is31fl32xx.o
obj-$(CONFIG_LEDS_KTD2692) += leds-ktd2692.o
obj-$(CONFIG_LEDS_LM3530) += leds-lm3530.o
obj-$(CONFIG_LEDS_LM3532) += leds-lm3532.o
obj-$(CONFIG_LEDS_LM3533) += leds-lm3533.o
obj-$(CONFIG_LEDS_LM355x) += leds-lm355x.o
obj-$(CONFIG_LEDS_LM3601X) += leds-lm3601x.o
obj-$(CONFIG_LEDS_LM36274) += leds-lm36274.o
obj-$(CONFIG_LEDS_LM3642) += leds-lm3642.o
obj-$(CONFIG_LEDS_LM3692X) += leds-lm3692x.o
Expand All @@ -60,7 +56,6 @@ obj-$(CONFIG_LEDS_LP8788) += leds-lp8788.o
obj-$(CONFIG_LEDS_LP8860) += leds-lp8860.o
obj-$(CONFIG_LEDS_LT3593) += leds-lt3593.o
obj-$(CONFIG_LEDS_MAX77650) += leds-max77650.o
obj-$(CONFIG_LEDS_MAX77693) += leds-max77693.o
obj-$(CONFIG_LEDS_MAX8997) += leds-max8997.o
obj-$(CONFIG_LEDS_MC13783) += leds-mc13783.o
obj-$(CONFIG_LEDS_MENF21BMC) += leds-menf21bmc.o
Expand All @@ -82,7 +77,6 @@ obj-$(CONFIG_LEDS_PWM) += leds-pwm.o
obj-$(CONFIG_LEDS_REGULATOR) += leds-regulator.o
obj-$(CONFIG_LEDS_S3C24XX) += leds-s3c24xx.o
obj-$(CONFIG_LEDS_SC27XX_BLTC) += leds-sc27xx-bltc.o
obj-$(CONFIG_LEDS_SGM3140) += leds-sgm3140.o
obj-$(CONFIG_LEDS_SUNFIRE) += leds-sunfire.o
obj-$(CONFIG_LEDS_SYSCON) += leds-syscon.o
obj-$(CONFIG_LEDS_TCA6507) += leds-tca6507.o
Expand Down
39 changes: 19 additions & 20 deletions drivers/leds/blink/leds-lgm-sso.c
Original file line number Diff line number Diff line change
Expand Up @@ -611,9 +611,6 @@ static void sso_led_shutdown(struct sso_led *led)
if (led->desc.hw_trig)
regmap_update_bits(priv->mmap, SSO_CON3, BIT(led->desc.pin), 0);

if (led->gpiod)
devm_gpiod_put(priv->dev, led->gpiod);

led->priv = NULL;
}

Expand All @@ -624,15 +621,16 @@ __sso_led_dt_parse(struct sso_led_priv *priv, struct fwnode_handle *fw_ssoled)
struct device *dev = priv->dev;
struct sso_led_desc *desc;
struct sso_led *led;
struct list_head *p;
const char *tmp;
u32 prop;
int ret;

fwnode_for_each_child_node(fw_ssoled, fwnode_child) {
led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL);
if (!led)
return -ENOMEM;
if (!led) {
ret = -ENOMEM;
goto __dt_err;
}

INIT_LIST_HEAD(&led->list);
led->priv = priv;
Expand All @@ -642,7 +640,7 @@ __sso_led_dt_parse(struct sso_led_priv *priv, struct fwnode_handle *fw_ssoled)
fwnode_child,
GPIOD_ASIS, NULL);
if (IS_ERR(led->gpiod)) {
dev_err(dev, "led: get gpio fail!\n");
ret = dev_err_probe(dev, PTR_ERR(led->gpiod), "led: get gpio fail!\n");
goto __dt_err;
}

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

ret = fwnode_property_read_u32(fwnode_child, "reg", &prop);
if (ret != 0 || prop >= SSO_LED_MAX_NUM) {
if (ret)
goto __dt_err;
if (prop >= SSO_LED_MAX_NUM) {
dev_err(dev, "invalid LED pin:%u\n", prop);
ret = -EINVAL;
goto __dt_err;
}
desc->pin = prop;
Expand Down Expand Up @@ -699,21 +700,20 @@ __sso_led_dt_parse(struct sso_led_priv *priv, struct fwnode_handle *fw_ssoled)
desc->brightness = LED_FULL;
}

if (sso_create_led(priv, led, fwnode_child))
ret = sso_create_led(priv, led, fwnode_child);
if (ret)
goto __dt_err;
}
fwnode_handle_put(fw_ssoled);

return 0;

__dt_err:
fwnode_handle_put(fw_ssoled);
fwnode_handle_put(fwnode_child);
/* unregister leds */
list_for_each(p, &priv->led_list) {
led = list_entry(p, struct sso_led, list);
list_for_each_entry(led, &priv->led_list, list)
sso_led_shutdown(led);
}

return -EINVAL;
return ret;
}

static int sso_led_dt_parse(struct sso_led_priv *priv)
Expand All @@ -731,6 +731,7 @@ static int sso_led_dt_parse(struct sso_led_priv *priv)
fw_ssoled = fwnode_get_named_child_node(fwnode, "ssoled");
if (fw_ssoled) {
ret = __sso_led_dt_parse(priv, fw_ssoled);
fwnode_handle_put(fw_ssoled);
if (ret)
return ret;
}
Expand Down Expand Up @@ -841,14 +842,12 @@ static int intel_sso_led_probe(struct platform_device *pdev)
static int intel_sso_led_remove(struct platform_device *pdev)
{
struct sso_led_priv *priv;
struct list_head *pos, *n;
struct sso_led *led;
struct sso_led *led, *n;

priv = platform_get_drvdata(pdev);

list_for_each_safe(pos, n, &priv->led_list) {
list_del(pos);
led = list_entry(pos, struct sso_led, list);
list_for_each_entry_safe(led, n, &priv->led_list, list) {
list_del(&led->list);
sso_led_shutdown(led);
}

Expand Down
Loading

0 comments on commit a998a62

Please sign in to comment.