mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-07 16:11:43 +00:00
Move files in preparation for merging keyboard_scan modules
This is part one of a series to merge the keyboard scan interface to be common across all platforms. This change just moves and renames files and APIs and removes some read code, and sets up protocol-specific CONFIG options. It makes the next CL which actually merges keyboard scanning easier to parse. BUG=chrome-os-partner:18360 BRANCH=none TEST=compile all boards; test keyboard on spring and link Change-Id: I815a40aae4e5d5f333b8501aff9656080533d913 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/46549 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
This commit is contained in:
committed by
ChromeBot
parent
0a2603e8ea
commit
c2b94fd184
@@ -181,7 +181,7 @@ void configure_board(void)
|
||||
gpio_set_level(GPIO_EC_INT, 1);
|
||||
}
|
||||
|
||||
void board_keyboard_suppress_noise(void)
|
||||
void keyboard_suppress_noise(void)
|
||||
{
|
||||
/* notify audio codec of keypress for noise suppression */
|
||||
gpio_set_level(GPIO_CODEC_INT, 0);
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
/* Optional features */
|
||||
#define CONFIG_CHIPSET_GAIA
|
||||
#define CONFIG_I2C
|
||||
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
|
||||
#define CONFIG_KEYBOARD_SUPPRESS_NOISE
|
||||
|
||||
/* Allow dangerous commands all the time, since we don't have a write protect
|
||||
* switch. */
|
||||
@@ -108,9 +110,6 @@ enum gpio_signal {
|
||||
|
||||
void configure_board(void);
|
||||
|
||||
/* Signal to the AP that keyboard scan data is available */
|
||||
void board_keyboard_suppress_noise(void);
|
||||
|
||||
/* Auto detect EC i2c host port */
|
||||
int board_i2c_host_port(void);
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#define CONFIG_CHIPSET_X86
|
||||
#define CONFIG_CONSOLE_CMDHELP
|
||||
#define CONFIG_EXTPOWER_GPIO
|
||||
#define CONFIG_KEYBOARD_PROTOCOL_8042
|
||||
#define CONFIG_LPC
|
||||
#define CONFIG_ONEWIRE
|
||||
#define CONFIG_ONEWIRE_LED
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
||||
/* Copyright (c) 2013 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.
|
||||
*/
|
||||
@@ -21,13 +21,15 @@
|
||||
#define CONFIG_CONSOLE_UART 1
|
||||
|
||||
/* Debug features */
|
||||
#define CONFIG_PANIC_HELP
|
||||
#define CONFIG_ASSERT_HELP
|
||||
#define CONFIG_CONSOLE_CMDHELP
|
||||
|
||||
#define CONFIG_PANIC_HELP
|
||||
#undef CONFIG_TASK_PROFILING
|
||||
#define CONFIG_WATCHDOG_HELP
|
||||
|
||||
/* Optional features */
|
||||
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
|
||||
|
||||
/* use STOP mode when we have nothing to do */
|
||||
/*
|
||||
* FIXME(dhendrix): This causes the UART to drop characters and likely
|
||||
|
||||
@@ -177,7 +177,7 @@ void configure_board_late(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void board_keyboard_suppress_noise(void)
|
||||
void keyboard_suppress_noise(void)
|
||||
{
|
||||
/* notify audio codec of keypress for noise suppression */
|
||||
gpio_set_level(GPIO_CODEC_INT, 0);
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#define CONFIG_HOST_COMMAND_STATUS
|
||||
#define CONFIG_I2C
|
||||
#define CONFIG_I2C_ARBITRATION
|
||||
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
|
||||
#define CONFIG_KEYBOARD_SUPPRESS_NOISE
|
||||
#undef CONFIG_TASK_PROFILING
|
||||
#define CONFIG_WATCHDOG_HELP
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#define CONFIG_CHIPSET_GAIA
|
||||
#define CONFIG_HOST_COMMAND_STATUS
|
||||
#define CONFIG_I2C
|
||||
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
|
||||
#undef CONFIG_TASK_PROFILING
|
||||
#define CONFIG_WATCHDOG_HELP
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
||||
/* Copyright (c) 2013 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.
|
||||
*/
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "console.h"
|
||||
#include "hooks.h"
|
||||
#include "gpio.h"
|
||||
#include "keyboard_scan.h"
|
||||
#include "keyboard_protocol.h"
|
||||
#include "pmu_tpschrome.h"
|
||||
#include "registers.h"
|
||||
#include "smart_battery.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- makefile -*-
|
||||
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
||||
# Copyright (c) 2013 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.
|
||||
#
|
||||
@@ -22,6 +22,6 @@ chip-$(CONFIG_ONEWIRE)+=onewire.o
|
||||
chip-$(CONFIG_PECI)+=peci.o
|
||||
chip-$(CONFIG_PWM)+=pwm.o
|
||||
chip-$(CONFIG_SPI)+=spi.o
|
||||
chip-$(CONFIG_TASK_KEYSCAN)+=keyboard_scan.o keyboard_raw.o
|
||||
chip-$(CONFIG_TASK_KEYSCAN)+=keyboard_raw.o
|
||||
chip-$(CONFIG_TASK_SWITCH)+=switch.o
|
||||
chip-$(CONFIG_WATCHDOG)+=watchdog.o
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "gpio.h"
|
||||
#include "hooks.h"
|
||||
#include "host_command.h"
|
||||
#include "keyboard.h"
|
||||
#include "keyboard_protocol.h"
|
||||
#include "keyboard_scan.h"
|
||||
#include "pwm.h"
|
||||
#include "switch.h"
|
||||
@@ -514,7 +514,7 @@ void switch_task(void)
|
||||
* no longer pressed.
|
||||
*/
|
||||
if (!raw_power_button_pressed())
|
||||
keyboard_enable_scanning(1);
|
||||
keyboard_scan_enable(1);
|
||||
|
||||
if (raw_power_button_pressed() !=
|
||||
debounced_power_pressed)
|
||||
@@ -607,7 +607,7 @@ void switch_interrupt(enum gpio_signal signal)
|
||||
* reduce the risk of false-reboot triggered by those
|
||||
* keys on the same column with refresh key.
|
||||
*/
|
||||
keyboard_enable_scanning(0);
|
||||
keyboard_scan_enable(0);
|
||||
}
|
||||
break;
|
||||
case GPIO_PCH_BKLTEN:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- makefile -*-
|
||||
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
||||
# Copyright (c) 2013 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.
|
||||
#
|
||||
@@ -14,7 +14,7 @@ chip-y+=jtag-$(CHIP_VARIANT).o clock-$(CHIP_VARIANT).o gpio-$(CHIP_VARIANT).o
|
||||
chip-$(CONFIG_SPI)+=spi.o
|
||||
chip-$(CONFIG_I2C)+=i2c.o
|
||||
chip-$(CONFIG_WATCHDOG)+=watchdog.o
|
||||
chip-$(CONFIG_TASK_KEYSCAN)+=keyboard_scan.o keyboard_raw.o
|
||||
chip-$(CONFIG_TASK_KEYSCAN)+=keyboard_raw.o
|
||||
chip-$(CONFIG_TASK_POWERLED)+=power_led.o
|
||||
chip-$(CONFIG_FLASH)+=flash-$(CHIP_VARIANT).o
|
||||
chip-$(CONFIG_ADC)+=adc.o
|
||||
|
||||
@@ -21,6 +21,10 @@ common-$(CONFIG_FLASH)+=flash_common.o fmap.o
|
||||
common-$(CONFIG_I2C)+=i2c_commands.o
|
||||
common-$(CONFIG_I2C_ARBITRATION)+=i2c_arbitration.o
|
||||
common-$(CONFIG_IR357x)+=ir357x.o
|
||||
# TODO: combine common bits of keyboard_scan into one file
|
||||
# (coming in a follow-up CL)
|
||||
common-$(CONFIG_KEYBOARD_PROTOCOL_MKBP)+=keyboard_mkbp.o
|
||||
common-$(CONFIG_KEYBOARD_PROTOCOL_8042)+=keyboard_scan.o
|
||||
common-$(CONFIG_KEYBOARD_TEST)+=keyboard_test.o
|
||||
common-$(CONFIG_LP5562)+=lp5562.o lp5562_battery_led.o
|
||||
common-$(CONFIG_LPC)+=port80.o
|
||||
@@ -30,7 +34,7 @@ common-$(CONFIG_SMART_BATTERY)+=smart_battery.o smart_battery_stub.o
|
||||
common-$(CONFIG_TASK_CHARGER)+=charge_state.o battery_precharge.o
|
||||
common-$(CONFIG_TASK_CONSOLE)+=console.o
|
||||
common-$(CONFIG_TASK_HOSTCMD)+=host_command.o host_event_commands.o
|
||||
common-$(CONFIG_TASK_I8042CMD)+=i8042.o keyboard.o
|
||||
common-$(CONFIG_TASK_I8042CMD)+=i8042.o keyboard_8042.o
|
||||
common-$(CONFIG_TASK_LIGHTBAR)+=lightbar.o
|
||||
common-$(CONFIG_TASK_THERMAL)+=thermal.o
|
||||
common-$(CONFIG_TASK_VBOOTHASH)+=sha256.o vboot_hash.o
|
||||
|
||||
@@ -26,7 +26,6 @@ static const char *channel_names[CC_CHANNEL_COUNT] = {
|
||||
"gpio",
|
||||
"hostcmd",
|
||||
"i2c",
|
||||
"i8042",
|
||||
"keyboard",
|
||||
"keyscan",
|
||||
"lightbar",
|
||||
|
||||
@@ -174,7 +174,7 @@ static int check_for_power_off_event(void)
|
||||
|
||||
/* Dis/Enable keyboard scanning when the power button state changes */
|
||||
if (!pressed || pressed != power_button_was_pressed)
|
||||
keyboard_enable_scanning(!pressed);
|
||||
keyboard_scan_enable(!pressed);
|
||||
|
||||
|
||||
now = get_time();
|
||||
@@ -263,13 +263,6 @@ static int gaia_power_init(void)
|
||||
auto_power_on = 1;
|
||||
}
|
||||
|
||||
/* Auto power on if the recovery combination was pressed */
|
||||
if (keyboard_scan_recovery_pressed()) {
|
||||
CPRINTF("[%T auto_power_on is set due to "
|
||||
"keyboard_scan_recovery_pressed() ...]\n");
|
||||
auto_power_on = 1;
|
||||
}
|
||||
|
||||
return EC_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
||||
/* Copyright (c) 2013 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.
|
||||
*
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "config.h"
|
||||
#include "console.h"
|
||||
#include "i8042.h"
|
||||
#include "keyboard.h"
|
||||
#include "keyboard_protocol.h"
|
||||
#include "lpc.h"
|
||||
#include "queue.h"
|
||||
#include "task.h"
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "util.h"
|
||||
|
||||
/* Console output macros */
|
||||
#define CPRINTF(format, args...) cprintf(CC_I8042, format, ## args)
|
||||
#define CPRINTF(format, args...) cprintf(CC_KEYBOARD, format, ## args)
|
||||
|
||||
static int i8042_irq_enabled;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
||||
/* Copyright (c) 2013 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.
|
||||
*
|
||||
@@ -12,8 +12,8 @@
|
||||
#include "host_command.h"
|
||||
#include "i8042.h"
|
||||
#include "i8042_protocol.h"
|
||||
#include "keyboard.h"
|
||||
#include "keyboard_config.h"
|
||||
#include "keyboard_protocol.h"
|
||||
#include "lightbar.h"
|
||||
#include "lpc.h"
|
||||
#include "registers.h"
|
||||
@@ -54,10 +54,10 @@ enum scancode_set_list {
|
||||
/*
|
||||
* i8042 global settings.
|
||||
*/
|
||||
static int keyboard_enabled = 0; /* default the keyboard is disabled. */
|
||||
static int keystroke_enabled; /* output keystrokes */
|
||||
static int keyboard_enabled; /* default the keyboard is disabled. */
|
||||
static int keystroke_enabled; /* output keystrokes */
|
||||
static uint8_t resend_command[MAX_SCAN_CODE_LEN];
|
||||
static uint8_t resend_command_len = 0;
|
||||
static uint8_t resend_command_len;
|
||||
static uint8_t controller_ram_address;
|
||||
static uint8_t controller_ram[0x20] = {
|
||||
/* the so called "command byte" */
|
||||
@@ -65,7 +65,7 @@ static uint8_t controller_ram[0x20] = {
|
||||
/* 0x01 - 0x1f are controller RAM */
|
||||
};
|
||||
static uint8_t A20_status;
|
||||
static int power_button_pressed = 0;
|
||||
static int power_button_pressed;
|
||||
static void keyboard_special(uint16_t k);
|
||||
|
||||
/*
|
||||
@@ -93,7 +93,7 @@ static uint8_t typematic_value_from_host = DEFAULT_TYPEMATIC_VALUE;
|
||||
static int refill_first_delay = DEFAULT_FIRST_DELAY; /* unit: ms */
|
||||
static int refill_inter_delay = DEFAULT_INTER_DELAY; /* unit: ms */
|
||||
static int typematic_delay; /* unit: us */
|
||||
static int typematic_len = 0; /* length of typematic_scan_code */
|
||||
static int typematic_len; /* length of typematic_scan_code */
|
||||
static uint8_t typematic_scan_code[MAX_SCAN_CODE_LEN];
|
||||
|
||||
|
||||
@@ -257,7 +257,7 @@ static void reset_rate_and_delay(void)
|
||||
}
|
||||
|
||||
|
||||
void keyboard_clear_underlying_buffer(void)
|
||||
void keyboard_clear_buffer(void)
|
||||
{
|
||||
i8042_flush_buffer();
|
||||
}
|
||||
@@ -493,25 +493,25 @@ int handle_keyboard_data(uint8_t data, uint8_t *output)
|
||||
case I8042_CMD_ENABLE:
|
||||
output[out_len++] = I8042_RET_ACK;
|
||||
keystroke_enable(1);
|
||||
keyboard_clear_underlying_buffer();
|
||||
keyboard_clear_buffer();
|
||||
break;
|
||||
|
||||
case I8042_CMD_RESET_DIS:
|
||||
output[out_len++] = I8042_RET_ACK;
|
||||
keystroke_enable(0);
|
||||
reset_rate_and_delay();
|
||||
keyboard_clear_underlying_buffer();
|
||||
keyboard_clear_buffer();
|
||||
break;
|
||||
|
||||
case I8042_CMD_RESET_DEF:
|
||||
output[out_len++] = I8042_RET_ACK;
|
||||
reset_rate_and_delay();
|
||||
keyboard_clear_underlying_buffer();
|
||||
keyboard_clear_buffer();
|
||||
break;
|
||||
|
||||
case I8042_CMD_RESET_BAT:
|
||||
reset_rate_and_delay();
|
||||
keyboard_clear_underlying_buffer();
|
||||
keyboard_clear_buffer();
|
||||
output[out_len++] = I8042_RET_ACK;
|
||||
output[out_len++] = I8042_RET_BAT;
|
||||
output[out_len++] = I8042_RET_BAT;
|
||||
@@ -644,7 +644,7 @@ int handle_keyboard_command(uint8_t command, uint8_t *output)
|
||||
} else {
|
||||
CPRINTF("[%T KB unsupported cmd: 0x%02x]\n", command);
|
||||
reset_rate_and_delay();
|
||||
keyboard_clear_underlying_buffer();
|
||||
keyboard_clear_buffer();
|
||||
output[out_len++] = I8042_RET_NAK;
|
||||
data_port_state = STATE_NORMAL;
|
||||
}
|
||||
@@ -658,7 +658,7 @@ int handle_keyboard_command(uint8_t command, uint8_t *output)
|
||||
/* U U D D L R L R b a */
|
||||
static void keyboard_special(uint16_t k)
|
||||
{
|
||||
static uint8_t s = 0;
|
||||
static uint8_t s;
|
||||
static const uint16_t a[] = {0xe048, 0xe048, 0xe050, 0xe050, 0xe04b,
|
||||
0xe04d, 0xe04b, 0xe04d, 0x0030, 0x001e};
|
||||
#ifdef CONFIG_TASK_LIGHTBAR
|
||||
@@ -984,7 +984,7 @@ static void keyboard_preserve_state(void)
|
||||
state.ctlram = controller_ram[0];
|
||||
|
||||
system_add_jump_tag(KB_SYSJUMP_TAG, KB_HOOK_VERSION,
|
||||
sizeof(state), &state);
|
||||
sizeof(state), &state);
|
||||
}
|
||||
DECLARE_HOOK(HOOK_SYSJUMP, keyboard_preserve_state, HOOK_PRIO_DEFAULT);
|
||||
|
||||
@@ -997,7 +997,7 @@ static void keyboard_restore_state(void)
|
||||
int version, size;
|
||||
|
||||
prev = (const struct kb_state *)system_get_jump_tag(KB_SYSJUMP_TAG,
|
||||
&version, &size);
|
||||
&version, &size);
|
||||
if (prev && version == KB_HOOK_VERSION && size == sizeof(*prev)) {
|
||||
/* Coming back from a sysjump, so restore settings. */
|
||||
scancode_set = prev->codeset;
|
||||
@@ -10,8 +10,8 @@
|
||||
#include "console.h"
|
||||
#include "gpio.h"
|
||||
#include "host_command.h"
|
||||
#include "keyboard.h"
|
||||
#include "keyboard_config.h"
|
||||
#include "keyboard_protocol.h"
|
||||
#include "keyboard_raw.h"
|
||||
#include "keyboard_scan.h"
|
||||
#include "keyboard_test.h"
|
||||
@@ -38,14 +38,6 @@ static uint8_t scan_edge_index[KEYBOARD_COLS][KEYBOARD_ROWS];
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/* Provide a default function in case the board doesn't have one */
|
||||
void __board_keyboard_suppress_noise(void)
|
||||
{
|
||||
}
|
||||
|
||||
void board_keyboard_suppress_noise(void)
|
||||
__attribute__((weak, alias("__board_keyboard_suppress_noise")));
|
||||
|
||||
#define KB_FIFO_DEPTH 16 /* FIXME: this is pretty huge */
|
||||
static uint32_t kb_fifo_start; /* first entry */
|
||||
static uint32_t kb_fifo_end; /* last entry */
|
||||
@@ -71,9 +63,6 @@ static struct ec_mkbp_config config = {
|
||||
.fifo_max_depth = KB_FIFO_DEPTH,
|
||||
};
|
||||
|
||||
/**
|
||||
* Clear keyboard state variables.
|
||||
*/
|
||||
void keyboard_clear_state(void)
|
||||
{
|
||||
int i;
|
||||
@@ -86,12 +75,7 @@ void keyboard_clear_state(void)
|
||||
memset(kb_fifo[i], 0, KEYBOARD_COLS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add keyboard state into FIFO
|
||||
*
|
||||
* @return EC_SUCCESS if entry added, EC_ERROR_OVERFLOW if FIFO is full
|
||||
*/
|
||||
static int kb_fifo_add(uint8_t *buffp)
|
||||
int keyboard_fifo_add(const uint8_t *buffp)
|
||||
{
|
||||
int ret = EC_SUCCESS;
|
||||
|
||||
@@ -308,7 +292,9 @@ static int check_keys_changed(uint8_t *state)
|
||||
}
|
||||
|
||||
if (any_change) {
|
||||
board_keyboard_suppress_noise();
|
||||
#ifdef CONFIG_KEYBOARD_SUPPRESS_NOISE
|
||||
keyboard_suppress_noise();
|
||||
#endif
|
||||
print_state(state, "state");
|
||||
|
||||
#ifdef PRINT_SCAN_TIMES
|
||||
@@ -325,7 +311,7 @@ static int check_keys_changed(uint8_t *state)
|
||||
/* Swallow special keys */
|
||||
if (check_runtime_keys(state))
|
||||
return 0;
|
||||
else if (kb_fifo_add(state) == EC_SUCCESS)
|
||||
else if (keyboard_fifo_add(state) == EC_SUCCESS)
|
||||
set_host_interrupt(1);
|
||||
else
|
||||
CPRINTF("dropped keystroke\n");
|
||||
@@ -473,12 +459,6 @@ void keyboard_put_char(uint8_t chr, int send_irq)
|
||||
/* TODO: needs to be implemented */
|
||||
}
|
||||
|
||||
int keyboard_scan_recovery_pressed(void)
|
||||
{
|
||||
return host_get_events() &
|
||||
EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY);
|
||||
}
|
||||
|
||||
static int keyboard_get_scan(struct host_cmd_handler_args *args)
|
||||
{
|
||||
kb_fifo_remove(args->response);
|
||||
@@ -509,7 +489,7 @@ DECLARE_HOST_COMMAND(EC_CMD_MKBP_INFO,
|
||||
keyboard_get_info,
|
||||
EC_VER_MASK(0));
|
||||
|
||||
void keyboard_enable_scanning(int enable)
|
||||
void keyboard_scan_enable(int enable)
|
||||
{
|
||||
if (enable) {
|
||||
mutex_unlock(&scanning_enabled);
|
||||
@@ -535,11 +515,11 @@ void keyboard_enable_scanning(int enable)
|
||||
#define BATTERY_KEY_ROW 7
|
||||
#define BATTERY_KEY_ROW_MASK (1 << BATTERY_KEY_ROW)
|
||||
|
||||
void keyboard_send_battery_key()
|
||||
void keyboard_send_battery_key(void)
|
||||
{
|
||||
mutex_lock(&scanning_enabled);
|
||||
debounced_state[BATTERY_KEY_COL] ^= BATTERY_KEY_ROW_MASK;
|
||||
if (kb_fifo_add(debounced_state) == EC_SUCCESS)
|
||||
if (keyboard_fifo_add(debounced_state) == EC_SUCCESS)
|
||||
set_host_interrupt(1);
|
||||
else
|
||||
CPRINTF("dropped battery keystroke\n");
|
||||
@@ -575,7 +555,7 @@ static int command_keyboard_press(int argc, char **argv)
|
||||
else
|
||||
debounced_state[c] &= ~(1 << r);
|
||||
|
||||
if (kb_fifo_add(debounced_state) == EC_SUCCESS)
|
||||
if (keyboard_fifo_add(debounced_state) == EC_SUCCESS)
|
||||
set_host_interrupt(1);
|
||||
else
|
||||
ccprintf("dropped keystroke\n");
|
||||
@@ -9,8 +9,8 @@
|
||||
#include "common.h"
|
||||
#include "console.h"
|
||||
#include "host_command.h"
|
||||
#include "keyboard.h"
|
||||
#include "keyboard_config.h"
|
||||
#include "keyboard_protocol.h"
|
||||
#include "keyboard_raw.h"
|
||||
#include "keyboard_scan.h"
|
||||
#include "switch.h"
|
||||
@@ -457,7 +457,7 @@ void keyboard_scan_task(void)
|
||||
}
|
||||
}
|
||||
|
||||
void keyboard_enable_scanning(int enable)
|
||||
void keyboard_scan_enable(int enable)
|
||||
{
|
||||
enable_scanning = enable;
|
||||
|
||||
@@ -470,7 +470,7 @@ void keyboard_enable_scanning(int enable)
|
||||
task_wake(TASK_ID_KEYSCAN);
|
||||
} else {
|
||||
keyboard_raw_drive_column(KEYBOARD_COLUMN_NONE);
|
||||
keyboard_clear_underlying_buffer();
|
||||
keyboard_clear_buffer();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
||||
/* Copyright (c) 2013 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.
|
||||
*
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "gpio.h"
|
||||
#include "hooks.h"
|
||||
#include "jtag.h"
|
||||
#include "keyboard.h"
|
||||
#include "keyboard_scan.h"
|
||||
#include "system.h"
|
||||
#include "task.h"
|
||||
|
||||
@@ -35,7 +35,6 @@ enum console_channel {
|
||||
CC_GPIO,
|
||||
CC_HOSTCMD,
|
||||
CC_I2C,
|
||||
CC_I8042,
|
||||
CC_KEYBOARD,
|
||||
CC_KEYSCAN,
|
||||
CC_LIGHTBAR,
|
||||
|
||||
@@ -1,44 +1,47 @@
|
||||
/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
||||
/* Copyright (c) 2013 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.
|
||||
*
|
||||
* The functions implemented by keyboard component of EC core.
|
||||
*/
|
||||
|
||||
#ifndef __CROS_EC_KEYBOARD_H
|
||||
#define __CROS_EC_KEYBOARD_H
|
||||
#ifndef __CROS_EC_KEYBOARD_8042_H
|
||||
#define __CROS_EC_KEYBOARD_8042_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define MAX_SCAN_CODE_LEN 4
|
||||
|
||||
/* Called by keyboard scan code once any key state change (after de-bounce),
|
||||
*
|
||||
* This function will look up matrix table and convert scancode host.
|
||||
*/
|
||||
void keyboard_state_changed(int row, int col, int is_pressed);
|
||||
|
||||
|
||||
/* Handle the port 0x60 writes from host.
|
||||
/**
|
||||
* Handle the port 0x60 writes from host.
|
||||
*
|
||||
* This functions returns the number of bytes stored in *output buffer.
|
||||
*/
|
||||
int handle_keyboard_data(uint8_t data, uint8_t *output);
|
||||
|
||||
/* Handle the port 0x64 writes from host.
|
||||
/**
|
||||
* Handle the port 0x64 writes from host.
|
||||
*
|
||||
* This functions returns the number of bytes stored in *output buffer.
|
||||
* BUT theose bytes will appear at port 0x60.
|
||||
*/
|
||||
int handle_keyboard_command(uint8_t command, uint8_t *output);
|
||||
|
||||
/* Clear the keyboard buffer to host. */
|
||||
void keyboard_clear_underlying_buffer(void);
|
||||
/**
|
||||
* Called by keyboard scan code once any key state change (after de-bounce),
|
||||
*
|
||||
* This function will look up matrix table and convert scancode host.
|
||||
*/
|
||||
void keyboard_state_changed(int row, int col, int is_pressed);
|
||||
|
||||
/* Send make/break code of power button to host. */
|
||||
/**
|
||||
* Send make/break code of power button to host.
|
||||
*/
|
||||
void keyboard_set_power_button(int pressed);
|
||||
|
||||
/* Log the keyboard-related information */
|
||||
/**
|
||||
* Log the keyboard-related information
|
||||
*/
|
||||
void kblog_put(char type, uint8_t byte);
|
||||
|
||||
#endif /* __CROS_EC_KEYBOARD_H */
|
||||
#endif /* __CROS_EC_KEYBOARD_8042_H */
|
||||
25
include/keyboard_mkbp.h
Normal file
25
include/keyboard_mkbp.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/* Copyright (c) 2013 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.
|
||||
*
|
||||
* MKBP keyboard protocol
|
||||
*/
|
||||
|
||||
#ifndef __CROS_EC_KEYBOARD_MKBP_H
|
||||
#define __CROS_EC_KEYBOARD_MKBP_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/**
|
||||
* Add keyboard state into FIFO
|
||||
*
|
||||
* @return EC_SUCCESS if entry added, EC_ERROR_OVERFLOW if FIFO is full
|
||||
*/
|
||||
int keyboard_fifo_add(const uint8_t *buffp);
|
||||
|
||||
/**
|
||||
* Send KEY_BATTERY keystroke.
|
||||
*/
|
||||
void keyboard_send_battery_key(void);
|
||||
|
||||
#endif /* __CROS_EC_KEYBOARD_MKBP_H */
|
||||
30
include/keyboard_protocol.h
Normal file
30
include/keyboard_protocol.h
Normal file
@@ -0,0 +1,30 @@
|
||||
/* Copyright (c) 2013 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.
|
||||
*
|
||||
* Keyboard protocol interface
|
||||
*/
|
||||
|
||||
#ifndef __CROS_EC_KEYBOARD_PROTOCOL_H
|
||||
#define __CROS_EC_KEYBOARD_PROTOCOL_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/* Routines common to all protocols */
|
||||
|
||||
/**
|
||||
* Clear the keyboard buffer to host.
|
||||
*/
|
||||
void keyboard_clear_buffer(void);
|
||||
|
||||
/* Protocol-specific includes */
|
||||
|
||||
#ifdef CONFIG_KEYBOARD_PROTOCOL_8042
|
||||
#include "keyboard_8042.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_KEYBOARD_PROTOCOL_MKBP
|
||||
#include "keyboard_mkbp.h"
|
||||
#endif
|
||||
|
||||
#endif /* __CROS_EC_KEYBOARD_PROTOCOL_H */
|
||||
@@ -26,29 +26,22 @@ enum boot_key {
|
||||
/**
|
||||
* Return the key held down at boot time in addition to the keyboard-controlled
|
||||
* reset keys. Returns BOOT_KEY_OTHER if none of the keys specifically checked
|
||||
* was pressed, or reset was not caused by a keyboard-controlled reset, or if
|
||||
* the state has been cleared by keyboard_scan_clear_boot_key().
|
||||
* was pressed, or reset was not caused by a keyboard-controlled reset.
|
||||
*/
|
||||
enum boot_key keyboard_scan_get_boot_key(void);
|
||||
|
||||
/**
|
||||
* Return non-zero if recovery key was pressed at boot.
|
||||
*/
|
||||
int keyboard_scan_recovery_pressed(void);
|
||||
|
||||
/**
|
||||
* Clear any saved keyboard state (empty FIFO, etc).
|
||||
*/
|
||||
void keyboard_clear_state(void);
|
||||
|
||||
/**
|
||||
* Enables/disables keyboard matrix scan.
|
||||
*/
|
||||
void keyboard_enable_scanning(int enable);
|
||||
void keyboard_scan_enable(int enable);
|
||||
|
||||
#ifdef CONFIG_KEYBOARD_SUPPRESS_NOISE
|
||||
/**
|
||||
* Sends KEY_BATTERY keystroke.
|
||||
* Indicate to audio codec that a key has been pressed.
|
||||
*
|
||||
* Boards may supply this function to suppress audio noise.
|
||||
*/
|
||||
void keyboard_send_battery_key(void);
|
||||
void keyboard_suppress_noise(void);
|
||||
#endif
|
||||
|
||||
#endif /* __CROS_EC_KEYBOARD_SCAN_H */
|
||||
|
||||
Reference in New Issue
Block a user