Skip to content

Commit 253ed27

Browse files
charles-goodixJiri Kosina
authored andcommitted
HID: hid-goodix: Fix HID get/set feature operation overwritten problem
Implement the hid get/set feature report function using a separate address, rather than sharing an address with coordinate reporting, to prevent feature events from being overwritten by coordinate events. Signed-off-by: Charles Wang <charles.goodix@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
1 parent be8f7f2 commit 253ed27

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

drivers/hid/hid-goodix-spi.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#define GOODIX_HID_DESC_ADDR 0x1058C
2020
#define GOODIX_HID_REPORT_DESC_ADDR 0x105AA
2121
#define GOODIX_HID_SIGN_ADDR 0x10D32
22+
#define GOODIX_HID_CMD_ADDR 0x10364
2223

2324
#define GOODIX_HID_GET_REPORT_CMD 0x02
2425
#define GOODIX_HID_SET_REPORT_CMD 0x03
@@ -348,7 +349,7 @@ static int goodix_hid_check_ack_status(struct goodix_ts_data *ts, u32 *resp_len)
348349
* - byte 0: Ack flag, value of 1 for data ready
349350
* - bytes 1-2: Response data length
350351
*/
351-
error = goodix_spi_read(ts, ts->hid_report_addr,
352+
error = goodix_spi_read(ts, GOODIX_HID_CMD_ADDR,
352353
&hdr, sizeof(hdr));
353354
if (!error && (hdr.flag & GOODIX_HID_ACK_READY_FLAG)) {
354355
len = le16_to_cpu(hdr.size);
@@ -431,7 +432,7 @@ static int goodix_hid_get_raw_report(struct hid_device *hid,
431432
tx_len += args_len;
432433

433434
/* Step1: write report request info */
434-
error = goodix_spi_write(ts, ts->hid_report_addr, tmp_buf, tx_len);
435+
error = goodix_spi_write(ts, GOODIX_HID_CMD_ADDR, tmp_buf, tx_len);
435436
if (error) {
436437
dev_err(ts->dev, "failed send read feature cmd, %d", error);
437438
return error;
@@ -451,7 +452,7 @@ static int goodix_hid_get_raw_report(struct hid_device *hid,
451452
return 0;
452453
len = min(len, response_data_len);
453454
/* Step3: read response data(skip 2bytes of hid pkg length) */
454-
error = goodix_spi_read(ts, ts->hid_report_addr +
455+
error = goodix_spi_read(ts, GOODIX_HID_CMD_ADDR +
455456
GOODIX_HID_ACK_HEADER_SIZE +
456457
GOODIX_HID_PKG_LEN_SIZE, buf, len);
457458
if (error) {
@@ -521,7 +522,7 @@ static int goodix_hid_set_raw_report(struct hid_device *hid,
521522
memcpy(tmp_buf + tx_len, buf, len);
522523
tx_len += len;
523524

524-
error = goodix_spi_write(ts, ts->hid_report_addr, tmp_buf, tx_len);
525+
error = goodix_spi_write(ts, GOODIX_HID_CMD_ADDR, tmp_buf, tx_len);
525526
if (error) {
526527
dev_err(ts->dev, "failed send report: %*ph", tx_len, tmp_buf);
527528
return error;
@@ -752,7 +753,7 @@ static int goodix_spi_set_power(struct goodix_ts_data *ts, int power_state)
752753
power_control_cmd[5] = power_state;
753754

754755
guard(mutex)(&ts->hid_request_lock);
755-
error = goodix_spi_write(ts, ts->hid_report_addr, power_control_cmd,
756+
error = goodix_spi_write(ts, GOODIX_HID_CMD_ADDR, power_control_cmd,
756757
sizeof(power_control_cmd));
757758
if (error) {
758759
dev_err(ts->dev, "failed set power mode: %s",

0 commit comments

Comments
 (0)