diff options
author | Andrew Duggan <aduggan@synaptics.com> | 2016-03-11 02:46:32 +0300 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2016-03-11 03:02:41 +0300 |
commit | d8a8b3edfd922e3886684a3434bd2b752167ff29 (patch) | |
tree | 7a43bd47dfdab7f209bf6aa68698401db679241d /drivers/input/rmi4/rmi_f01.c | |
parent | fdf51604f104f95bbb828019e6b8f17e7a0f834a (diff) | |
download | linux-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_f01.c')
-rw-r--r-- | drivers/input/rmi4/rmi_f01.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/drivers/input/rmi4/rmi_f01.c b/drivers/input/rmi4/rmi_f01.c index e50ecc6699e7..eb362bc71a4c 100644 --- a/drivers/input/rmi4/rmi_f01.c +++ b/drivers/input/rmi4/rmi_f01.c @@ -247,6 +247,50 @@ char *rmi_f01_get_product_ID(struct rmi_function *fn) return f01->properties.product_id; } +#ifdef CONFIG_OF +static int rmi_f01_of_probe(struct device *dev, + struct rmi_device_platform_data *pdata) +{ + int retval; + u32 val; + + retval = rmi_of_property_read_u32(dev, + (u32 *)&pdata->power_management.nosleep, + "syna,nosleep-mode", 1); + if (retval) + return retval; + + retval = rmi_of_property_read_u32(dev, &val, + "syna,wakeup-threshold", 1); + if (retval) + return retval; + + pdata->power_management.wakeup_threshold = val; + + retval = rmi_of_property_read_u32(dev, &val, + "syna,doze-holdoff-ms", 1); + if (retval) + return retval; + + pdata->power_management.doze_holdoff = val * 100; + + retval = rmi_of_property_read_u32(dev, &val, + "syna,doze-interval-ms", 1); + if (retval) + return retval; + + pdata->power_management.doze_interval = val / 10; + + return 0; +} +#else +static inline int rmi_f01_of_probe(struct device *dev, + struct rmi_device_platform_data *pdata) +{ + return -ENODEV; +} +#endif + static int rmi_f01_probe(struct rmi_function *fn) { struct rmi_device *rmi_dev = fn->rmi_dev; @@ -258,6 +302,12 @@ static int rmi_f01_probe(struct rmi_function *fn) u8 device_status; u8 temp; + if (fn->dev.of_node) { + error = rmi_f01_of_probe(&fn->dev, pdata); + if (error) + return error; + } + f01 = devm_kzalloc(&fn->dev, sizeof(struct f01_data), GFP_KERNEL); if (!f01) return -ENOMEM; |