summaryrefslogtreecommitdiff
path: root/include/keyboard_8042_sharedlib.h
Commit message (Collapse)AuthorAgeFilesLines
* ec: Change get_keycap_label return to unsignedJeremy Bettis2023-01-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | This causes compiler failures with some compiler flags. Change all references to get_keycap_label to use uint8_t instead of char. BRANCH=NONE BUG=b:264434836,b:257393779 TEST=make clobber && make V=1 TEST_ASAN=y TEST_FLAG=TEST_HOSTTEST=y \ test-list-host=kb_8042 run-kb_8042 LOW_COVERAGE_REASON=Refactor of types only. Change-Id: I95db81e8adc2bc082df8fae26d33aad78adbd1cf Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4136957 Tested-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Eric Yilun Lin <yllin@google.com> Code-Coverage: Eric Yilun Lin <yllin@google.com>
* include: Sort header filesJeremy Bettis2022-11-291-2/+2
| | | | | | | | | | | | | | | | | | | | Sort all includes in include with the clang-format rules used by the zephyr project. BRANCH=None BUG=b:247100970 TEST=zmake build -a TEST=./twister --clobber -v -i TEST=make -j72 buildall_only runtests TEST=zmake compare-builds -a Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: Ic23f440ebd93519e4341423cf6cb7a298620cbfe Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4049883 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Tristan Honscheid <honscheid@google.com>
* Update license boilerplate text in source code filesMike Frysinger2022-09-121-1/+1
| | | | | | | | | | | | | | | Normally we don't do this, but enough changes have accumulated that we're doing a tree-wide one-off update of the name & style. BRANCH=none BUG=chromium:1098010 TEST=`repo upload` works Change-Id: Icd3a1723c20595356af83d190b2c6a9078b3013b Signed-off-by: Mike Frysinger <vapier@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891203 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* include/keyboard_8042_sharedlib.h: Format with clang-formatJack Rosenthal2022-06-291-70/+70
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: Ibbf93e5314f62f905a413a004a7b575d8ec92309 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730295 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* keyboard: Modify register_scancode_set2 APIYu-An Chen2022-05-201-1/+1
| | | | | | | | | | | | | Modify register_scancode_set2 API argument BUG=b:220800586 BRANCH=none TEST=manual check function working Signed-off-by: Yu-An Chen <yu-an.chen@quanta.corp-partner.google.com> Change-Id: I3a13c93007c4d929ade0d7e32623b6308f0a05ae Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3649936 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* keyboard: Add register_scancode_set2 APIDaisuke Nojiri2022-05-171-0/+10
| | | | | | | | | | | | | | register_scancode_set2 API allows each board to install an entire scancode set. BUG=b:220800586 BRANCH=None TEST=buildall Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: Ideafef9a4fce6197e56eee6e28acceff77803681 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3644693 Reviewed-by: Parth Malkan <parthmalkan@google.com>
* common/keyboard_vivaldi: Add new top row action keyScott Chao2021-08-031-0/+2
| | | | | | | | | | | | | | Use codeset 1 e01b(make)/ e09b(break) for MICMUTE. Use codeset 1 e01e(make)/ e09e(break) for KBBL toggle. BUG=b:194146863 BRANCH=none TEST=make -j BOARD=gimble Signed-off-by: Scott Chao <scott_chao@wistron.corp-partner.google.com> Change-Id: Ide0873c32236ead87d661e36b5f9b20cfd78144b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3060242 Reviewed-by: Boris Mittelberg <bmbm@google.com>
* common/keyboard_vivaldi: New keyboard framework for custom layoutRajat Jain2020-04-211-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Vivaldi is a new keyboard that allows individual boards to have additional or different top row keys and/or to reorder those keys. The primary agenda of vivaldi is to allow customization of the top row keys. However, as a secondary objective, it also allows coreboot to send a keymap to the kernel, for only the keys that are actually present on the keyboard. As part of enabling vivaldi, another feature that get enabled is to start sending action codes instead of function codes for the top row of the keyboard. go/vivaldi-prd go/vivaldi-design go/vivaldi-fw-design With this patch, things remain unchanged for any boards that do not provide board_set_vivaldi_keybd_config(). For boards that do provide it: * EC begins to send action scancodes instead of function scancodes for the top row when top row keys are pressed. * EC responds to an EC command from the coreboot, that asks for the layout for the keyboard. Coreboot uses this to expose corresponding keycodes to the kernel. BUG=b:146501925 TEST=Check on Jinlon the (new) expected scancodes are output from EC. BRANCH=firmware-hatch-12672.B Signed-off-by: Rajat Jain <rajatja@google.com> Change-Id: I1f45ce6eee138a984f8d4caef1ec76c9538dd30b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2135566
* common: Make scancode table always mutableRajat Jain2020-04-211-14/+35
| | | | | | | | | | | | | | | | Since the vivaldi requires the scancode to be mutable, and vivaldi shall be enabled by default for all boards, thus make the scancode table to be always mutable and get rid of the config option it hides behind. BUG=b:146501925 TEST=Build BRANCH=firmware-hatch-12672.B Signed-off-by: Rajat Jain <rajatja@google.com> Change-Id: Iaedcd6d84caf31c91a61854f96414bcea38f5c2a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2133825 Reviewed-by: Jett Rink <jettrink@chromium.org>
* common/vivaldi: Minor fixupsRajat Jain2020-03-271-2/+2
| | | | | | | | | | | | | | * Remove trailing "\n" from some debugs * Rename 2 keys to make it more clear / reader friendly. * Add a print for keyboard config for top keys on boot. Signed-off-by: Rajat Jain <rajatja@google.com> BRANCH=cros/firmware-hatch-12672.B BUG=b:146589270 TEST=Test on Jinlon Change-Id: I27691c697bbc26ad9cd5d3516e257110fe163df6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2124013 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
* common/keyboard_vivaldi: Support for new Vivaldi keyboardRajat Jain2020-03-171-10/+32
| | | | | | | | | | | | | | | | | | | | | | | | | Vivaldi is a new keyboard that allows individual boards to have additional or different top row keys and/or to reorder those keys. go/vivaldi-prd go/vivaldi-design Add code to provide an API that individual boards that use the vivaldi keyboard, that lets them define their board keyboard top row layout. Some scan codes have been taken from https://wiki.osdev.org/PS/2_Keyboard#Key_Codes.2C_Key_States_and_Key_Mappings and ones that did not exist, have been allotted from (seemingly) free holes in there. BUG=b:146501925 TEST=Check on Jinlon the (new) expected scancodes are output from EC. BRANCH=firmware-hatch-12672.B Signed-off-by: Rajat Jain <rajatja@google.com> Change-Id: Id6b854337958d99898175e7be7a9972938e32399 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2080603 Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* keyboard: Add a new config for the keyboard customizationZhuohao Lee2020-03-101-2/+4
| | | | | | | | | | | | | | | In order to support a non-chromeos keyboard matrix, we can add a new config CONFIG_KEYBOARD_CUSTOMIZATION to customize the keyboard matrix in the board setting. BUG=b:148034320 BRANCH=firmware-hatch-12672.B TEST=build pass Change-Id: I6a32a1f79aeb09805c5f47f8540ea25f67a34f7f Signed-off-by: Zhuohao Lee <zhuohao@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2035444 Reviewed-by: Jett Rink <jettrink@chromium.org>
* common/keyboard_8042: When pressed, print F11-F15 for debugRajat Jain2020-03-041-2/+2
| | | | | | | | | | | | | | | | | | Vivaldi adds support for a new keyboard layout, and more function keys. The scan matrix is here: https://drive.google.com/corp/drive/u/1/folders/17UtVQ-AixnlQuicRPTp8t46HE-sT522E Allow to print F11-F15 labels when debugging those extra keys. BUG=b:146501925 TEST=Check extra keys by putting debug prints in the EC. BRANCH=firmware-hatch-12672.B Signed-off-by: Rajat Jain <rajatja@google.com> Change-Id: I0714baf4a8981b90aefdd3b955ebf93985f70197 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2080602 Reviewed-by: Scott Collyer <scollyer@chromium.org>
* Keyboard: Allow keyboard size to be set at run timeDaisuke Nojiri2018-10-191-4/+4
| | | | | | | | | | | | | | | | | | | | | | | Currently, the keyboard size (i.e. number of columns) is static. This patch allows it to be configured at run time. It's required to support a keyboard with/without keypad in a single image. KEYBOARD_COLS_MAX has the build time col size. It's used to allocate exact spaces for arrays. Actual keyboard scanning is done using keyboard_cols, which holds a runtime col size. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:117126568 BRANCH=none TEST=Verify keyboard functionality on Sona and Veyron. Change-Id: I4b3552be0b4b315c3fe5a6884cf25e10aba8be7c Reviewed-on: https://chromium-review.googlesource.com/1285292 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Keyboard: switch column and row of scancode tableDaisuke Nojiri2018-10-191-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch switches column and row of scancode_set2. That is, scancode_set2[ROWS][COLS] = {0x00, 0x01, 0x02, ..., 0x10, 0x11, ..., 0x20, ..., becomes scancode_set2[COLS][ROWS] = {0x00, 0x10, 0x20, ..., 0x01, 0x11, ..., 0x02, ..., This will allow us to extend the table for a keypad without losing too much readability. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:117126568 BRANCH=none TEST=Verify keyboard functionality on Sona. Change-Id: I49a7c0796d5c91989f1d3686c80743fb4bcd5ba7 Reviewed-on: https://chromium-review.googlesource.com/1285291 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* keyboard: display keycap label in key status debug messagesNamyoon Woo2018-09-131-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current debug message in keyboard_8042.c displays a tuple of row, column, and press status. Additionally, this CL displays a keycap label for better readability. For keycap label mapping table can be adjustable under "CONFIG_KEYBOARD_SCANCODE_MUTABLE" condition as scancode_set2[] is. For coral board, Enabling CONFIG_KEYBOARD_DEBUG (w/o this CL) occupies 652 bytes in flash, and this CL occupies another 312 bytes. BUG=b:111060830 TEST=manually tested by pressing keyboards and check the EC console screen. BRANCH=kblog Signed-off-by: Namyoon Woo <namyoon@chromium.org> Changes to be committed: modified: board/eve/board.c modified: common/keyboard_8042.c modified: common/keyboard_8042_sharedlib.c modified: include/keyboard_8042_sharedlib.h Change-Id: Idd71a5475b1ee313f99e087be9143dcfb6f81550 Reviewed-on: https://chromium-review.googlesource.com/1214543 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Namyoon Woo <namyoon@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* keyboard: Change scan code magic values to enum.Hung-Te Lin2018-08-161-0/+49
| | | | | | | | | | | | | The key codes are now always scan code set 2 so we can create a list of scan codes and use them easily. BUG=None TEST=make buildall -j; boots properly BRANCH=None Change-Id: I1fdd7ab81bc13c97c4139afc19d71f5898e22f96 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1166743
* keyboard: Keep only scan code set 2 table and do translation for set 1.Hung-Te Lin2018-08-151-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | The 8042 scan code set 1 can be directly translated from set 2, with a 256 byte table. With this change, we can always process key stroke in scan code (set 2), and only translate in the single function `scancode_bytes`. This is very helpful when we need to do key processing, for example the buttons_8042 can now be simplified with only one scan code. And is extremely helpful if we want to do dynamic translation (i.e., to prevent something like CL:1164725). For `make BOARD=samus', the free space is also increased from 18472 to 18656 (+184) bytes. BUG=None TEST=make buildall; manually installed on Eve and tested by running 'keyboard' factory test to make sure all key scancodes are not changed. BRANCH=None Change-Id: Ieb303d84edcd4375bbeb1ea5f032d0462bbfd250 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1166742 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* keyboard_8042: Allow scancode sets to be mutableDuncan Laurie2017-05-181-0/+5
| | | | | | | | | | | | | | | | | | | Add an option to allow the scancode sets to be mutable. The only reason to use this is to allow a scancode to be changed at runtime, for instance to support different keyboards in one image. The side effect of this is the scancode sets are moved out of the shared RO section. BUG=b:36735408 BRANCH=none TEST=make -j buildall Change-Id: Iefb97691d1f295411d7b5db603d9214d41af49fd Signed-off-by: Duncan Laurie <dlaurie@google.com> Reviewed-on: https://chromium-review.googlesource.com/506717 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* libsharedobjs: Add 8042 scancodes to shared lib.Aseda Aboagye2015-07-171-0/+28
This commit adds the 8042 scancodes to the shared objects library saving 504 bytes from the RW image. To enable the space savings, define CONFIG_SHAREDLIB in the target's board.h file. BUG=none BRANCH=none TEST=make -j buildall tests TEST=Built samus EC image and verified keyboard still worked in RO and RW. TEST=Built samus EC image with CONFIG_SHAREDLIB enabled and verified that the keyboard still worked in RO and RW. TEST=Enabled CONFIG_SHAREDLIB for glados and cyan and watched build fail. CQ-DEPEND=CL:275344 Change-Id: I1241506c6b34d63e270677d4e8d0531a8a4236c9 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/276212 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>