summaryrefslogtreecommitdiff
path: root/drivers/input/rmi4/rmi_driver.c
diff options
context:
space:
mode:
authorAndrew Duggan <aduggan@synaptics.com>2016-03-11 02:46:32 +0300
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2016-03-11 03:02:41 +0300
commitd8a8b3edfd922e3886684a3434bd2b752167ff29 (patch)
tree7a43bd47dfdab7f209bf6aa68698401db679241d /drivers/input/rmi4/rmi_driver.c
parentfdf51604f104f95bbb828019e6b8f17e7a0f834a (diff)
downloadlinux-d8a8b3edfd922e3886684a3434bd2b752167ff29.tar.xz
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_driver.c')
-rw-r--r--drivers/input/rmi4/rmi_driver.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
index b0f34b57a126..da38f0ad80ed 100644
--- a/drivers/input/rmi4/rmi_driver.c
+++ b/drivers/input/rmi4/rmi_driver.c
@@ -20,6 +20,7 @@
#include <linux/kconfig.h>
#include <linux/pm.h>
#include <linux/slab.h>
+#include <linux/of.h>
#include <uapi/linux/input.h>
#include <linux/rmi.h>
#include "rmi_bus.h"
@@ -821,6 +822,27 @@ static int rmi_driver_remove(struct device *dev)
return 0;
}
+#ifdef CONFIG_OF
+static int rmi_driver_of_probe(struct device *dev,
+ struct rmi_device_platform_data *pdata)
+{
+ int retval;
+
+ retval = rmi_of_property_read_u32(dev, &pdata->reset_delay_ms,
+ "syna,reset-delay-ms", 1);
+ if (retval)
+ return retval;
+
+ return 0;
+}
+#else
+static inline int rmi_driver_of_probe(struct device *dev,
+ struct rmi_device_platform_data *pdata)
+{
+ return -ENODEV;
+}
+#endif
+
static int rmi_driver_probe(struct device *dev)
{
struct rmi_driver *rmi_driver;
@@ -846,6 +868,12 @@ static int rmi_driver_probe(struct device *dev)
pdata = rmi_get_platform_data(rmi_dev);
+ if (rmi_dev->xport->dev->of_node) {
+ retval = rmi_driver_of_probe(rmi_dev->xport->dev, pdata);
+ if (retval)
+ return retval;
+ }
+
data = devm_kzalloc(dev, sizeof(struct rmi_driver_data), GFP_KERNEL);
if (!data)
return -ENOMEM;