Skip to content

Commit 45ee66c

Browse files
nunojsalag-linaro
authored andcommitted
mfd: adp5585: Add support for a reset pin
Make sure to perform an Hardware reset during probe if the pin is given in FW. Signed-off-by: Nuno Sá <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lee Jones <[email protected]>
1 parent ce262d6 commit 45ee66c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

drivers/mfd/adp5585.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <linux/device.h>
1313
#include <linux/err.h>
1414
#include <linux/i2c.h>
15+
#include <linux/gpio/consumer.h>
1516
#include <linux/mfd/adp5585.h>
1617
#include <linux/mfd/core.h>
1718
#include <linux/mod_devicetable.h>
@@ -690,6 +691,7 @@ static int adp5585_i2c_probe(struct i2c_client *i2c)
690691
{
691692
struct regmap_config *regmap_config;
692693
struct adp5585_dev *adp5585;
694+
struct gpio_desc *gpio;
693695
unsigned int id;
694696
int ret;
695697

@@ -714,6 +716,20 @@ static int adp5585_i2c_probe(struct i2c_client *i2c)
714716
if (ret)
715717
return ret;
716718

719+
gpio = devm_gpiod_get_optional(&i2c->dev, "reset", GPIOD_OUT_HIGH);
720+
if (IS_ERR(gpio))
721+
return PTR_ERR(gpio);
722+
723+
/*
724+
* Note the timings are not documented anywhere in the datasheet. They are just
725+
* reasonable values that work.
726+
*/
727+
if (gpio) {
728+
fsleep(30);
729+
gpiod_set_value_cansleep(gpio, 0);
730+
fsleep(60);
731+
}
732+
717733
adp5585->regmap = devm_regmap_init_i2c(i2c, regmap_config);
718734
if (IS_ERR(adp5585->regmap))
719735
return dev_err_probe(&i2c->dev, PTR_ERR(adp5585->regmap),

0 commit comments

Comments
 (0)