Ambient Light Sensor

Michael E Brown Michael_E_Brown at dell.com
Tue May 1 12:37:00 CDT 2007


On Tue, May 01, 2007 at 05:44:40PM +0100, Bastien Nocera wrote:
> Hey Michael,
> 
> I got your e-mail address from David Zeuthen.

I've cc'd libsmbios-devel where this stuff really belongs... :)

> 
> Work (Red Hat as well) just got me a Dell Latitude D420 laptop, and I
> see that it has an ambient light sensor builtin. There's similar
> hardware on the Intel MacBook, and HAL already has code to handle this
> hardware, and LCD brigthness is automatically adjusted based on the data
> from the sensor.

I dont quite understand all of the docs completely. I would have to
write a test app to experiment to see what it all means.

> 
> I was wondering if you had any chance of getting some data/specs/code to
> drive this piece of hardware, so that I could add support for it to HAL.

Here is what I have so far:

Token interface: 
    0x0187 - ALS OFF
        The panel brightness is controlled by the Fn+Up-arrow and
        Fn+Down-arrow keys and by the brightness fields in BIOS setup.
        They can be manipulated by OS-level applications as well.

    0x0188 - ALS ON
        Ambient Light Sensor (ALS) in certain notebook computers,
        controls the brightness of the notebook's LCD panel
        according to the amount of light in the surrounding environment.

SMI Interface:
    
    cbClass:  17
    cbSelect: 10
    Name:     Ambient Light Sensor Status and Control

    On entry:
    cbARG1, byte 0: Function to perform:
        0   Get ALS Status
        1   Control ALS
        2   Get Brightness Table

    If cbARG1, byte 0 is 1 (Control ALS):
    cbARG2, byte 0: Command
        0   Disable ALS
        1   Enable ALS
    cbARG2, byte 1: ALS low limit to set
    cbARG2, byte 2: ALS high limit to set

    On return:
    cbRES1: Return code
        0   Completed successfully
        -1  Completed with error
        -2  Function not supported

    If cbARG1 byte 0 was 0 (Get ALS Status):
    cbRES2, byte 0: Current ALS Status
        0   Disabled
        1   Enabled
    cbRES3, byte 0: Current ALS low limit
    cbRES3, byte 1: Current ALS high limit
    cbRES3, byte 2: Absolute ALS low limit
    cbRES3, byte 3: Absolute ALS high limit

    If cbARG1 byte 0 was 2 (Get Brightness Table):
    cbRES2: Bytes 3..0 of the brightness table
    cbRES3: Bytes 7..4 of the brightness table


You can use the libsmbios smi::doSimpleCallingInterfaceSmi() API to make
the SMI calls above.

> I filed a bug upstream:
> http://bugs.freedesktop.org/show_bug.cgi?id=10760

I've added this info to the bug.

BTW, if you do write this library interface, please be sure to include
the docs above in a comment.
--
Michael


More information about the libsmbios-devel mailing list