Message ID | 20250512-dev-adp5589-fw-v3-21-092b14b79a88@analog.com |
---|---|
State | New |
Headers | show |
Series | mfd: adp5585: support keymap events and drop legacy Input driver | expand |
On Tue, 2025-05-13 at 17:26 +0100, Lee Jones wrote: > On Mon, 12 May 2025, Nuno Sá via B4 Relay wrote: > > > From: Nuno Sá <nuno.sa@analog.com> > > > > Make sure to perform an Hardware reset during probe if the pin is given > > in FW. > > > > Signed-off-by: Nuno Sá <nuno.sa@analog.com> > > --- > > drivers/mfd/adp5585.c | 16 ++++++++++++++++ > > 1 file changed, 16 insertions(+) > > > > diff --git a/drivers/mfd/adp5585.c b/drivers/mfd/adp5585.c > > index > > 88401668f30e06ac201175470eeaf6216f3121d9..0fbe1f7f2582408b2e1b99f629182ceebce73fd > > 7 100644 > > --- a/drivers/mfd/adp5585.c > > +++ b/drivers/mfd/adp5585.c > > @@ -11,6 +11,7 @@ > > #include <linux/device.h> > > #include <linux/err.h> > > #include <linux/i2c.h> > > +#include <linux/gpio/consumer.h> > > #include <linux/mfd/adp5585.h> > > #include <linux/mfd/core.h> > > #include <linux/mod_devicetable.h> > > @@ -712,6 +713,7 @@ static int adp5585_i2c_probe(struct i2c_client *i2c) > > { > > struct regmap_config regmap_config; > > struct adp5585_dev *adp5585; > > + struct gpio_desc *gpio; > > struct mfd_cell *devs; > > unsigned int id; > > int ret, n_devs; > > @@ -730,6 +732,20 @@ static int adp5585_i2c_probe(struct i2c_client *i2c) > > if (ret) > > return ret; > > > > + gpio = devm_gpiod_get_optional(&i2c->dev, "reset", GPIOD_OUT_HIGH); > > + if (IS_ERR(gpio)) > > + return PTR_ERR(gpio); > > + > > + /* > > + * Note the timings are not documented anywhere in the DS. They are just > > It's okay, you can say "datasheet". :) > > > + * reasonable values that work... > > What does "..." mean in this context? Nothing :). Just an annoying habit I have. It comes automatically > > > + */ > > + if (gpio) { > > + fsleep(30); > > + gpiod_set_value_cansleep(gpio, 0); > > + fsleep(60); > > + } > > + > > adp5585->regmap = devm_regmap_init_i2c(i2c, ®map_config); > > if (IS_ERR(adp5585->regmap)) > > return dev_err_probe(&i2c->dev, PTR_ERR(adp5585->regmap), > > > > -- > > 2.49.0 > > > > >
diff --git a/drivers/mfd/adp5585.c b/drivers/mfd/adp5585.c index 88401668f30e06ac201175470eeaf6216f3121d9..0fbe1f7f2582408b2e1b99f629182ceebce73fd7 100644 --- a/drivers/mfd/adp5585.c +++ b/drivers/mfd/adp5585.c @@ -11,6 +11,7 @@ #include <linux/device.h> #include <linux/err.h> #include <linux/i2c.h> +#include <linux/gpio/consumer.h> #include <linux/mfd/adp5585.h> #include <linux/mfd/core.h> #include <linux/mod_devicetable.h> @@ -712,6 +713,7 @@ static int adp5585_i2c_probe(struct i2c_client *i2c) { struct regmap_config regmap_config; struct adp5585_dev *adp5585; + struct gpio_desc *gpio; struct mfd_cell *devs; unsigned int id; int ret, n_devs; @@ -730,6 +732,20 @@ static int adp5585_i2c_probe(struct i2c_client *i2c) if (ret) return ret; + gpio = devm_gpiod_get_optional(&i2c->dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(gpio)) + return PTR_ERR(gpio); + + /* + * Note the timings are not documented anywhere in the DS. They are just + * reasonable values that work... + */ + if (gpio) { + fsleep(30); + gpiod_set_value_cansleep(gpio, 0); + fsleep(60); + } + adp5585->regmap = devm_regmap_init_i2c(i2c, ®map_config); if (IS_ERR(adp5585->regmap)) return dev_err_probe(&i2c->dev, PTR_ERR(adp5585->regmap),