2024-05-24 10:35:24

by Charles Wang

[permalink] [raw]
Subject: [PATCH] HID: hid-goodix: Add Goodix HID-over-SPI driver

This patch introduces a new driver to support the Goodix GT7986U
touch controller. The data reported is packaged according to the
HID protocol but uses SPI for communication to improve speed. This
enables the device to transmit not only coordinate data but also
corresponding raw data that can be accessed by user-space programs
through the hidraw interface. The raw data can be utilized for
functions like palm rejection, thereby improving the touch experience.

Key features:
- Device connection confirmation and initialization
- IRQ-based event reporting to the input subsystem
- Support for HIDRAW operations (GET_REPORT and SET_REPORT)

Signed-off-by: Charles Wang <[email protected]>
---
drivers/hid/Kconfig | 6 +
drivers/hid/Makefile | 1 +
drivers/hid/hid-goodix.c | 646 +++++++++++++++++++++++++++++++++++++++
3 files changed, 653 insertions(+)
create mode 100644 drivers/hid/hid-goodix.c

diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 4c682c650..f57d8fb88 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -404,6 +404,12 @@ config HID_VIVALDI_COMMON
option so that drivers can use common code to parse the HID
descriptors for vivaldi function row keymap.

+config HID_GOODIX
+ tristate "Goodix GT7986U SPI HID touchscreen"
+ depends on SPI_MASTER
+ help
+ Support for Goodix GT7986U SPI HID touchscreen device.
+
config HID_GOOGLE_HAMMER
tristate "Google Hammer Keyboard"
select HID_VIVALDI_COMMON
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 082a728ea..4e799f7e5 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -54,6 +54,7 @@ obj-$(CONFIG_HID_GEMBIRD) += hid-gembird.o
obj-$(CONFIG_HID_GFRM) += hid-gfrm.o
obj-$(CONFIG_HID_GLORIOUS) += hid-glorious.o
obj-$(CONFIG_HID_VIVALDI_COMMON) += hid-vivaldi-common.o
+obj-$(CONFIG_HID_GOODIX) += hid-goodix.o
obj-$(CONFIG_HID_GOOGLE_HAMMER) += hid-google-hammer.o
obj-$(CONFIG_HID_GOOGLE_STADIA_FF) += hid-google-stadiaff.o
obj-$(CONFIG_HID_VIVALDI) += hid-vivaldi.o
diff --git a/drivers/hid/hid-goodix.c b/drivers/hid/hid-goodix.c
new file mode 100644
index 000000000..8e14807fb
--- /dev/null
+++ b/drivers/hid/hid-goodix.c
@@ -0,0 +1,646 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Goodix GT7986U SPI Driver Code for HID.
+ *
+ * Copyright (C) 2024 Godix, Inc.
+ */
+#include <asm/unaligned.h>
+#include <linux/delay.h>
+#include <linux/hid.h>
+#include <linux/interrupt.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/sizes.h>
+#include <linux/spi/spi.h>
+
+#define GOODIX_DEV_CONFIRM_ADDR 0x10000
+#define GOODIX_FW_VERSION_ADDR 0x10014
+#define GOODIX_HID_DESC_ADDR 0x1058C
+#define GOODIX_HID_REPORT_DESC_ADDR 0x105AA
+#define GOODIX_HID_SIGN_ADDR 0x10D32
+#define GOODIX_HID_REPORT_ADDR 0x22C8C
+
+#define GOODIX_HID_GET_REPORT_CMD 0x02
+#define GOODIX_HID_SET_REPORT_CMD 0x03
+
+#define GOODIX_HID_MAX_INBUF_SIZE 128
+#define GOODIX_HID_ACK_READY_FLAG 0x01
+#define GOODIX_HID_REPORT_READY_FLAG 0x80
+
+#define GOODIX_DEV_CONFIRM_VAL 0xAA
+
+#define GOODIX_SPI_WRITE_FLAG 0xF0
+#define GOODIX_SPI_READ_FLAG 0xF1
+#define GOODIX_SPI_TRANS_PREFIX_LEN 1
+#define GOODIX_REGISTER_WIDTH 4
+#define GOODIX_SPI_READ_DUMMY_LEN 3
+#define GOODIX_SPI_READ_PREFIX_LEN (GOODIX_SPI_TRANS_PREFIX_LEN + \
+ GOODIX_REGISTER_WIDTH + \
+ GOODIX_SPI_READ_DUMMY_LEN)
+#define GOODIX_SPI_WRITE_PREFIX_LEN (GOODIX_SPI_TRANS_PREFIX_LEN + \
+ GOODIX_REGISTER_WIDTH)
+
+#define GOODIX_CHECKSUM_SIZE sizeof(u16)
+#define GOODIX_NORMAL_RESET_DELAY_MS 150
+
+struct goodix_hid_report_header {
+ u8 flag;
+ __le16 size;
+} __packed;
+#define GOODIX_HID_ACK_HEADER_SIZE sizeof(struct goodix_hid_report_header)
+
+struct goodix_hid_report_package {
+ __le16 size;
+ u8 data[];
+};
+
+#define GOODIX_HID_PKG_LEN_SIZE sizeof(u16)
+#define GOODIX_HID_COOR_DATA_LEN 82
+#define GOODIX_HID_COOR_PKG_LEN (GOODIX_HID_PKG_LEN_SIZE + \
+ GOODIX_HID_COOR_DATA_LEN)
+
+#define GOODIX_REPORT_DATA_ADDR (GOODIX_HID_REPORT_ADDR + \
+ GOODIX_HID_ACK_HEADER_SIZE + \
+ GOODIX_HID_PKG_LEN_SIZE)
+
+struct goodix_hid_report_event {
+ struct goodix_hid_report_header hdr;
+ u8 data[GOODIX_HID_COOR_PKG_LEN];
+} __packed;
+
+struct goodix_hid_desc {
+ __le16 desc_length;
+ __le16 bcd_version;
+ __le16 report_desc_lenght;
+ __le16 report_desc_register;
+ __le16 input_register;
+ __le16 max_input_length;
+ __le16 output_register;
+ __le16 max_output_length;
+ __le16 cmd_register;
+ __le16 data_register;
+ __le16 vendor_id;
+ __le16 product_id;
+ __le16 version_id;
+ __le32 reserved;
+} __packed;
+
+struct goodix_ts_data {
+ struct device *dev;
+ struct spi_device *spi;
+ struct hid_device *hid;
+ struct goodix_hid_desc hid_desc;
+
+ struct gpio_desc *reset_gpio;
+
+ /* Buffer used to store hid report data */
+ u8 xfer_buf[SZ_4K];
+};
+
+static int goodix_spi_read(struct goodix_ts_data *ts, u32 addr,
+ u8 *data, unsigned int len)
+{
+ struct spi_device *spi = to_spi_device(&ts->spi->dev);
+ struct spi_transfer xfers;
+ struct spi_message spi_msg;
+ u8 *buf;
+ int error;
+
+ buf = kzalloc(GOODIX_SPI_READ_PREFIX_LEN + len, GFP_KERNEL);
+ if (!buf)
+ return -ENOMEM;
+
+ spi_message_init(&spi_msg);
+ memset(&xfers, 0, sizeof(xfers));
+
+ /* buffer format: 0xF1 + addr(4bytes) + dummy(3bytes) + data */
+ buf[0] = GOODIX_SPI_READ_FLAG;
+ put_unaligned_be32(addr, buf + GOODIX_SPI_TRANS_PREFIX_LEN);
+ memset(buf + GOODIX_SPI_TRANS_PREFIX_LEN + GOODIX_REGISTER_WIDTH,
+ 0xff, GOODIX_SPI_READ_DUMMY_LEN);
+
+ xfers.tx_buf = buf;
+ xfers.rx_buf = buf;
+ xfers.len = GOODIX_SPI_READ_PREFIX_LEN + len;
+ xfers.cs_change = 0;
+ spi_message_add_tail(&xfers, &spi_msg);
+
+ error = spi_sync(spi, &spi_msg);
+ if (error)
+ dev_err(ts->dev, "spi transfer error:%d", error);
+ else
+ memcpy(data, buf + GOODIX_SPI_READ_PREFIX_LEN, len);
+
+ kfree(buf);
+ return error;
+}
+
+static int goodix_spi_write(struct goodix_ts_data *ts, u32 addr,
+ u8 *data, unsigned int len)
+{
+ struct spi_device *spi = to_spi_device(&ts->spi->dev);
+ struct spi_transfer xfers;
+ struct spi_message spi_msg;
+ u8 *buf;
+ int error;
+
+ buf = kzalloc(GOODIX_SPI_WRITE_PREFIX_LEN + len, GFP_KERNEL);
+ if (!buf)
+ return -ENOMEM;
+
+ spi_message_init(&spi_msg);
+ memset(&xfers, 0, sizeof(xfers));
+
+ /* buffer format: 0xF0 + addr(4bytes) + data */
+ buf[0] = GOODIX_SPI_WRITE_FLAG;
+ put_unaligned_be32(addr, buf + GOODIX_SPI_TRANS_PREFIX_LEN);
+ memcpy(buf + GOODIX_SPI_WRITE_PREFIX_LEN, data, len);
+
+ xfers.tx_buf = buf;
+ xfers.len = GOODIX_SPI_WRITE_PREFIX_LEN + len;
+ xfers.cs_change = 0;
+ spi_message_add_tail(&xfers, &spi_msg);
+
+ error = spi_sync(spi, &spi_msg);
+ if (error)
+ dev_err(ts->dev, "spi transfer error:%d", error);
+
+ kfree(buf);
+ return error;
+}
+
+static int goodix_dev_confirm(struct goodix_ts_data *ts)
+{
+ u8 tx_buf[8], rx_buf[8];
+ int retry = 3;
+ int error;
+
+ gpiod_set_value_cansleep(ts->reset_gpio, 0);
+ usleep_range(4000, 4100);
+
+ memset(tx_buf, GOODIX_DEV_CONFIRM_VAL, sizeof(tx_buf));
+ while (retry--) {
+ error = goodix_spi_write(ts, GOODIX_DEV_CONFIRM_ADDR,
+ tx_buf, sizeof(tx_buf));
+ if (error)
+ return error;
+
+ error = goodix_spi_read(ts, GOODIX_DEV_CONFIRM_ADDR,
+ rx_buf, sizeof(rx_buf));
+ if (error)
+ return error;
+
+ if (!memcmp(tx_buf, rx_buf, sizeof(tx_buf)))
+ return 0;
+
+ usleep_range(5000, 5100);
+ }
+
+ dev_err(ts->dev, "device confirm failed, rx_buf:%*ph", 8, rx_buf);
+ return -EINVAL;
+}
+
+/**
+ * goodix_hid_parse() - hid-core .parse() callback
+ * @hid: hid device instance
+ *
+ * This function gets called during call to hid_add_device
+ *
+ * Return: 0 on success and non zero on error
+ */
+static int goodix_hid_parse(struct hid_device *hid)
+{
+ struct goodix_ts_data *ts = hid->driver_data;
+ u16 rsize;
+ u8 *rdesc;
+ int error;
+
+ rsize = le16_to_cpu(ts->hid_desc.report_desc_lenght);
+ if (!rsize || rsize > HID_MAX_DESCRIPTOR_SIZE) {
+ dev_err(ts->dev, "invalid report desc size %d", rsize);
+ return -EINVAL;
+ }
+
+ rdesc = kzalloc(rsize, GFP_KERNEL);
+ if (!rdesc)
+ return -ENOMEM;
+
+ error = goodix_spi_read(ts, GOODIX_HID_REPORT_DESC_ADDR, rdesc, rsize);
+ if (error) {
+ dev_err(ts->dev, "failed get report desc, %d", error);
+ goto free_mem;
+ }
+
+ error = hid_parse_report(hid, rdesc, rsize);
+ if (error)
+ dev_err(ts->dev, "failed parse report, %d", error);
+
+free_mem:
+ kfree(rdesc);
+ return error;
+}
+
+/* Empty callbacks with success return code */
+static int goodix_hid_start(struct hid_device *hid)
+{
+ return 0;
+}
+
+static void goodix_hid_stop(struct hid_device *hid)
+{
+}
+
+static int goodix_hid_open(struct hid_device *hid)
+{
+ return 0;
+}
+
+static void goodix_hid_close(struct hid_device *hid)
+{
+}
+
+/* Return date length of response data */
+static int goodix_hid_check_ack_status(struct goodix_ts_data *ts)
+{
+ struct goodix_hid_report_header hdr;
+ int retry = 20;
+ int error;
+
+ while (retry--) {
+ /*
+ * 3 bytes of hid request response data
+ * - byte 0: Ack flag, value of 1 for data ready
+ * - bytes 1-2: Response data length
+ */
+ error = goodix_spi_read(ts, GOODIX_HID_REPORT_ADDR,
+ (u8 *)&hdr, sizeof(hdr));
+ if (!error && (hdr.flag & GOODIX_HID_ACK_READY_FLAG))
+ return le16_to_cpu(hdr.size);
+
+ /* Wait 10ms for another try */
+ usleep_range(10000, 11000);
+ }
+
+ return -EINVAL;
+}
+
+/**
+ * goodix_hid_get_raw_report() - Process hidraw GET REPORT operation
+ * @hid: hid device instance
+ * @reportnum: Report ID
+ * @buf: Buffer for store the reprot date
+ * @len: Length fo reprot data
+ * @report_type: Report type
+ *
+ * The function for hid_ll_driver.get_raw_report to handle the HIDRAW ioctl
+ * get report request. The transmitted data follows the standard i2c-hid
+ * protocol with a specified header.
+ *
+ * Return: The length of the data in the buf on success, negative error code
+ */
+static int goodix_hid_get_raw_report(struct hid_device *hid,
+ unsigned char reportnum,
+ __u8 *buf, size_t len,
+ unsigned char report_type)
+{
+ struct goodix_ts_data *ts = hid->driver_data;
+ u8 tmp_buf[GOODIX_HID_MAX_INBUF_SIZE];
+ int tx_len = 0, args_len = 0;
+ int response_data_len;
+ u8 args[3];
+ int error;
+
+ if (report_type == HID_OUTPUT_REPORT)
+ return -EINVAL;
+
+ if (reportnum == 3) {
+ /* Get win8 signature data */
+ error = goodix_spi_read(ts, GOODIX_HID_SIGN_ADDR, buf, len);
+ if (error) {
+ dev_err(ts->dev, "failed get win8 sign:%d", error);
+ return -EINVAL;
+ }
+ return len;
+ }
+
+ if (reportnum >= 0x0F) {
+ args[args_len++] = reportnum;
+ reportnum = 0x0F;
+ }
+ put_unaligned_le16(ts->hid_desc.data_register, args + args_len);
+ args_len += sizeof(ts->hid_desc.data_register);
+
+ /* Clean 3 bytes of hid ack header data */
+ memset(tmp_buf, 0, GOODIX_HID_ACK_HEADER_SIZE);
+ tx_len += GOODIX_HID_ACK_HEADER_SIZE;
+
+ put_unaligned_le16(ts->hid_desc.cmd_register, tmp_buf + tx_len);
+ tx_len += sizeof(ts->hid_desc.cmd_register);
+
+ tmp_buf[tx_len++] = ((report_type == HID_FEATURE_REPORT ? 0x03 : 0x01) << 4) | reportnum;
+ tmp_buf[tx_len++] = GOODIX_HID_GET_REPORT_CMD;
+
+ memcpy(tmp_buf + tx_len, args, args_len);
+ tx_len += args_len;
+
+ /* Step1: write report request info */
+ error = goodix_spi_write(ts, GOODIX_HID_REPORT_ADDR, tmp_buf, tx_len);
+ if (error) {
+ dev_err(ts->dev, "failed send read feature cmd, %d", error);
+ return error;
+ }
+
+ /* No need read response data */
+ if (!len)
+ return 0;
+
+ /* Step2: check response data status */
+ response_data_len = goodix_hid_check_ack_status(ts);
+ if (response_data_len <= 0)
+ return -EINVAL;
+
+ /* Step3: read response data(skip 2bytes of hid pkg length) */
+ error = goodix_spi_read(ts, GOODIX_REPORT_DATA_ADDR, buf,
+ response_data_len - GOODIX_HID_PKG_LEN_SIZE);
+ if (error) {
+ dev_err(ts->dev, "failed read hid response data, %d", error);
+ return error;
+ }
+
+ return response_data_len - GOODIX_HID_PKG_LEN_SIZE;
+}
+
+/**
+ * goodix_hid_set_raw_report() - process hidraw SET REPORT operation
+ * @hid: HID device
+ * @reportnum: Report ID
+ * @buf: Buffer for communication
+ * @len: Length of data in the buffer
+ * @report_type: Report type
+ *
+ * The function for hid_ll_driver.get_raw_report to handle the HIDRAW ioctl
+ * set report request. The transmitted data follows the standard i2c-hid
+ * protocol with a specified header.
+ *
+ * Return: The length of the data sent, negative error code on failure
+ */
+static int goodix_hid_set_raw_report(struct hid_device *hid,
+ unsigned char reportnum,
+ __u8 *buf, size_t len,
+ unsigned char report_type)
+{
+ struct goodix_ts_data *ts = hid->driver_data;
+ int tx_len = 0, args_len = 0;
+ u8 tmp_buf[GOODIX_HID_MAX_INBUF_SIZE];
+ u8 args[5];
+ int error;
+
+ if (reportnum >= 0x0F) {
+ args[args_len++] = reportnum;
+ reportnum = 0x0F;
+ }
+
+ put_unaligned_le16(ts->hid_desc.data_register, args + args_len);
+ args_len += sizeof(ts->hid_desc.data_register);
+
+ put_unaligned_le16(GOODIX_HID_PKG_LEN_SIZE + len, args + args_len);
+ args_len += GOODIX_HID_PKG_LEN_SIZE;
+
+ /* Clean 3 bytes of hid ack header data */
+ memset(tmp_buf, 0, GOODIX_HID_ACK_HEADER_SIZE);
+ tx_len += GOODIX_HID_ACK_HEADER_SIZE;
+
+ put_unaligned_le16(ts->hid_desc.cmd_register, tmp_buf + tx_len);
+ tx_len += sizeof(ts->hid_desc.cmd_register);
+
+ tmp_buf[tx_len++] = ((report_type == HID_FEATURE_REPORT ? 0x03 : 0x02) << 4) | reportnum;
+ tmp_buf[tx_len++] = GOODIX_HID_SET_REPORT_CMD;
+
+ memcpy(tmp_buf + tx_len, args, args_len);
+ tx_len += args_len;
+
+ memcpy(tmp_buf + tx_len, buf, len);
+ tx_len += len;
+
+ error = goodix_spi_write(ts, GOODIX_HID_REPORT_ADDR, tmp_buf, tx_len);
+ if (error) {
+ dev_err(ts->dev, "failed send report %*ph", tx_len, tmp_buf);
+ return error;
+ }
+ return len;
+}
+
+static int goodix_hid_raw_request(struct hid_device *hid,
+ unsigned char reportnum,
+ __u8 *buf, size_t len,
+ unsigned char rtype, int reqtype)
+{
+ switch (reqtype) {
+ case HID_REQ_GET_REPORT:
+ return goodix_hid_get_raw_report(hid, reportnum, buf,
+ len, rtype);
+ case HID_REQ_SET_REPORT:
+ if (buf[0] != reportnum)
+ return -EINVAL;
+ return goodix_hid_set_raw_report(hid, reportnum, buf,
+ len, rtype);
+ default:
+ return -EIO;
+ }
+
+ return -EINVAL;
+}
+
+static struct hid_ll_driver goodix_hid_ll_driver = {
+ .parse = goodix_hid_parse,
+ .start = goodix_hid_start,
+ .stop = goodix_hid_stop,
+ .open = goodix_hid_open,
+ .close = goodix_hid_close,
+ .raw_request = goodix_hid_raw_request
+};
+
+static irqreturn_t goodix_hid_irq(int irq, void *data)
+{
+ struct goodix_ts_data *ts = data;
+ struct goodix_hid_report_event event;
+ struct goodix_hid_report_package *pkg;
+ int error;
+
+ /*
+ * First, read buffer with space for header and coordinate package:
+ * - event header = 3 bytes
+ * - coordinate event = GOODIX_HID_COOR_PKG_LEN bytes
+ *
+ * If the data size info in the event header exceeds
+ * GOODIX_HID_COOR_PKG_LEN, it means that there are other packages
+ * besides the coordinate package.
+ */
+ error = goodix_spi_read(ts, GOODIX_HID_REPORT_ADDR, (u8 *)&event,
+ sizeof(event));
+ if (error) {
+ dev_err(ts->dev, "failed get coordinate data, %d", error);
+ return IRQ_HANDLED;
+ }
+
+ /* Check coordinate data valid falg */
+ if (event.hdr.flag != GOODIX_HID_REPORT_READY_FLAG) {
+ dev_err(ts->dev, "invalid event flag 0x%x", event.hdr.flag);
+ return IRQ_HANDLED;
+ }
+
+ pkg = (struct goodix_hid_report_package *)event.data;
+ hid_input_report(ts->hid, HID_INPUT_REPORT, pkg->data,
+ le16_to_cpu(pkg->size) - GOODIX_HID_PKG_LEN_SIZE, 1);
+
+ event.hdr.size = le16_to_cpu(event.hdr.size);
+ /* Check if there are other packages */
+ if (event.hdr.size <= GOODIX_HID_COOR_PKG_LEN)
+ return IRQ_HANDLED;
+
+ if (event.hdr.size - GOODIX_HID_COOR_PKG_LEN > sizeof(ts->xfer_buf)) {
+ dev_err(ts->dev, "invalid package size, %d", event.hdr.size);
+ return IRQ_HANDLED;
+ }
+
+ /* Read the package behind the coordinate data */
+ error = goodix_spi_read(ts, GOODIX_HID_REPORT_ADDR + sizeof(event),
+ ts->xfer_buf,
+ event.hdr.size - GOODIX_HID_COOR_PKG_LEN);
+ if (error) {
+ dev_err(ts->dev, "failed read data, %d", error);
+ return IRQ_HANDLED;
+ }
+
+ pkg = (struct goodix_hid_report_package *)ts->xfer_buf;
+ hid_input_report(ts->hid, HID_INPUT_REPORT, pkg->data,
+ le16_to_cpu(pkg->size) - GOODIX_HID_PKG_LEN_SIZE, 1);
+
+ return IRQ_HANDLED;
+}
+
+static int goodix_hid_init(struct goodix_ts_data *ts)
+{
+ struct hid_device *hid;
+ int error;
+
+ /* Get hid descriptor */
+ error = goodix_spi_read(ts, GOODIX_HID_DESC_ADDR, (u8 *)&ts->hid_desc,
+ sizeof(ts->hid_desc));
+ if (error) {
+ dev_err(ts->dev, "failed get hid desc, %d", error);
+ return error;
+ }
+
+ hid = hid_allocate_device();
+ if (IS_ERR(hid))
+ return PTR_ERR(hid);
+
+ hid->driver_data = ts;
+ hid->ll_driver = &goodix_hid_ll_driver;
+ hid->bus = BUS_SPI;
+ hid->dev.parent = &ts->spi->dev;
+
+ hid->version = le16_to_cpu(ts->hid_desc.bcd_version);
+ hid->vendor = le16_to_cpu(ts->hid_desc.vendor_id);
+ hid->product = le16_to_cpu(ts->hid_desc.product_id);
+ snprintf(hid->name, sizeof(hid->name), "%s %04X:%04X", "hid-gdix",
+ hid->vendor, hid->product);
+
+ error = hid_add_device(hid);
+ if (error) {
+ dev_err(ts->dev, "failed add hid device, %d", error);
+ hid_destroy_device(hid);
+ return error;
+ }
+
+ ts->hid = hid;
+ return 0;
+}
+
+static int goodix_spi_probe(struct spi_device *spi)
+{
+ struct device *dev = &spi->dev;
+ struct goodix_ts_data *ts;
+ int error;
+
+ /* init spi_device */
+ spi->mode = SPI_MODE_0;
+ spi->bits_per_word = 8;
+ error = spi_setup(spi);
+ if (error)
+ return error;
+
+ ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL);
+ if (!ts)
+ return -ENOMEM;
+
+ spi_set_drvdata(spi, ts);
+ ts->spi = spi;
+ ts->dev = dev;
+ ts->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
+ if (IS_ERR(ts->reset_gpio))
+ return dev_err_probe(dev, PTR_ERR(ts->reset_gpio),
+ "Failed to request reset gpio\n");
+
+ error = goodix_dev_confirm(ts);
+ if (error)
+ return error;
+
+ /* Waits 150ms for firmware to fully boot */
+ msleep(GOODIX_NORMAL_RESET_DELAY_MS);
+
+ error = devm_request_threaded_irq(&ts->spi->dev, ts->spi->irq,
+ NULL, goodix_hid_irq,
+ IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+ "goodix_spi_hid", ts);
+ if (error < 0) {
+ dev_err(ts->dev, "could not register interrupt, irq = %d, %d",
+ ts->spi->irq, error);
+ return error;
+ }
+
+ error = goodix_hid_init(ts);
+ if (error) {
+ dev_err(dev, "failed init hid device");
+ return error;
+ }
+
+ return 0;
+}
+
+static void goodix_spi_remove(struct spi_device *spi)
+{
+ struct goodix_ts_data *ts = spi_get_drvdata(spi);
+
+ hid_destroy_device(ts->hid);
+}
+
+static void goodix_spi_shutdown(struct spi_device *spi)
+{
+ struct goodix_ts_data *ts = spi_get_drvdata(spi);
+
+ disable_irq_nosync(spi->irq);
+ hid_destroy_device(ts->hid);
+}
+
+static const struct acpi_device_id goodix_spi_acpi_match[] = {
+ { "GXTS7986" },
+ { },
+};
+MODULE_DEVICE_TABLE(acpi, goodix_spi_acpi_match);
+
+static struct spi_driver goodix_spi_driver = {
+ .driver = {
+ .name = "goodix-spi-hid",
+ .acpi_match_table = ACPI_PTR(goodix_spi_acpi_match),
+ },
+ .probe = goodix_spi_probe,
+ .remove = goodix_spi_remove,
+ .shutdown = goodix_spi_shutdown,
+};
+module_spi_driver(goodix_spi_driver);
+
+MODULE_DESCRIPTION("Goodix SPI driver for HID touchscreen");
+MODULE_AUTHOR("Goodix, Inc.");
+MODULE_LICENSE("GPL");
--
2.43.0



2024-05-24 17:43:06

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] HID: hid-goodix: Add Goodix HID-over-SPI driver

Hi Charles,

kernel test robot noticed the following build warnings:

[auto build test WARNING on hid/for-next]
[also build test WARNING on linus/master v6.9 next-20240523]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Charles-Wang/HID-hid-goodix-Add-Goodix-HID-over-SPI-driver/20240524-183743
base: https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-next
patch link: https://lore.kernel.org/r/20240524103407.36861-1-charles.goodix%40gmail.com
patch subject: [PATCH] HID: hid-goodix: Add Goodix HID-over-SPI driver
config: hexagon-allyesconfig (https://download.01.org/0day-ci/archive/20240525/[email protected]/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 7aa382fd7257d9bd4f7fc50bb7078a3c26a1628c)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240525/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

In file included from drivers/hid/hid-goodix.c:9:
In file included from include/linux/hid.h:29:
In file included from include/linux/hid_bpf.h:6:
In file included from include/linux/bpf.h:21:
In file included from include/linux/kallsyms.h:13:
In file included from include/linux/mm.h:2253:
include/linux/vmstat.h:514:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
514 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
In file included from drivers/hid/hid-goodix.c:9:
In file included from include/linux/hid.h:29:
In file included from include/linux/hid_bpf.h:6:
In file included from include/linux/bpf.h:31:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:26:
In file included from include/linux/kernel_stat.h:9:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:14:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
548 | val = __raw_readb(PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
561 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
| ^
In file included from drivers/hid/hid-goodix.c:9:
In file included from include/linux/hid.h:29:
In file included from include/linux/hid_bpf.h:6:
In file included from include/linux/bpf.h:31:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:26:
In file included from include/linux/kernel_stat.h:9:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:14:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
574 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
| ^
In file included from drivers/hid/hid-goodix.c:9:
In file included from include/linux/hid.h:29:
In file included from include/linux/hid_bpf.h:6:
In file included from include/linux/bpf.h:31:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:26:
In file included from include/linux/kernel_stat.h:9:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:14:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
585 | __raw_writeb(value, PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
595 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
605 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
>> drivers/hid/hid-goodix.c:627:36: warning: unused variable 'goodix_spi_acpi_match' [-Wunused-const-variable]
627 | static const struct acpi_device_id goodix_spi_acpi_match[] = {
| ^~~~~~~~~~~~~~~~~~~~~
8 warnings generated.


vim +/goodix_spi_acpi_match +627 drivers/hid/hid-goodix.c

626
> 627 static const struct acpi_device_id goodix_spi_acpi_match[] = {
628 { "GXTS7986" },
629 { },
630 };
631 MODULE_DEVICE_TABLE(acpi, goodix_spi_acpi_match);
632

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

2024-05-24 18:38:14

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] HID: hid-goodix: Add Goodix HID-over-SPI driver

Hi Charles,

kernel test robot noticed the following build warnings:

[auto build test WARNING on hid/for-next]
[also build test WARNING on linus/master v6.9 next-20240523]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Charles-Wang/HID-hid-goodix-Add-Goodix-HID-over-SPI-driver/20240524-183743
base: https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-next
patch link: https://lore.kernel.org/r/20240524103407.36861-1-charles.goodix%40gmail.com
patch subject: [PATCH] HID: hid-goodix: Add Goodix HID-over-SPI driver
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20240525/[email protected]/config)
compiler: alpha-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240525/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> drivers/hid/hid-goodix.c:627:36: warning: 'goodix_spi_acpi_match' defined but not used [-Wunused-const-variable=]
627 | static const struct acpi_device_id goodix_spi_acpi_match[] = {
| ^~~~~~~~~~~~~~~~~~~~~


vim +/goodix_spi_acpi_match +627 drivers/hid/hid-goodix.c

626
> 627 static const struct acpi_device_id goodix_spi_acpi_match[] = {
628 { "GXTS7986" },
629 { },
630 };
631 MODULE_DEVICE_TABLE(acpi, goodix_spi_acpi_match);
632

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

2024-05-25 17:55:09

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] HID: hid-goodix: Add Goodix HID-over-SPI driver

Hi Charles,

kernel test robot noticed the following build warnings:

[auto build test WARNING on hid/for-next]
[also build test WARNING on linus/master v6.9 next-20240523]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Charles-Wang/HID-hid-goodix-Add-Goodix-HID-over-SPI-driver/20240524-183743
base: https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-next
patch link: https://lore.kernel.org/r/20240524103407.36861-1-charles.goodix%40gmail.com
patch subject: [PATCH] HID: hid-goodix: Add Goodix HID-over-SPI driver
config: alpha-randconfig-r112-20240525 (https://download.01.org/0day-ci/archive/20240526/[email protected]/config)
compiler: alpha-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20240526/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

sparse warnings: (new ones prefixed by >>)
>> drivers/hid/hid-goodix.c:330:40: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned short [usertype] val @@ got restricted __le16 [usertype] data_register @@
drivers/hid/hid-goodix.c:330:40: sparse: expected unsigned short [usertype] val
drivers/hid/hid-goodix.c:330:40: sparse: got restricted __le16 [usertype] data_register
>> drivers/hid/hid-goodix.c:337:40: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned short [usertype] val @@ got restricted __le16 [usertype] cmd_register @@
drivers/hid/hid-goodix.c:337:40: sparse: expected unsigned short [usertype] val
drivers/hid/hid-goodix.c:337:40: sparse: got restricted __le16 [usertype] cmd_register
drivers/hid/hid-goodix.c:403:40: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned short [usertype] val @@ got restricted __le16 [usertype] data_register @@
drivers/hid/hid-goodix.c:403:40: sparse: expected unsigned short [usertype] val
drivers/hid/hid-goodix.c:403:40: sparse: got restricted __le16 [usertype] data_register
drivers/hid/hid-goodix.c:413:40: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned short [usertype] val @@ got restricted __le16 [usertype] cmd_register @@
drivers/hid/hid-goodix.c:413:40: sparse: expected unsigned short [usertype] val
drivers/hid/hid-goodix.c:413:40: sparse: got restricted __le16 [usertype] cmd_register
>> drivers/hid/hid-goodix.c:496:24: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [addressable] [usertype] size @@ got unsigned short [usertype] @@
drivers/hid/hid-goodix.c:496:24: sparse: expected restricted __le16 [addressable] [usertype] size
drivers/hid/hid-goodix.c:496:24: sparse: got unsigned short [usertype]
>> drivers/hid/hid-goodix.c:498:22: sparse: sparse: restricted __le16 degrades to integer
drivers/hid/hid-goodix.c:501:22: sparse: sparse: restricted __le16 degrades to integer
drivers/hid/hid-goodix.c:509:42: sparse: sparse: restricted __le16 degrades to integer
drivers/hid/hid-goodix.c: note: in included file (through include/linux/smp.h, include/linux/lockdep.h, include/linux/spinlock.h, ...):
include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true
include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true

vim +330 drivers/hid/hid-goodix.c

286
287 /**
288 * goodix_hid_get_raw_report() - Process hidraw GET REPORT operation
289 * @hid: hid device instance
290 * @reportnum: Report ID
291 * @buf: Buffer for store the reprot date
292 * @len: Length fo reprot data
293 * @report_type: Report type
294 *
295 * The function for hid_ll_driver.get_raw_report to handle the HIDRAW ioctl
296 * get report request. The transmitted data follows the standard i2c-hid
297 * protocol with a specified header.
298 *
299 * Return: The length of the data in the buf on success, negative error code
300 */
301 static int goodix_hid_get_raw_report(struct hid_device *hid,
302 unsigned char reportnum,
303 __u8 *buf, size_t len,
304 unsigned char report_type)
305 {
306 struct goodix_ts_data *ts = hid->driver_data;
307 u8 tmp_buf[GOODIX_HID_MAX_INBUF_SIZE];
308 int tx_len = 0, args_len = 0;
309 int response_data_len;
310 u8 args[3];
311 int error;
312
313 if (report_type == HID_OUTPUT_REPORT)
314 return -EINVAL;
315
316 if (reportnum == 3) {
317 /* Get win8 signature data */
318 error = goodix_spi_read(ts, GOODIX_HID_SIGN_ADDR, buf, len);
319 if (error) {
320 dev_err(ts->dev, "failed get win8 sign:%d", error);
321 return -EINVAL;
322 }
323 return len;
324 }
325
326 if (reportnum >= 0x0F) {
327 args[args_len++] = reportnum;
328 reportnum = 0x0F;
329 }
> 330 put_unaligned_le16(ts->hid_desc.data_register, args + args_len);
331 args_len += sizeof(ts->hid_desc.data_register);
332
333 /* Clean 3 bytes of hid ack header data */
334 memset(tmp_buf, 0, GOODIX_HID_ACK_HEADER_SIZE);
335 tx_len += GOODIX_HID_ACK_HEADER_SIZE;
336
> 337 put_unaligned_le16(ts->hid_desc.cmd_register, tmp_buf + tx_len);
338 tx_len += sizeof(ts->hid_desc.cmd_register);
339
340 tmp_buf[tx_len++] = ((report_type == HID_FEATURE_REPORT ? 0x03 : 0x01) << 4) | reportnum;
341 tmp_buf[tx_len++] = GOODIX_HID_GET_REPORT_CMD;
342
343 memcpy(tmp_buf + tx_len, args, args_len);
344 tx_len += args_len;
345
346 /* Step1: write report request info */
347 error = goodix_spi_write(ts, GOODIX_HID_REPORT_ADDR, tmp_buf, tx_len);
348 if (error) {
349 dev_err(ts->dev, "failed send read feature cmd, %d", error);
350 return error;
351 }
352
353 /* No need read response data */
354 if (!len)
355 return 0;
356
357 /* Step2: check response data status */
358 response_data_len = goodix_hid_check_ack_status(ts);
359 if (response_data_len <= 0)
360 return -EINVAL;
361
362 /* Step3: read response data(skip 2bytes of hid pkg length) */
363 error = goodix_spi_read(ts, GOODIX_REPORT_DATA_ADDR, buf,
364 response_data_len - GOODIX_HID_PKG_LEN_SIZE);
365 if (error) {
366 dev_err(ts->dev, "failed read hid response data, %d", error);
367 return error;
368 }
369
370 return response_data_len - GOODIX_HID_PKG_LEN_SIZE;
371 }
372
373 /**
374 * goodix_hid_set_raw_report() - process hidraw SET REPORT operation
375 * @hid: HID device
376 * @reportnum: Report ID
377 * @buf: Buffer for communication
378 * @len: Length of data in the buffer
379 * @report_type: Report type
380 *
381 * The function for hid_ll_driver.get_raw_report to handle the HIDRAW ioctl
382 * set report request. The transmitted data follows the standard i2c-hid
383 * protocol with a specified header.
384 *
385 * Return: The length of the data sent, negative error code on failure
386 */
387 static int goodix_hid_set_raw_report(struct hid_device *hid,
388 unsigned char reportnum,
389 __u8 *buf, size_t len,
390 unsigned char report_type)
391 {
392 struct goodix_ts_data *ts = hid->driver_data;
393 int tx_len = 0, args_len = 0;
394 u8 tmp_buf[GOODIX_HID_MAX_INBUF_SIZE];
395 u8 args[5];
396 int error;
397
398 if (reportnum >= 0x0F) {
399 args[args_len++] = reportnum;
400 reportnum = 0x0F;
401 }
402
> 403 put_unaligned_le16(ts->hid_desc.data_register, args + args_len);
404 args_len += sizeof(ts->hid_desc.data_register);
405
406 put_unaligned_le16(GOODIX_HID_PKG_LEN_SIZE + len, args + args_len);
407 args_len += GOODIX_HID_PKG_LEN_SIZE;
408
409 /* Clean 3 bytes of hid ack header data */
410 memset(tmp_buf, 0, GOODIX_HID_ACK_HEADER_SIZE);
411 tx_len += GOODIX_HID_ACK_HEADER_SIZE;
412
413 put_unaligned_le16(ts->hid_desc.cmd_register, tmp_buf + tx_len);
414 tx_len += sizeof(ts->hid_desc.cmd_register);
415
416 tmp_buf[tx_len++] = ((report_type == HID_FEATURE_REPORT ? 0x03 : 0x02) << 4) | reportnum;
417 tmp_buf[tx_len++] = GOODIX_HID_SET_REPORT_CMD;
418
419 memcpy(tmp_buf + tx_len, args, args_len);
420 tx_len += args_len;
421
422 memcpy(tmp_buf + tx_len, buf, len);
423 tx_len += len;
424
425 error = goodix_spi_write(ts, GOODIX_HID_REPORT_ADDR, tmp_buf, tx_len);
426 if (error) {
427 dev_err(ts->dev, "failed send report %*ph", tx_len, tmp_buf);
428 return error;
429 }
430 return len;
431 }
432
433 static int goodix_hid_raw_request(struct hid_device *hid,
434 unsigned char reportnum,
435 __u8 *buf, size_t len,
436 unsigned char rtype, int reqtype)
437 {
438 switch (reqtype) {
439 case HID_REQ_GET_REPORT:
440 return goodix_hid_get_raw_report(hid, reportnum, buf,
441 len, rtype);
442 case HID_REQ_SET_REPORT:
443 if (buf[0] != reportnum)
444 return -EINVAL;
445 return goodix_hid_set_raw_report(hid, reportnum, buf,
446 len, rtype);
447 default:
448 return -EIO;
449 }
450
451 return -EINVAL;
452 }
453
454 static struct hid_ll_driver goodix_hid_ll_driver = {
455 .parse = goodix_hid_parse,
456 .start = goodix_hid_start,
457 .stop = goodix_hid_stop,
458 .open = goodix_hid_open,
459 .close = goodix_hid_close,
460 .raw_request = goodix_hid_raw_request
461 };
462
463 static irqreturn_t goodix_hid_irq(int irq, void *data)
464 {
465 struct goodix_ts_data *ts = data;
466 struct goodix_hid_report_event event;
467 struct goodix_hid_report_package *pkg;
468 int error;
469
470 /*
471 * First, read buffer with space for header and coordinate package:
472 * - event header = 3 bytes
473 * - coordinate event = GOODIX_HID_COOR_PKG_LEN bytes
474 *
475 * If the data size info in the event header exceeds
476 * GOODIX_HID_COOR_PKG_LEN, it means that there are other packages
477 * besides the coordinate package.
478 */
479 error = goodix_spi_read(ts, GOODIX_HID_REPORT_ADDR, (u8 *)&event,
480 sizeof(event));
481 if (error) {
482 dev_err(ts->dev, "failed get coordinate data, %d", error);
483 return IRQ_HANDLED;
484 }
485
486 /* Check coordinate data valid falg */
487 if (event.hdr.flag != GOODIX_HID_REPORT_READY_FLAG) {
488 dev_err(ts->dev, "invalid event flag 0x%x", event.hdr.flag);
489 return IRQ_HANDLED;
490 }
491
492 pkg = (struct goodix_hid_report_package *)event.data;
493 hid_input_report(ts->hid, HID_INPUT_REPORT, pkg->data,
494 le16_to_cpu(pkg->size) - GOODIX_HID_PKG_LEN_SIZE, 1);
495
> 496 event.hdr.size = le16_to_cpu(event.hdr.size);
497 /* Check if there are other packages */
> 498 if (event.hdr.size <= GOODIX_HID_COOR_PKG_LEN)
499 return IRQ_HANDLED;
500
501 if (event.hdr.size - GOODIX_HID_COOR_PKG_LEN > sizeof(ts->xfer_buf)) {
502 dev_err(ts->dev, "invalid package size, %d", event.hdr.size);
503 return IRQ_HANDLED;
504 }
505
506 /* Read the package behind the coordinate data */
507 error = goodix_spi_read(ts, GOODIX_HID_REPORT_ADDR + sizeof(event),
508 ts->xfer_buf,
509 event.hdr.size - GOODIX_HID_COOR_PKG_LEN);
510 if (error) {
511 dev_err(ts->dev, "failed read data, %d", error);
512 return IRQ_HANDLED;
513 }
514
515 pkg = (struct goodix_hid_report_package *)ts->xfer_buf;
516 hid_input_report(ts->hid, HID_INPUT_REPORT, pkg->data,
517 le16_to_cpu(pkg->size) - GOODIX_HID_PKG_LEN_SIZE, 1);
518
519 return IRQ_HANDLED;
520 }
521

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki