summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorLouis Yung-Chieh Lo <yjlou@chromium.org>2012-04-30 17:55:42 +0800
committerLouis Yung-Chieh Lo <yjlou@chromium.org>2012-05-24 13:32:35 +0800
commit29d25d807c18330c1426425e8c53af1067be7640 (patch)
tree3a5c5538b97e74433d6ab6ea189180f696ce5289 /common
parenteb7765c0c41986e225506447de0d9f722c66e32b (diff)
downloadchrome-ec-29d25d807c18330c1426425e8c53af1067be7640.tar.gz
Keyboard scan must stop driving columns when power button is pressed.
Tristage all columns as soon as possible right after the power button is pressed. This can avoid the silego chip to reset the EC. Resume the interrupt mode after power button is released so that the deasserted columns doesn't trigger EC reset. Also change some function names for export. BUG=chrome-os-partner:7486 TEST= press g first, then power button. repeat many times. system is not rebooted. press power button first, then g. repeat many times. system is not rebooted. ESC+power is still reseting system. The long press power button still shutdowns system. Change-Id: Ie5dec20ec3d3c4ffbd4acf5a4dd7f63eec38af56
Diffstat (limited to 'common')
-rw-r--r--common/i8042.c2
-rw-r--r--common/keyboard.c14
2 files changed, 8 insertions, 8 deletions
diff --git a/common/i8042.c b/common/i8042.c
index 35e1f2b094..54eb668f3c 100644
--- a/common/i8042.c
+++ b/common/i8042.c
@@ -46,7 +46,7 @@ static int i8042_irq_enabled = 0;
/* Reset all i8042 buffer */
-void i8042_init()
+void i8042_flush_buffer()
{
head_to_buffer = tail_to_buffer = 0;
keyboard_clear_buffer();
diff --git a/common/keyboard.c b/common/keyboard.c
index 2d69dba438..6b2dc48088 100644
--- a/common/keyboard.c
+++ b/common/keyboard.c
@@ -255,9 +255,9 @@ static void reset_rate_and_delay(void)
}
-static void clear_underlying_buffer(void)
+void keyboard_clear_underlying_buffer(void)
{
- i8042_init();
+ i8042_flush_buffer();
}
@@ -482,25 +482,25 @@ int handle_keyboard_data(uint8_t data, uint8_t *output)
case I8042_CMD_ENABLE:
output[out_len++] = I8042_RET_ACK;
keyboard_enable(1);
- clear_underlying_buffer();
+ keyboard_clear_underlying_buffer();
break;
case I8042_CMD_RESET_DIS:
output[out_len++] = I8042_RET_ACK;
keyboard_enable(0);
reset_rate_and_delay();
- clear_underlying_buffer();
+ keyboard_clear_underlying_buffer();
break;
case I8042_CMD_RESET_DEF:
output[out_len++] = I8042_RET_ACK;
reset_rate_and_delay();
- clear_underlying_buffer();
+ keyboard_clear_underlying_buffer();
break;
case I8042_CMD_RESET_BAT:
reset_rate_and_delay();
- clear_underlying_buffer();
+ keyboard_clear_underlying_buffer();
output[out_len++] = I8042_RET_ACK;
output[out_len++] = I8042_RET_BAT;
output[out_len++] = I8042_RET_BAT;
@@ -613,7 +613,7 @@ int handle_keyboard_command(uint8_t command, uint8_t *output)
} else {
CPRINTF("[Unsupported cmd: 0x%02x]\n", command);
reset_rate_and_delay();
- clear_underlying_buffer();
+ keyboard_clear_underlying_buffer();
output[out_len++] = I8042_RET_NAK;
data_port_state = STATE_NORMAL;
}