diff options
author | Nuno Sá | 2022-08-30 21:12:54 -0700 |
---|---|---|
committer | Dmitry Torokhov | 2022-08-30 21:16:32 -0700 |
commit | cfacae58646462c5afedc8b42ad72a0968678e7c (patch) | |
tree | 4cda0e2b6cc8a160e98a240f046bac4c4425349e /drivers | |
parent | e22d21d31f5d0ade2fa80c44d615ee488b723063 (diff) |
Input: adp5588-keys - add optional reset gpio
Optionally reset the device during probe.
Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220829131553.690063-9-nuno.sa@analog.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/input/keyboard/adp5588-keys.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c index 565123e5894b..950abc1c25a3 100644 --- a/drivers/input/keyboard/adp5588-keys.c +++ b/drivers/input/keyboard/adp5588-keys.c @@ -11,6 +11,7 @@ #include <linux/bits.h> #include <linux/delay.h> #include <linux/errno.h> +#include <linux/gpio/consumer.h> #include <linux/gpio/driver.h> #include <linux/i2c.h> #include <linux/input.h> @@ -716,6 +717,7 @@ static int adp5588_probe(struct i2c_client *client, { struct adp5588_kpad *kpad; struct input_dev *input; + struct gpio_desc *gpio; unsigned int revid; int ret; int error; @@ -741,6 +743,16 @@ static int adp5588_probe(struct i2c_client *client, if (error) return error; + gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(gpio)) + return PTR_ERR(gpio); + + if (gpio) { + fsleep(30); + gpiod_set_value_cansleep(gpio, 0); + fsleep(60); + } + ret = adp5588_read(client, DEV_ID); if (ret < 0) return ret; |