summaryrefslogtreecommitdiff
path: root/chip/it83xx/keyboard_raw.c
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2021-11-04 12:11:58 -0600
committerCommit Bot <commit-bot@chromium.org>2021-11-05 04:22:34 +0000
commit252457d4b21f46889eebad61d4c0a65331919cec (patch)
tree01856c4d31d710b20e85a74c8d7b5836e35c3b98 /chip/it83xx/keyboard_raw.c
parent08f5a1e6fc2c9467230444ac9b582dcf4d9f0068 (diff)
downloadchrome-ec-stabilize-14498.B-ish.tar.gz
In the interest of making long-term branch maintenance incur as little technical debt on us as possible, we should not maintain any files on the branch we are not actually using. This has the added effect of making it extremely clear when merging CLs from the main branch when changes have the possibility to affect us. The follow-on CL adds a convenience script to actually pull updates from the main branch and generate a CL for the update. BUG=b:204206272 BRANCH=ish TEST=make BOARD=arcada_ish && make BOARD=drallion_ish Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'chip/it83xx/keyboard_raw.c')
-rw-r--r--chip/it83xx/keyboard_raw.c158
1 files changed, 0 insertions, 158 deletions
diff --git a/chip/it83xx/keyboard_raw.c b/chip/it83xx/keyboard_raw.c
deleted file mode 100644
index 6c7a10c463..0000000000
--- a/chip/it83xx/keyboard_raw.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/* Copyright 2015 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.
- */
-
-#include "common.h"
-#include "keyboard_raw.h"
-#include "keyboard_scan.h"
-#include "registers.h"
-#include "task.h"
-#include "irq_chip.h"
-
-#define KSOH_PIN_MASK (((1 << (KEYBOARD_COLS_MAX - 8)) - 1) & 0xff)
-
-/*
- * Initialize the raw keyboard interface.
- */
-void keyboard_raw_init(void)
-{
- uint32_t int_mask;
-
- /* Ensure top-level interrupt is disabled */
- keyboard_raw_enable_interrupt(0);
-
- /*
- * bit2, Setting 1 enables the internal pull-up of the KSO[15:0] pins.
- * To pull up KSO[17:16], set the GPCR registers of their
- * corresponding GPIO ports.
- * bit0, Setting 1 enables the open-drain mode of the KSO[17:0] pins.
- */
- IT83XX_KBS_KSOCTRL = 0x05;
-
- /* 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 = BIT(2);
- /* Enable KSO2's push-pull */
- IT83XX_KBS_KSOLGCTRL |= BIT(2);
- IT83XX_KBS_KSOLGOEN |= BIT(2);
-#else
- /* KSO[7:0] pins low. */
- IT83XX_KBS_KSOL = 0x00;
-#endif
-
- /* critical section with interrupts off */
- int_mask = read_clear_int_mask();
- /*
- * KSO[COLS_MAX:8] pins low.
- * NOTE: KSO[15:8] pins can part be enabled for keyboard function and
- * rest be configured as GPIO output mode. In this case that we
- * disable the ISR in critical section to avoid race condition.
- */
- IT83XX_KBS_KSOH1 &= ~KSOH_PIN_MASK;
- /* restore interrupts */
- set_int_mask(int_mask);
-
- /* KSI[0-7] falling-edge triggered is selected */
- IT83XX_WUC_WUEMR3 = 0xFF;
-
- /* W/C */
- IT83XX_WUC_WUESR3 = 0xFF;
-
- task_clear_pending_irq(IT83XX_IRQ_WKINTC);
-
- /* Enable WUC for KSI[0-7] */
- IT83XX_WUC_WUENR3 = 0xFF;
-}
-
-/*
- * Finish initialization after task scheduling has started.
- */
-void keyboard_raw_task_start(void)
-{
- IT83XX_WUC_WUESR3 = 0xFF;
- task_clear_pending_irq(IT83XX_IRQ_WKINTC);
- task_enable_irq(IT83XX_IRQ_WKINTC);
-}
-
-/*
- * Drive the specified column low.
- */
-test_mockable void keyboard_raw_drive_column(int col)
-{
- int mask;
- uint32_t int_mask;
-
- /* Tri-state all outputs */
- if (col == KEYBOARD_COLUMN_NONE)
- mask = 0xffff;
- /* Assert all outputs */
- else if (col == KEYBOARD_COLUMN_ALL)
- mask = 0;
- /* Assert a single output */
- else
- mask = 0xffff ^ BIT(col);
-
-#ifdef CONFIG_KEYBOARD_COL2_INVERTED
- /* KSO[2] is inverted. */
- mask ^= BIT(2);
-#endif
- IT83XX_KBS_KSOL = mask & 0xff;
-
- /* critical section with interrupts off */
- int_mask = read_clear_int_mask();
- /*
- * Because IT83XX_KBS_KSOH1 register is shared by keyboard scan
- * out and GPIO output mode, so we don't drive all KSOH pins
- * here (this depends on how many keyboard matrix output pin
- * we are using).
- */
- IT83XX_KBS_KSOH1 = (IT83XX_KBS_KSOH1 & ~KSOH_PIN_MASK) |
- ((mask >> 8) & KSOH_PIN_MASK);
- /* restore interrupts */
- set_int_mask(int_mask);
-}
-
-/*
- * Read raw row state.
- * Bits are 1 if signal is present, 0 if not present.
- */
-test_mockable int keyboard_raw_read_rows(void)
-{
- /* Bits are active-low, so invert returned levels */
- return IT83XX_KBS_KSI ^ 0xff;
-}
-
-/*
- * Enable or disable keyboard matrix scan interrupts.
- */
-void keyboard_raw_enable_interrupt(int enable)
-{
- if (enable) {
- IT83XX_WUC_WUESR3 = 0xFF;
- task_clear_pending_irq(IT83XX_IRQ_WKINTC);
- task_enable_irq(IT83XX_IRQ_WKINTC);
- } else {
- task_disable_irq(IT83XX_IRQ_WKINTC);
- }
-}
-
-/*
- * Interrupt handler for keyboard matrix scan interrupt.
- */
-void keyboard_raw_interrupt(void)
-{
- IT83XX_WUC_WUESR3 = 0xFF;
- task_clear_pending_irq(IT83XX_IRQ_WKINTC);
-
- /* Wake the scan task */
- task_wake(TASK_ID_KEYSCAN);
-}
-
-int keyboard_raw_is_input_low(int port, int id)
-{
- return !(IT83XX_GPIO_DATA_MIRROR(port) & BIT(id));
-}