Skip to content

Commit 3f5df63

Browse files
alexVinarskislag-linaro
authored andcommitted
dt-bindings: leds: Add generic LED consumer documentation
Introduce common generic led consumer binding, where consumer defines led(s) by phandle, as opposed to trigger-source binding where the trigger source is defined in led itself. Add already used in some schemas 'leds' parameter which expects phandle-array. Additionally, introduce 'led-names' which could be used by consumers to map LED devices to their respective functions. Signed-off-by: Aleksandrs Vinarskis <[email protected]> Reviewed-by: "Rob Herring (Arm)" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lee Jones <[email protected]>
1 parent 96e048f commit 3f5df63

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/leds/leds-consumer.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Common leds consumer
8+
9+
maintainers:
10+
- Aleksandrs Vinarskis <[email protected]>
11+
12+
description:
13+
Some LED defined in DT are required by other DT consumers, for example
14+
v4l2 subnode may require privacy or flash LED. Unlike trigger-source
15+
approach which is typically used as 'soft' binding, referencing LED
16+
devices by phandle makes things simpler when 'hard' binding is desired.
17+
18+
Document LED properties that its consumers may define.
19+
20+
select: true
21+
22+
properties:
23+
leds:
24+
oneOf:
25+
- type: object
26+
- $ref: /schemas/types.yaml#/definitions/phandle-array
27+
description:
28+
A list of LED device(s) required by a particular consumer.
29+
items:
30+
maxItems: 1
31+
32+
led-names:
33+
description:
34+
A list of device name(s). Used to map LED devices to their respective
35+
functions, when consumer requires more than one LED.
36+
37+
additionalProperties: true
38+
39+
examples:
40+
- |
41+
#include <dt-bindings/gpio/gpio.h>
42+
#include <dt-bindings/leds/common.h>
43+
44+
leds {
45+
compatible = "gpio-leds";
46+
47+
privacy_led: privacy-led {
48+
color = <LED_COLOR_ID_RED>;
49+
default-state = "off";
50+
function = LED_FUNCTION_INDICATOR;
51+
gpios = <&tlmm 110 GPIO_ACTIVE_HIGH>;
52+
};
53+
};
54+
55+
i2c {
56+
#address-cells = <1>;
57+
#size-cells = <0>;
58+
59+
v4l2_node: camera@36 {
60+
reg = <0x36>;
61+
62+
leds = <&privacy_led>;
63+
led-names = "privacy";
64+
};
65+
};
66+
67+
...

0 commit comments

Comments
 (0)