summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWei-Han Chen <stimim@google.com>2018-07-17 19:50:28 +0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2018-11-19 01:24:15 +0000
commit0040af5c9cdfa2f04e748c810faca80863b2c941 (patch)
treed562b5ab926dd359c738c69bd74fdd19ab09d899
parent08500a9f30f50a56942b2e136e298ad9c8448582 (diff)
downloadchrome-ec-0040af5c9cdfa2f04e748c810faca80863b2c941.tar.gz
usb_hid_touchpad: make max pressure configurable
Maximum pressure is now defined by CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_Z. `hammer` is the only board using usb_hid_touchpad, the board.h is updated to reflect the change (for old boards "HAMMER" and "STAFF", we keep the value 1023, so they should behave the same). BRANCH=none BUG=b:70482333 BUG=chromium:904711 TEST=make BOARD=whiskers TEST=make buildall -j TEST=manually on device Signed-off-by: Wei-Han Chen <stimim@chromium.org> Change-Id: I70b0a5b19dfbe3ac731ef2ead08578a7f7a1cb0b Reviewed-on: https://chromium-review.googlesource.com/1141676 Commit-Ready: Wei-Han Chen <stimim@chromium.org> Tested-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/1333948 Commit-Queue: Nicolas Boichat <drinkcat@chromium.org> Tested-by: Nicolas Boichat <drinkcat@chromium.org>
-rw-r--r--board/hammer/board.h3
-rw-r--r--chip/stm32/usb_hid_touchpad.c4
-rw-r--r--include/config.h1
3 files changed, 7 insertions, 1 deletions
diff --git a/board/hammer/board.h b/board/hammer/board.h
index 7ef3cc1a71..a1b2f3175b 100644
--- a/board/hammer/board.h
+++ b/board/hammer/board.h
@@ -189,18 +189,21 @@
#if defined(BOARD_HAMMER) || defined(BOARD_WAND)
#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 1023
#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 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 1023
#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 CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_X 2160
#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_Y 1080
+#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_PRESSURE 255
#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_X 1000 /* tenth of mm */
#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_Y 500 /* tenth of mm */
#define CONFIG_TOUCHPAD_VIRTUAL_SIZE (128*1024)
diff --git a/chip/stm32/usb_hid_touchpad.c b/chip/stm32/usb_hid_touchpad.c
index 6646ad2e09..06082fdb1f 100644
--- a/chip/stm32/usb_hid_touchpad.c
+++ b/chip/stm32/usb_hid_touchpad.c
@@ -82,7 +82,9 @@ const struct usb_endpoint_descriptor USB_EP_DESC(USB_IFACE_HID_TOUCHPAD, 81) = {
0x25, 0x0F, /* Logical Maximum (15) */ \
0x81, 0x02, /* Input (Data,Var,Abs) */ \
0x05, 0x0D, /* Usage Page (Digitizer) */ \
- 0x26, 0xFF, 0x03, /* Logical Maximum (1023) */ \
+ /* Logical Maximum of Pressure */ \
+ 0x26, (CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_PRESSURE & 0xFF), \
+ (CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_PRESSURE >> 8), \
0x75, 0x0A, /* Report Size (10) */ \
0x09, 0x30, /* Usage (Tip pressure) */ \
0x81, 0x02, /* Input (Data,Var,Abs) */ \
diff --git a/include/config.h b/include/config.h
index 22780cf170..fb71433a05 100644
--- a/include/config.h
+++ b/include/config.h
@@ -3031,6 +3031,7 @@
/* HID touchpad logical dimensions */
#undef CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_X
#undef CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_Y
+#undef CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_PRESSURE
/* HID touchpad physical dimensions (tenth of mm) */
#undef CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_X
#undef CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_Y