question about sysfs interface for backlight adjustment

877 views
Skip to first unread message

Xiaoyang Yu (Max)

unread,
Feb 6, 2009, 1:33:44 AM2/6/09
to Android Linux Kernel Development
Android assumes the sysfs interface for backlight adjustment is at "/
sys/class/leds/lcd-backlight/brightness", which is not true for EeePC.
EeePC uses "/sys/class/backlight/eeepc/brightness". And other
platforms may use "/sys/class/backlight/acpi_video0/brightness".

Also Android assuems the backlight value change from 30..255. While it
should be 0..15 for EeePC, and 0..7 for other platforms. The maximum
backlight value can be read from "/sys/class/backlight/eeepc/
max_brightness" or "/sys/class/backlight/acpi_video0/max_brightness".

So should we change Android kernel's sysfs interface? For example,
Android kernel create a symbol link "default" in "/sys/class/
backlight", and make it link to "eeepc" or "acpi_video0". Or create "/
sys/class/leds/lcd-backlight" as a symbol link to "/sys/class/
backlight/eeepc" or "/sys/class/backlight/acpi_video0".

Or should we not change kernel, but only change the userspace code,
like scan the directory "/sys/class/backlight" to see which sub-
directory in it?

You can refer to the following discussion in android porting group:
http://groups.google.com/group/android-porting/browse_thread/thread/adf45961132dc76b/7593d68bab566412?lnk=gst&q=backlight#

Gross, Mark

unread,
Feb 6, 2009, 11:44:57 AM2/6/09
to android...@googlegroups.com


>-----Original Message-----
>From: android...@googlegroups.com [mailto:android-
>ker...@googlegroups.com] On Behalf Of Xiaoyang Yu (Max)
>Sent: Thursday, February 05, 2009 10:34 PM
>To: Android Linux Kernel Development
>Subject: [android-kernel] question about sysfs interface for backlight
>adjustment
>
>
>Android assumes the sysfs interface for backlight adjustment is at "/
>sys/class/leds/lcd-backlight/brightness", which is not true for EeePC.
>EeePC uses "/sys/class/backlight/eeepc/brightness". And other
>platforms may use "/sys/class/backlight/acpi_video0/brightness".
>
>Also Android assuems the backlight value change from 30..255. While it
>should be 0..15 for EeePC, and 0..7 for other platforms. The maximum
>backlight value can be read from "/sys/class/backlight/eeepc/
>max_brightness" or "/sys/class/backlight/acpi_video0/max_brightness".
>
>So should we change Android kernel's sysfs interface? For example,
>Android kernel create a symbol link "default" in "/sys/class/
>backlight", and make it link to "eeepc" or "acpi_video0". Or create "/
>sys/class/leds/lcd-backlight" as a symbol link to "/sys/class/
>backlight/eeepc" or "/sys/class/backlight/acpi_video0".
>
>Or should we not change kernel, but only change the userspace code,
>like scan the directory "/sys/class/backlight" to see which sub-
>directory in it?
>

It looks to me that the android kernel using /sys/class/leds/lcd-backlight is not consistent with existing backlight sysfs interfaces and should be changed to /sys/class/backlight/... .

Additionally some introspection of the backlight range should be available from the sysfs interface and used by the user mode code to deal with the differing ranges. User mode should not assume kernel details like valid ranges for brightness.

--mgross

Dianne Hackborn

unread,
Feb 6, 2009, 12:43:29 PM2/6/09
to android...@googlegroups.com
We'd welcome patches to remove this kind of hard-coding.  The that is there now is just what is needed to support the current shipping devices.
--
Dianne Hackborn
Android framework engineer
hac...@android.com

Note: please don't send private questions to me, as I don't have time to provide private support.  All such questions should be posted on public forums, where I and others can see and answer them.

Brian Swetland

unread,
Feb 6, 2009, 1:27:23 PM2/6/09
to android...@googlegroups.com
["Xiaoyang Yu (Max)" <max....@intel.com>]

>
> Android assumes the sysfs interface for backlight adjustment is at "/
> sys/class/leds/lcd-backlight/brightness", which is not true for EeePC.
> EeePC uses "/sys/class/backlight/eeepc/brightness". And other
> platforms may use "/sys/class/backlight/acpi_video0/brightness".
>
> Also Android assuems the backlight value change from 30..255. While it
> should be 0..15 for EeePC, and 0..7 for other platforms. The maximum
> backlight value can be read from "/sys/class/backlight/eeepc/
> max_brightness" or "/sys/class/backlight/acpi_video0/max_brightness".
>
> So should we change Android kernel's sysfs interface? For example,
> Android kernel create a symbol link "default" in "/sys/class/
> backlight", and make it link to "eeepc" or "acpi_video0". Or create "/
> sys/class/leds/lcd-backlight" as a symbol link to "/sys/class/
> backlight/eeepc" or "/sys/class/backlight/acpi_video0".
>
> Or should we not change kernel, but only change the userspace code,
> like scan the directory "/sys/class/backlight" to see which sub-
> directory in it?

Updating the userspace side of things to not hardcode names within
/sys/class/backlight and /sys/class/leds, and to pick up max_brightness
from the sysfs interface makes the most sense to me.

Brian

Reply all
Reply to author
Forward
0 new messages