summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2013-12-06 11:37:13 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-12-07 00:57:56 +0000
commit61f1b8aea9e5b624b569f2f86bc90a00918f9799 (patch)
treef7e5b5baf6068841e6ab7919bc72bb8ed85d5d50
parent53d219f5552f595dde8e885a7ec41ee81e9d56af (diff)
downloadchrome-ec-61f1b8aea9e5b624b569f2f86bc90a00918f9799.tar.gz
Add lightbar calibration for samus
The samus lightbar uses different LEDs from Link. Adjust the per-color current limits accordingly. Also swizzle the layout, since LEDs 0/1 and 2/3 are swapped. BUG=chrome-os-partner:24405 BRANCH=samus TEST=manual The colors were ugly and weird. Now they should be pretty and Googley. Change-Id: I19f317243ff46852628b8b28f2bf6f5e02c6e631 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/179160 Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--common/lightbar.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/common/lightbar.c b/common/lightbar.c
index 420435270f..04e6482db4 100644
--- a/common/lightbar.c
+++ b/common/lightbar.c
@@ -59,6 +59,7 @@ static inline uint8_t controller_read(int ctrl_num, uint8_t reg)
* them identically for our purposes */
/******************************************************************************/
+#ifdef BOARD_bds
/* We need to limit the total current per ISC to no more than 20mA (5mA per
* color LED, but we have four LEDs in parallel on each ISC). Any more than
* that runs the risk of damaging the LED component. A value of 0x67 is as high
@@ -69,6 +70,19 @@ static inline uint8_t controller_read(int ctrl_num, uint8_t reg)
#define MAX_RED 0x5c
#define MAX_GREEN 0x30
#define MAX_BLUE 0x67
+#endif
+#ifdef BOARD_link
+/* Link uses seven segments, not four, but keep the same limits anyway */
+#define MAX_RED 0x5c
+#define MAX_GREEN 0x30
+#define MAX_BLUE 0x67
+#endif
+#ifdef BOARD_samus
+/* Samus uses completely different LEDs, so the numbers are different */
+#define MAX_RED 0x4f
+#define MAX_GREEN 0x55
+#define MAX_BLUE 0x67
+#endif
/* How many (logical) LEDs do we have? */
#define NUM_LEDS 4
@@ -109,7 +123,15 @@ static void set_from_array(const struct initdata_s *data, int count)
/* Controller register lookup tables. */
static const uint8_t led_to_ctrl[] = { 1, 1, 0, 0 };
+#ifdef BOARD_bds
+static const uint8_t led_to_isc[] = { 0x18, 0x15, 0x18, 0x15 };
+#endif
+#ifdef BOARD_link
static const uint8_t led_to_isc[] = { 0x18, 0x15, 0x18, 0x15 };
+#endif
+#ifdef BOARD_samus
+static const uint8_t led_to_isc[] = { 0x15, 0x18, 0x15, 0x18 };
+#endif
/* Scale 0-255 into max value */
static inline uint8_t scale_abs(int val, int max)