diff options
| author | Jun Yan <jerrysteve1101@gmail.com> | 2026-06-17 23:02:45 +0800 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2026-06-22 23:19:39 -0700 |
| commit | e40bdf042d417c876ce2623f77215a7eb51a4caa (patch) | |
| tree | 758e023823a9ba3a01089ff07a4d9c611b0ec112 /drivers | |
| parent | 7c492b9eee50076da2717890236d4a08cd0109a5 (diff) | |
| download | linux-next-e40bdf042d417c876ce2623f77215a7eb51a4caa.tar.gz linux-next-e40bdf042d417c876ce2623f77215a7eb51a4caa.zip | |
Input: cap11xx - add reset gpio support
Some CAP11xx devices (CAP1126/CAP1188) have a dedicated RESET pin.
Add hardware reset operation to improve device reliability and
ensure proper initialization on probe.
Signed-off-by: Jun Yan <jerrysteve1101@gmail.com>
Link: https://patch.msgid.link/20260617150318.753148-7-jerrysteve1101@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/input/keyboard/cap11xx.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/input/keyboard/cap11xx.c b/drivers/input/keyboard/cap11xx.c index fae26f035186..1db4a9090705 100644 --- a/drivers/input/keyboard/cap11xx.c +++ b/drivers/input/keyboard/cap11xx.c @@ -5,6 +5,7 @@ * (c) 2014 Daniel Mack <linux@zonque.org> */ +#include <linux/delay.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/interrupt.h> @@ -44,6 +45,9 @@ #define CAP11XX_MANUFACTURER_ID 0x5d +#define CAP11XX_T_RST_FILT_MIN_US 10000 +#define CAP11XX_T_RST_ON_MIN_MS 400 + #ifdef CONFIG_LEDS_CLASS struct cap11xx_led { struct cap11xx_priv *priv; @@ -56,6 +60,7 @@ struct cap11xx_priv { struct regmap *regmap; struct device *dev; struct input_dev *idev; + struct gpio_desc *reset_gpio; const struct cap11xx_hw_model *model; struct cap11xx_led *leds; @@ -459,6 +464,17 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client) if (IS_ERR(priv->regmap)) return PTR_ERR(priv->regmap); + priv->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(priv->reset_gpio)) + return dev_err_probe(dev, PTR_ERR(priv->reset_gpio), + "Failed to get 'reset' GPIO\n"); + + if (priv->reset_gpio) { + usleep_range(CAP11XX_T_RST_FILT_MIN_US, CAP11XX_T_RST_FILT_MIN_US * 2); + gpiod_set_value_cansleep(priv->reset_gpio, 0); + msleep(CAP11XX_T_RST_ON_MIN_MS); + } + error = regmap_read(priv->regmap, CAP11XX_REG_PRODUCT_ID, &val); if (error) return dev_err_probe(dev, error, "Failed to read product ID\n"); |
