* [PATCH v4 0/2] dt-bindings: input: Goodix GT7986U SPI HID Touchscreen
@ 2024-11-11 7:49 Charles Wang
2024-11-11 7:49 ` [PATCH v4 1/2] " Charles Wang
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Charles Wang @ 2024-11-11 7:49 UTC (permalink / raw)
To: robh, krzk, hbarnor, dianders, conor.dooley
Cc: dmitry.torokhov, jikos, bentiss, linux-input, devicetree,
linux-kernel, Charles Wang
The Goodix GT7986U touch controller report touch data according to the
HID protocol through the SPI bus. However, it is incompatible with
Microsoft's HID-over-SPI protocol.
The patchset introduces the following two changes:
1) Add goodix,gt7986u-spifw.yaml.
2) Modify the driver to align with the device binding file.
Signed-off-by: Charles Wang <charles.goodix@gmail.com>
---
Changes in v4:
- Fix dt build warnings.
- Modify the driver to align with the device binding file.
Changes in v3:
- Split the commit into two patches.
Changes in v2:
- Change compatible to 'goodix,gt7986u-spifw'.
- Remove 'goodix,hid-report-addr' property.
- Change additionalProperties to unevaluatedProperties.
- v1: https://lore.kernel.org/all/20241025114642.40793-2-charles.goodix@gmail.com/
---
Charles Wang (2):
dt-bindings: input: Goodix GT7986U SPI HID Touchscreen
HID: hid-goodix: Add OF supports
.../bindings/input/goodix,gt7986u-spifw.yaml | 69 +++++++++++++++++++
drivers/hid/hid-goodix-spi.c | 17 +++--
2 files changed, 80 insertions(+), 6 deletions(-)
create mode 100644 Documentation/devicetree/bindings/input/goodix,gt7986u-spifw.yaml
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH v4 1/2] dt-bindings: input: Goodix GT7986U SPI HID Touchscreen 2024-11-11 7:49 [PATCH v4 0/2] dt-bindings: input: Goodix GT7986U SPI HID Touchscreen Charles Wang @ 2024-11-11 7:49 ` Charles Wang 2024-11-11 17:25 ` Doug Anderson 2024-11-12 16:30 ` Rob Herring (Arm) 2024-11-11 7:50 ` [PATCH v4 2/2] HID: hid-goodix: Add OF supports Charles Wang 2024-11-13 9:57 ` [PATCH v4 0/2] dt-bindings: input: Goodix GT7986U SPI HID Touchscreen Jiri Kosina 2 siblings, 2 replies; 9+ messages in thread From: Charles Wang @ 2024-11-11 7:49 UTC (permalink / raw) To: robh, krzk, hbarnor, dianders, conor.dooley Cc: dmitry.torokhov, jikos, bentiss, linux-input, devicetree, linux-kernel, Charles Wang The Goodix GT7986U touch controller report touch data according to the HID protocol through the SPI bus. However, it is incompatible with Microsoft's HID-over-SPI protocol. NOTE: these bindings are distinct from the bindings used with the GT7986U when the chip is running I2C firmware. For some background, see discussion on the mailing lists in the thread: https://lore.kernel.org/r/20241018020815.3098263-2-charles.goodix@gmail.com Signed-off-by: Charles Wang <charles.goodix@gmail.com> --- .../bindings/input/goodix,gt7986u-spifw.yaml | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/goodix,gt7986u-spifw.yaml diff --git a/Documentation/devicetree/bindings/input/goodix,gt7986u-spifw.yaml b/Documentation/devicetree/bindings/input/goodix,gt7986u-spifw.yaml new file mode 100644 index 000000000..92bd0041f --- /dev/null +++ b/Documentation/devicetree/bindings/input/goodix,gt7986u-spifw.yaml @@ -0,0 +1,69 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/input/goodix,gt7986u-spifw.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Goodix GT7986U SPI HID Touchscreen + +maintainers: + - Charles Wang <charles.goodix@gmail.com> + +description: | + Supports the Goodix GT7986U touchscreen. + This touch controller reports data packaged according to the HID protocol + over the SPI bus, but it is incompatible with Microsoft's HID-over-SPI protocol. + + NOTE: these bindings are distinct from the bindings used with the + GT7986U when the chip is running I2C firmware. This is because there's + not a single device that talks over both I2C and SPI but rather + distinct touchscreens that happen to be built with the same ASIC but + that are distinct products running distinct firmware. + +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +properties: + compatible: + enum: + - goodix,gt7986u-spifw + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + reset-gpios: + maxItems: 1 + + spi-max-frequency: true + +required: + - compatible + - reg + - interrupts + - reset-gpios + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + #include <dt-bindings/gpio/gpio.h> + + spi { + #address-cells = <1>; + #size-cells = <0>; + + touchscreen@0 { + compatible = "goodix,gt7986u-spifw"; + reg = <0>; + interrupt-parent = <&gpio>; + interrupts = <25 IRQ_TYPE_LEVEL_LOW>; + reset-gpios = <&gpio1 1 GPIO_ACTIVE_LOW>; + spi-max-frequency = <10000000>; + }; + }; + +... -- 2.43.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v4 1/2] dt-bindings: input: Goodix GT7986U SPI HID Touchscreen 2024-11-11 7:49 ` [PATCH v4 1/2] " Charles Wang @ 2024-11-11 17:25 ` Doug Anderson 2024-11-12 16:30 ` Rob Herring (Arm) 1 sibling, 0 replies; 9+ messages in thread From: Doug Anderson @ 2024-11-11 17:25 UTC (permalink / raw) To: Charles Wang Cc: robh, krzk, hbarnor, conor.dooley, dmitry.torokhov, jikos, bentiss, linux-input, devicetree, linux-kernel Hi, On Sun, Nov 10, 2024 at 11:50 PM Charles Wang <charles.goodix@gmail.com> wrote: > > The Goodix GT7986U touch controller report touch data according to the > HID protocol through the SPI bus. However, it is incompatible with > Microsoft's HID-over-SPI protocol. > > NOTE: these bindings are distinct from the bindings used with the > GT7986U when the chip is running I2C firmware. For some background, > see discussion on the mailing lists in the thread: > > https://lore.kernel.org/r/20241018020815.3098263-2-charles.goodix@gmail.com > > Signed-off-by: Charles Wang <charles.goodix@gmail.com> > --- > .../bindings/input/goodix,gt7986u-spifw.yaml | 69 +++++++++++++++++++ > 1 file changed, 69 insertions(+) As far as I can tell this looks fine now. Thanks! Reviewed-by: Douglas Anderson <dianders@chromium.org> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4 1/2] dt-bindings: input: Goodix GT7986U SPI HID Touchscreen 2024-11-11 7:49 ` [PATCH v4 1/2] " Charles Wang 2024-11-11 17:25 ` Doug Anderson @ 2024-11-12 16:30 ` Rob Herring (Arm) 1 sibling, 0 replies; 9+ messages in thread From: Rob Herring (Arm) @ 2024-11-12 16:30 UTC (permalink / raw) To: Charles Wang Cc: hbarnor, bentiss, linux-input, krzk, dianders, jikos, linux-kernel, dmitry.torokhov, devicetree, conor.dooley On Mon, 11 Nov 2024 15:49:59 +0800, Charles Wang wrote: > The Goodix GT7986U touch controller report touch data according to the > HID protocol through the SPI bus. However, it is incompatible with > Microsoft's HID-over-SPI protocol. > > NOTE: these bindings are distinct from the bindings used with the > GT7986U when the chip is running I2C firmware. For some background, > see discussion on the mailing lists in the thread: > > https://lore.kernel.org/r/20241018020815.3098263-2-charles.goodix@gmail.com > > Signed-off-by: Charles Wang <charles.goodix@gmail.com> > --- > .../bindings/input/goodix,gt7986u-spifw.yaml | 69 +++++++++++++++++++ > 1 file changed, 69 insertions(+) > create mode 100644 Documentation/devicetree/bindings/input/goodix,gt7986u-spifw.yaml > Reviewed-by: Rob Herring (Arm) <robh@kernel.org> ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v4 2/2] HID: hid-goodix: Add OF supports 2024-11-11 7:49 [PATCH v4 0/2] dt-bindings: input: Goodix GT7986U SPI HID Touchscreen Charles Wang 2024-11-11 7:49 ` [PATCH v4 1/2] " Charles Wang @ 2024-11-11 7:50 ` Charles Wang 2024-11-11 17:24 ` Doug Anderson 2024-11-13 9:57 ` [PATCH v4 0/2] dt-bindings: input: Goodix GT7986U SPI HID Touchscreen Jiri Kosina 2 siblings, 1 reply; 9+ messages in thread From: Charles Wang @ 2024-11-11 7:50 UTC (permalink / raw) To: robh, krzk, hbarnor, dianders, conor.dooley Cc: dmitry.torokhov, jikos, bentiss, linux-input, devicetree, linux-kernel, Charles Wang 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> --- drivers/hid/hid-goodix-spi.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/hid/hid-goodix-spi.c b/drivers/hid/hid-goodix-spi.c index 6ae2300a6..80c0288a3 100644 --- a/drivers/hid/hid-goodix-spi.c +++ b/drivers/hid/hid-goodix-spi.c @@ -20,6 +20,7 @@ #define GOODIX_HID_REPORT_DESC_ADDR 0x105AA #define GOODIX_HID_SIGN_ADDR 0x10D32 #define GOODIX_HID_CMD_ADDR 0x10364 +#define GOODIX_HID_REPORT_ADDR 0x22C8C #define GOODIX_HID_GET_REPORT_CMD 0x02 #define GOODIX_HID_SET_REPORT_CMD 0x03 @@ -701,12 +702,7 @@ static int goodix_spi_probe(struct spi_device *spi) return dev_err_probe(dev, PTR_ERR(ts->reset_gpio), "failed to request reset gpio\n"); - error = device_property_read_u32(dev, "goodix,hid-report-addr", - &ts->hid_report_addr); - if (error) - return dev_err_probe(dev, error, - "failed get hid report addr\n"); - + ts->hid_report_addr = GOODIX_HID_REPORT_ADDR; error = goodix_dev_confirm(ts); if (error) return error; @@ -790,6 +786,14 @@ static const struct acpi_device_id goodix_spi_acpi_match[] = { MODULE_DEVICE_TABLE(acpi, goodix_spi_acpi_match); #endif +#ifdef CONFIG_OF +static const struct of_device_id goodix_spi_of_match[] = { + { .compatible = "goodix,gt7986u-spifw", }, + { } +}; +MODULE_DEVICE_TABLE(of, goodix_spi_of_match); +#endif + static const struct spi_device_id goodix_spi_ids[] = { { "gt7986u" }, { }, @@ -800,6 +804,7 @@ static struct spi_driver goodix_spi_driver = { .driver = { .name = "goodix-spi-hid", .acpi_match_table = ACPI_PTR(goodix_spi_acpi_match), + .of_match_table = of_match_ptr(goodix_spi_of_match), .pm = pm_sleep_ptr(&goodix_spi_pm_ops), }, .probe = goodix_spi_probe, -- 2.43.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v4 2/2] HID: hid-goodix: Add OF supports 2024-11-11 7:50 ` [PATCH v4 2/2] HID: hid-goodix: Add OF supports Charles Wang @ 2024-11-11 17:24 ` Doug Anderson 2024-11-12 11:53 ` Charles Wang 2024-11-13 9:56 ` Jiri Kosina 0 siblings, 2 replies; 9+ messages in thread From: Doug Anderson @ 2024-11-11 17:24 UTC (permalink / raw) To: Charles Wang Cc: robh, krzk, hbarnor, conor.dooley, dmitry.torokhov, jikos, bentiss, linux-input, devicetree, linux-kernel Hi, On Sun, Nov 10, 2024 at 11:50 PM Charles Wang <charles.goodix@gmail.com> wrote: > > 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> > --- > drivers/hid/hid-goodix-spi.c | 17 +++++++++++------ > 1 file changed, 11 insertions(+), 6 deletions(-) > > diff --git a/drivers/hid/hid-goodix-spi.c b/drivers/hid/hid-goodix-spi.c > index 6ae2300a6..80c0288a3 100644 > --- a/drivers/hid/hid-goodix-spi.c > +++ b/drivers/hid/hid-goodix-spi.c > @@ -20,6 +20,7 @@ > #define GOODIX_HID_REPORT_DESC_ADDR 0x105AA > #define GOODIX_HID_SIGN_ADDR 0x10D32 > #define GOODIX_HID_CMD_ADDR 0x10364 > +#define GOODIX_HID_REPORT_ADDR 0x22C8C > > #define GOODIX_HID_GET_REPORT_CMD 0x02 > #define GOODIX_HID_SET_REPORT_CMD 0x03 > @@ -701,12 +702,7 @@ static int goodix_spi_probe(struct spi_device *spi) > return dev_err_probe(dev, PTR_ERR(ts->reset_gpio), > "failed to request reset gpio\n"); > > - error = device_property_read_u32(dev, "goodix,hid-report-addr", > - &ts->hid_report_addr); > - if (error) > - return dev_err_probe(dev, error, > - "failed get hid report addr\n"); > - > + ts->hid_report_addr = GOODIX_HID_REPORT_ADDR; > error = goodix_dev_confirm(ts); > if (error) > return error; > @@ -790,6 +786,14 @@ static const struct acpi_device_id goodix_spi_acpi_match[] = { > MODULE_DEVICE_TABLE(acpi, goodix_spi_acpi_match); > #endif > > +#ifdef CONFIG_OF > +static const struct of_device_id goodix_spi_of_match[] = { > + { .compatible = "goodix,gt7986u-spifw", }, > + { } > +}; > +MODULE_DEVICE_TABLE(of, goodix_spi_of_match); > +#endif > + > static const struct spi_device_id goodix_spi_ids[] = { > { "gt7986u" }, > { }, > @@ -800,6 +804,7 @@ static struct spi_driver goodix_spi_driver = { > .driver = { > .name = "goodix-spi-hid", > .acpi_match_table = ACPI_PTR(goodix_spi_acpi_match), > + .of_match_table = of_match_ptr(goodix_spi_of_match), I can never quite remember what the current preference is in regards to "OF" tables (whether to use #ifdef like you've done or mark them `__maybe_unused`), so maybe someone will request you change it. ...but IMO what you have is fine and looks to be properly guarded with of_match_ptr(). As far as I'm concerned, this patch looks OK. Oh, I guess the one "nit" is that I would have put "spi" in the subject, making it "HID: hid-goodix-spi: Add OF supports". It might be worth sending a v5 for that (after waiting a day or two) unless a maintainer tells you not to. In any case: Reviewed-by: Douglas Anderson <dianders@chromium.org> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4 2/2] HID: hid-goodix: Add OF supports 2024-11-11 17:24 ` Doug Anderson @ 2024-11-12 11:53 ` Charles Wang 2024-11-13 9:56 ` Jiri Kosina 1 sibling, 0 replies; 9+ messages in thread From: Charles Wang @ 2024-11-12 11:53 UTC (permalink / raw) To: Doug Anderson Cc: robh, krzk, hbarnor, conor.dooley, dmitry.torokhov, jikos, bentiss, linux-input, devicetree, linux-kernel Hi Doug, On Mon, Nov 11, 2024 at 09:24:39AM -0800, Doug Anderson wrote: > Hi, > > On Sun, Nov 10, 2024 at 11:50 PM Charles Wang <charles.goodix@gmail.com> wrote: > > > > 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> > > --- > > drivers/hid/hid-goodix-spi.c | 17 +++++++++++------ > > 1 file changed, 11 insertions(+), 6 deletions(-) > > > > diff --git a/drivers/hid/hid-goodix-spi.c b/drivers/hid/hid-goodix-spi.c > > index 6ae2300a6..80c0288a3 100644 > > --- a/drivers/hid/hid-goodix-spi.c > > +++ b/drivers/hid/hid-goodix-spi.c > > @@ -20,6 +20,7 @@ > > #define GOODIX_HID_REPORT_DESC_ADDR 0x105AA > > #define GOODIX_HID_SIGN_ADDR 0x10D32 > > #define GOODIX_HID_CMD_ADDR 0x10364 > > +#define GOODIX_HID_REPORT_ADDR 0x22C8C > > > > #define GOODIX_HID_GET_REPORT_CMD 0x02 > > #define GOODIX_HID_SET_REPORT_CMD 0x03 > > @@ -701,12 +702,7 @@ static int goodix_spi_probe(struct spi_device *spi) > > return dev_err_probe(dev, PTR_ERR(ts->reset_gpio), > > "failed to request reset gpio\n"); > > > > - error = device_property_read_u32(dev, "goodix,hid-report-addr", > > - &ts->hid_report_addr); > > - if (error) > > - return dev_err_probe(dev, error, > > - "failed get hid report addr\n"); > > - > > + ts->hid_report_addr = GOODIX_HID_REPORT_ADDR; > > error = goodix_dev_confirm(ts); > > if (error) > > return error; > > @@ -790,6 +786,14 @@ static const struct acpi_device_id goodix_spi_acpi_match[] = { > > MODULE_DEVICE_TABLE(acpi, goodix_spi_acpi_match); > > #endif > > > > +#ifdef CONFIG_OF > > +static const struct of_device_id goodix_spi_of_match[] = { > > + { .compatible = "goodix,gt7986u-spifw", }, > > + { } > > +}; > > +MODULE_DEVICE_TABLE(of, goodix_spi_of_match); > > +#endif > > + > > static const struct spi_device_id goodix_spi_ids[] = { > > { "gt7986u" }, > > { }, > > @@ -800,6 +804,7 @@ static struct spi_driver goodix_spi_driver = { > > .driver = { > > .name = "goodix-spi-hid", > > .acpi_match_table = ACPI_PTR(goodix_spi_acpi_match), > > + .of_match_table = of_match_ptr(goodix_spi_of_match), > > I can never quite remember what the current preference is in regards > to "OF" tables (whether to use #ifdef like you've done or mark them > `__maybe_unused`), so maybe someone will request you change it. ...but > IMO what you have is fine and looks to be properly guarded with > of_match_ptr(). As far as I'm concerned, this patch looks OK. > > Oh, I guess the one "nit" is that I would have put "spi" in the > subject, making it "HID: hid-goodix-spi: Add OF supports". It might be > worth sending a v5 for that (after waiting a day or two) unless a > maintainer tells you not to. > Ack, > In any case: > > Reviewed-by: Douglas Anderson <dianders@chromium.org> Thanks, Charles ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4 2/2] HID: hid-goodix: Add OF supports 2024-11-11 17:24 ` Doug Anderson 2024-11-12 11:53 ` Charles Wang @ 2024-11-13 9:56 ` Jiri Kosina 1 sibling, 0 replies; 9+ messages in thread From: Jiri Kosina @ 2024-11-13 9:56 UTC (permalink / raw) To: Doug Anderson Cc: Charles Wang, robh, krzk, hbarnor, conor.dooley, dmitry.torokhov, bentiss, linux-input, devicetree, linux-kernel On Mon, 11 Nov 2024, Doug Anderson wrote: > Oh, I guess the one "nit" is that I would have put "spi" in the > subject, making it "HID: hid-goodix-spi: Add OF supports". It might be > worth sending a v5 for that (after waiting a day or two) unless a > maintainer tells you not to. No need to resend v5 just for this, I'll adjust manually while applying. Thanks, -- Jiri Kosina SUSE Labs ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4 0/2] dt-bindings: input: Goodix GT7986U SPI HID Touchscreen 2024-11-11 7:49 [PATCH v4 0/2] dt-bindings: input: Goodix GT7986U SPI HID Touchscreen Charles Wang 2024-11-11 7:49 ` [PATCH v4 1/2] " Charles Wang 2024-11-11 7:50 ` [PATCH v4 2/2] HID: hid-goodix: Add OF supports Charles Wang @ 2024-11-13 9:57 ` Jiri Kosina 2 siblings, 0 replies; 9+ messages in thread From: Jiri Kosina @ 2024-11-13 9:57 UTC (permalink / raw) To: Charles Wang Cc: robh, krzk, hbarnor, dianders, conor.dooley, dmitry.torokhov, bentiss, linux-input, devicetree, linux-kernel On Mon, 11 Nov 2024, Charles Wang wrote: > The Goodix GT7986U touch controller report touch data according to the > HID protocol through the SPI bus. However, it is incompatible with > Microsoft's HID-over-SPI protocol. > > The patchset introduces the following two changes: > 1) Add goodix,gt7986u-spifw.yaml. > 2) Modify the driver to align with the device binding file. > > Signed-off-by: Charles Wang <charles.goodix@gmail.com> > --- > Changes in v4: > - Fix dt build warnings. > - Modify the driver to align with the device binding file. > > Changes in v3: > - Split the commit into two patches. > > Changes in v2: > - Change compatible to 'goodix,gt7986u-spifw'. > - Remove 'goodix,hid-report-addr' property. > - Change additionalProperties to unevaluatedProperties. > - v1: https://lore.kernel.org/all/20241025114642.40793-2-charles.goodix@gmail.com/ Now queued in hid.git#for-6.13/goodix. Thanks, -- Jiri Kosina SUSE Labs ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-11-13 9:57 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-11-11 7:49 [PATCH v4 0/2] dt-bindings: input: Goodix GT7986U SPI HID Touchscreen Charles Wang 2024-11-11 7:49 ` [PATCH v4 1/2] " Charles Wang 2024-11-11 17:25 ` Doug Anderson 2024-11-12 16:30 ` Rob Herring (Arm) 2024-11-11 7:50 ` [PATCH v4 2/2] HID: hid-goodix: Add OF supports Charles Wang 2024-11-11 17:24 ` Doug Anderson 2024-11-12 11:53 ` Charles Wang 2024-11-13 9:56 ` Jiri Kosina 2024-11-13 9:57 ` [PATCH v4 0/2] dt-bindings: input: Goodix GT7986U SPI HID Touchscreen Jiri Kosina
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).