From 26afde33310bf3cff88d9fc44bd4648426c00336 Mon Sep 17 00:00:00 2001 From: Dino Li Date: Thu, 5 May 2016 13:37:39 +0800 Subject: [PATCH] keyboard: it83xx: add COL02 inverted feature The other chips support this feature so we implement it too. Signed-off-by: Dino Li BRANCH=none BUG=none TEST=The behavior of kso2 is inverted if define 'CONFIG_KEYBOARD_COL2_INVERTED'. Change-Id: I70d1694ca7d3d10278a484a632e88dc204b71b23 Reviewed-on: https://chromium-review.googlesource.com/342488 Commit-Ready: Dino Li Tested-by: Dino Li Reviewed-by: Randall Spangler --- chip/it83xx/keyboard_raw.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/chip/it83xx/keyboard_raw.c b/chip/it83xx/keyboard_raw.c index 42f877ffcc..9c5d1028ae 100644 --- a/chip/it83xx/keyboard_raw.c +++ b/chip/it83xx/keyboard_raw.c @@ -29,8 +29,13 @@ void keyboard_raw_init(void) /* bit2, 1 enables the internal pull-up of the KSI[7:0] pins. */ IT83XX_KBS_KSICTRL = 0x04; +#ifdef CONFIG_KEYBOARD_COL2_INVERTED + /* KSO[2] is high, others are low. */ + IT83XX_KBS_KSOL = (1 << 2); +#else /* KSO[7:0] pins low. */ IT83XX_KBS_KSOL = 0x00; +#endif /* KSO[15:8] pins low. */ IT83XX_KBS_KSOH1 = 0x00; @@ -74,6 +79,10 @@ test_mockable void keyboard_raw_drive_column(int col) else mask = 0xffff ^ (1 << col); +#ifdef CONFIG_KEYBOARD_COL2_INVERTED + /* KSO[2] is inverted. */ + mask ^= (1 << 2); +#endif IT83XX_KBS_KSOL = mask & 0xff; IT83XX_KBS_KSOH1 = (mask >> 8) & 0xff; }