Commit 4feaab05 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'leds-for-5.4-rc1' of...

Merge tag 'leds-for-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/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
  ...
parents e7345f92 6d4faf3b
Loading
Loading
Loading
Loading
+14 −8
Original line number Diff line number Diff line
@@ -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)
@@ -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;
		};
	};
+54 −8
Original line number Diff line number Diff line
@@ -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
@@ -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>;
        };
};
+8 −4
Original line number Diff line number Diff line
@@ -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>;
@@ -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>;
+17 −5
Original line number Diff line number Diff line
@@ -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>;
@@ -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>;
	};
};
+19 −7
Original line number Diff line number Diff line
@@ -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>;
@@ -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>;
	};
	...
};
Loading