summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaul E Rangel <rrangel@chromium.org>2020-02-25 16:43:27 -0700
committerCommit Bot <commit-bot@chromium.org>2020-02-27 19:42:28 +0000
commit782d71645f713bbce7021a0d3bd75ef1345297b0 (patch)
tree11358b26a78f4c55635638e13761bbe35b9de1fc
parent621cc6985400e77dbc5bfe1724a12baa4899641d (diff)
downloadchrome-ec-782d71645f713bbce7021a0d3bd75ef1345297b0.tar.gz
common/keyboard_8042: Track aux chan enable and aux irq enable
Start tracking these so we can correctly filter mouse messages. BUG=b:145575366 BRANCH=none TEST=Verified 8042 command prints current state Change-Id: I8a5fe3c66196d961c3a1adbb7355532de5ac0dc9 Signed-off-by: Raul E Rangel <rrangel@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2073284 Reviewed-by: Edward Hill <ecgh@chromium.org>
-rw-r--r--common/keyboard_8042.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/common/keyboard_8042.c b/common/keyboard_8042.c
index 3640b2704e..367b2feb3c 100644
--- a/common/keyboard_8042.c
+++ b/common/keyboard_8042.c
@@ -95,9 +95,11 @@ struct host_byte {
static struct queue const from_host = QUEUE_NULL(8, struct host_byte);
static int i8042_keyboard_irq_enabled;
+static int i8042_aux_irq_enabled;
/* i8042 global settings */
static int keyboard_enabled; /* default the keyboard is disabled. */
+static int aux_chan_enabled; /* default the mouse is disabled. */
static int keystroke_enabled; /* output keystrokes */
static uint8_t resend_command[MAX_SCAN_CODE_LEN];
static uint8_t resend_command_len;
@@ -213,6 +215,18 @@ static void keyboard_enable_irq(int enable)
}
/**
+ * Enable mouse IRQ generation.
+ *
+ * @param enable Enable (!=0) or disable (0) IRQ generation.
+ */
+static void aux_enable_irq(int enable)
+{
+ CPRINTS("AUX IRQ %s", enable ? "enable" : "disable");
+
+ i8042_aux_irq_enabled = enable;
+}
+
+/**
* Send a scan code to the host.
*
* The EC lib will push the scan code bytes to host via port 0x60 and assert
@@ -431,6 +445,16 @@ static void keyboard_enable(int enable)
keyboard_enabled = enable;
}
+static void aux_enable(int enable)
+{
+ if (!aux_chan_enabled && enable)
+ CPRINTS("AUX enabled");
+ else if (aux_chan_enabled && !enable)
+ CPRINTS("AUX disabled");
+
+ aux_chan_enabled = enable;
+}
+
static uint8_t read_ctl_ram(uint8_t addr)
{
if (addr < ARRAY_SIZE(controller_ram))
@@ -462,16 +486,23 @@ static void update_ctl_ram(uint8_t addr, uint8_t data)
/* Enable IRQ before enable keyboard (queue chars to host) */
if (!(orig & I8042_ENIRQ1) && (data & I8042_ENIRQ1))
keyboard_enable_irq(1);
+ if (!(orig & I8042_ENIRQ12) && (data & I8042_ENIRQ12))
+ aux_enable_irq(1);
/* Handle the I8042_KBD_DIS bit */
keyboard_enable(!(data & I8042_KBD_DIS));
+ /* Handle the I8042_AUX_DIS bit */
+ aux_enable(!(data & I8042_AUX_DIS));
+
/*
* Disable IRQ after disable keyboard so that every char must
* have informed the host.
*/
if ((orig & I8042_ENIRQ1) && !(data & I8042_ENIRQ1))
keyboard_enable_irq(0);
+ if ((orig & I8042_ENIRQ12) && !(data & I8042_ENIRQ12))
+ aux_enable_irq(0);
}
}
@@ -1046,8 +1077,10 @@ static int command_8042_internal(int argc, char **argv)
ccprintf("data_port_state=%d\n", data_port_state);
ccprintf("i8042_keyboard_irq_enabled=%d\n", i8042_keyboard_irq_enabled);
+ ccprintf("i8042_aux_irq_enabled=%d\n", i8042_aux_irq_enabled);
ccprintf("keyboard_enabled=%d\n", keyboard_enabled);
ccprintf("keystroke_enabled=%d\n", keystroke_enabled);
+ ccprintf("aux_chan_enabled=%d\n", aux_chan_enabled);
ccprintf("resend_command[]={");
for (i = 0; i < resend_command_len; i++)