Re: [PATCH 1/1] PXAFB: Support for backlight control

Paul Sokolovsky
2007-02-22T10:33:33Z

[-- Attachment #1: Type: text/plain, Size: 2187 bytes --]

Hello Rodolfo,

Thursday, February 22, 2007, 10:32:04 AM, you wrote:

> On Wed, Feb 21, 2007 at 06:26:08PM +0200, Paul Sokolovsky wrote:
k>> Why? It's the same, except that it already exists, generic one (not
>> limited to pxafb), and requires 1 function (too bad that C doesn't
>> support lambda's):

> Ah, ok.

>> I sent a bit of criticism for that too ;-). YMMV, but kernel
>> solutions are just bound to be pretty simple and generic and lack
>> any "niceties", which you'd likely want to do anyway eventually. For
>> example, what if you'll want to implement "fade out" effect for
>> keyboard backlight? Doing it in adhoc manner in kernel? Whereas with
>> the LCD classdev, you can write generic "fade out" trigger and
>> attach/detach it from userspace.

> I agree. I just wish to add a backlight support for my LCD and
> minikeypad.

> What do you suggest to me in order to accomplish such task?

Well, I write exactly to share experience and work towards having
best practices for backlight, etc. control, reusable on wide range of
embedded/handheld devices.

We in handhelds.org codebase have attached patch* to make corgi_bl
more suitable for general use. This patch was submitted to Richard
(so, more votes needed ;-) ). Otherwise, snippet I pasted is from real
machine implementation, HP iPaq h4000.

As for keyboard backlight, another port we have, HTC Universal, has:
normal indicator LEDs, keyboard backlight, flashlight, ring vibra. All
of these are handled via Generic LED API:
http://handhelds.org/cgi-bin/cvsweb.cgi/linux/kernel26/arch/arm/mach-pxa/htcuniversal/htcuniversal_leds.c?rev=1.6&content-type=text/x-cvsweb-markup

To show that it is not an anomaly, but hopefully, a trend, here's
vibra driver for the upcoming OpenMoko phone:
http://wiki.openmoko.org/wiki/Neo1973_Hardware#Vibrator

So, if you have freedom to add keyboard backlight control to your
userspace, that would allow you to do many interesting things without
disturbing the kernel.

[*] Optimized for size, full one should patch <asm/arch/sharpsl.h> of
course.

> Thanks for your suggestions,

> Rodolfo

--
Best regards,
Paul mailto:pmiscml@gmail.com

[-- Attachment #2: driver-corgi-bl-generalize.patch --]
[-- Type: application/octet-stream, Size: 1636 bytes --]

diff -N -U3 -r -x CVS ../linux-2.6.20/drivers/video/backlight/Kconfig ../linux-2.6.20-hh/drivers/video/backlight/Kconfig
--- ../linux-2.6.20/drivers/video/backlight/Kconfig 2007-02-04 18:44:54.000000000 +0000
+++ ../linux-2.6.20-hh/drivers/video/backlight/Kconfig 2006-12-18 12:41:24.000000000 +0000
@@ -44,7 +44,7 @@

config BACKLIGHT_CORGI
tristate "Sharp Corgi Backlight Driver (SL Series)"
- depends on BACKLIGHT_DEVICE && PXA_SHARPSL
+ depends on BACKLIGHT_DEVICE
default y
help
If you have a Sharp Zaurus SL-C7xx, SL-Cxx00 or SL-6000x say y to enable the
diff -N -U3 -r -x CVS ../linux-2.6.20/drivers/video/backlight/corgi_bl.c ../linux-2.6.20-hh/drivers/video/backlight/corgi_bl.c
--- ../linux-2.6.20/drivers/video/backlight/corgi_bl.c 2007-02-04 18:44:54.000000000 +0000
+++ ../linux-2.6.20-hh/drivers/video/backlight/corgi_bl.c 2007-02-13 20:12:14.000000000 +0000
@@ -18,7 +18,7 @@
#include <linux/mutex.h>
#include <linux/fb.h>
#include <linux/backlight.h>
-#include <asm/arch/sharpsl.h>
+#include <linux/corgi_bl.h>
#include <asm/hardware/sharpsl_pm.h>

static int corgibl_intensity;
diff -N -U3 -r -x CVS ../linux-2.6.20/include/linux/corgi_bl.h ../linux-2.6.20-hh/include/linux/corgi_bl.h
--- ../linux-2.6.20/include/linux/corgi_bl.h 1970-01-01 00:00:00.000000000 +0000
+++ ../linux-2.6.20-hh/include/linux/corgi_bl.h 2006-11-04 17:36:48.000000000 +0000
@@ -0,0 +1,10 @@
+/*
+ * Generic Backlight, from sharpsl.h
+ */
+struct corgibl_machinfo {
+ int max_intensity;
+ int default_intensity;
+ int limit_mask;
+ void (*set_bl_intensity)(int intensity);
+};
+extern void corgibl_limit_intensity(int limit);