Skip to content

Commit 9243f29

Browse files
committed
dt-bindings: leds: Convert gpio-leds to DT schema
Convert the gpio-leds binding to DT schema format. Drop the last example as the node name collides when built, and it doesn't add much value. Cc: Pavel Machek <[email protected]> Cc: Dan Murphy <[email protected]> Acked-by: Jacek Anaszewski <[email protected]> Signed-off-by: Rob Herring <[email protected]>
1 parent 24a71af commit 9243f29

File tree

2 files changed

+86
-75
lines changed

2 files changed

+86
-75
lines changed

Documentation/devicetree/bindings/leds/leds-gpio.txt

Lines changed: 0 additions & 75 deletions
This file was deleted.
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/leds/leds-gpio.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: LEDs connected to GPIO lines
8+
9+
maintainers:
10+
- Jacek Anaszewski <[email protected]>
11+
- Pavel Machek <[email protected]>
12+
13+
description:
14+
Each LED is represented as a sub-node of the gpio-leds device. Each
15+
node's name represents the name of the corresponding LED.
16+
17+
properties:
18+
compatible:
19+
const: gpio-leds
20+
21+
patternProperties:
22+
# The first form is preferred, but fall back to just 'led' anywhere in the
23+
# node name to at least catch some child nodes.
24+
"(^led-[0-9a-f]$|led)":
25+
type: object
26+
27+
allOf:
28+
- $ref: common.yaml#
29+
30+
properties:
31+
gpios:
32+
maxItems: 1
33+
34+
retain-state-suspended:
35+
description:
36+
The suspend state can be retained.Such as charge-led gpio.
37+
type: boolean
38+
39+
retain-state-shutdown:
40+
description:
41+
Retain the state of the LED on shutdown. Useful in BMC systems, for
42+
example when the BMC is rebooted while the host remains up.
43+
type: boolean
44+
45+
required:
46+
- gpios
47+
48+
additionalProperties: false
49+
50+
examples:
51+
- |
52+
53+
#include <dt-bindings/gpio/gpio.h>
54+
#include <dt-bindings/leds/common.h>
55+
56+
leds {
57+
compatible = "gpio-leds";
58+
led-0 {
59+
gpios = <&mcu_pio 0 GPIO_ACTIVE_LOW>;
60+
linux,default-trigger = "disk-activity";
61+
function = LED_FUNCTION_DISK;
62+
};
63+
64+
led-1 {
65+
gpios = <&mcu_pio 1 GPIO_ACTIVE_HIGH>;
66+
/* Keep LED on if BIOS detected hardware fault */
67+
default-state = "keep";
68+
function = LED_FUNCTION_FAULT;
69+
};
70+
};
71+
72+
run-control {
73+
compatible = "gpio-leds";
74+
led-0 {
75+
gpios = <&mpc8572 6 GPIO_ACTIVE_HIGH>;
76+
color = <LED_COLOR_ID_RED>;
77+
default-state = "off";
78+
};
79+
led-1 {
80+
gpios = <&mpc8572 7 GPIO_ACTIVE_HIGH>;
81+
color = <LED_COLOR_ID_GREEN>;
82+
default-state = "on";
83+
};
84+
};
85+
86+
...

0 commit comments

Comments
 (0)