[coreboot-gerrit] New patch to review for coreboot: cb3ce72 chrome ec: Add ACPI Device for ALS if enabled

Marc Jones (marc.jones@se-eng.com) gerrit at coreboot.org
Tue Jan 6 00:19:01 CET 2015


Marc Jones (marc.jones at se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8132

-gerrit

commit cb3ce72753a1dca7ab2246ec827d039ba2f5b7f1
Author: Duncan Laurie <dlaurie at chromium.org>
Date:   Fri Jun 13 10:35:22 2014 -0700

    chrome ec: Add ACPI Device for ALS if enabled
    
    The EC can export ALS information if the sensor is attached
    to it directly rather than to the host.  This adds a basic
    ACPI ALS device and implements the required information.
    
    The kernel does not use the _ALR tuple set but it is required
    by the ACPI spec so this just adds the sample two point
    response curve defined in ACPI 5.0 section 9.2.5.
    
    The EC does not currently send events for lux value changes so
    a polling interval of 1 second is defined.
    
    BUG=chrome-os-partner:24208
    BRANCH=None
    TEST=build and boot on samus, add acpi-als driver to the kernel
    and read /sys/bus/iio/devices/iio:device0/in_illuminance_raw
    
    Original-Change-Id: Id29b72a68aa21c1a7c71d5f87223ac010cef0377
    Original-Signed-off-by: Duncan Laurie <dlaurie at chromium.org>
    Original-Reviewed-on: https://chromium-review.googlesource.com/203743
    Original-Reviewed-by: Aaron Durbin <adurbin at chromium.org>
    (cherry picked from commit 81f44b33b87a6ee3079b8ef6efffacd0eeb0283f)
    Signed-off-by: Marc Jones <marc.jones at se-eng.com>
    
    Change-Id: I5a0ccd30e8b453675beaf7d0363dbfa162bd5b3f
---
 src/ec/google/chromeec/acpi/als.asl | 70 +++++++++++++++++++++++++++++++++++++
 src/ec/google/chromeec/acpi/ec.asl  |  4 +++
 2 files changed, 74 insertions(+)

diff --git a/src/ec/google/chromeec/acpi/als.asl b/src/ec/google/chromeec/acpi/als.asl
new file mode 100644
index 0000000..8bc68bf
--- /dev/null
+++ b/src/ec/google/chromeec/acpi/als.asl
@@ -0,0 +1,70 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2014 Google Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+Device (ALS)
+{
+	Name (_HID, "ACPI0008")
+	Name (_UID, 1)
+
+	Method (_STA, 0, NotSerialized)
+	{
+		Return (0xF)
+	}
+
+	/*
+	 * Returns the current ambient light illuminance reading in lux
+	 *
+	 *  0: Reading is below the range of sensitivity of the sensor
+	 * -1: Reading is above the range or sensitivity of the sensor
+	 */
+	Method (_ALI, 0, NotSerialized)
+	{
+		Return (^^ALS0)
+	}
+
+	/*
+	 * Returns a recommended polling frequency in tenths of seconds
+	 *
+	 *  0: No need to poll, async notifications will indicate changes
+	 */
+	Name (_ALP, 10)
+
+	/*
+	 * Returns a package of packages where each tuple consists of a pair
+	 * of integers mapping ambient light illuminance to display brightness.
+	 *
+	 * {<display luminance adjustment>, <ambient light illuminance>}
+	 *
+	 * Ambient light illuminance values are specified in lux.
+	 *
+	 * Display luminance adjustment values are relative percentages where
+	 * 100 is no (0%) display brightness adjustment.  Values <100 indicate
+	 * negative adjustment (dimming) and values >100 indicate positive
+	 * adjustment (brightening).
+	 *
+	 * This is currently unused by the Linux kernel ACPI ALS driver but
+	 * is required by the ACPI specification so just define a basic two
+	 * point response curve.
+	 */
+	Name (_ALR, Package ()
+	{
+		Package () { 70, 30 },    // Min { -30% adjust at 30 lux }
+		Package () { 150, 1000 }  // Max { +50% adjust at 1000 lux }
+	})
+}
diff --git a/src/ec/google/chromeec/acpi/ec.asl b/src/ec/google/chromeec/acpi/ec.asl
index 650efd2..2760f19 100644
--- a/src/ec/google/chromeec/acpi/ec.asl
+++ b/src/ec/google/chromeec/acpi/ec.asl
@@ -431,4 +431,8 @@ Device (EC0)
 
 	#include "ac.asl"
 	#include "battery.asl"
+
+#ifdef EC_ENABLE_ALS_DEVICE
+	#include "als.asl"
+#endif
 }



More information about the coreboot-gerrit mailing list