summaryrefslogtreecommitdiff
path: root/include/i2c_hid_touchpad.h
diff options
context:
space:
mode:
authorShecky Lin <sheckylin@chromium.org>2020-03-11 15:25:53 +0800
committerCommit Bot <commit-bot@chromium.org>2020-03-17 12:11:48 +0000
commit1499ed62a817db87a6cee635fa3c409b323d6ebf (patch)
tree9d0d1292aee2aff318617d4f2290809c3d2221ef /include/i2c_hid_touchpad.h
parentc6f631c3e461cdafe5b643fa5d12415d67097ac6 (diff)
downloadchrome-ec-1499ed62a817db87a6cee635fa3c409b323d6ebf.tar.gz
i2c_hid_touchpad: Add init and request handlers
This is part of a chain to add a common I2C HID interface for touchpads. The CL adds an init function for I2C HID touchpad and implements a handler that can process I2C HID requests from the host. BUG=chromium:1008568 BRANCH=none TEST=Build and run on MCU to forward touchpad events to host through I2C HID. Signed-off-by: Shecky Lin <sheckylin@chromium.org> Cq-Depend: chromium:2094927 Change-Id: I58d46031396976eb3bf02e1b5516e92a9cd88ed4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2094928 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Diffstat (limited to 'include/i2c_hid_touchpad.h')
-rw-r--r--include/i2c_hid_touchpad.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/i2c_hid_touchpad.h b/include/i2c_hid_touchpad.h
index e24c0f0ab8..3bb53f4020 100644
--- a/include/i2c_hid_touchpad.h
+++ b/include/i2c_hid_touchpad.h
@@ -52,4 +52,22 @@ struct touchpad_event {
} __packed finger[I2C_HID_TOUCHPAD_MAX_FINGERS];
} __packed;
+/* Initialize the I2C HID touchpad */
+void i2c_hid_touchpad_init(void);
+/*
+ * Process an I2C-HID command from host.
+ *
+ * @param len >= 0 - Input data length in bytes
+ * @param buffer Shared input/output buffer
+ * @param send_response Function to send the response to host
+ * @param data Extracted request content if there is any
+ * @param reg I2C HID register as defined in include/i2c-hid.h
+ * @param cmd I2C HID command as defined in common/i2c_hid_touchpad.c
+ *
+ * @return EC_SUCCESS, or non-zero if error.
+ */
+int i2c_hid_touchpad_process(unsigned int len, uint8_t *buffer,
+ void (*send_response)(int len), uint8_t *data,
+ int *reg, int *cmd);
+
#endif /* __CROS_EC_I2C_HID_TOUCHPAD_H */