aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/rmi4/rmi_i2c.c
diff options
context:
space:
mode:
authorAndrew Duggan <aduggan@synaptics.com>2016-03-10 15:46:32 -0800
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2016-03-10 16:02:41 -0800
commitd8a8b3edfd922e3886684a3434bd2b752167ff29 (patch)
tree7a43bd47dfdab7f209bf6aa68698401db679241d /drivers/input/rmi4/rmi_i2c.c
parentInput: synaptics-rmi4 - add I2C transport driver (diff)
downloadlinux-dev-d8a8b3edfd922e3886684a3434bd2b752167ff29.tar.xz
linux-dev-d8a8b3edfd922e3886684a3434bd2b752167ff29.zip
Input: synaptics-rmi4 - add device tree support for RMI4 I2C devices
Add devicetree binding for I2C devices and add bindings for optional parameters in the function drivers. Parameters for function drivers are defined in child nodes for each of the functions. Signed-off-by: Andrew Duggan <aduggan@synaptics.com> Acked-by: Rob Herring <robh@kernel.org> Tested-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Tested-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/rmi4/rmi_i2c.c')
-rw-r--r--drivers/input/rmi4/rmi_i2c.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/input/rmi4/rmi_i2c.c b/drivers/input/rmi4/rmi_i2c.c
index f93742b6537e..a96a326b53bd 100644
--- a/drivers/input/rmi4/rmi_i2c.c
+++ b/drivers/input/rmi4/rmi_i2c.c
@@ -10,6 +10,7 @@
#include <linux/i2c.h>
#include <linux/rmi.h>
#include <linux/irq.h>
+#include <linux/of.h>
#include "rmi_driver.h"
#define BUFFER_SIZE_INCREMENT 32
@@ -207,6 +208,14 @@ static int rmi_i2c_init_irq(struct i2c_client *client)
return 0;
}
+#ifdef CONFIG_OF
+static const struct of_device_id rmi_i2c_of_match[] = {
+ { .compatible = "syna,rmi4-i2c" },
+ {},
+};
+MODULE_DEVICE_TABLE(of, rmi_i2c_of_match);
+#endif
+
static int rmi_i2c_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
@@ -223,7 +232,7 @@ static int rmi_i2c_probe(struct i2c_client *client,
pdata = &rmi_i2c->xport.pdata;
- if (client_pdata)
+ if (!client->dev.of_node && client_pdata)
*pdata = *client_pdata;
if (client->irq > 0)
@@ -372,6 +381,7 @@ static struct i2c_driver rmi_i2c_driver = {
.driver = {
.name = "rmi4_i2c",
.pm = &rmi_i2c_pm,
+ .of_match_table = of_match_ptr(rmi_i2c_of_match),
},
.id_table = rmi_id,
.probe = rmi_i2c_probe,