2009-01-11 01:26:01 +08:00
|
|
|
LEDs connected to GPIO lines
|
2008-07-05 00:53:28 +08:00
|
|
|
|
|
|
|
Required properties:
|
2009-01-11 01:26:01 +08:00
|
|
|
- compatible : should be "gpio-leds".
|
|
|
|
|
|
|
|
Each LED is represented as a sub-node of the gpio-leds device. Each
|
|
|
|
node's name represents the name of the corresponding LED.
|
|
|
|
|
|
|
|
LED sub-node properties:
|
2012-02-07 01:29:15 +08:00
|
|
|
- gpios : Should specify the LED's GPIO, see "gpios property" in
|
2012-09-11 11:21:23 +08:00
|
|
|
Documentation/devicetree/bindings/gpio/gpio.txt. Active low LEDs should be
|
2012-02-07 01:29:15 +08:00
|
|
|
indicated using flags in the GPIO specifier.
|
2012-11-16 05:51:56 +08:00
|
|
|
- label : (optional)
|
|
|
|
see Documentation/devicetree/bindings/leds/common.txt
|
|
|
|
- linux,default-trigger : (optional)
|
|
|
|
see Documentation/devicetree/bindings/leds/common.txt
|
leds: Add options to have GPIO LEDs start on or keep their state
There already is a "default-on" trigger but there are problems with it.
For one, it's a inefficient way to do it and requires led trigger support
to be compiled in.
But the real reason is that is produces a glitch on the LED. The GPIO is
allocate with the LED *off*, then *later* when the trigger runs it is
turned back on. If the LED was already on via the GPIO's reset default or
action of the firmware, this produces a glitch where the LED goes from on
to off to on. While normally this is fast enough that it wouldn't be
noticeable to a human observer, there are still serious problems.
One is that there may be something else on the GPIO line, like a hardware
alarm or watchdog, that is fast enough to notice the glitch.
Another is that the kernel may panic before the LED is turned back on, thus
hanging with the LED in the wrong state. This is not just speculation, but
actually happened to me with an embedded system that has an LED which
should turn off when the kernel finishes booting, which was left in the
incorrect state due to a bug in the OF LED binding code.
We also let GPIO LEDs get their initial value from whatever the current
state of the GPIO line is. On some systems the LEDs are put into some
state by the firmware or hardware before Linux boots, and it is desired to
have them keep this state which is otherwise unknown to Linux.
This requires that the underlying GPIO driver support reading the value of
output GPIOs. Some drivers support this and some do not.
The platform device binding gains a field in the platform data
"default_state" that controls this. There are three constants defined to
select from on, off, or keeping the current state. The OpenFirmware
binding uses a property named "default-state" that can be set to "on",
"off", or "keep". The default if the property isn't present is off.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Sean MacLennan <smaclennan@pikatech.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2009-05-13 06:33:12 +08:00
|
|
|
- default-state: (optional) 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 set the to same value, then no
|
|
|
|
glitch should be produced where the LED momentarily turns off (or
|
|
|
|
on). The "keep" setting will keep the LED at whatever its current
|
|
|
|
state is, without producing a glitch. The default is off if this
|
|
|
|
property is not present.
|
2008-07-05 00:53:28 +08:00
|
|
|
|
2009-01-11 01:26:01 +08:00
|
|
|
Examples:
|
2008-07-05 00:53:28 +08:00
|
|
|
|
2009-01-11 01:26:01 +08:00
|
|
|
leds {
|
|
|
|
compatible = "gpio-leds";
|
|
|
|
hdd {
|
|
|
|
label = "IDE Activity";
|
|
|
|
gpios = <&mcu_pio 0 1>; /* Active low */
|
|
|
|
linux,default-trigger = "ide-disk";
|
|
|
|
};
|
leds: Add options to have GPIO LEDs start on or keep their state
There already is a "default-on" trigger but there are problems with it.
For one, it's a inefficient way to do it and requires led trigger support
to be compiled in.
But the real reason is that is produces a glitch on the LED. The GPIO is
allocate with the LED *off*, then *later* when the trigger runs it is
turned back on. If the LED was already on via the GPIO's reset default or
action of the firmware, this produces a glitch where the LED goes from on
to off to on. While normally this is fast enough that it wouldn't be
noticeable to a human observer, there are still serious problems.
One is that there may be something else on the GPIO line, like a hardware
alarm or watchdog, that is fast enough to notice the glitch.
Another is that the kernel may panic before the LED is turned back on, thus
hanging with the LED in the wrong state. This is not just speculation, but
actually happened to me with an embedded system that has an LED which
should turn off when the kernel finishes booting, which was left in the
incorrect state due to a bug in the OF LED binding code.
We also let GPIO LEDs get their initial value from whatever the current
state of the GPIO line is. On some systems the LEDs are put into some
state by the firmware or hardware before Linux boots, and it is desired to
have them keep this state which is otherwise unknown to Linux.
This requires that the underlying GPIO driver support reading the value of
output GPIOs. Some drivers support this and some do not.
The platform device binding gains a field in the platform data
"default_state" that controls this. There are three constants defined to
select from on, off, or keeping the current state. The OpenFirmware
binding uses a property named "default-state" that can be set to "on",
"off", or "keep". The default if the property isn't present is off.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Sean MacLennan <smaclennan@pikatech.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2009-05-13 06:33:12 +08:00
|
|
|
|
|
|
|
fault {
|
|
|
|
gpios = <&mcu_pio 1 0>;
|
|
|
|
/* Keep LED on if BIOS detected hardware fault */
|
|
|
|
default-state = "keep";
|
|
|
|
};
|
2008-07-05 00:53:28 +08:00
|
|
|
};
|
2009-01-11 01:26:01 +08:00
|
|
|
|
|
|
|
run-control {
|
|
|
|
compatible = "gpio-leds";
|
|
|
|
red {
|
|
|
|
gpios = <&mpc8572 6 0>;
|
leds: Add options to have GPIO LEDs start on or keep their state
There already is a "default-on" trigger but there are problems with it.
For one, it's a inefficient way to do it and requires led trigger support
to be compiled in.
But the real reason is that is produces a glitch on the LED. The GPIO is
allocate with the LED *off*, then *later* when the trigger runs it is
turned back on. If the LED was already on via the GPIO's reset default or
action of the firmware, this produces a glitch where the LED goes from on
to off to on. While normally this is fast enough that it wouldn't be
noticeable to a human observer, there are still serious problems.
One is that there may be something else on the GPIO line, like a hardware
alarm or watchdog, that is fast enough to notice the glitch.
Another is that the kernel may panic before the LED is turned back on, thus
hanging with the LED in the wrong state. This is not just speculation, but
actually happened to me with an embedded system that has an LED which
should turn off when the kernel finishes booting, which was left in the
incorrect state due to a bug in the OF LED binding code.
We also let GPIO LEDs get their initial value from whatever the current
state of the GPIO line is. On some systems the LEDs are put into some
state by the firmware or hardware before Linux boots, and it is desired to
have them keep this state which is otherwise unknown to Linux.
This requires that the underlying GPIO driver support reading the value of
output GPIOs. Some drivers support this and some do not.
The platform device binding gains a field in the platform data
"default_state" that controls this. There are three constants defined to
select from on, off, or keeping the current state. The OpenFirmware
binding uses a property named "default-state" that can be set to "on",
"off", or "keep". The default if the property isn't present is off.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Sean MacLennan <smaclennan@pikatech.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2009-05-13 06:33:12 +08:00
|
|
|
default-state = "off";
|
2009-01-11 01:26:01 +08:00
|
|
|
};
|
|
|
|
green {
|
|
|
|
gpios = <&mpc8572 7 0>;
|
leds: Add options to have GPIO LEDs start on or keep their state
There already is a "default-on" trigger but there are problems with it.
For one, it's a inefficient way to do it and requires led trigger support
to be compiled in.
But the real reason is that is produces a glitch on the LED. The GPIO is
allocate with the LED *off*, then *later* when the trigger runs it is
turned back on. If the LED was already on via the GPIO's reset default or
action of the firmware, this produces a glitch where the LED goes from on
to off to on. While normally this is fast enough that it wouldn't be
noticeable to a human observer, there are still serious problems.
One is that there may be something else on the GPIO line, like a hardware
alarm or watchdog, that is fast enough to notice the glitch.
Another is that the kernel may panic before the LED is turned back on, thus
hanging with the LED in the wrong state. This is not just speculation, but
actually happened to me with an embedded system that has an LED which
should turn off when the kernel finishes booting, which was left in the
incorrect state due to a bug in the OF LED binding code.
We also let GPIO LEDs get their initial value from whatever the current
state of the GPIO line is. On some systems the LEDs are put into some
state by the firmware or hardware before Linux boots, and it is desired to
have them keep this state which is otherwise unknown to Linux.
This requires that the underlying GPIO driver support reading the value of
output GPIOs. Some drivers support this and some do not.
The platform device binding gains a field in the platform data
"default_state" that controls this. There are three constants defined to
select from on, off, or keeping the current state. The OpenFirmware
binding uses a property named "default-state" that can be set to "on",
"off", or "keep". The default if the property isn't present is off.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Sean MacLennan <smaclennan@pikatech.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
2009-05-13 06:33:12 +08:00
|
|
|
default-state = "on";
|
2009-01-11 01:26:01 +08:00
|
|
|
};
|
2012-06-24 02:41:17 +08:00
|
|
|
};
|