xref: /linux/Documentation/devicetree/bindings/leds/leds-consumer.yaml (revision ec2e0fb07d789976c601bec19ecced7a501c3705)
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
7title: Common leds consumer
8
9maintainers:
10  - Aleksandrs Vinarskis <alex@vinarskis.com>
11
12description:
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
20select: true
21
22properties:
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
37additionalProperties: true
38
39examples:
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...
68