summaryrefslogtreecommitdiff
path: root/board/ryu
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2015-09-20 14:04:03 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-10-20 22:09:05 -0700
commit7340e804a1e3ffba2f1ffb9bf826a33b8b5fb19c (patch)
treed1fb324ab8bd25d65c3b0471f52f698ac528801c /board/ryu
parentfb6e6a4b410eff13961437d9a28fe86b222e3ef1 (diff)
downloadchrome-ec-7340e804a1e3ffba2f1ffb9bf826a33b8b5fb19c.tar.gz
common: Add lightbar dimming based on outside light.
Unless the lid is closed, the ALS is used for lightbar dimming. Change the google colors depending on the light sensor result. BUG=chrome-os-partner:44400 BRANCH=smaug TEST=Check all 3 levels of brightness of the lightbar. Check value using "adb shell ectool lightbar" Check double tap color are not affected and is using full brightness. Change-Id: I7b5e2890c3557f1dd3ae719f5f82ffb5fe7b24fb Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/301216 Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'board/ryu')
-rw-r--r--board/ryu/board.c36
-rw-r--r--board/ryu/board.h1
2 files changed, 37 insertions, 0 deletions
diff --git a/board/ryu/board.c b/board/ryu/board.c
index 02e9ed0191..a2d36dce9e 100644
--- a/board/ryu/board.c
+++ b/board/ryu/board.c
@@ -25,6 +25,7 @@
#include "i2c.h"
#include "inductive_charging.h"
#include "lid_switch.h"
+#include "lightbar.h"
#include "motion_sense.h"
#include "power.h"
#include "power_button.h"
@@ -455,6 +456,41 @@ struct motion_sensor_t motion_sensors[] = {
};
const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
+struct lb_brightness_def lb_brightness_levels[] = {
+ {
+ /* regular brightness */
+ .lux = 40,
+ .color = {
+ {0x74, 0x58, 0xb4}, /* Segment0: Google blue */
+ {0xd6, 0x40, 0x20}, /* Segment1: Google red */
+ {0xfa, 0xe6, 0x20}, /* Segment2: Google yellow */
+ {0x66, 0xb0, 0x50}, /* Segment3: Google green */
+ },
+ },
+ {
+ /* 25 - 50% brightness */
+ .lux = 20,
+ .color = {
+ {0x51, 0x38, 0x7d},
+ {0x99, 0x28, 0x15},
+ {0xb8, 0x9e, 0x1a},
+ {0x44, 0x80, 0x35},
+ },
+ },
+ {
+ /* 0 .. 25% brightness */
+ .lux = 0,
+ .color = {
+ {0x3d, 0x28, 0x5c},
+ {0x71, 0x28, 0x10},
+ {0x8a, 0x6f, 0x10},
+ {0x2f, 0x60, 0x25},
+ },
+ },
+};
+const unsigned int lb_brightness_levels_count =
+ ARRAY_SIZE(lb_brightness_levels);
+
int extpower_is_present(void)
{
return gpio_get_level(GPIO_CHGR_ACOK);
diff --git a/board/ryu/board.h b/board/ryu/board.h
index 833a131eb4..6a438e6bcc 100644
--- a/board/ryu/board.h
+++ b/board/ryu/board.h
@@ -286,6 +286,7 @@ void pp1800_on_off_evt(enum gpio_signal signal);
/* ALS sensor is in forced mode */
#define CONFIG_ACCEL_FORCE_MODE_MASK \
((1 << RYU_LID_LIGHT) | (1 << RYU_LID_PROX))
+#define CONFIG_ALS_LIGHTBAR_DIMMING RYU_LID_LIGHT
#endif /* !__ASSEMBLER__ */