summaryrefslogtreecommitdiff
path: root/board/hammer/variants.h
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2019-08-12 08:52:37 +0800
committerCommit Bot <commit-bot@chromium.org>2019-08-12 05:39:14 +0000
commite4440d52945fef7e5f3c98911f50363e65fc488e (patch)
tree73cffd4360d9bdccd72cee70770f29075301cd1f /board/hammer/variants.h
parentfb0eb4d1b932ba469f7385e42cf43f5a11f09c85 (diff)
downloadchrome-ec-e4440d52945fef7e5f3c98911f50363e65fc488e.tar.gz
hammer: Refactor config options to support more variants
board.h is already quite difficult to read, and will become worse as we add more and more derivatives, let's refactor most of the variations into variants.h. BRANCH=none BUG=b:138968914 TEST=make buildall -j, see that there is no size change before and after the change. Change-Id: Ideb381d8d04c65c3e76eb3ab9353e1ce5cdee954 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1746352 Reviewed-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Yilun Lin <yllin@chromium.org>
Diffstat (limited to 'board/hammer/variants.h')
-rw-r--r--board/hammer/variants.h80
1 files changed, 80 insertions, 0 deletions
diff --git a/board/hammer/variants.h b/board/hammer/variants.h
new file mode 100644
index 0000000000..e520a0b450
--- /dev/null
+++ b/board/hammer/variants.h
@@ -0,0 +1,80 @@
+/* Copyright 2019 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.
+ */
+
+/*
+ * Hammer variants configuration, there should be no/little BOARD_ checks
+ * in the rest of the files. If this grows out of control, we can create
+ * variant_*.h files.
+ */
+
+#ifndef __CROS_EC_VARIANTS_H
+#define __CROS_EC_VARIANTS_H
+
+/* USB ID */
+#ifdef BOARD_HAMMER
+#define CONFIG_USB_PID 0x5022
+#elif defined(BOARD_STAFF)
+#define CONFIG_USB_PID 0x502b
+#elif defined(BOARD_WAND)
+#define CONFIG_USB_PID 0x502d
+#elif defined(BOARD_WHISKERS)
+#define CONFIG_USB_PID 0x5030
+#else
+#error "Invalid board"
+#endif
+
+#ifdef SECTION_IS_RW
+
+/* Touchpad interface, firmware size and physical dimension. */
+#if defined(BOARD_HAMMER) || defined(BOARD_WAND)
+#define HAS_I2C_TOUCHPAD
+#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_X 3207
+#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_Y 1783
+#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_PRESSURE 511
+#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_X 1018 /* tenth of mm */
+#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_Y 566 /* tenth of mm */
+#define CONFIG_TOUCHPAD_VIRTUAL_SIZE (48*1024)
+#elif defined(BOARD_STAFF)
+#define HAS_I2C_TOUCHPAD
+#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_X 3206
+#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_Y 1832
+#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_PRESSURE 511
+#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_X 1017 /* tenth of mm */
+#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_Y 581 /* tenth of mm */
+#define CONFIG_TOUCHPAD_VIRTUAL_SIZE (56*1024)
+#elif defined(BOARD_WHISKERS)
+#define HAS_SPI_TOUCHPAD
+#define HAS_EN_PP3300_TP_ACTIVE_HIGH
+#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_X 2160
+#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_Y 1573
+#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_PRESSURE 255
+#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_X 1030 /* tenth of mm */
+#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_Y 750 /* tenth of mm */
+#define CONFIG_TOUCHPAD_VIRTUAL_SIZE (CONFIG_UPDATE_PDU_SIZE + 128*1024)
+/* Enable to send heatmap to AP */
+#define CONFIG_USB_ISOCHRONOUS
+#else
+#error "No touchpad information for board."
+#endif
+
+/* Assistant key */
+#if defined(BOARD_HAMMER) || defined(BOARD_WAND) || defined(BOARD_WHISKERS)
+#define CONFIG_KEYBOARD_BOARD_CONFIG
+#define CONFIG_KEYBOARD_ASSISTANT_KEY
+#endif
+
+/* Backlight driver */
+#ifdef BOARD_WHISKERS
+#define CONFIG_LED_DRIVER_LM3630A
+#endif
+
+/* Hall sensor for tablet mode detection */
+#ifdef BOARD_WHISKERS
+#define CONFIG_HALL_SENSOR
+#endif
+
+#endif /* SECTION_IS_RW */
+
+#endif /* __CROS_EC_VARIANTS_H */