Re: [PATCH V10 4/9] mfd: pm8008: Add reset-gpios

From: Satya Priya Kakitapalli (Temp)
Date: Wed Apr 27 2022 - 02:03:43 EST



On 4/27/2022 10:58 AM, Satya Priya Kakitapalli (Temp) wrote:

On 4/18/2022 10:34 AM, Satya Priya Kakitapalli (Temp) wrote:

On 4/15/2022 5:40 AM, Stephen Boyd wrote:
Quoting Satya Priya (2022-04-14 05:30:13)
diff --git a/drivers/mfd/qcom-pm8008.c b/drivers/mfd/qcom-pm8008.c
index c472d7f..97a72da 100644
--- a/drivers/mfd/qcom-pm8008.c
+++ b/drivers/mfd/qcom-pm8008.c
@@ -239,6 +241,13 @@ static int pm8008_probe(struct i2c_client *client)
                         dev_err(chip->dev, "Failed to probe irq periphs: %d\n", rc);
         }

+       chip->reset_gpio = devm_gpiod_get(chip->dev, "reset", GPIOD_OUT_HIGH);
+       if (IS_ERR(chip->reset_gpio)) {
+               dev_err(chip->dev, "failed to acquire reset gpio\n");
The API looks to print debug messages. This print doesn't look required.


Okay.


+               return PTR_ERR(chip->reset_gpio);
+       }
+       gpiod_set_value(chip->reset_gpio, 1);
Does this do anything? Does this work just as well?

    reset_gpio = devm_gpiod_get(chip->dev, "reset", GPIOD_OUT_LOW);
    if (IS_ERR(reset_gpio))
        return PTR_ERR(reset_gpio);


This is not working as expected. We need to add "gpiod_set_value(chip->reset_gpio, 1);"  to actually toggle the line.


I checked again and it is working after using GPIOD_OUT_HIGH instead of LOW.

reset_gpio = devm_gpiod_get(chip->dev, "reset", GPIOD_OUT_HIGH);
    if (IS_ERR(reset_gpio))
        return PTR_ERR(reset_gpio);



Note that there's no point to store the reset gpio in the structure if
it won't be used outside of probe.


Okay, I'll use a local variable.


This should work fine? I used
GPIOD_OUT_LOW to indicate that the reset should be returned to this
function deasserted, i.e. taking the PMIC out of reset.


I'll try this out.