summaryrefslogtreecommitdiff
path: root/common/lightbar.c
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2014-11-26 12:40:05 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-12-11 04:23:33 +0000
commit401498bb6a1c38771720c84cc1d58f2f5dbf7ac0 (patch)
tree068ac939a9d941cf25b0a3094308a9917af201fa /common/lightbar.c
parent1b1c3089afada7b53e7836ce2b98c157f36a44a8 (diff)
downloadchrome-ec-401498bb6a1c38771720c84cc1d58f2f5dbf7ac0.tar.gz
lightbar: ask the PD MCU for the charge direction
This exposes the pd_exchange_status() function and lets it return the charge port that the PD reports, so that the lightbar TAP sequence can decide which direction to display. BUG=chrome-os-partner:32227 BRANCH=ToT, samus TEST=make buildall -j Change-Id: I78b57fbeaaf38fee15c86eca4d90abce77e2f722 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/232092 Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'common/lightbar.c')
-rw-r--r--common/lightbar.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/common/lightbar.c b/common/lightbar.c
index ab4df550d3..bc43a6080e 100644
--- a/common/lightbar.c
+++ b/common/lightbar.c
@@ -900,15 +900,25 @@ static uint32_t sequence_TAP_inner(int dir)
return 0;
}
-/* TODO(chrome-os-partner:32227): Remove this when it works for real. */
-static int force_dir;
+/* Override the tap direction for testing. -1 means ask the PD MCU. */
+static int force_dir = -1;
/* Return 0 (left or none) or 1 (right) */
static int get_tap_direction(void)
{
- /* TODO(chrome-os-partner:32227): Decide which direction to go */
- CPRINTS("LB tap direction %d", force_dir);
- return force_dir;
+ int dir = 0;
+
+ if (force_dir >= 0)
+ dir = force_dir;
+#ifdef HAS_TASK_PDCMD
+ else
+ pd_exchange_status(&dir);
+#endif
+ if (dir != 1)
+ dir = 0;
+
+ CPRINTS("LB tap direction %d", dir);
+ return dir;
}
static uint32_t sequence_TAP(void)