diff mbox series

[3/3] power: reset: qcom-pon: Add support for 'qcom,pon-reboot-not-used'

Message ID 20210705025032.12804-4-shawn.guo@linaro.org (mailing list archive)
State Not Applicable, archived
Headers show
Series Add 'qcom,pon-reboot-not-used' support in PON driver | expand

Commit Message

Shawn Guo July 5, 2021, 2:50 a.m. UTC
Check property 'qcom,pon-reboot-not-used' and skip reboot-mode setup
if the property is present.  This is useful for devices that use IMEM
instead of PON register to pass reboot mode, but still want to populate
pwrkey and resin devices.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 drivers/power/reset/qcom-pon.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Bjorn Andersson July 12, 2021, 5:12 p.m. UTC | #1
On Sun 04 Jul 21:50 CDT 2021, Shawn Guo wrote:

> Check property 'qcom,pon-reboot-not-used' and skip reboot-mode setup
> if the property is present.  This is useful for devices that use IMEM
> instead of PON register to pass reboot mode, but still want to populate
> pwrkey and resin devices.
> 

If IMEM is used instead, I think it should be sufficient for the DT
author to omit mode-* properties to achieve this. If the PON hardware
doesn't support mode-*, then that should be reflected in the DT binding
and compatible.

Regards,
Bjorn

> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> ---
>  drivers/power/reset/qcom-pon.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/power/reset/qcom-pon.c b/drivers/power/reset/qcom-pon.c
> index 4a688741a88a..85fae9e85878 100644
> --- a/drivers/power/reset/qcom-pon.c
> +++ b/drivers/power/reset/qcom-pon.c
> @@ -47,6 +47,14 @@ static int pm8916_pon_probe(struct platform_device *pdev)
>  	struct pm8916_pon *pon;
>  	int error;
>  
> +	if (device_property_present(&pdev->dev, "qcom,pon-reboot-not-used")) {
> +		/*
> +		 * Skip reboot-mode setup and registration if PON is not used
> +		 * for passing reboot mode at all.
> +		 */
> +		goto done;
> +	}
> +
>  	pon = devm_kzalloc(&pdev->dev, sizeof(*pon), GFP_KERNEL);
>  	if (!pon)
>  		return -ENOMEM;
> @@ -75,6 +83,7 @@ static int pm8916_pon_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, pon);
>  
> +done:
>  	return devm_of_platform_populate(&pdev->dev);
>  }
>  
> -- 
> 2.17.1
>
Shawn Guo July 14, 2021, 11:49 a.m. UTC | #2
On Mon, Jul 12, 2021 at 12:12:26PM -0500, Bjorn Andersson wrote:
> On Sun 04 Jul 21:50 CDT 2021, Shawn Guo wrote:
> 
> > Check property 'qcom,pon-reboot-not-used' and skip reboot-mode setup
> > if the property is present.  This is useful for devices that use IMEM
> > instead of PON register to pass reboot mode, but still want to populate
> > pwrkey and resin devices.
> > 
> 
> If IMEM is used instead, I think it should be sufficient for the DT
> author to omit mode-* properties to achieve this.

Indeed!  This is much better solution.  Thanks for the suggestion!

So please disregard patch #2 and #3, and I will resend #1 as a separate
patch.

Shawn

> If the PON hardware
> doesn't support mode-*, then that should be reflected in the DT binding
> and compatible.
diff mbox series

Patch

diff --git a/drivers/power/reset/qcom-pon.c b/drivers/power/reset/qcom-pon.c
index 4a688741a88a..85fae9e85878 100644
--- a/drivers/power/reset/qcom-pon.c
+++ b/drivers/power/reset/qcom-pon.c
@@ -47,6 +47,14 @@  static int pm8916_pon_probe(struct platform_device *pdev)
 	struct pm8916_pon *pon;
 	int error;
 
+	if (device_property_present(&pdev->dev, "qcom,pon-reboot-not-used")) {
+		/*
+		 * Skip reboot-mode setup and registration if PON is not used
+		 * for passing reboot mode at all.
+		 */
+		goto done;
+	}
+
 	pon = devm_kzalloc(&pdev->dev, sizeof(*pon), GFP_KERNEL);
 	if (!pon)
 		return -ENOMEM;
@@ -75,6 +83,7 @@  static int pm8916_pon_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, pon);
 
+done:
 	return devm_of_platform_populate(&pdev->dev);
 }