diff mbox

[1/2] input: goodix: Add device tree support

Message ID 1425458028-4521-1-git-send-email-mamlinav@gmail.com
State Superseded, archived
Headers show

Commit Message

Aleksei Mamlin March 4, 2015, 8:33 a.m. UTC
This patch adds device tree support for Goodix GT9xx series touchscreen
controller.

Signed-off-by: Aleksei Mamlin <mamlinav@gmail.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
---
 .../bindings/input/touchscreen/goodix.txt          | 27 ++++++++++++++++++++++
 .../devicetree/bindings/vendor-prefixes.txt        |  1 +
 drivers/input/touchscreen/Kconfig                  |  2 +-
 drivers/input/touchscreen/goodix.c                 | 19 ++++++++++++++-
 4 files changed, 47 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/goodix.txt

Comments

Bastien Nocera March 4, 2015, 9:21 a.m. UTC | #1
On Wed, 2015-03-04 at 11:33 +0300, Aleksei Mamlin wrote:
> This patch adds device tree support for Goodix GT9xx series 
> touchscreen controller.

<snip>
> diff --git a/drivers/input/touchscreen/Kconfig 
> b/drivers/input/touchscreen/Kconfig
> index 5891752..7a6ab8c 100644
> --- a/drivers/input/touchscreen/Kconfig
> +++ b/drivers/input/touchscreen/Kconfig
> @@ -297,7 +297,7 @@ config TOUCHSCREEN_FUJITSU
>  
>  config TOUCHSCREEN_GOODIX
>         tristate "Goodix I2C touchscreen"
> -       depends on I2C && ACPI
> +       depends on I2C

Any way to say depends on I2C && (ACPI || OF) ?

>         help
>                         Say Y here if you have the Goodix 
> touchscreen (such as one
>                         installed in Onda v975w tablets) connected 
> to your

Can you update the description to add the newly supported devices to 
the list?

Cheers
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Antonio Ospite March 4, 2015, 5:12 p.m. UTC | #2
On Wed, 04 Mar 2015 10:21:26 +0100
Bastien Nocera <hadess@hadess.net> wrote:

> On Wed, 2015-03-04 at 11:33 +0300, Aleksei Mamlin wrote:
> > This patch adds device tree support for Goodix GT9xx series 
> > touchscreen controller.
> 
> <snip>
> > diff --git a/drivers/input/touchscreen/Kconfig 
> > b/drivers/input/touchscreen/Kconfig
> > index 5891752..7a6ab8c 100644
> > --- a/drivers/input/touchscreen/Kconfig
> > +++ b/drivers/input/touchscreen/Kconfig
> > @@ -297,7 +297,7 @@ config TOUCHSCREEN_FUJITSU
> >  
> >  config TOUCHSCREEN_GOODIX
> >         tristate "Goodix I2C touchscreen"
> > -       depends on I2C && ACPI
> > +       depends on I2C
> 
> Any way to say depends on I2C && (ACPI || OF) ?
>

Hi Bastien,

I only see something like this in _one_ driver under drivers/:

drivers/net/phy/Kconfig:        depends on (OF || ACPI) && HAS_IOMEM

I guess this is because "depends" is about compilation requirements
rather than runtime ones? The driver should still compile fine without
either ACPI or OF with the appropriate guards in place, so I'd rather
leave this hunk as Aleksei proposed.

Ciao,
   Antonio

> >         help
> >                         Say Y here if you have the Goodix 
> > touchscreen (such as one
> >                         installed in Onda v975w tablets) connected 
> > to your
> 
> Can you update the description to add the newly supported devices to 
> the list?
> 
> Cheers
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
new file mode 100644
index 0000000..cbaf085
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
@@ -0,0 +1,27 @@ 
+Device tree bindings for Goodix GT9xx series touchscreen controller
+
+Required properties:
+
+ - compatible		: Should be "goodix,gt9110"
+				 or "goodix,gt927"
+				 or "goodix,gt9271"
+				 or "goodix,gt928"
+				 or "goodix,gt967"
+ - reg			: I2C address of the chip
+ - interrupt-parent 	: Interrupt controller to which the chip is connected
+ - interrupts		: Interrupt to which the chip is connected
+
+Example:
+
+	i2c@00000000 {
+		/* ... */
+
+		gt928@5d {
+			compatible = "goodix,gt928";
+			reg = <0x5d>;
+			interrupt-parent = <&gpio>;
+			interrupts = <0 0>;
+		};
+
+		/* ... */
+	};
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 389ca13..e9f70d8 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -76,6 +76,7 @@  geniatech	Geniatech, Inc.
 giantplus	Giantplus Technology Co., Ltd.
 globalscale	Globalscale Technologies, Inc.
 gmt	Global Mixed-mode Technology, Inc.
+goodix	Shenzhen Huiding Technology Co. Ltd.
 google	Google, Inc.
 gumstix	Gumstix, Inc.
 gw	Gateworks Corporation
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 5891752..7a6ab8c 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -297,7 +297,7 @@  config TOUCHSCREEN_FUJITSU
 
 config TOUCHSCREEN_GOODIX
 	tristate "Goodix I2C touchscreen"
-	depends on I2C && ACPI
+	depends on I2C
 	help
 	  Say Y here if you have the Goodix touchscreen (such as one
 	  installed in Onda v975w tablets) connected to your
diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
index ca19668..16f016a 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -23,6 +23,8 @@ 
 #include <linux/irq.h>
 #include <linux/interrupt.h>
 #include <linux/slab.h>
+#include <linux/acpi.h>
+#include <linux/of.h>
 #include <asm/unaligned.h>
 
 struct goodix_ts_data {
@@ -372,11 +374,25 @@  static const struct i2c_device_id goodix_ts_id[] = {
 	{ }
 };
 
+#ifdef CONFIG_ACPI
 static const struct acpi_device_id goodix_acpi_match[] = {
 	{ "GDIX1001", 0 },
 	{ }
 };
 MODULE_DEVICE_TABLE(acpi, goodix_acpi_match);
+#endif
+
+#ifdef CONFIG_OF
+static struct of_device_id goodix_of_match[] = {
+	{ .compatible = "goodix,gt9110" },
+	{ .compatible = "goodix,gt927" },
+	{ .compatible = "goodix,gt9271" },
+	{ .compatible = "goodix,gt928" },
+	{ .compatible = "goodix,gt967" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, goodix_of_match);
+#endif
 
 static struct i2c_driver goodix_ts_driver = {
 	.probe = goodix_ts_probe,
@@ -384,7 +400,8 @@  static struct i2c_driver goodix_ts_driver = {
 	.driver = {
 		.name = "Goodix-TS",
 		.owner = THIS_MODULE,
-		.acpi_match_table = goodix_acpi_match,
+		.acpi_match_table = ACPI_PTR(goodix_acpi_match),
+		.of_match_table = of_match_ptr(goodix_of_match),
 	},
 };
 module_i2c_driver(goodix_ts_driver);