android_kernel_xiaomi_sm8350/drivers/leds
Trent Piepho ed88bae691 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-06-23 20:21:39 +01:00
..
Kconfig leds: LED driver for National Semiconductor LP3944 Funlight Chip 2009-06-23 20:21:38 +01:00
led-class.c leds: allow led-drivers to use a variable range of brightness values 2009-04-06 16:06:25 +01:00
led-core.c
led-triggers.c leds: Prevent multiple LED triggers with the same name 2009-04-06 16:06:26 +01:00
leds-alix2.c leds: alix-leds2 fixed for Award BIOS 2009-06-23 20:20:34 +01:00
leds-ams-delta.c
leds-atmel-pwm.c
leds-bd2802.c leds: add the sysfs interface into the leds-bd2802 driver for changing wave pattern and led current. 2009-06-23 20:19:10 +01:00
leds-clevo-mail.c
leds-cobalt-qube.c
leds-cobalt-raq.c
leds-da903x.c
leds-dac124s085.c leds: Add dac124s085 driver 2009-04-06 16:06:25 +01:00
leds-fsg.c
leds-gpio.c leds: Add options to have GPIO LEDs start on or keep their state 2009-06-23 20:21:39 +01:00
leds-h1940.c [ARM] S3C24XX: GPIO: Move gpio functions out of <mach/hardware.h> 2009-05-18 16:25:40 +01:00
leds-hp6xx.c
leds-locomo.c
leds-lp3944.c leds: LED driver for National Semiconductor LP3944 Funlight Chip 2009-06-23 20:21:38 +01:00
leds-net48xx.c
leds-pca955x.c
leds-pca9532.c leds: pca9532 - Indent using tabs, not spaces. 2009-06-23 20:21:20 +01:00
leds-pwm.c leds: simple driver for pwm driven LEDs 2009-04-06 16:06:26 +01:00
leds-rb532.c leds: Add rb532 LED driver for the User LED 2009-04-06 16:06:26 +01:00
leds-s3c24xx.c [ARM] S3C24XX: GPIO: Move gpio functions out of <mach/hardware.h> 2009-05-18 16:25:40 +01:00
leds-sunfire.c
leds-wm8350.c
leds-wrap.c
leds.h leds: allow led-drivers to use a variable range of brightness values 2009-04-06 16:06:25 +01:00
ledtrig-backlight.c
ledtrig-default-on.c leds: allow led-drivers to use a variable range of brightness values 2009-04-06 16:06:25 +01:00
ledtrig-gpio.c leds: Add gpio-led trigger 2009-04-06 16:06:26 +01:00
ledtrig-heartbeat.c leds: allow led-drivers to use a variable range of brightness values 2009-04-06 16:06:25 +01:00
ledtrig-ide-disk.c leds: allow led-drivers to use a variable range of brightness values 2009-04-06 16:06:25 +01:00
ledtrig-timer.c leds: allow led-drivers to use a variable range of brightness values 2009-04-06 16:06:25 +01:00
Makefile leds: LED driver for National Semiconductor LP3944 Funlight Chip 2009-06-23 20:21:38 +01:00