]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mfd: pm8008: Deassert reset on probe
authorJohan Hovold <johan+linaro@kernel.org>
Sat, 8 Jun 2024 15:55:17 +0000 (17:55 +0200)
committerLee Jones <lee@kernel.org>
Thu, 13 Jun 2024 17:42:20 +0000 (18:42 +0100)
Request and deassert any (optional) reset gpio during probe in case it
has been left asserted by the boot firmware.

Note the reset line is not asserted to avoid reverting to the default
I2C address in case the firmware has configured an alternate address.

Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20240608155526.12996-4-johan+linaro@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/mfd/qcom-pm8008.c

index f71c490f25c8464cfc454a08898c7caa75203d29..5a77155a63d78316812c7e37bae762b71f099efc 100644 (file)
@@ -4,6 +4,7 @@
  */
 
 #include <linux/bitops.h>
+#include <linux/gpio/consumer.h>
 #include <linux/i2c.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
@@ -156,6 +157,7 @@ static struct regmap_config qcom_mfd_regmap_cfg = {
 static int pm8008_probe(struct i2c_client *client)
 {
        struct regmap_irq_chip_data *irq_data;
+       struct gpio_desc *reset;
        int rc;
        struct device *dev;
        struct regmap *regmap;
@@ -167,6 +169,16 @@ static int pm8008_probe(struct i2c_client *client)
 
        i2c_set_clientdata(client, regmap);
 
+       reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
+       if (IS_ERR(reset))
+               return PTR_ERR(reset);
+
+       /*
+        * The PMIC does not appear to require a post-reset delay, but wait
+        * for a millisecond for now anyway.
+        */
+       usleep_range(1000, 2000);
+
        if (of_property_read_bool(dev->of_node, "interrupt-controller")) {
                rc = devm_regmap_add_irq_chip(dev, regmap, client->irq,
                                IRQF_SHARED, 0, &pm8008_irq_chip, &irq_data);