Allow the wacom-i2c device to be exposed via device tree.
Signed-off-by: Alistair Francis <[email protected]>
---
v4:
- Avoid unused variable warning by not using of_match_ptr()
drivers/input/touchscreen/wacom_i2c.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/input/touchscreen/wacom_i2c.c b/drivers/input/touchscreen/wacom_i2c.c
index 1afc6bde2891..eada68770671 100644
--- a/drivers/input/touchscreen/wacom_i2c.c
+++ b/drivers/input/touchscreen/wacom_i2c.c
@@ -12,6 +12,7 @@
#include <linux/slab.h>
#include <linux/irq.h>
#include <linux/interrupt.h>
+#include <linux/of.h>
#include <asm/unaligned.h>
#define WACOM_CMD_QUERY0 0x04
@@ -262,10 +263,17 @@ static const struct i2c_device_id wacom_i2c_id[] = {
};
MODULE_DEVICE_TABLE(i2c, wacom_i2c_id);
+static const struct of_device_id wacom_i2c_of_match_table[] = {
+ { .compatible = "wacom,generic" },
+ {}
+};
+MODULE_DEVICE_TABLE(of, wacom_i2c_of_match_table);
+
static struct i2c_driver wacom_i2c_driver = {
.driver = {
.name = "wacom_i2c",
.pm = &wacom_i2c_pm,
+ .of_match_table = wacom_i2c_of_match_table,
},
.probe = wacom_i2c_probe,
--
2.31.0
Hi Alistair,
On Thu, Mar 25, 2021 at 09:52:23PM -0400, Alistair Francis wrote:
> Allow the wacom-i2c device to be exposed via device tree.
>
> Signed-off-by: Alistair Francis <[email protected]>
> ---
> v4:
> - Avoid unused variable warning by not using of_match_ptr()
>
> drivers/input/touchscreen/wacom_i2c.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/input/touchscreen/wacom_i2c.c b/drivers/input/touchscreen/wacom_i2c.c
> index 1afc6bde2891..eada68770671 100644
> --- a/drivers/input/touchscreen/wacom_i2c.c
> +++ b/drivers/input/touchscreen/wacom_i2c.c
> @@ -12,6 +12,7 @@
> #include <linux/slab.h>
> #include <linux/irq.h>
> #include <linux/interrupt.h>
> +#include <linux/of.h>
> #include <asm/unaligned.h>
>
> #define WACOM_CMD_QUERY0 0x04
> @@ -262,10 +263,17 @@ static const struct i2c_device_id wacom_i2c_id[] = {
> };
> MODULE_DEVICE_TABLE(i2c, wacom_i2c_id);
>
> +static const struct of_device_id wacom_i2c_of_match_table[] = {
> + { .compatible = "wacom,generic" },
No, "generic" is not something we want in device tree binding. What is
the version of the controller used in your device? Put it instead of
"generic". Or if you know the earliest model with this protocol then it
can be used.
> + {}
> +};
> +MODULE_DEVICE_TABLE(of, wacom_i2c_of_match_table);
> +
> static struct i2c_driver wacom_i2c_driver = {
> .driver = {
> .name = "wacom_i2c",
> .pm = &wacom_i2c_pm,
> + .of_match_table = wacom_i2c_of_match_table,
> },
>
> .probe = wacom_i2c_probe,
> --
> 2.31.0
>
Thanks.
--
Dmitry