Skip to content

Commit

Permalink
Merge tag 'leds-5.11-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:
 "Small cleanups/fixes mostly thanks to Marek, nothing major made it in
  this time"

* tag 'leds-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds:
  leds: turris-omnia: check for LED_COLOR_ID_RGB instead LED_COLOR_ID_MULTI
  leds: turris-omnia: fix checkpatch warning
  leds: turris-omnia: wrap to 80 columns
  leds: turris-omnia: use constants instead of macros for color command
  dt-bindings: leds: Convert pwm to yaml
  leds: lp50xx: Fix an error handling path in 'lp50xx_probe_dt()'
  leds: netxbig: add missing put_device() call in netxbig_leds_get_of_pdata()
  Documentation: leds: remove invalidated information
  • Loading branch information
Linus Torvalds committed Dec 16, 2020
2 parents f67d662 + 98650b0 commit 945433b
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 117 deletions.
50 changes: 0 additions & 50 deletions Documentation/devicetree/bindings/leds/leds-pwm.txt

This file was deleted.

70 changes: 70 additions & 0 deletions Documentation/devicetree/bindings/leds/leds-pwm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/leds/leds-pwm.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: LEDs connected to PWM

maintainers:
- Pavel Machek <pavel@ucw.cz>

description:
Each LED is represented as a sub-node of the pwm-leds device. Each
node's name represents the name of the corresponding LED.

properties:
compatible:
const: pwm-leds

patternProperties:
"^led(-[0-9a-f]+)?$":
type: object

$ref: common.yaml#

properties:
pwms:
maxItems: 1

pwm-names: true

max-brightness:
description:
Maximum brightness possible for the LED
$ref: /schemas/types.yaml#/definitions/uint32

active-low:
description:
For PWMs where the LED is wired to supply rather than ground.
type: boolean

required:
- pwms
- max-brightness

additionalProperties: false

examples:
- |
#include <dt-bindings/leds/common.h>
led-controller {
compatible = "pwm-leds";
led-1 {
label = "omap4::keypad";
pwms = <&twl_pwm 0 7812500>;
max-brightness = <127>;
};
led-2 {
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_CHARGING;
pwms = <&twl_pwmled 0 7812500>;
max-brightness = <255>;
};
};
...
10 changes: 0 additions & 10 deletions Documentation/leds/leds-class.rst
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,3 @@ The LED Trigger core cannot be a module as the simple trigger functions
would cause nightmare dependency issues. I see this as a minor issue
compared to the benefits the simple trigger functionality brings. The
rest of the LED subsystem can be modular.


Future Development
==================

At the moment, a trigger can't be created specifically for a single LED.
There are a number of cases where a trigger might only be mappable to a
particular LED (ACPI?). The addition of triggers provided by the LED driver
should cover this option and be possible to add without breaking the
current interface.
6 changes: 4 additions & 2 deletions drivers/leds/leds-lp50xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,10 @@ static int lp50xx_probe_dt(struct lp50xx *priv)
*/
mc_led_info = devm_kcalloc(priv->dev, LP50XX_LEDS_PER_MODULE,
sizeof(*mc_led_info), GFP_KERNEL);
if (!mc_led_info)
return -ENOMEM;
if (!mc_led_info) {
ret = -ENOMEM;
goto child_out;
}

fwnode_for_each_child_node(child, led_node) {
ret = fwnode_property_read_u32(led_node, "color",
Expand Down
35 changes: 24 additions & 11 deletions drivers/leds/leds-netxbig.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,31 +448,39 @@ static int netxbig_leds_get_of_pdata(struct device *dev,
gpio_ext = devm_kzalloc(dev, sizeof(*gpio_ext), GFP_KERNEL);
if (!gpio_ext) {
of_node_put(gpio_ext_np);
return -ENOMEM;
ret = -ENOMEM;
goto put_device;
}
ret = netxbig_gpio_ext_get(dev, gpio_ext_dev, gpio_ext);
of_node_put(gpio_ext_np);
if (ret)
return ret;
goto put_device;
pdata->gpio_ext = gpio_ext;

/* Timers (optional) */
ret = of_property_count_u32_elems(np, "timers");
if (ret > 0) {
if (ret % 3)
return -EINVAL;
if (ret % 3) {
ret = -EINVAL;
goto put_device;
}

num_timers = ret / 3;
timers = devm_kcalloc(dev, num_timers, sizeof(*timers),
GFP_KERNEL);
if (!timers)
return -ENOMEM;
if (!timers) {
ret = -ENOMEM;
goto put_device;
}
for (i = 0; i < num_timers; i++) {
u32 tmp;

of_property_read_u32_index(np, "timers", 3 * i,
&timers[i].mode);
if (timers[i].mode >= NETXBIG_LED_MODE_NUM)
return -EINVAL;
if (timers[i].mode >= NETXBIG_LED_MODE_NUM) {
ret = -EINVAL;
goto put_device;
}
of_property_read_u32_index(np, "timers",
3 * i + 1, &tmp);
timers[i].delay_on = tmp;
Expand All @@ -488,12 +496,15 @@ static int netxbig_leds_get_of_pdata(struct device *dev,
num_leds = of_get_available_child_count(np);
if (!num_leds) {
dev_err(dev, "No LED subnodes found in DT\n");
return -ENODEV;
ret = -ENODEV;
goto put_device;
}

leds = devm_kcalloc(dev, num_leds, sizeof(*leds), GFP_KERNEL);
if (!leds)
return -ENOMEM;
if (!leds) {
ret = -ENOMEM;
goto put_device;
}

led = leds;
for_each_available_child_of_node(np, child) {
Expand Down Expand Up @@ -574,6 +585,8 @@ static int netxbig_leds_get_of_pdata(struct device *dev,

err_node_put:
of_node_put(child);
put_device:
put_device(gpio_ext_dev);
return ret;
}

Expand Down
Loading

0 comments on commit 945433b

Please sign in to comment.