[maemo-developers] [maemo-developers] Re: backlight

From: Frantisek Dufka dufkaf at seznam.cz
Date: Sun Jan 29 16:04:05 EET 2006
Hello,

I just tried to compile my own kernel with backlight changes and found this:

- my kernel works in the device without any ill effects and without 
messing with initfs, great :) I used kernel from
http://repository.maemo.org/pool/maemo1.1/free/k/kernel-source-2.6.12.3/

I removed translation from 0-15 to 0-127 so backlight_max returns 127 
now and any value goes directly to tahvo backlight. UI works still the 
same. It still has 9 levels going from same minimum to same maximum only 
values in sysfs are scaled now. It means that either UI dynamically 
adjusts itself to the value of sysfs backlight_max or it uses directly 
tahvo. I hope the first one is true. Now I am trying to make translation 
table in kernel and keep 16 levels but let each one to be configured 
with value 0-127. Second soulution is trying to hack brigtness applet to 
provide more levels than 9. I'll probably try both solutions.

Frantisek

Arnaud Patard (Rtp) wrote:
> Brad Midgley <bmidgley at xmission.com> writes:
> 
> 
>>Arnaud
>>
>>The strange thing is that when you're on the lowest level the gui will
>>allow (1), the display goes a little dimmer than that when idle and the
>>sys file actually reports the value 0. But if you *write* a 0 to the sys
>>file, the backlight turns off altogether.
>>
>>This leaves two interpretations for a 0 value.
> 
> 
> after looking at the kernel sources, you have 2 ways of setting the PWM
> value for the backlight : 
> - through sysfs
> - through /dev/tavho with an ioctl (look at the tahvo-user.c and tahvo.h
> files in the kernel).
> 
> If you use the first method, you're have to cope with a scale factor eg
> when you write 1, you'll write 1*0x7f/0x0f=0x08. This is also happening
> when you read the file.
> 
> If you use the second method, you may write an arbitrary value for the
> pwm. This is probably how is working the gui. This is why 1 with the gui
> is not the same 1 as with sysfs.
> 
> If you try to set the level with the ioctl, to something like 1, you'll
> get a darker screen as expected but it'll go a few sec later to the gui
> setting.
> 
> I hope that this helps you :)
> 
> Arnaud
> 
> 
>>Brad
>>
>>
>>>>Looks like it can be controlled via ioctl on the framebuffer device.
>>>>http://maemo.org/lxr/source/osso-af-utils/src/omapfb.h
>>>>
>>>>struct lcd_panel has pointer
>>>>int (*set_bklight_level)(struct lcd_panel *panel,unsigned int level);
>>>>
>>>>I'll try to figure out how it can be called. If anyone knows, don't
>>>>hesitate to answer :)
>>>
>>>
>>>well, you can call it by echoing to
>>>/sys/bus/platform/devices/omapfb/panel/backlight_level
>>>
>>>In reality, the function called is lph8923_panel_set_bklight_level() in
>>>lcd_lph8923.c (which in turn calls tahvo_set_backlight_level). The code
>>>is saying that 1 is the lowest value (except 0 :P) and 15 the highest.
>>>
>>>So, you can't go lower unless there's an other way to play with the
>>>level.
>>>
>>>
>>>Arnaud
>>>
>>>
>>>
>>>
>>>>Frantisek
>>>>
>>>>Brad Midgley wrote:
>>>>
>>>>
>>>>>Frantisek
>>>>>I noticed this too, but we know it can go lower... the backlight goes
>>>>>just a bit lower when you're idle and before it turns off altogether.
>>>>>Brad
>>>>>

More information about the maemo-developers mailing list