Skip to content

Commit c8eb2fa

Browse files
charles-goodixJiri Kosina
authored andcommitted
HID: hid-goodix-spi: Add OF supports
This patch introduces the following changes: - Adds OF match table. - Hardcodes hid-report-addr in the driver rather than fetching it from the device property. Signed-off-by: Charles Wang <charles.goodix@gmail.com> Reviewed-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: Jiri Kosina <jkosina@suse.com>
1 parent 20bcb27 commit c8eb2fa

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

drivers/hid/hid-goodix-spi.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#define GOODIX_HID_REPORT_DESC_ADDR 0x105AA
2121
#define GOODIX_HID_SIGN_ADDR 0x10D32
2222
#define GOODIX_HID_CMD_ADDR 0x10364
23+
#define GOODIX_HID_REPORT_ADDR 0x22C8C
2324

2425
#define GOODIX_HID_GET_REPORT_CMD 0x02
2526
#define GOODIX_HID_SET_REPORT_CMD 0x03
@@ -701,12 +702,7 @@ static int goodix_spi_probe(struct spi_device *spi)
701702
return dev_err_probe(dev, PTR_ERR(ts->reset_gpio),
702703
"failed to request reset gpio\n");
703704

704-
error = device_property_read_u32(dev, "goodix,hid-report-addr",
705-
&ts->hid_report_addr);
706-
if (error)
707-
return dev_err_probe(dev, error,
708-
"failed get hid report addr\n");
709-
705+
ts->hid_report_addr = GOODIX_HID_REPORT_ADDR;
710706
error = goodix_dev_confirm(ts);
711707
if (error)
712708
return error;
@@ -790,6 +786,14 @@ static const struct acpi_device_id goodix_spi_acpi_match[] = {
790786
MODULE_DEVICE_TABLE(acpi, goodix_spi_acpi_match);
791787
#endif
792788

789+
#ifdef CONFIG_OF
790+
static const struct of_device_id goodix_spi_of_match[] = {
791+
{ .compatible = "goodix,gt7986u-spifw", },
792+
{ }
793+
};
794+
MODULE_DEVICE_TABLE(of, goodix_spi_of_match);
795+
#endif
796+
793797
static const struct spi_device_id goodix_spi_ids[] = {
794798
{ "gt7986u" },
795799
{ },
@@ -800,6 +804,7 @@ static struct spi_driver goodix_spi_driver = {
800804
.driver = {
801805
.name = "goodix-spi-hid",
802806
.acpi_match_table = ACPI_PTR(goodix_spi_acpi_match),
807+
.of_match_table = of_match_ptr(goodix_spi_of_match),
803808
.pm = pm_sleep_ptr(&goodix_spi_pm_ops),
804809
},
805810
.probe = goodix_spi_probe,

0 commit comments

Comments
 (0)