summaryrefslogtreecommitdiff
path: root/board/hammer
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2018-05-30 15:55:57 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-06-06 05:00:49 -0700
commit65d87bf9f0ef9b084d91ed44eda58b7463c82b48 (patch)
tree64bcafd6797a3a60bc9c5a7e2164688ad9bb7a38 /board/hammer
parent8290d879dab1fbba805cfcdb4f2409bdee803dc6 (diff)
downloadchrome-ec-65d87bf9f0ef9b084d91ed44eda58b7463c82b48.tar.gz
whiskers: Expose a switch for tablet mode
With this, whiskers exposes a tablet mode switch to inform the lid when the base is flipped around. We take this opportunity to clean up a bit whiskers/keyboard code: - Use tablet mode switch instead of lid switch - Refactor usb_hid_keyboard.c to accept either assistant key or tablet mode switch, or both. - Remove bit-field usage in HID report struct, and instead, generalize with an "extra" field that can be used for additional key/switches. BRANCH=none BUG=b:73133611 TEST=Flash whiskers, see that tablet mode events are sent when a magnet approaches the hall sensor. Change-Id: Ibf43bb04fdc867d18d9f318388d1ebd17b49d47f Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1077915 Reviewed-by: Wei-Han Chen <stimim@chromium.org>
Diffstat (limited to 'board/hammer')
-rw-r--r--board/hammer/board.c14
-rw-r--r--board/hammer/board.h6
-rw-r--r--board/hammer/gpio.inc2
3 files changed, 6 insertions, 16 deletions
diff --git a/board/hammer/board.c b/board/hammer/board.c
index e0edde5884..80910fbf16 100644
--- a/board/hammer/board.c
+++ b/board/hammer/board.c
@@ -15,7 +15,6 @@
#include "i2c.h"
#include "keyboard_raw.h"
#include "keyboard_scan.h"
-#include "lid_switch.h"
#include "printf.h"
#include "pwm.h"
#include "pwm_chip.h"
@@ -25,6 +24,7 @@
#include "rollback.h"
#include "spi.h"
#include "system.h"
+#include "tablet_mode.h"
#include "task.h"
#include "touchpad.h"
#include "timer.h"
@@ -253,18 +253,6 @@ void board_touchpad_reset(void)
#endif
}
-#if defined(SECTION_IS_RW) && defined(BOARD_WHISKERS)
-static void lid_change(void)
-{
- if (lid_is_open())
- usb_connect();
- else
- usb_disconnect();
-}
-DECLARE_HOOK(HOOK_LID_CHANGE, lid_change, HOOK_PRIO_DEFAULT);
-DECLARE_HOOK(HOOK_INIT, lid_change, HOOK_PRIO_DEFAULT + 1);
-#endif
-
/*
* Get entropy based on Clock Recovery System, which is enabled on hammer to
* synchronize USB SOF with internal oscillator.
diff --git a/board/hammer/board.h b/board/hammer/board.h
index 0f84c53d39..aa5678f5d2 100644
--- a/board/hammer/board.h
+++ b/board/hammer/board.h
@@ -231,8 +231,10 @@
#ifdef BOARD_WHISKERS
#define CONFIG_LED_DRIVER_LM3630A
-#define CONFIG_LID_SWITCH
-#define CONFIG_USB_INHIBIT_CONNECT
+#define CONFIG_TABLET_MODE
+#define CONFIG_TABLET_SWITCH
+#define TABLET_MODE_GPIO_L GPIO_TABLET_MODE_L
+#define CONFIG_KEYBOARD_TABLET_MODE_SWITCH
/* Enable control of SPI over USB */
#define CONFIG_USB_SPI
#define CONFIG_SPI_MASTER
diff --git a/board/hammer/gpio.inc b/board/hammer/gpio.inc
index 8786c435d1..4f8e28a5a7 100644
--- a/board/hammer/gpio.inc
+++ b/board/hammer/gpio.inc
@@ -11,7 +11,7 @@
#ifdef SECTION_IS_RW
GPIO_INT(TOUCHPAD_INT, PIN(B, 8), GPIO_INT_FALLING, touchpad_interrupt)
#ifdef BOARD_WHISKERS
-GPIO_INT(LID_OPEN, PIN(B, 11), GPIO_PULL_UP | GPIO_INT_BOTH, lid_interrupt)
+GPIO_INT(TABLET_MODE_L, PIN(B, 11), GPIO_PULL_UP | GPIO_INT_BOTH, tablet_mode_isr)
#endif /* BOARD_WHISKERS */
#endif /* SECTION_IS_RW */