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>
This commit is contained in:
Andrew Duggan
2016-03-10 15:46:32 -08:00
committed by Dmitry Torokhov
parent fdf51604f1
commit d8a8b3edfd
8 changed files with 217 additions and 5 deletions

View File

@@ -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;