Re: [PATCH 1/3] input: goodix: Add device tree support

3 messages, 3 authors, 2015-01-18 · open the first message on its own page

Re: [PATCH 1/3] input: goodix: Add device tree support

From: Алексей Мамлин <hidden>
Date: 2015-01-18 12:25:35

Look at include/linux/of.h

#ifdef CONFIG_OF
 ...
#define of_match_ptr(_ptr)	(_ptr)
 ...
#else /* CONFIG_OF */
 ...
#define of_match_ptr(_ptr)	NULL
 ...
#endif /* CONFIG_OF */

So it would be compiled. Similarly in other touchscreen drivers.
But Kconfig should be fixed to enable CONFIG_OF. Will be fixed in v2.

2015-01-17 23:38 GMT+03:00, Bastien Nocera [off-list ref]:
On Sat, 2015-01-17 at 17:36 +0300, Aleksei Mamlin wrote:
quoted
Signed-off-by: Aleksei Mamlin <redacted>
---
 drivers/input/touchscreen/goodix.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff --git a/drivers/input/touchscreen/goodix.c
b/drivers/input/touchscreen/goodix.c
index ca19668..603d2ae 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -23,6 +23,7 @@
 #include <linux/irq.h>
 #include <linux/interrupt.h>
 #include <linux/slab.h>
+#include <linux/of.h>
 #include <asm/unaligned.h>

 struct goodix_ts_data {
@@ -378,6 +379,14 @@ static const struct acpi_device_id
goodix_acpi_match[] = {
 };
 MODULE_DEVICE_TABLE(acpi, goodix_acpi_match);

+#ifdef CONFIG_OF
+static struct of_device_id goodix_of_match[] = {
+	{ .compatible = "goodix,gt9xx" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, goodix_of_match);
+#endif
+
 static struct i2c_driver goodix_ts_driver = {
 	.probe = goodix_ts_probe,
 	.id_table = goodix_ts_id,
@@ -385,6 +394,7 @@ static struct i2c_driver goodix_ts_driver = {
 		.name = "Goodix-TS",
 		.owner = THIS_MODULE,
 		.acpi_match_table = goodix_acpi_match,
+		.of_match_table = of_match_ptr(goodix_of_match),
Pretty sure that wouldn't compile if CONFIG_OF is disabled.
quoted
 	},
 };
 module_i2c_driver(goodix_ts_driver);

-- 
Thanks and regards,
Aleksei Mamlin
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Re: [PATCH 1/3] input: goodix: Add device tree support

From: Antonio Ospite <hidden>
Date: 2015-01-18 14:22:47

On Sun, 18 Jan 2015 16:25:35 +0400
Алексей Мамлин [off-list ref] wrote:
Look at include/linux/of.h

#ifdef CONFIG_OF
 ...
#define of_match_ptr(_ptr)	(_ptr)
 ...
#else /* CONFIG_OF */
 ...
#define of_match_ptr(_ptr)	NULL
 ...
#endif /* CONFIG_OF */

So it would be compiled. Similarly in other touchscreen drivers.
But Kconfig should be fixed to enable CONFIG_OF. Will be fixed in v2.
I was thinking, instead of depending on (ACPI || OF), can we make ACPI
optional as well and remove the dependency on it?
Does it make sense to allow selecting a driver even with no
enabled mechanism to pass platform data to it?

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
--
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

Re: [PATCH 1/3] input: goodix: Add device tree support

From: Aleksei Mamlin <hidden>
Date: 2015-01-18 15:12:43

Do you mean that I should use #ifdef CONFIG_ACPI and ACPI_PTR?

#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,gt9xx" },
	{ }
};
MODULE_DEVICE_TABLE(of, goodix_of_match);
#endif

static struct i2c_driver goodix_ts_driver = {
	...
		.acpi_match_table = ACPI_PTR(goodix_acpi_match),
		.of_match_table = of_match_ptr(goodix_of_match),
}

2015-01-18 17:22 GMT+03:00, Antonio Ospite [off-list ref]:
On Sun, 18 Jan 2015 16:25:35 +0400
Алексей Мамлин [off-list ref] wrote:
quoted
Look at include/linux/of.h

#ifdef CONFIG_OF
 ...
#define of_match_ptr(_ptr)	(_ptr)
 ...
#else /* CONFIG_OF */
 ...
#define of_match_ptr(_ptr)	NULL
 ...
#endif /* CONFIG_OF */

So it would be compiled. Similarly in other touchscreen drivers.
But Kconfig should be fixed to enable CONFIG_OF. Will be fixed in v2.
I was thinking, instead of depending on (ACPI || OF), can we make ACPI
optional as well and remove the dependency on it?
Does it make sense to allow selecting a driver even with no
enabled mechanism to pass platform data to it?

Thanks,
   Antonio

--
Antonio Ospite
http://ao2.it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?

-- 
Thanks and regards,
Aleksei Mamlin
--
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help