Skip to content

Commit

Permalink
Merge tag 'leds-for-5.4-rc1' of git://git.kernel.org/pub/scm/linux/ke…
Browse files Browse the repository at this point in the history
…rnel/git/j.anaszewski/linux-leds

Pull LED updates from Jacek Anaszewski:
 "In this cycle we've finally managed to contribute the patch set
  sorting out LED naming issues. Besides that there are many changes
  scattered among various LED class drivers and triggers.

  LED naming related improvements:

   - add new 'function' and 'color' fwnode properties and deprecate
     'label' property which has been frequently abused for conveying
     vendor specific names that have been available in sysfs anyway

   - introduce a set of standard LED_FUNCTION* definitions

   - introduce a set of standard LED_COLOR_ID* definitions

   - add a new {devm_}led_classdev_register_ext() API with the
     capability of automatic LED name composition basing on the
     properties available in the passed fwnode; the function is
     backwards compatible in a sense that it uses 'label' data, if
     present in the fwnode, for creating LED name

   - add tools/leds/get_led_device_info.sh script for retrieving LED
     vendor, product and bus names, if applicable; it also performs
     basic validation of an LED name

   - update following drivers and their DT bindings to use the new LED
     registration API:

        - leds-an30259a, leds-gpio, leds-as3645a, leds-aat1290, leds-cr0014114,
          leds-lm3601x, leds-lm3692x, leds-lp8860, leds-lt3593, leds-sc27xx-blt

  Other LED class improvements:

   - replace {devm_}led_classdev_register() macros with inlines

   - allow to call led_classdev_unregister() unconditionally

   - switch to use fwnode instead of be stuck with OF one

  LED triggers improvements:

   - led-triggers:
        - fix dereferencing of null pointer
        - fix a memory leak bug

   - ledtrig-gpio:
        - GPIO 0 is valid

  Drop superseeded apu2/3 support from leds-apu since for apu2+ a newer,
  more complete driver exists, based on a generic driver for the AMD
  SOCs gpio-controller, supporting LEDs as well other devices:

   - drop profile field from priv data

   - drop iosize field from priv data

   - drop enum_apu_led_platform_types

   - drop superseeded apu2/3 led support

   - add pr_fmt prefix for better log output

   - fix error message on probing failure

  Other misc fixes and improvements to existing LED class drivers:

   - leds-ns2, leds-max77650:
        - add of_node_put() before return

   - leds-pwm, leds-is31fl32xx:
        - use struct_size() helper

   - leds-lm3697, leds-lm36274, leds-lm3532:
        - switch to use fwnode_property_count_uXX()

   - leds-lm3532:
        - fix brightness control for i2c mode
        - change the define for the fs current register
        - fixes for the driver for stability
        - add full scale current configuration
        - dt: Add property for full scale current.
        - avoid potentially unpaired regulator calls
        - move static keyword to the front of declarations
        - fix optional led-max-microamp prop error handling

   - leds-max77650:
        - add of_node_put() before return
        - add MODULE_ALIAS()
        - Switch to fwnode property API

   - leds-as3645a:
        - fix misuse of strlcpy

   - leds-netxbig:
        - add of_node_put() in netxbig_leds_get_of_pdata()
        - remove legacy board-file support

   - leds-is31fl319x:
        - simplify getting the adapter of a client

   - leds-ti-lmu-common:
        - fix coccinelle issue
        - move static keyword to the front of declaration

   - leds-syscon:
        - use resource managed variant of device register

   - leds-ktd2692:
        - fix a typo in the name of a constant

   - leds-lp5562:
        - allow firmware files up to the maximum length

   - leds-an30259a:
        - fix typo

   - leds-pca953x:
        - include the right header"

* tag 'leds-for-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds: (72 commits)
  leds: lm3532: Fix optional led-max-microamp prop error handling
  led: triggers: Fix dereferencing of null pointer
  leds: ti-lmu-common: Move static keyword to the front of declaration
  leds: lm3532: Move static keyword to the front of declarations
  leds: trigger: gpio: GPIO 0 is valid
  leds: pwm: Use struct_size() helper
  leds: is31fl32xx: Use struct_size() helper
  leds: ti-lmu-common: Fix coccinelle issue in TI LMU
  leds: lm3532: Avoid potentially unpaired regulator calls
  leds: syscon: Use resource managed variant of device register
  leds: Replace {devm_}led_classdev_register() macros with inlines
  leds: Allow to call led_classdev_unregister() unconditionally
  leds: lm3532: Add full scale current configuration
  dt: lm3532: Add property for full scale current.
  leds: lm3532: Fixes for the driver for stability
  leds: lm3532: Change the define for the fs current register
  leds: lm3532: Fix brightness control for i2c mode
  leds: Switch to use fwnode instead of be stuck with OF one
  leds: max77650: Switch to fwnode property API
  led: triggers: Fix a memory leak bug
  ...
  • Loading branch information
torvalds committed Sep 18, 2019
2 parents e7345f9 + 6d4faf3 commit 4feaab0
Show file tree
Hide file tree
Showing 97 changed files with 1,484 additions and 999 deletions.
22 changes: 14 additions & 8 deletions Documentation/devicetree/bindings/leds/ams,as3645a.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ ams,input-max-microamp: Maximum flash controller input current. The
Optional properties of the flash child node
===========================================

label : The label of the flash LED.
function : See Documentation/devicetree/bindings/leds/common.txt.
color : See Documentation/devicetree/bindings/leds/common.txt.
label : See Documentation/devicetree/bindings/leds/common.txt (deprecated).


Required properties of the indicator child node (1)
Expand All @@ -52,28 +54,32 @@ led-max-microamp: Maximum indicator current. The allowed values are
Optional properties of the indicator child node
===============================================

label : The label of the indicator LED.
function : See Documentation/devicetree/bindings/leds/common.txt.
color : See Documentation/devicetree/bindings/leds/common.txt.
label : See Documentation/devicetree/bindings/leds/common.txt (deprecated).


Example
=======

#include <dt-bindings/leds/common.h>

as3645a@30 {
#address-cells: 1
#size-cells: 0
#address-cells = <1>;
#size-cells = <0>;
reg = <0x30>;
compatible = "ams,as3645a";
flash@0 {
led@0 {
reg = <0x0>;
flash-timeout-us = <150000>;
flash-max-microamp = <320000>;
led-max-microamp = <60000>;
ams,input-max-microamp = <1750000>;
label = "as3645a:flash";
function = LED_FUNCTION_FLASH;
};
indicator@1 {
led@1 {
reg = <0x1>;
led-max-microamp = <10000>;
label = "as3645a:indicator";
function = LED_FUNCTION_INDICATOR;
};
};
62 changes: 54 additions & 8 deletions Documentation/devicetree/bindings/leds/common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,30 @@ can influence the way of the LED device initialization, the LED components
have to be tightly coupled with the LED device binding. They are represented
by child nodes of the parent LED device binding.


Optional properties for child nodes:
- led-sources : List of device current outputs the LED is connected to. The
outputs are identified by the numbers that must be defined
in the LED device binding documentation.

- function: LED functon. Use one of the LED_FUNCTION_* prefixed definitions
from the header include/dt-bindings/leds/common.h.
If there is no matching LED_FUNCTION available, add a new one.

- color : Color of the LED. Use one of the LED_COLOR_ID_* prefixed definitions
from the header include/dt-bindings/leds/common.h.
If there is no matching LED_COLOR_ID available, add a new one.

- function-enumerator: Integer to be used when more than one instance
of the same function is needed, differing only with
an ordinal number.

- label : The label for this LED. If omitted, the label is taken from the node
name (excluding the unit address). It has to uniquely identify
a device, i.e. no other LED class device can be assigned the same
label.
label. This property is deprecated - use 'function' and 'color'
properties instead. function-enumerator has no effect when this
property is present.

- default-state : The initial state of the LED. Valid values are "on", "off",
and "keep". If the LED is already on or off and the default-state property is
Expand Down Expand Up @@ -99,29 +115,59 @@ Required properties for trigger source:

* Examples

gpio-leds {
#include <dt-bindings/leds/common.h>

led-controller@0 {
compatible = "gpio-leds";

system-status {
label = "Status";
led0 {
function = LED_FUNCTION_STATUS;
linux,default-trigger = "heartbeat";
gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>;
};

usb {
led1 {
function = LED_FUNCTION_USB;
gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
trigger-sources = <&ohci_port1>, <&ehci_port1>;
};
};

max77693-led {
led-controller@0 {
compatible = "maxim,max77693-led";

camera-flash {
label = "Flash";
led {
function = LED_FUNCTION_FLASH;
color = <LED_COLOR_ID_WHITE>;
led-sources = <0>, <1>;
led-max-microamp = <50000>;
flash-max-microamp = <320000>;
flash-max-timeout-us = <500000>;
};
};

led-controller@30 {
compatible = "panasonic,an30259a";
reg = <0x30>;
#address-cells = <1>;
#size-cells = <0>;

led@1 {
reg = <1>;
linux,default-trigger = "heartbeat";
function = LED_FUNCTION_INDICATOR;
function-enumerator = <1>;
};

led@2 {
reg = <2>;
function = LED_FUNCTION_INDICATOR;
function-enumerator = <2>;
};

led@3 {
reg = <3>;
function = LED_FUNCTION_INDICATOR;
function-enumerator = <3>;
};
};
12 changes: 8 additions & 4 deletions Documentation/devicetree/bindings/leds/leds-aat1290.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,18 @@ Required properties of the LED child node:
formula: T = 8.82 * 10^9 * Ct.

Optional properties of the LED child node:
- label : see Documentation/devicetree/bindings/leds/common.txt
- function : see Documentation/devicetree/bindings/leds/common.txt
- color : see Documentation/devicetree/bindings/leds/common.txt
- label : see Documentation/devicetree/bindings/leds/common.txt (deprecated)

Example (by Ct = 220nF, Rset = 160kohm and exynos4412-trats2 board with
a switch that allows for routing strobe signal either from the host or from
the camera sensor):

#include "exynos4412.dtsi"
#include <dt-bindings/leds/common.h>

aat1290 {
led-controller {
compatible = "skyworks,aat1290";
flen-gpios = <&gpj1 1 GPIO_ACTIVE_HIGH>;
enset-gpios = <&gpj1 2 GPIO_ACTIVE_HIGH>;
Expand All @@ -50,8 +53,9 @@ aat1290 {
pinctrl-1 = <&camera_flash_host>;
pinctrl-2 = <&camera_flash_isp>;

camera_flash: flash-led {
label = "aat1290-flash";
camera_flash: led {
function = LED_FUNCTION_FLASH;
color = <LED_COLOR_ID_WHITE>;
led-max-microamp = <520833>;
flash-max-microamp = <1012500>;
flash-max-timeout-us = <1940000>;
Expand Down
22 changes: 17 additions & 5 deletions Documentation/devicetree/bindings/leds/leds-an30259a.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,19 @@ Required sub-node properties:
- reg: Pin that the LED is connected to. Must be 1, 2, or 3.

Optional sub-node properties:
- label: see Documentation/devicetree/bindings/leds/common.txt
- linux,default-trigger: see Documentation/devicetree/bindings/leds/common.txt
- function :
see Documentation/devicetree/bindings/leds/common.txt
- color :
see Documentation/devicetree/bindings/leds/common.txt
- label :
see Documentation/devicetree/bindings/leds/common.txt (deprecated)
- linux,default-trigger :
see Documentation/devicetree/bindings/leds/common.txt

Example:

#include <dt-bindings/leds/common.h>

led-controller@30 {
compatible = "panasonic,an30259a";
reg = <0x30>;
Expand All @@ -28,16 +37,19 @@ led-controller@30 {
led@1 {
reg = <1>;
linux,default-trigger = "heartbeat";
label = "red:indicator";
function = LED_FUNCTION_INDICATOR;
color = <LED_COLOR_ID_RED>;
};

led@2 {
reg = <2>;
label = "green:indicator";
function = LED_FUNCTION_INDICATOR;
color = <LED_COLOR_ID_GREEN>;
};

led@3 {
reg = <3>;
label = "blue:indicator";
function = LED_FUNCTION_INDICATOR;
color = <LED_COLOR_ID_BLUE>;
};
};
26 changes: 19 additions & 7 deletions Documentation/devicetree/bindings/leds/leds-cr0014114.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,20 @@ Property rules described in Documentation/devicetree/bindings/spi/spi-bus.txt
apply. In particular, "reg" and "spi-max-frequency" properties must be given.

LED sub-node properties:
- label :
- function :
see Documentation/devicetree/bindings/leds/common.txt
- color :
see Documentation/devicetree/bindings/leds/common.txt
- label :
see Documentation/devicetree/bindings/leds/common.txt (deprecated)
- linux,default-trigger : (optional)
see Documentation/devicetree/bindings/leds/common.txt

Example
-------

#include <dt-bindings/leds/common.h>

led-controller@0 {
compatible = "crane,cr0014114";
reg = <0>;
Expand All @@ -28,27 +34,33 @@ led-controller@0 {

led@0 {
reg = <0>;
label = "red:coin";
function = "coin";
color = <LED_COLOR_ID_RED>;
};
led@1 {
reg = <1>;
label = "green:coin";
function = "coin";
color = <LED_COLOR_ID_GREEN>;
};
led@2 {
reg = <2>;
label = "blue:coin";
function = "coin";
color = <LED_COLOR_ID_BLUE>;
};
led@3 {
reg = <3>;
label = "red:bill";
function = "bill";
color = <LED_COLOR_ID_RED>;
};
led@4 {
reg = <4>;
label = "green:bill";
function = "bill";
color = <LED_COLOR_ID_GREEN>;
};
led@5 {
reg = <5>;
label = "blue:bill";
function = "bill";
color = <LED_COLOR_ID_BLUE>;
};
...
};
23 changes: 16 additions & 7 deletions Documentation/devicetree/bindings/leds/leds-gpio.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ LED sub-node properties:
- gpios : Should specify the LED's GPIO, see "gpios property" in
Documentation/devicetree/bindings/gpio/gpio.txt. Active low LEDs should be
indicated using flags in the GPIO specifier.
- label : (optional)
- function : (optional)
see Documentation/devicetree/bindings/leds/common.txt
- color : (optional)
see Documentation/devicetree/bindings/leds/common.txt
- label : (optional)
see Documentation/devicetree/bindings/leds/common.txt (deprecated)
- linux,default-trigger : (optional)
see Documentation/devicetree/bindings/leds/common.txt
- default-state: (optional) The initial state of the LED.
Expand All @@ -27,40 +31,45 @@ LED sub-node properties:
Examples:

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/leds/common.h>

leds {
compatible = "gpio-leds";
hdd {
label = "Disk Activity";
led0 {
gpios = <&mcu_pio 0 GPIO_ACTIVE_LOW>;
linux,default-trigger = "disk-activity";
function = LED_FUNCTION_DISK;
};

fault {
led1 {
gpios = <&mcu_pio 1 GPIO_ACTIVE_HIGH>;
/* Keep LED on if BIOS detected hardware fault */
default-state = "keep";
function = LED_FUNCTION_FAULT;
};
};

run-control {
compatible = "gpio-leds";
red {
led0 {
gpios = <&mpc8572 6 GPIO_ACTIVE_HIGH>;
color = <LED_COLOR_ID_RED>;
default-state = "off";
};
green {
led1 {
gpios = <&mpc8572 7 GPIO_ACTIVE_HIGH>;
color = <LED_COLOR_ID_GREEN>;
default-state = "on";
};
};

leds {
compatible = "gpio-leds";

charger-led {
led0 {
gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "max8903-charger-charging";
retain-state-suspended;
function = LED_FUNCTION_CHARGE;
};
};
4 changes: 4 additions & 0 deletions Documentation/devicetree/bindings/leds/leds-lm3532.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ Optional LED child properties:
- label : see Documentation/devicetree/bindings/leds/common.txt
- linux,default-trigger :
see Documentation/devicetree/bindings/leds/common.txt
- led-max-microamp : Defines the full scale current value for each control
bank. The range is from 5000uA-29800uA in increments
of 800uA.

Example:
led-controller@38 {
Expand All @@ -85,6 +88,7 @@ led-controller@38 {
reg = <0>;
led-sources = <2>;
ti,led-mode = <1>;
led-max-microamp = <21800>;
label = ":backlight";
linux,default-trigger = "backlight";
};
Expand Down
10 changes: 8 additions & 2 deletions Documentation/devicetree/bindings/leds/leds-lm3601x.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,14 @@ Required properties for flash LED child nodes:
- led-max-microamp : Range from 2.4mA - 376mA

Optional child properties:
- label : see Documentation/devicetree/bindings/leds/common.txt
- function : see Documentation/devicetree/bindings/leds/common.txt
- color : see Documentation/devicetree/bindings/leds/common.txt
- label : see Documentation/devicetree/bindings/leds/common.txt (deprecated)

Example:

#include <dt-bindings/leds/common.h>

led-controller@64 {
compatible = "ti,lm36010";
#address-cells = <1>;
Expand All @@ -33,7 +38,8 @@ led-controller@64 {

led@0 {
reg = <1>;
label = "white:torch";
function = LED_FUNCTION_TORCH;
color = <LED_COLOR_ID_WHITE>;
led-max-microamp = <376000>;
flash-max-microamp = <1500000>;
flash-max-timeout-us = <1600000>;
Expand Down
Loading

0 comments on commit 4feaab0

Please sign in to comment.