devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/4] ARM: dts: qcom: apq8074-dragonboard: enable resin device
@ 2023-05-31  1:42 Dmitry Baryshkov
  2023-05-31  1:42 ` [PATCH v3 1/4] dt-bindings: power: reset: qcom-pon: define pm8941-pon Dmitry Baryshkov
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Dmitry Baryshkov @ 2023-05-31  1:42 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Andy Gross, Bjorn Andersson, Konrad Dybcio, Vinod Koul
  Cc: linux-pm, devicetree, linux-arm-msm

Add support for buttons, LEDs and coincell charger found on the APQ8074
dragonboard device.

For PM8941 we don't have a defined field to store the reset reason.
Support wrapping pwrkey and resin, but without writing the reset
reason.

Changes since v2:
- Split non-pon patches to separate patchset
- Changed schema to disallow reboot modes for pm8941-pon (Konrad)

Changes since v1 (noted by Konrad):
 - Changed to use freshly defined qcom,pm8941-pon compat
 - Fixed indentiation for LEDs definition
 - Reverted the order of pinctrl fields
 - Moved status field to the last position
 - Removed unnecessary pinconf indirection

Dmitry Baryshkov (4):
  dt-bindings: power: reset: qcom-pon: define pm8941-pon
  power: reset: qcom-pon: add support for pm8941-pon
  ARM: dts: qcom-pm8941: add resin support
  ARM: dts: qcom: apq8074-dragonboard: add resin

 .../bindings/power/reset/qcom,pon.yaml        | 12 +++++++++-
 .../arm/boot/dts/qcom-apq8074-dragonboard.dts |  5 +++++
 arch/arm/boot/dts/qcom-pm8941.dtsi            | 22 ++++++++++++++-----
 drivers/power/reset/qcom-pon.c                | 22 +++++++++++++------
 4 files changed, 48 insertions(+), 13 deletions(-)

-- 
2.39.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v3 1/4] dt-bindings: power: reset: qcom-pon: define pm8941-pon
  2023-05-31  1:42 [PATCH v3 0/4] ARM: dts: qcom: apq8074-dragonboard: enable resin device Dmitry Baryshkov
@ 2023-05-31  1:42 ` Dmitry Baryshkov
       [not found]   ` <3a0deecb-8235-8cf5-262e-8cb8d2349a4c@linaro.org>
                     ` (2 more replies)
  2023-05-31  1:42 ` [PATCH v3 2/4] power: reset: qcom-pon: add support for pm8941-pon Dmitry Baryshkov
                   ` (2 subsequent siblings)
  3 siblings, 3 replies; 8+ messages in thread
From: Dmitry Baryshkov @ 2023-05-31  1:42 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Andy Gross, Bjorn Andersson, Konrad Dybcio, Vinod Koul
  Cc: linux-pm, devicetree, linux-arm-msm

On PM8941 pon doesn't store the reset reason. However we still need the
wrapping node for pwrkey and resin nodes. Add bindings for pm8941-pon
device.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 .../devicetree/bindings/power/reset/qcom,pon.yaml    | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
index d96170eecbd2..eb3c88e501ef 100644
--- a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
+++ b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
@@ -19,6 +19,7 @@ properties:
   compatible:
     enum:
       - qcom,pm8916-pon
+      - qcom,pm8941-pon
       - qcom,pms405-pon
       - qcom,pm8998-pon
       - qcom,pmk8350-pon
@@ -56,13 +57,22 @@ required:
 unevaluatedProperties: false
 
 allOf:
-  - $ref: reboot-mode.yaml#
+  - if:
+      not:
+        properties:
+          compatible:
+            contains:
+              const: qcom,pm8941-pon
+    then:
+      $ref: reboot-mode.yaml#
+
   - if:
       properties:
         compatible:
           contains:
             enum:
               - qcom,pm8916-pon
+              - qcom,pm8941-pon
               - qcom,pms405-pon
               - qcom,pm8998-pon
     then:
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 2/4] power: reset: qcom-pon: add support for pm8941-pon
  2023-05-31  1:42 [PATCH v3 0/4] ARM: dts: qcom: apq8074-dragonboard: enable resin device Dmitry Baryshkov
  2023-05-31  1:42 ` [PATCH v3 1/4] dt-bindings: power: reset: qcom-pon: define pm8941-pon Dmitry Baryshkov
@ 2023-05-31  1:42 ` Dmitry Baryshkov
  2023-05-31  1:42 ` [PATCH v3 3/4] ARM: dts: qcom-pm8941: add resin support Dmitry Baryshkov
  2023-05-31  1:42 ` [PATCH v3 4/4] ARM: dts: qcom: apq8074-dragonboard: add resin Dmitry Baryshkov
  3 siblings, 0 replies; 8+ messages in thread
From: Dmitry Baryshkov @ 2023-05-31  1:42 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Andy Gross, Bjorn Andersson, Konrad Dybcio, Vinod Koul
  Cc: linux-pm, devicetree, linux-arm-msm

For PM8941 we don't have a defined field to store the reset reason.
Support wrapping pwrkey and resin, but without writing the reset
reason.

Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/power/reset/qcom-pon.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/power/reset/qcom-pon.c b/drivers/power/reset/qcom-pon.c
index ebdcfb28c4a0..1344b361a475 100644
--- a/drivers/power/reset/qcom-pon.c
+++ b/drivers/power/reset/qcom-pon.c
@@ -17,6 +17,8 @@
 #define GEN1_REASON_SHIFT		2
 #define GEN2_REASON_SHIFT		1
 
+#define NO_REASON_SHIFT			0
+
 struct pm8916_pon {
 	struct device *dev;
 	struct regmap *regmap;
@@ -45,6 +47,7 @@ static int pm8916_reboot_mode_write(struct reboot_mode_driver *reboot,
 static int pm8916_pon_probe(struct platform_device *pdev)
 {
 	struct pm8916_pon *pon;
+	long reason_shift;
 	int error;
 
 	pon = devm_kzalloc(&pdev->dev, sizeof(*pon), GFP_KERNEL);
@@ -64,13 +67,17 @@ static int pm8916_pon_probe(struct platform_device *pdev)
 	if (error)
 		return error;
 
-	pon->reboot_mode.dev = &pdev->dev;
-	pon->reason_shift = (long)of_device_get_match_data(&pdev->dev);
-	pon->reboot_mode.write = pm8916_reboot_mode_write;
-	error = devm_reboot_mode_register(&pdev->dev, &pon->reboot_mode);
-	if (error) {
-		dev_err(&pdev->dev, "can't register reboot mode\n");
-		return error;
+	reason_shift = (long)of_device_get_match_data(&pdev->dev);
+
+	if (reason_shift != NO_REASON_SHIFT) {
+		pon->reboot_mode.dev = &pdev->dev;
+		pon->reason_shift = reason_shift;
+		pon->reboot_mode.write = pm8916_reboot_mode_write;
+		error = devm_reboot_mode_register(&pdev->dev, &pon->reboot_mode);
+		if (error) {
+			dev_err(&pdev->dev, "can't register reboot mode\n");
+			return error;
+		}
 	}
 
 	platform_set_drvdata(pdev, pon);
@@ -80,6 +87,7 @@ static int pm8916_pon_probe(struct platform_device *pdev)
 
 static const struct of_device_id pm8916_pon_id_table[] = {
 	{ .compatible = "qcom,pm8916-pon", .data = (void *)GEN1_REASON_SHIFT },
+	{ .compatible = "qcom,pm8941-pon", .data = (void *)NO_REASON_SHIFT },
 	{ .compatible = "qcom,pms405-pon", .data = (void *)GEN1_REASON_SHIFT },
 	{ .compatible = "qcom,pm8998-pon", .data = (void *)GEN2_REASON_SHIFT },
 	{ .compatible = "qcom,pmk8350-pon", .data = (void *)GEN2_REASON_SHIFT },
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 3/4] ARM: dts: qcom-pm8941: add resin support
  2023-05-31  1:42 [PATCH v3 0/4] ARM: dts: qcom: apq8074-dragonboard: enable resin device Dmitry Baryshkov
  2023-05-31  1:42 ` [PATCH v3 1/4] dt-bindings: power: reset: qcom-pon: define pm8941-pon Dmitry Baryshkov
  2023-05-31  1:42 ` [PATCH v3 2/4] power: reset: qcom-pon: add support for pm8941-pon Dmitry Baryshkov
@ 2023-05-31  1:42 ` Dmitry Baryshkov
  2023-05-31  1:42 ` [PATCH v3 4/4] ARM: dts: qcom: apq8074-dragonboard: add resin Dmitry Baryshkov
  3 siblings, 0 replies; 8+ messages in thread
From: Dmitry Baryshkov @ 2023-05-31  1:42 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Andy Gross, Bjorn Andersson, Konrad Dybcio, Vinod Koul
  Cc: linux-pm, devicetree, linux-arm-msm

Wrap existing pwrkey and new resin nodes into the new pon node to enable
volume-down key support on platforms using pm8941 PMIC.

Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 arch/arm/boot/dts/qcom-pm8941.dtsi | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/arch/arm/boot/dts/qcom-pm8941.dtsi b/arch/arm/boot/dts/qcom-pm8941.dtsi
index a821f0368a28..cf1fcf97fa88 100644
--- a/arch/arm/boot/dts/qcom-pm8941.dtsi
+++ b/arch/arm/boot/dts/qcom-pm8941.dtsi
@@ -19,12 +19,24 @@ rtc@6000 {
 			interrupts = <0x0 0x61 0x1 IRQ_TYPE_EDGE_RISING>;
 		};
 
-		pwrkey@800 {
-			compatible = "qcom,pm8941-pwrkey";
+		pon@800 {
+			compatible = "qcom,pm8941-pon";
 			reg = <0x800>;
-			interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>;
-			debounce = <15625>;
-			bias-pull-up;
+
+			pwrkey {
+				compatible = "qcom,pm8941-pwrkey";
+				interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>;
+				debounce = <15625>;
+				bias-pull-up;
+			};
+
+			pm8941_resin: resin {
+				compatible = "qcom,pm8941-resin";
+				interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_BOTH>;
+				debounce = <15625>;
+				bias-pull-up;
+				status = "disabled";
+			};
 		};
 
 		usb_id: usb-detect@900 {
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 4/4] ARM: dts: qcom: apq8074-dragonboard: add resin
  2023-05-31  1:42 [PATCH v3 0/4] ARM: dts: qcom: apq8074-dragonboard: enable resin device Dmitry Baryshkov
                   ` (2 preceding siblings ...)
  2023-05-31  1:42 ` [PATCH v3 3/4] ARM: dts: qcom-pm8941: add resin support Dmitry Baryshkov
@ 2023-05-31  1:42 ` Dmitry Baryshkov
  3 siblings, 0 replies; 8+ messages in thread
From: Dmitry Baryshkov @ 2023-05-31  1:42 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Andy Gross, Bjorn Andersson, Konrad Dybcio, Vinod Koul
  Cc: linux-pm, devicetree, linux-arm-msm

Add device nodes for resin (reset, volume-down) device node.

Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 arch/arm/boot/dts/qcom-apq8074-dragonboard.dts | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts b/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
index 7f759b00524b..ce5eb56a5d1d 100644
--- a/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
+++ b/arch/arm/boot/dts/qcom-apq8074-dragonboard.dts
@@ -148,6 +148,11 @@ led@7 {
 	};
 };
 
+&pm8941_resin {
+	linux,code = <KEY_VOLUMEDOWN>;
+	status = "okay";
+};
+
 &pm8941_wled {
 	qcom,cs-out;
 	qcom,switching-freq = <3200>;
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 1/4] dt-bindings: power: reset: qcom-pon: define pm8941-pon
       [not found]   ` <3a0deecb-8235-8cf5-262e-8cb8d2349a4c@linaro.org>
@ 2023-06-01  0:28     ` Dmitry Baryshkov
  0 siblings, 0 replies; 8+ messages in thread
From: Dmitry Baryshkov @ 2023-06-01  0:28 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Andy Gross, Bjorn Andersson, Konrad Dybcio, Vinod Koul, linux-pm,
	devicetree, linux-arm-msm

On Wed, 31 May 2023 at 21:59, Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
>
> On 31/05/2023 03:42, Dmitry Baryshkov wrote:
> > On PM8941 pon doesn't store the reset reason. However we still need the
> > wrapping node for pwrkey and resin nodes. Add bindings for pm8941-pon
> > device.
> >
> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > ---
> >  .../devicetree/bindings/power/reset/qcom,pon.yaml    | 12 +++++++++++-
> >  1 file changed, 11 insertions(+), 1 deletion(-)
> >
> > diff --git a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
> > index d96170eecbd2..eb3c88e501ef 100644
> > --- a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
> > +++ b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
> > @@ -19,6 +19,7 @@ properties:
> >    compatible:
> >      enum:
> >        - qcom,pm8916-pon
> > +      - qcom,pm8941-pon
> >        - qcom,pms405-pon
> >        - qcom,pm8998-pon
> >        - qcom,pmk8350-pon
> > @@ -56,13 +57,22 @@ required:
> >  unevaluatedProperties: false
> >
> >  allOf:
> > -  - $ref: reboot-mode.yaml#
> > +  - if:
> > +      not:
> > +        properties:
> > +          compatible:
> > +            contains:
> > +              const: qcom,pm8941-pon
> > +    then:
> > +      $ref: reboot-mode.yaml#
>
> Are you sure that this works, so pm8941 does not allow mode-*
> properties? I am afraid they would still be considered evaluated, thus
> your if-not is not effective.

Yes, I checked that they trigger the schema validation error. If you'd
prefer I can extend this 'if' with explicit 'mode-*: false'.


-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 1/4] dt-bindings: power: reset: qcom-pon: define pm8941-pon
  2023-05-31  1:42 ` [PATCH v3 1/4] dt-bindings: power: reset: qcom-pon: define pm8941-pon Dmitry Baryshkov
       [not found]   ` <3a0deecb-8235-8cf5-262e-8cb8d2349a4c@linaro.org>
@ 2023-06-08 15:59   ` Rob Herring
  2023-06-08 21:53   ` Sebastian Reichel
  2 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2023-06-08 15:59 UTC (permalink / raw)
  To: Dmitry Baryshkov
  Cc: devicetree, Rob Herring, Konrad Dybcio, Andy Gross, linux-pm,
	Krzysztof Kozlowski, Bjorn Andersson, Vinod Koul, linux-arm-msm,
	Sebastian Reichel, Conor Dooley


On Wed, 31 May 2023 04:42:45 +0300, Dmitry Baryshkov wrote:
> On PM8941 pon doesn't store the reset reason. However we still need the
> wrapping node for pwrkey and resin nodes. Add bindings for pm8941-pon
> device.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
>  .../devicetree/bindings/power/reset/qcom,pon.yaml    | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 

Acked-by: Rob Herring <robh@kernel.org>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 1/4] dt-bindings: power: reset: qcom-pon: define pm8941-pon
  2023-05-31  1:42 ` [PATCH v3 1/4] dt-bindings: power: reset: qcom-pon: define pm8941-pon Dmitry Baryshkov
       [not found]   ` <3a0deecb-8235-8cf5-262e-8cb8d2349a4c@linaro.org>
  2023-06-08 15:59   ` Rob Herring
@ 2023-06-08 21:53   ` Sebastian Reichel
  2 siblings, 0 replies; 8+ messages in thread
From: Sebastian Reichel @ 2023-06-08 21:53 UTC (permalink / raw)
  To: Dmitry Baryshkov
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Vinod Koul, linux-pm, devicetree,
	linux-arm-msm

[-- Attachment #1: Type: text/plain, Size: 1611 bytes --]

Hi,

On Wed, May 31, 2023 at 04:42:45AM +0300, Dmitry Baryshkov wrote:
> On PM8941 pon doesn't store the reset reason. However we still need the
> wrapping node for pwrkey and resin nodes. Add bindings for pm8941-pon
> device.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---

Does not apply, please rebase.

-- Sebastian

>  .../devicetree/bindings/power/reset/qcom,pon.yaml    | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
> index d96170eecbd2..eb3c88e501ef 100644
> --- a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
> +++ b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
> @@ -19,6 +19,7 @@ properties:
>    compatible:
>      enum:
>        - qcom,pm8916-pon
> +      - qcom,pm8941-pon
>        - qcom,pms405-pon
>        - qcom,pm8998-pon
>        - qcom,pmk8350-pon
> @@ -56,13 +57,22 @@ required:
>  unevaluatedProperties: false
>  
>  allOf:
> -  - $ref: reboot-mode.yaml#
> +  - if:
> +      not:
> +        properties:
> +          compatible:
> +            contains:
> +              const: qcom,pm8941-pon
> +    then:
> +      $ref: reboot-mode.yaml#
> +
>    - if:
>        properties:
>          compatible:
>            contains:
>              enum:
>                - qcom,pm8916-pon
> +              - qcom,pm8941-pon
>                - qcom,pms405-pon
>                - qcom,pm8998-pon
>      then:
> -- 
> 2.39.2
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-06-08 21:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-31  1:42 [PATCH v3 0/4] ARM: dts: qcom: apq8074-dragonboard: enable resin device Dmitry Baryshkov
2023-05-31  1:42 ` [PATCH v3 1/4] dt-bindings: power: reset: qcom-pon: define pm8941-pon Dmitry Baryshkov
     [not found]   ` <3a0deecb-8235-8cf5-262e-8cb8d2349a4c@linaro.org>
2023-06-01  0:28     ` Dmitry Baryshkov
2023-06-08 15:59   ` Rob Herring
2023-06-08 21:53   ` Sebastian Reichel
2023-05-31  1:42 ` [PATCH v3 2/4] power: reset: qcom-pon: add support for pm8941-pon Dmitry Baryshkov
2023-05-31  1:42 ` [PATCH v3 3/4] ARM: dts: qcom-pm8941: add resin support Dmitry Baryshkov
2023-05-31  1:42 ` [PATCH v3 4/4] ARM: dts: qcom: apq8074-dragonboard: add resin Dmitry Baryshkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).