From 40ca542a0df0731f7f0df9789c9344581f826d11 Mon Sep 17 00:00:00 2001 From: Vic Yang Date: Tue, 10 Jun 2014 21:17:06 -0700 Subject: Keyborg: fix incorrect column driving in fast scanning In the fast scan code, the master chip is driving the right side of the panel at incorrect time. Let's fix this. BUG=None TEST=Manual BRANCH=None Change-Id: I9500f8ec4947c46762505ff20d0e5c4169bf5a67 Signed-off-by: Vic Yang Reviewed-on: https://chromium-review.googlesource.com/203370 Reviewed-by: Vincent Palatin --- board/keyborg/touch_scan.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/board/keyborg/touch_scan.c b/board/keyborg/touch_scan.c index bd66c8f0b1..53eec0ae16 100644 --- a/board/keyborg/touch_scan.c +++ b/board/keyborg/touch_scan.c @@ -152,14 +152,19 @@ static inline void set_scan_needed(int col) int fast_scan(uint32_t *data) { int col; + int chip_col; memset(data, 0, SCAN_BUF_SIZE * 4); STM32_PMSE_MRCR = 1 << 31; for (col = 0; col < COL_COUNT * 2; ++col) { - if (col < COL_COUNT) { - enable_col(col, 1); - STM32_PMSE_MCCR = mccr_list[col]; + if (master_slave_is_master()) + chip_col = (col >= COL_COUNT) ? col - COL_COUNT : -1; + else + chip_col = (col < COL_COUNT) ? col : -1; + if (chip_col >= 0) { + enable_col(chip_col, 1); + STM32_PMSE_MCCR = mccr_list[chip_col]; } if (master_slave_sync(5) != EC_SUCCESS) @@ -173,8 +178,8 @@ int fast_scan(uint32_t *data) if (master_slave_sync(5) != EC_SUCCESS) return EC_ERROR_UNKNOWN; - if (col < COL_COUNT) { - enable_col(col, 0); + if (chip_col >= 0) { + enable_col(chip_col, 0); STM32_PMSE_MCCR = 0; } } -- cgit v1.2.1