summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2012-12-19 11:38:41 -0800
committerBill Richardson <wfrichar@chromium.org>2013-01-08 16:00:07 -0800
commitcf0d9a5529f6a3f3db23b44e8cdd621608e8c2d1 (patch)
tree6e4ddd6c78e2475da403b4d03cd1547dd08e5730
parenteb6e08570a46fe641308ff696225acfa1643a5a8 (diff)
downloadchrome-ec-toolchain-3428.65.B.tar.gz
Add AP userspace scripts to tweak lightbar colorstoolchain-3428.65.B
We have yet another tweak for the lightbar, but we don't want to update the EC. This CL adds an init script that runs on the AP at every boot and pokes the EC to modify the lightbar settings. We have to run it at every boot because the EC will hibernate after the AP has been off (not suspended) for an hour on battery power and will lose its settings. There's a corresponding CL for the ec-utils ebuild that installs the userspace scripts into the rootfs. BUG=chrome-os-partner:16827 BRANCH=link TEST=manual Build the image for Link, install, reboot. Run "ectool lightbar params". The output should match what's in /usr/share/ec/lightbar_params.txt Original-Change-Id: If50ac2ef2432f7d60cdaf4c222b68dbdee80b2ec Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/39979 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Richard Barnette <jrbarnette@chromium.org> (cherry picked from commit 3eb6f58d3e18647797ad4e3f16203c419ed4c791) Change-Id: I11dcb0318a8f499c26abd3ed9ebf65788ff26c66 Reviewed-on: https://gerrit.chromium.org/gerrit/40626 Commit-Queue: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Tested-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r--board/link/userspace/README3
-rw-r--r--board/link/userspace/etc/init/ec.conf13
-rw-r--r--board/link/userspace/usr/share/ec/lightbar_params.txt31
-rw-r--r--common/lightbar.c6
4 files changed, 50 insertions, 3 deletions
diff --git a/board/link/userspace/README b/board/link/userspace/README
new file mode 100644
index 0000000000..204b9a4522
--- /dev/null
+++ b/board/link/userspace/README
@@ -0,0 +1,3 @@
+Sometimes we need to perform some run-time tweaks of the EC from the AP's
+userspace. This directory holds those tweaks. They're picked up by the
+ec-utils ebuild.
diff --git a/board/link/userspace/etc/init/ec.conf b/board/link/userspace/etc/init/ec.conf
new file mode 100644
index 0000000000..738cb8b2b8
--- /dev/null
+++ b/board/link/userspace/etc/init/ec.conf
@@ -0,0 +1,13 @@
+# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+description "Overrides lightbar params to tweak appearance"
+author "chromium-os-dev@chromium.org"
+
+start on startup
+
+script
+ PARAMS=/usr/share/ec/lightbar_params.txt
+ [ -f "$PARAMS" ] && ectool lightbar params "$PARAMS" >/dev/null 2>&1
+end script
diff --git a/board/link/userspace/usr/share/ec/lightbar_params.txt b/board/link/userspace/usr/share/ec/lightbar_params.txt
new file mode 100644
index 0000000000..5561ede29c
--- /dev/null
+++ b/board/link/userspace/usr/share/ec/lightbar_params.txt
@@ -0,0 +1,31 @@
+2500 # .google_ramp_up
+10000 # .google_ramp_down
+2000 # .s3s0_ramp_up
+45000 # .s0_tick_delay (battery)
+30000 # .s0_tick_delay (AC)
+5000 # .s0a_tick_delay (battery)
+3000 # .s0a_tick_delay (AC)
+2000 # .s0s3_ramp_down
+5000000 # .s3_sleep_for
+2500 # .s3_ramp_up
+10000 # .s3_ramp_down
+1 # .new_s0
+0x60 0x60 # .osc_min (battery, AC)
+0xd0 0xd0 # .osc_max (battery, AC)
+24 24 # .w_ofs (battery, AC)
+0xcc 0xff # .bright_bl_off_fixed (battery, AC)
+0xcc 0xff # .bright_bl_on_min (battery, AC)
+0xcc 0xff # .bright_bl_on_max (battery, AC)
+10 40 99 # .battery_threshold
+5 4 4 4 # .s0_idx[] (battery)
+4 4 4 4 # .s0_idx[] (AC)
+5 255 255 255 # .s3_idx[] (battery)
+255 255 255 255 # .s3_idx[] (AC)
+0x33 0x69 0xe8 # color[0]
+0xd5 0x0f 0x25 # color[1]
+0xee 0xb2 0x11 # color[2]
+0x00 0x99 0x25 # color[3]
+0x00 0x00 0xff # color[4]
+0xff 0x00 0x00 # color[5]
+0xff 0xff 0x00 # color[6]
+0x00 0xff 0x00 # color[7]
diff --git a/common/lightbar.c b/common/lightbar.c
index 4fe6179837..5359bc6e4f 100644
--- a/common/lightbar.c
+++ b/common/lightbar.c
@@ -193,9 +193,9 @@ static const struct lightbar_params default_params = {
.osc_max = { 0xd0, 0xd0 }, /* battery, AC */
.w_ofs = {24, 24}, /* phase offset, 256 == 2*PI */
- .bright_bl_off_fixed = {0x80, 0xc0}, /* backlight off: battery, AC */
- .bright_bl_on_min = {0x80, 0xc0}, /* backlight on: battery, AC */
- .bright_bl_on_max = {0x80, 0xc0}, /* backlight on: battery, AC */
+ .bright_bl_off_fixed = {0xcc, 0xff}, /* backlight off: battery, AC */
+ .bright_bl_on_min = {0xcc, 0xff}, /* backlight on: battery, AC */
+ .bright_bl_on_max = {0xcc, 0xff}, /* backlight on: battery, AC */
.battery_threshold = { 10, 40, 99 }, /* percent, lowest to highest */
.s0_idx = {