mirror of
https://github.com/armbian/linux-cix.git
synced 2026-01-06 12:30:45 -08:00
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
...
This commit is contained in:
@@ -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;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -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>;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -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>;
|
||||
|
||||
@@ -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>;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -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>;
|
||||
};
|
||||
...
|
||||
};
|
||||
|
||||
@@ -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.
|
||||
@@ -27,30 +31,34 @@ 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";
|
||||
};
|
||||
};
|
||||
@@ -58,9 +66,10 @@ run-control {
|
||||
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;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -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 {
|
||||
@@ -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";
|
||||
};
|
||||
|
||||
@@ -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>;
|
||||
@@ -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>;
|
||||
|
||||
@@ -26,12 +26,16 @@ Required child properties:
|
||||
3 - Will enable the LED3 sync (LM36923 only)
|
||||
|
||||
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)
|
||||
- linux,default-trigger :
|
||||
see Documentation/devicetree/bindings/leds/common.txt
|
||||
|
||||
Example:
|
||||
|
||||
#include <dt-bindings/leds/common.h>
|
||||
|
||||
led-controller@36 {
|
||||
compatible = "ti,lm3692x";
|
||||
reg = <0x36>;
|
||||
@@ -43,7 +47,8 @@ led-controller@36 {
|
||||
|
||||
led@0 {
|
||||
reg = <0>;
|
||||
label = "white:backlight_cluster";
|
||||
function = LED_FUNCTION_BACKLIGHT;
|
||||
color = <LED_COLOR_ID_WHITE>;
|
||||
linux,default-trigger = "backlight";
|
||||
};
|
||||
}
|
||||
|
||||
@@ -20,12 +20,16 @@ Required child properties:
|
||||
- reg : 0
|
||||
|
||||
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)
|
||||
- linux,default-trigger :
|
||||
see Documentation/devicetree/bindings/leds/common.txt
|
||||
|
||||
Example:
|
||||
|
||||
#include <dt-bindings/leds/common.h>
|
||||
|
||||
led-controller@2d {
|
||||
compatible = "ti,lp8860";
|
||||
#address-cells = <1>;
|
||||
@@ -36,7 +40,8 @@ led-controller@2d {
|
||||
|
||||
led@0 {
|
||||
reg = <0>;
|
||||
label = "white:backlight";
|
||||
function = LED_FUNCTION_BACKLIGHT;
|
||||
color = <LED_COLOR_ID_WHITE>;
|
||||
linux,default-trigger = "backlight";
|
||||
};
|
||||
}
|
||||
|
||||
@@ -9,8 +9,10 @@ The hardware supports only one LED. The properties of this LED are
|
||||
configured in a sub-node in the device node.
|
||||
|
||||
Optional sub-node properties:
|
||||
- label: A label for the LED. If none is given, the LED will be
|
||||
named "lt3595::".
|
||||
- function: See Documentation/devicetree/bindings/leds/common.txt
|
||||
- color: See Documentation/devicetree/bindings/leds/common.txt
|
||||
- label: A label for the LED. If none is given, the LED will be
|
||||
named "lt3595::" (deprecated)
|
||||
- linux,default-trigger: The default trigger for the LED.
|
||||
See Documentation/devicetree/bindings/leds/common.txt
|
||||
- default-state: The initial state of the LED.
|
||||
@@ -21,12 +23,15 @@ be handled by its own device node.
|
||||
|
||||
Example:
|
||||
|
||||
#include <dt-bindings/leds/common.h>
|
||||
|
||||
led-controller {
|
||||
compatible = "lltc,lt3593";
|
||||
lltc,ctrl-gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
|
||||
|
||||
led {
|
||||
label = "white:backlight";
|
||||
function = LED_FUNCTION_BACKLIGHT;
|
||||
color = <LED_COLOR_ID_WHITE>;
|
||||
default-state = "on";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -14,7 +14,9 @@ Required child properties:
|
||||
- reg: Port this LED is connected to.
|
||||
|
||||
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).
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -25,17 +27,17 @@ led-controller@200 {
|
||||
reg = <0x200>;
|
||||
|
||||
led@0 {
|
||||
label = "red";
|
||||
color = <LED_COLOR_ID_RED>;
|
||||
reg = <0x0>;
|
||||
};
|
||||
|
||||
led@1 {
|
||||
label = "green";
|
||||
color = <LED_COLOR_ID_GREEN>;
|
||||
reg = <0x1>;
|
||||
};
|
||||
|
||||
led@2 {
|
||||
label = "blue";
|
||||
color = <LED_COLOR_ID_BLUE>;
|
||||
reg = <0x2>;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -43,9 +43,73 @@ LED Device Naming
|
||||
|
||||
Is currently of the form:
|
||||
|
||||
"devicename:colour:function"
|
||||
"devicename:color:function"
|
||||
|
||||
There have been calls for LED properties such as colour to be exported as
|
||||
- devicename:
|
||||
it should refer to a unique identifier created by the kernel,
|
||||
like e.g. phyN for network devices or inputN for input devices, rather
|
||||
than to the hardware; the information related to the product and the bus
|
||||
to which given device is hooked is available in sysfs and can be
|
||||
retrieved using get_led_device_info.sh script from tools/leds; generally
|
||||
this section is expected mostly for LEDs that are somehow associated with
|
||||
other devices.
|
||||
|
||||
- color:
|
||||
one of LED_COLOR_ID_* definitions from the header
|
||||
include/dt-bindings/leds/common.h.
|
||||
|
||||
- function:
|
||||
one of LED_FUNCTION_* definitions from the header
|
||||
include/dt-bindings/leds/common.h.
|
||||
|
||||
If required color or function is missing, please submit a patch
|
||||
to linux-leds@vger.kernel.org.
|
||||
|
||||
It is possible that more than one LED with the same color and function will
|
||||
be required for given platform, differing only with an ordinal number.
|
||||
In this case it is preferable to just concatenate the predefined LED_FUNCTION_*
|
||||
name with required "-N" suffix in the driver. fwnode based drivers can use
|
||||
function-enumerator property for that and then the concatenation will be handled
|
||||
automatically by the LED core upon LED class device registration.
|
||||
|
||||
LED subsystem has also a protection against name clash, that may occur
|
||||
when LED class device is created by a driver of hot-pluggable device and
|
||||
it doesn't provide unique devicename section. In this case numerical
|
||||
suffix (e.g. "_1", "_2", "_3" etc.) is added to the requested LED class
|
||||
device name.
|
||||
|
||||
There might be still LED class drivers around using vendor or product name
|
||||
for devicename, but this approach is now deprecated as it doesn't convey
|
||||
any added value. Product information can be found in other places in sysfs
|
||||
(see tools/leds/get_led_device_info.sh).
|
||||
|
||||
Examples of proper LED names:
|
||||
|
||||
- "red:disk"
|
||||
- "white:flash"
|
||||
- "red:indicator"
|
||||
- "phy1:green:wlan"
|
||||
- "phy3::wlan"
|
||||
- ":kbd_backlight"
|
||||
- "input5::kbd_backlight"
|
||||
- "input3::numlock"
|
||||
- "input3::scrolllock"
|
||||
- "input3::capslock"
|
||||
- "mmc1::status"
|
||||
- "white:status"
|
||||
|
||||
get_led_device_info.sh script can be used for verifying if the LED name
|
||||
meets the requirements pointed out here. It performs validation of the LED class
|
||||
devicename sections and gives hints on expected value for a section in case
|
||||
the validation fails for it. So far the script supports validation
|
||||
of associations between LEDs and following types of devices:
|
||||
|
||||
- input devices
|
||||
- ieee80211 compliant USB devices
|
||||
|
||||
The script is open to extensions.
|
||||
|
||||
There have been calls for LED properties such as color to be exported as
|
||||
individual led class attributes. As a solution which doesn't incur as much
|
||||
overhead, I suggest these become part of the device name. The naming scheme
|
||||
above leaves scope for further attributes should they be needed. If sections
|
||||
|
||||
@@ -134,22 +134,13 @@ static inline void gizmo_writel(struct tegra_ahb *ahb, u32 value, u32 offset)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_TEGRA_IOMMU_SMMU
|
||||
static int tegra_ahb_match_by_smmu(struct device *dev, const void *data)
|
||||
{
|
||||
struct tegra_ahb *ahb = dev_get_drvdata(dev);
|
||||
const struct device_node *dn = data;
|
||||
|
||||
return (ahb->dev->of_node == dn) ? 1 : 0;
|
||||
}
|
||||
|
||||
int tegra_ahb_enable_smmu(struct device_node *dn)
|
||||
{
|
||||
struct device *dev;
|
||||
u32 val;
|
||||
struct tegra_ahb *ahb;
|
||||
|
||||
dev = driver_find_device(&tegra_ahb_driver.driver, NULL, dn,
|
||||
tegra_ahb_match_by_smmu);
|
||||
dev = driver_find_device_by_of_node(&tegra_ahb_driver.driver, dn);
|
||||
if (!dev)
|
||||
return -EPROBE_DEFER;
|
||||
ahb = dev_get_drvdata(dev);
|
||||
|
||||
@@ -342,30 +342,6 @@ struct device *bus_find_device(struct bus_type *bus,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(bus_find_device);
|
||||
|
||||
static int match_name(struct device *dev, const void *data)
|
||||
{
|
||||
const char *name = data;
|
||||
|
||||
return sysfs_streq(name, dev_name(dev));
|
||||
}
|
||||
|
||||
/**
|
||||
* bus_find_device_by_name - device iterator for locating a particular device of a specific name
|
||||
* @bus: bus type
|
||||
* @start: Device to begin with
|
||||
* @name: name of the device to match
|
||||
*
|
||||
* This is similar to the bus_find_device() function above, but it handles
|
||||
* searching by a name automatically, no need to write another strcmp matching
|
||||
* function.
|
||||
*/
|
||||
struct device *bus_find_device_by_name(struct bus_type *bus,
|
||||
struct device *start, const char *name)
|
||||
{
|
||||
return bus_find_device(bus, start, (void *)name, match_name);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(bus_find_device_by_name);
|
||||
|
||||
/**
|
||||
* subsys_find_device_by_id - find a device with a specific enumeration number
|
||||
* @subsys: subsystem
|
||||
|
||||
@@ -2944,13 +2944,6 @@ struct device *device_create_with_groups(struct class *class,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(device_create_with_groups);
|
||||
|
||||
static int __match_devt(struct device *dev, const void *data)
|
||||
{
|
||||
const dev_t *devt = data;
|
||||
|
||||
return dev->devt == *devt;
|
||||
}
|
||||
|
||||
/**
|
||||
* device_destroy - removes a device that was created with device_create()
|
||||
* @class: pointer to the struct class that this device was registered with
|
||||
@@ -2963,7 +2956,7 @@ void device_destroy(struct class *class, dev_t devt)
|
||||
{
|
||||
struct device *dev;
|
||||
|
||||
dev = class_find_device(class, NULL, &devt, __match_devt);
|
||||
dev = class_find_device_by_devt(class, devt);
|
||||
if (dev) {
|
||||
put_device(dev);
|
||||
device_unregister(dev);
|
||||
@@ -3434,8 +3427,38 @@ void device_set_of_node_from_dev(struct device *dev, const struct device *dev2)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(device_set_of_node_from_dev);
|
||||
|
||||
int device_match_name(struct device *dev, const void *name)
|
||||
{
|
||||
return sysfs_streq(dev_name(dev), name);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(device_match_name);
|
||||
|
||||
int device_match_of_node(struct device *dev, const void *np)
|
||||
{
|
||||
return dev->of_node == np;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(device_match_of_node);
|
||||
|
||||
int device_match_fwnode(struct device *dev, const void *fwnode)
|
||||
{
|
||||
return dev_fwnode(dev) == fwnode;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(device_match_fwnode);
|
||||
|
||||
int device_match_devt(struct device *dev, const void *pdevt)
|
||||
{
|
||||
return dev->devt == *(dev_t *)pdevt;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(device_match_devt);
|
||||
|
||||
int device_match_acpi_dev(struct device *dev, const void *adev)
|
||||
{
|
||||
return ACPI_COMPANION(dev) == adev;
|
||||
}
|
||||
EXPORT_SYMBOL(device_match_acpi_dev);
|
||||
|
||||
int device_match_any(struct device *dev, const void *unused)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(device_match_any);
|
||||
|
||||
@@ -133,19 +133,13 @@ static struct bus_type *generic_match_buses[] = {
|
||||
NULL,
|
||||
};
|
||||
|
||||
static int device_fwnode_match(struct device *dev, const void *fwnode)
|
||||
{
|
||||
return dev_fwnode(dev) == fwnode;
|
||||
}
|
||||
|
||||
static void *device_connection_fwnode_match(struct device_connection *con)
|
||||
{
|
||||
struct bus_type *bus;
|
||||
struct device *dev;
|
||||
|
||||
for (bus = generic_match_buses[0]; bus; bus++) {
|
||||
dev = bus_find_device(bus, NULL, (void *)con->fwnode,
|
||||
device_fwnode_match);
|
||||
dev = bus_find_device_by_fwnode(bus, con->fwnode);
|
||||
if (dev && !strncmp(dev_name(dev), con->id, strlen(con->id)))
|
||||
return dev;
|
||||
|
||||
|
||||
@@ -1202,6 +1202,20 @@ struct bus_type platform_bus_type = {
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(platform_bus_type);
|
||||
|
||||
/**
|
||||
* platform_find_device_by_driver - Find a platform device with a given
|
||||
* driver.
|
||||
* @start: The device to start the search from.
|
||||
* @drv: The device driver to look for.
|
||||
*/
|
||||
struct device *platform_find_device_by_driver(struct device *start,
|
||||
const struct device_driver *drv)
|
||||
{
|
||||
return bus_find_device(&platform_bus_type, start, drv,
|
||||
(void *)platform_match);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(platform_find_device_by_driver);
|
||||
|
||||
int __init platform_bus_init(void)
|
||||
{
|
||||
int error;
|
||||
|
||||
@@ -19,11 +19,6 @@ static struct class *fpga_bridge_class;
|
||||
/* Lock for adding/removing bridges to linked lists*/
|
||||
static spinlock_t bridge_list_lock;
|
||||
|
||||
static int fpga_bridge_of_node_match(struct device *dev, const void *data)
|
||||
{
|
||||
return dev->of_node == data;
|
||||
}
|
||||
|
||||
/**
|
||||
* fpga_bridge_enable - Enable transactions on the bridge
|
||||
*
|
||||
@@ -104,8 +99,7 @@ struct fpga_bridge *of_fpga_bridge_get(struct device_node *np,
|
||||
{
|
||||
struct device *dev;
|
||||
|
||||
dev = class_find_device(fpga_bridge_class, NULL, np,
|
||||
fpga_bridge_of_node_match);
|
||||
dev = class_find_device_by_of_node(fpga_bridge_class, np);
|
||||
if (!dev)
|
||||
return ERR_PTR(-ENODEV);
|
||||
|
||||
|
||||
@@ -482,11 +482,6 @@ struct fpga_manager *fpga_mgr_get(struct device *dev)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(fpga_mgr_get);
|
||||
|
||||
static int fpga_mgr_of_node_match(struct device *dev, const void *data)
|
||||
{
|
||||
return dev->of_node == data;
|
||||
}
|
||||
|
||||
/**
|
||||
* of_fpga_mgr_get - Given a device node, get a reference to a fpga mgr.
|
||||
*
|
||||
@@ -498,8 +493,7 @@ struct fpga_manager *of_fpga_mgr_get(struct device_node *node)
|
||||
{
|
||||
struct device *dev;
|
||||
|
||||
dev = class_find_device(fpga_mgr_class, NULL, node,
|
||||
fpga_mgr_of_node_match);
|
||||
dev = class_find_device_by_of_node(fpga_mgr_class, node);
|
||||
if (!dev)
|
||||
return ERR_PTR(-ENODEV);
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user