led: Backlight trigger for led subsystem
PATCH v3 1/1 led: Backlight trigger for led subsystem
This patch set adds a new led trigger which emulates the backlight
behaviour: the leds are turned off and on each time the display blanks and unblacks.
Since backlights are usually implemented with leds this patch set is useful for those drivers whose manage leds controller used as backlight controller.
The driver simply registers itself into the led subsystem and then the user may get backlight emulation by setting the "backlight" trigger. Moreover a driver, which usually manages more than one led, can use some leds as "led" and the others as "backlights" at user request.
Rodolfo
---
CHANGELOG:
V2 ---> V3:
* Avoid that two consecutive blank commands as follow:
echo 1 > /sys/class/graphics/fb0/blank
echo 1 > /sys/class/graphics/fb0/blank
may vanish unblank led intensity status.
PATCH 1/1 led: add a backlight emulation trigger.
From: Rodolfo Giometti <[email protected]>
This allows LEDs to be controlled as a backlight device: they turn off and on when the display is blanked and unblanked.
--- drivers/leds/Kconfig | 9 +++ drivers/leds/Makefile | 1 + drivers/leds/ledtrig-backlight.c | 110 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 120 insertions(+), 0 deletions(-) create mode 100644 drivers/leds/ledtrig-backlight.c
drivers/leds/Kconfig +9 -0
@@ -199,6 +199,15 @@ config LEDS_TRIGGER_HEARTBEAT load average. If unsure, say Y. +config LEDS_TRIGGER_BACKLIGHT + tristate "LED backlight Trigger" + depends on LEDS_TRIGGERS + help + This allows LEDs to be controlled as a backlight device: they + turn off and on when the display is blanked and unblanked. + + If unsure, say N. + config LEDS_TRIGGER_DEFAULT_ON tristate "LED Default ON Trigger" depends on LEDS_TRIGGERS
drivers/leds/Makefile +1 -0
@@ -28,4 +28,5 @@ obj-$(CONFIG_LEDS_PCA955X) += leds-pca955x.o obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o obj-$(CONFIG_LEDS_TRIGGER_IDE_DISK) += ledtrig-ide-disk.o obj-$(CONFIG_LEDS_TRIGGER_HEARTBEAT) += ledtrig-heartbeat.o +obj-$(CONFIG_LEDS_TRIGGER_BACKLIGHT) += ledtrig-backlight.o obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o
drivers/leds/ledtrig-backlight.c new file +110 -0
110 lines not on this page · raw message
Signature · 1 line
1.5.4.3
Re: [PATCH 1/1] led: add a backlight emulation trigger.
Quoted 4 lines · Rodolfo Giometti
This allows LEDs to be controlled as a backlight device: they turn off and on when the display is blanked and unblanked.
Signed-off-by Rodolfo Giometti <[email protected]>
Added to the LEDs tree, thanks.
Richard
Hi!
Quoted 8 lines
This patch set adds a new led trigger which emulates the backlight
behaviour: the leds are turned off and on each time the display blanks and unblacks.Since backlights are usually implemented with leds this patch set is useful for those drivers whose manage leds controller used as backlight controller.
Quoted 5 lines
The driver simply registers itself into the led subsystem and then the user may get backlight emulation by setting the "backlight" trigger. Moreover a driver, which usually manages more than one led, can use some leds as "led" and the others as "backlights" at user request.
We already have backlight subsystem, it can also handle display brightness. Why not use that?
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 10 lines · Pavel Machek
Hi!
Quoted 8 lines
This patch set adds a new led trigger which emulates the backlight
behaviour: the leds are turned off and on each time the display blanks and unblacks.Since backlights are usually implemented with leds this patch set is useful for those drivers whose manage leds controller used as backlight controller.
Quoted 8 lines
Quoted 5 lines
The driver simply registers itself into the led subsystem and then the user may get backlight emulation by setting the "backlight" trigger. Moreover a driver, which usually manages more than one led, can use some leds as "led" and the others as "backlights" at user request.
We already have backlight subsystem, it can also handle display brightness. Why not use that?
Just to use a led as "led" or as "backlight" at user request. You can do it by using:
echo none > /sys/class/leds/lcd/trigger
echo backlight > /sys/class/leds/lcd/trigger
and the led will work accordingly.
Also a led used as "backlight" is just a normal led (you can set the brightness as a normal led) but it switchs off automatically when the LCD blanks.
Ciao,
Rodolfo
Signature · 4 lines
GNU/Linux Solutions e-mail: [email protected] Linux Device Driver [email protected] Embedded Systems phone: +39 349 2432127 UNIX programming skype: rodolfo.giometti
Quoted 23 lines · Rodolfo Giometti
Quoted 10 lines · Pavel Machek
Hi!
Quoted 8 lines
This patch set adds a new led trigger which emulates the backlight
behaviour: the leds are turned off and on each time the display blanks and unblacks.Since backlights are usually implemented with leds this patch set is useful for those drivers whose manage leds controller used as backlight controller.
Quoted 8 lines
Quoted 5 lines
The driver simply registers itself into the led subsystem and then the user may get backlight emulation by setting the "backlight" trigger. Moreover a driver, which usually manages more than one led, can use some leds as "led" and the others as "backlights" at user request.
We already have backlight subsystem, it can also handle display brightness. Why not use that?
Just to use a led as "led" or as "backlight" at user request. You can do it by using:
Quoted 8 lines
echo none >
/sys/class/leds/lcd/trigger
echo backlight >/sys/class/leds/lcd/triggerand the led will work accordingly.
Also a led used as "backlight" is just a normal led (you can set the brightness as a normal led) but it switchs off automatically when the LCD blanks.
Ok, what is it good for? So I have backlight, charging led and hdd led on my zaurus. Now I can set charging led to indicate backlight... but why is it useful?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 4 lines · Pavel Machek
Ok, what is it good for? So I have backlight, charging led and hdd led on my zaurus. Now I can set charging led to indicate backlight... but why is it useful?
On my board, for example, I have a led for each "special" buttons and others to indicate to the user some "special" conditions of machine internals. All these leds should be switched off each time the LCD blanks and they should get their old brightness status when the LCD unblanks.
Ciao,
Rodolfo
Signature · 4 lines
GNU/Linux Solutions e-mail: [email protected] Linux Device Driver [email protected] Embedded Systems phone: +39 349 2432127 UNIX programming skype: rodolfo.giometti
Quoted 11 lines · Rodolfo Giometti
Quoted 4 lines · Pavel Machek
Ok, what is it good for? So I have backlight, charging led and hdd led on my zaurus. Now I can set charging led to indicate backlight... but why is it useful?
On my board, for example, I have a led for each "special" buttons and others to indicate to the user some "special" conditions of machine internals. All these leds should be switched off each time the LCD blanks and they should get their old brightness status when the LCD unblanks.
Hmm, what's "your board"?
But ok, I guess that makes some sense, additionally it would be useful for keyboard backlight...
In fact, thinkpad light should probably behave like that, too...
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 8 lines · Pavel Machek
Quoted 5 lines · Rodolfo Giometti
On my board, for example, I have a led for each "special" buttons and others to indicate to the user some "special" conditions of machine internals. All these leds should be switched off each time the LCD blanks and they should get their old brightness status when the LCD unblanks.
Hmm, what's "your board"?
Sorry, I meant "my custom board". :) It's PXA270 based but it's not into Linux main tree.
Quoted 4 lines
But ok, I guess that makes some sense, additionally it would be useful for keyboard backlight...
In fact, thinkpad light should probably behave like that, too...
:)
Ciao,
Rodolfo
Signature · 4 lines
GNU/Linux Solutions e-mail: [email protected] Linux Device Driver [email protected] Embedded Systems phone: +39 349 2432127 UNIX programming skype: rodolfo.giometti
Quoted 6 lines · Rodolfo Giometti
Quoted 1 line · Pavel Machek
Hmm, what's "your board"?
Sorry, I meant "my custom board". :) It's PXA270 based but it's not into Linux main tree.
Another example, support for which should be coming shortly, is the LED driver provided by the WM8350: this is a PMIC capable of producing outputs to drive LEDs, potentially strings of very bright LEDs. This is frequently used to illuminate displays but the actual function depends entirely on how the system has been wired up.
The implementation is identical no matter what the LEDs are doing but the current out of tree drivers have two drivers for this bit of the hardware, one for use in the normal LED case and one for when used as a backlight, which is redundnant. With the driver Rodolfo has written this should no longer be required and the backlight trigger can be used to share the hardware interface code.
Quoted 14 lines · Mark Brown
Quoted 6 lines · Rodolfo Giometti
Quoted 1 line · Pavel Machek
Hmm, what's "your board"?
Sorry, I meant "my custom board". :) It's PXA270 based but it's not into Linux main tree.
Another example, support for which should be coming shortly, is the LED driver provided by the WM8350: this is a PMIC capable of producing outputs to drive LEDs, potentially strings of very bright LEDs. This is frequently used to illuminate displays but the actual function depends entirely on how the system has been wired up.
Quoted 6 lines
The implementation is identical no matter what the LEDs are doing but the current out of tree drivers have two drivers for this bit of the hardware, one for use in the normal LED case and one for when used as a backlight, which is redundnant. With the driver Rodolfo has written this should no longer be required and the backlight trigger can be used to share the hardware interface code.
Well, Rodolfo's patch will not allow you to set backlight brightness, only on/off, right?
So if your leds are really a backlight, you still should use backlight class directly...
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 2 lines · Pavel Machek
Well, Rodolfo's patch will not allow you to set backlight brightness, only on/off, right?
No, you can set the backlight brightness, but when the LCD blanks it is set to zero and it get back to its previous status when the LCD unblanks.
Ciao,
Rodolfo
Signature · 4 lines
GNU/Linux Solutions e-mail: [email protected] Linux Device Driver [email protected] Embedded Systems phone: +39 349 2432127 UNIX programming skype: rodolfo.giometti
Quoted 1 line · Pavel Machek
In fact, thinkpad light should probably behave like that, too...
It is supposed to, and actually does so in my T43 without any extra help :-)
But if it doesn't in your ThinkPad, thinkpad-acpi does export a LED interface for the ThinkLight and this new tigger will fix it for you right away :p
Signature · 4 lines
"One disk to rule them all, One disk to find them. One disk to bring them all and in the darkness grind them. In the Land of Redmond where the shadows lie." -- The Silicon Valley Tarot Henrique Holschuh