2022-05-05 17:40:18

by Satya Priya

[permalink] [raw]
Subject: [PATCH V11 4/9] mfd: pm8008: Add reset-gpios

Add the reset-gpio toggling in the pm8008_probe() to bring
pm8008 chip out of reset instead of doing it in DT node using
"output-high" property.

Signed-off-by: Satya Priya <[email protected]>
---
Changes in V11:
- Use local variable for reset_gpios as it is not used outside of probe.
- Use GPIOD_OUT_LOW flag to initialize the gpio and remove below line
as it is not required "gpiod_set_value(chip->reset_gpio, 1);".

Changes in V10:
- This has been split from [V9,3/6] as per comments here [1]
[1] https://patchwork.kernel.org/project/linux-arm-msm/patch/[email protected]/#24803409

drivers/mfd/qcom-pm8008.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/mfd/qcom-pm8008.c b/drivers/mfd/qcom-pm8008.c
index c472d7f..e7c3b32 100644
--- a/drivers/mfd/qcom-pm8008.c
+++ b/drivers/mfd/qcom-pm8008.c
@@ -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>
@@ -221,6 +222,7 @@ static int pm8008_probe(struct i2c_client *client)
{
int rc;
struct pm8008_data *chip;
+ struct gpio_desc *reset_gpio;

chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
if (!chip)
@@ -239,6 +241,10 @@ static int pm8008_probe(struct i2c_client *client)
dev_err(chip->dev, "Failed to probe irq periphs: %d\n", rc);
}

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

--
2.7.4



2022-05-09 01:25:04

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH V11 4/9] mfd: pm8008: Add reset-gpios

Quoting Satya Priya (2022-05-05 02:25:34)
> Add the reset-gpio toggling in the pm8008_probe() to bring
> pm8008 chip out of reset instead of doing it in DT node using
> "output-high" property.
>
> Signed-off-by: Satya Priya <[email protected]>
> ---

Reviewed-by: Stephen Boyd <[email protected]>

2022-05-09 04:13:52

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH V11 4/9] mfd: pm8008: Add reset-gpios

Quoting Satya Priya (2022-05-05 02:25:34)
> diff --git a/drivers/mfd/qcom-pm8008.c b/drivers/mfd/qcom-pm8008.c
> index c472d7f..e7c3b32 100644
> --- a/drivers/mfd/qcom-pm8008.c
> +++ b/drivers/mfd/qcom-pm8008.c
> @@ -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>
> @@ -221,6 +222,7 @@ static int pm8008_probe(struct i2c_client *client)
> {
> int rc;
> struct pm8008_data *chip;
> + struct gpio_desc *reset_gpio;
>
> chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
> if (!chip)
> @@ -239,6 +241,10 @@ static int pm8008_probe(struct i2c_client *client)
> dev_err(chip->dev, "Failed to probe irq periphs: %d\n", rc);
> }
>
> + reset_gpio = devm_gpiod_get(chip->dev, "reset", GPIOD_OUT_LOW);

Actually, this needs to come before probing irq chip right? Otherwise
irq chip could try to read/write from the pmic but it would fail.