diff options
author | Simon Glass <sjg@chromium.org> | 2012-10-04 12:27:36 -0700 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-10-05 04:26:20 -0700 |
commit | 41b42b5ead6a99a264d0ed0fb5b44a235191d486 (patch) | |
tree | 8fc377aefd3ff1d1741293f109316a18fc7dc77e | |
parent | a752e1f5d18ac5bd129dbc60ca74abfdcb47ea09 (diff) | |
download | chrome-ec-41b42b5ead6a99a264d0ed0fb5b44a235191d486.tar.gz |
Define key scan parameters and get/set command
At present the keyboard scan parameters are hard-coded, so changing them
requires a new EC image. This can be problematic if we want to adjust
the behavior of keyboard scanning since we must send an EC update.
Define the keyboard scan parameters and commands to get/set these
parameters.
Signed-off-by: Simon Glass <sjg@chromium.org>
BUG=chrome-os-partner:12179
BRANCH=snow,link
TEST=manual
Build for all boards
Change-Id: I715755cb5357503723b27ae33053dba1452e48e0
Reviewed-on: https://gerrit.chromium.org/gerrit/34656
Commit-Ready: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | include/ec_commands.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/include/ec_commands.h b/include/ec_commands.h index 42882cba5d..2dc53f1feb 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -866,6 +866,55 @@ struct ec_params_mkbp_simulate_key { uint8_t pressed; } __packed; +/* Configure keyboard scanning */ +#define EC_CMD_MKBP_SET_CONFIG 0x64 +#define EC_CMD_MKBP_GET_CONFIG 0x65 + +/* flags */ +enum mkbp_config_flags { + EC_MKBP_FLAGS_ENABLE = 1, /* Enable keyboard scanning */ +}; + +enum mkbp_config_valid { + EC_MKBP_VALID_SCAN_PERIOD = 1 << 0, + EC_MKBP_VALID_POLL_TIMEOUT = 1 << 1, + EC_MKBP_VALID_MIN_POST_SCAN_DELAY = 1 << 3, + EC_MKBP_VALID_OUTPUT_SETTLE = 1 << 4, + EC_MKBP_VALID_DEBOUNCE_DOWN = 1 << 5, + EC_MKBP_VALID_DEBOUNCE_UP = 1 << 6, + EC_MKBP_VALID_FIFO_MAX_DEPTH = 1 << 7, +}; + +/* Configuration for our key scanning algorithm */ +struct ec_mkbp_config { + uint32_t valid_mask; /* valid fields */ + uint8_t flags; /* some flags (enum mkbp_config_flags) */ + uint8_t valid_flags; /* which flags are valid */ + uint16_t scan_period_us; /* period between start of scans */ + /* revert to interrupt mode after no activity for this long */ + uint32_t poll_timeout_us; + /* + * minimum post-scan relax time. Once we finish a scan we check + * the time until we are due to start the next one. If this time is + * shorter this field, we use this instead. + */ + uint16_t min_post_scan_delay_us; + /* delay between setting up output and waiting for it to settle */ + uint16_t output_settle_us; + uint16_t debounce_down_us; /* time for debounce on key down */ + uint16_t debounce_up_us; /* time for debounce on key up */ + /* maximum depth to allow for fifo (0 = no keyscan output) */ + uint8_t fifo_max_depth; +} __packed; + +struct ec_params_mkbp_set_config { + struct ec_mkbp_config config; +} __packed; + +struct ec_response_mkbp_get_config { + struct ec_mkbp_config config; +} __packed; + /*****************************************************************************/ /* Temperature sensor commands */ |