Re: [PATCH 0/3] Generic sysfs support for ACPI ALS and other ALS devices

Pavel Machek
2009-08-05T16:19:37Z

On Wed 2009-08-05 09:02:50, Zhang Rui wrote:
> On Tue, 2009-08-04 at 21:21 +0800, Pavel Machek wrote:
> > On Mon 2009-08-03 17:10:57, Zhang Rui wrote:
> > > Hi, all,
> > >
> > > This is the patch set I made to introduce ACPI ALS device driver
> > > and a generic sysfs I/F for all the ALS devices, like ACPI ALS,
> > > platform ALS, etc.
> > >
> > > Patch 01 introduces the ACPI ALS device driver.
> > >
> > > Patch 02 introduces ALS sysfs class.
> > > Two sysfs I/F are created for each ALS device.
> > > /sys/class/als/alsX/illuminance:
> > > the amount of light incident upon a specified surface area.
> > > /sys/class/als/alsX/mappings:
> > > ambient light illuminance to display luminance mappings
> > > that can be used by an OS to calibrate its ambient light policy
> > > this is what I got on a test box:
> > > cat /sys/class/als/als0/mappings
> > > ???Illuminance Adjustment
> > > 0 70
> > > 10 73
> > > 80 85
> > > 300 100
> > > 1000 150
> >
> > There's one value per file for sysfs... You should definitely have the
> > header.
> >
> > Is there chance to already return adjusted values, avoiding this
> > uglyness?
>
> No,
> For a ALS policy, user space should set a brightness level as the base
> point, i.e. the backlight when display adjustment is 100.
> and then uses the adjustment values gotten from this mappings to
> calculate the actual brightness level the display should be put in.

Ok, so just make the code return only the "adjustement" -- userspace
does not really need to know "illuminance" and you can do the mapping
in the kernel AFAICT.
Pavel

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html