devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Add 'qcom,mode-in-imem' support in PON driver
@ 2021-07-04  7:40 Shawn Guo
  2021-07-04  7:40 ` [PATCH 1/3] dt-bindings: power: reset: Convert qcom,pon to DT schema Shawn Guo
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Shawn Guo @ 2021-07-04  7:40 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Rob Herring, Vinod Koul, Bjorn Andersson, devicetree,
	linux-arm-msm, linux-pm, Shawn Guo

It's not always the case that reboot mode value gets stored in PON
register.  For example, Sony Xperia M4 Aqua phone (MSM8939) uses a
different set of mode values and stores them in IMEM.  Add property
'qcom,mode-in-imem' to distinguish this mechanism from the existing
one.

Shawn Guo (3):
  dt-bindings: power: reset: Convert qcom,pon to DT schema
  dt-bindings: qcom,pon: Add 'qcom,mode-in-imem' support
  power: reset: qcom-pon: Add support for 'qcom,mode-in-imem'

 .../bindings/power/reset/qcom,pon.txt         | 49 -------------
 .../bindings/power/reset/qcom,pon.yaml        | 68 +++++++++++++++++++
 drivers/power/reset/qcom-pon.c                | 25 ++++++-
 3 files changed, 92 insertions(+), 50 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/power/reset/qcom,pon.txt
 create mode 100644 Documentation/devicetree/bindings/power/reset/qcom,pon.yaml

-- 
2.17.1


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

* [PATCH 1/3] dt-bindings: power: reset: Convert qcom,pon to DT schema
  2021-07-04  7:40 [PATCH 0/3] Add 'qcom,mode-in-imem' support in PON driver Shawn Guo
@ 2021-07-04  7:40 ` Shawn Guo
  2021-07-04  7:40 ` [PATCH 2/3] dt-bindings: qcom,pon: Add 'qcom,mode-in-imem' support Shawn Guo
  2021-07-04  7:40 ` [PATCH 3/3] power: reset: qcom-pon: Add support for 'qcom,mode-in-imem' Shawn Guo
  2 siblings, 0 replies; 9+ messages in thread
From: Shawn Guo @ 2021-07-04  7:40 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Rob Herring, Vinod Koul, Bjorn Andersson, devicetree,
	linux-arm-msm, linux-pm, Shawn Guo

It converts qcom,pon DT bindings from legacy bare text to YAML format.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 .../bindings/power/reset/qcom,pon.txt         | 49 -------------------
 .../bindings/power/reset/qcom,pon.yaml        | 49 +++++++++++++++++++
 2 files changed, 49 insertions(+), 49 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/power/reset/qcom,pon.txt
 create mode 100644 Documentation/devicetree/bindings/power/reset/qcom,pon.yaml

diff --git a/Documentation/devicetree/bindings/power/reset/qcom,pon.txt b/Documentation/devicetree/bindings/power/reset/qcom,pon.txt
deleted file mode 100644
index 0c0dc3a1e693..000000000000
--- a/Documentation/devicetree/bindings/power/reset/qcom,pon.txt
+++ /dev/null
@@ -1,49 +0,0 @@
-Qualcomm PON Device
-
-The Power On device for Qualcomm PM8xxx is MFD supporting pwrkey
-and resin along with the Android reboot-mode.
-
-This DT node has pwrkey and resin as sub nodes.
-
-Required Properties:
--compatible: Must be one of:
-	"qcom,pm8916-pon"
-	"qcom,pms405-pon"
-	"qcom,pm8998-pon"
-
--reg: Specifies the physical address of the pon register
-
-Optional subnode:
--pwrkey: Specifies the subnode pwrkey and should follow the
- qcom,pm8941-pwrkey.txt description.
--resin: Specifies the subnode resin and should follow the
- qcom,pm8xxx-pwrkey.txt description.
-
-The rest of the properties should follow the generic reboot-mode description
-found in reboot-mode.txt
-
-Example:
-
-	pon@800 {
-		compatible = "qcom,pm8916-pon";
-
-		reg = <0x800>;
-		mode-bootloader = <0x2>;
-		mode-recovery = <0x1>;
-
-		pwrkey {
-			compatible = "qcom,pm8941-pwrkey";
-			interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>;
-			debounce = <15625>;
-			bias-pull-up;
-			linux,code = <KEY_POWER>;
-		};
-
-		resin {
-			compatible = "qcom,pm8941-resin";
-			interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_BOTH>;
-			debounce = <15625>;
-			bias-pull-up;
-			linux,code = <KEY_VOLUMEDOWN>;
-		};
-	};
diff --git a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
new file mode 100644
index 000000000000..7764c804af1d
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
@@ -0,0 +1,49 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/reset/qcom,pon.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm PON Device
+
+maintainers:
+  - Vinod Koul <vkoul@kernel.org>
+
+description: |
+  The Power On device for Qualcomm PM8xxx is MFD supporting pwrkey
+  and resin along with the Android reboot-mode.
+
+properties:
+  compatible:
+    enum:
+      - qcom,pm8916-pon
+      - qcom,pms405-pon
+      - qcom,pm8998-pon
+
+  reg:
+    maxItems: 1
+
+patternProperties:
+  "^mode-.+":
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Vendor-specific mode value written to the mode register
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    pmic {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        pon@800 {
+            compatible = "qcom,pm8916-pon";
+            reg = <0x800>;
+            mode-bootloader = <0x2>;
+            mode-recovery = <0x1>;
+        };
+    };
-- 
2.17.1


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

* [PATCH 2/3] dt-bindings: qcom,pon: Add 'qcom,mode-in-imem' support
  2021-07-04  7:40 [PATCH 0/3] Add 'qcom,mode-in-imem' support in PON driver Shawn Guo
  2021-07-04  7:40 ` [PATCH 1/3] dt-bindings: power: reset: Convert qcom,pon to DT schema Shawn Guo
@ 2021-07-04  7:40 ` Shawn Guo
  2021-07-04  9:36   ` Stephan Gerhold
  2021-07-04  7:40 ` [PATCH 3/3] power: reset: qcom-pon: Add support for 'qcom,mode-in-imem' Shawn Guo
  2 siblings, 1 reply; 9+ messages in thread
From: Shawn Guo @ 2021-07-04  7:40 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Rob Herring, Vinod Koul, Bjorn Andersson, devicetree,
	linux-arm-msm, linux-pm, Shawn Guo

It's not always the case that reboot mode value gets stored in PON
register.  For example, Sony Xperia M4 Aqua phone (MSM8939) uses a
different set of mode value and stores them in IMEM.  Add property
'qcom,mode-in-imem' to distinguish this mechanism from the existing one.

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

diff --git a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
index 7764c804af1d..a6270e39b7a2 100644
--- a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
+++ b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
@@ -23,6 +23,10 @@ properties:
   reg:
     maxItems: 1
 
+  qcom,mode-in-imem:
+    description: Reboot mode is stored in IMEM rather than PON register
+    type: boolean
+
 patternProperties:
   "^mode-.+":
     $ref: /schemas/types.yaml#/definitions/uint32
@@ -35,6 +39,7 @@ required:
 additionalProperties: false
 
 examples:
+  # Example 1: Reboot mode is stored in PON register
   - |
     pmic {
         #address-cells = <1>;
@@ -47,3 +52,17 @@ examples:
             mode-recovery = <0x1>;
         };
     };
+  # Example 2: Reboot mode is stored in IMEM
+  - |
+    pmic {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        pon@800 {
+            compatible = "qcom,pm8916-pon";
+            reg = <0x860065c>;
+            qcom,mode-in-imem;
+            mode-bootloader = <0x77665500>;
+            mode-recovery = <0x77665502>;
+        };
+    };
-- 
2.17.1


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

* [PATCH 3/3] power: reset: qcom-pon: Add support for 'qcom,mode-in-imem'
  2021-07-04  7:40 [PATCH 0/3] Add 'qcom,mode-in-imem' support in PON driver Shawn Guo
  2021-07-04  7:40 ` [PATCH 1/3] dt-bindings: power: reset: Convert qcom,pon to DT schema Shawn Guo
  2021-07-04  7:40 ` [PATCH 2/3] dt-bindings: qcom,pon: Add 'qcom,mode-in-imem' support Shawn Guo
@ 2021-07-04  7:40 ` Shawn Guo
  2 siblings, 0 replies; 9+ messages in thread
From: Shawn Guo @ 2021-07-04  7:40 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Rob Herring, Vinod Koul, Bjorn Andersson, devicetree,
	linux-arm-msm, linux-pm, Shawn Guo

Add support for DT property 'qcom,mode-in-imem', which is used on
devices like Sony Xperia M4 Aqua phone (MSM8939) to store a different
set of mode values IMEM rather than PON register.

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

diff --git a/drivers/power/reset/qcom-pon.c b/drivers/power/reset/qcom-pon.c
index 4a688741a88a..f63d49c72f55 100644
--- a/drivers/power/reset/qcom-pon.c
+++ b/drivers/power/reset/qcom-pon.c
@@ -42,6 +42,24 @@ static int pm8916_reboot_mode_write(struct reboot_mode_driver *reboot,
 	return ret;
 }
 
+static int pm8916_reboot_mode_write_imem(struct reboot_mode_driver *reboot,
+					 unsigned int magic)
+{
+	struct pm8916_pon *pon = container_of(reboot, struct pm8916_pon,
+					      reboot_mode);
+	void __iomem *imem;
+
+	imem = devm_ioremap(pon->dev, pon->baseaddr, 4);
+	if (!imem) {
+		dev_err(pon->dev, "failed to map imem\n");
+		return -ENOMEM;
+	}
+
+	writel(magic, imem);
+
+	return 0;
+}
+
 static int pm8916_pon_probe(struct platform_device *pdev)
 {
 	struct pm8916_pon *pon;
@@ -66,7 +84,12 @@ static int pm8916_pon_probe(struct platform_device *pdev)
 
 	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;
+
+	if (device_property_present(&pdev->dev, "qcom,mode-in-imem"))
+		pon->reboot_mode.write = pm8916_reboot_mode_write_imem;
+	else
+		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");
-- 
2.17.1


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

* Re: [PATCH 2/3] dt-bindings: qcom,pon: Add 'qcom,mode-in-imem' support
  2021-07-04  7:40 ` [PATCH 2/3] dt-bindings: qcom,pon: Add 'qcom,mode-in-imem' support Shawn Guo
@ 2021-07-04  9:36   ` Stephan Gerhold
  2021-07-05  2:41     ` Shawn Guo
  0 siblings, 1 reply; 9+ messages in thread
From: Stephan Gerhold @ 2021-07-04  9:36 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Sebastian Reichel, Rob Herring, Vinod Koul, Bjorn Andersson,
	devicetree, linux-arm-msm, linux-pm

On Sun, Jul 04, 2021 at 03:40:44PM +0800, Shawn Guo wrote:
> It's not always the case that reboot mode value gets stored in PON
> register.  For example, Sony Xperia M4 Aqua phone (MSM8939) uses a
> different set of mode value and stores them in IMEM.  Add property
> 'qcom,mode-in-imem' to distinguish this mechanism from the existing one.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> ---
>  .../bindings/power/reset/qcom,pon.yaml        | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
> index 7764c804af1d..a6270e39b7a2 100644
> --- a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
> +++ b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
> @@ -23,6 +23,10 @@ properties:
>    reg:
>      maxItems: 1
>  
> +  qcom,mode-in-imem:
> +    description: Reboot mode is stored in IMEM rather than PON register
> +    type: boolean
> +
>  patternProperties:
>    "^mode-.+":
>      $ref: /schemas/types.yaml#/definitions/uint32
> @@ -35,6 +39,7 @@ required:
>  additionalProperties: false
>  
>  examples:
> +  # Example 1: Reboot mode is stored in PON register
>    - |
>      pmic {
>          #address-cells = <1>;
> @@ -47,3 +52,17 @@ examples:
>              mode-recovery = <0x1>;
>          };
>      };
> +  # Example 2: Reboot mode is stored in IMEM
> +  - |
> +    pmic {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        pon@800 {
> +            compatible = "qcom,pm8916-pon";
> +            reg = <0x860065c>;

This is quite strange. pon@800 is a node of the PM8916 PMIC,
so the reg should refer to the address inside the PMIC, not some memory
address of the SoC. dtc will probably warn about this too since the unit
address (@800) should match the first reg. (At least on W=1.)

Actually we already have some devices using IMEM for the reboot mode,
like this (qcom-msm8974.dtsi plus qcom-msm8974-fairphone-fp2.dts):

	imem@fe805000 {
		compatible = "syscon", "simple-mfd";
		reg = <0xfe805000 0x1000>;

		reboot-mode {
			compatible = "syscon-reboot-mode";
			offset = <0x65c>;
			mode-normal	= <0x77665501>;
			mode-bootloader	= <0x77665500>;
			mode-recovery	= <0x77665502>;
		};
	};

Perhaps it would be cleaner to add a property to disable the reboot mode
functionality of pm8916-pon and then set it up like this?

Thanks!
Stephan

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

* Re: [PATCH 2/3] dt-bindings: qcom,pon: Add 'qcom,mode-in-imem' support
  2021-07-04  9:36   ` Stephan Gerhold
@ 2021-07-05  2:41     ` Shawn Guo
  0 siblings, 0 replies; 9+ messages in thread
From: Shawn Guo @ 2021-07-05  2:41 UTC (permalink / raw)
  To: Stephan Gerhold
  Cc: Sebastian Reichel, Rob Herring, Vinod Koul, Bjorn Andersson,
	devicetree, linux-arm-msm, linux-pm

On Sun, Jul 04, 2021 at 11:36:41AM +0200, Stephan Gerhold wrote:
> On Sun, Jul 04, 2021 at 03:40:44PM +0800, Shawn Guo wrote:
> > It's not always the case that reboot mode value gets stored in PON
> > register.  For example, Sony Xperia M4 Aqua phone (MSM8939) uses a
> > different set of mode value and stores them in IMEM.  Add property
> > 'qcom,mode-in-imem' to distinguish this mechanism from the existing one.
> > 
> > Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> > ---
> >  .../bindings/power/reset/qcom,pon.yaml        | 19 +++++++++++++++++++
> >  1 file changed, 19 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
> > index 7764c804af1d..a6270e39b7a2 100644
> > --- a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
> > +++ b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
> > @@ -23,6 +23,10 @@ properties:
> >    reg:
> >      maxItems: 1
> >  
> > +  qcom,mode-in-imem:
> > +    description: Reboot mode is stored in IMEM rather than PON register
> > +    type: boolean
> > +
> >  patternProperties:
> >    "^mode-.+":
> >      $ref: /schemas/types.yaml#/definitions/uint32
> > @@ -35,6 +39,7 @@ required:
> >  additionalProperties: false
> >  
> >  examples:
> > +  # Example 1: Reboot mode is stored in PON register
> >    - |
> >      pmic {
> >          #address-cells = <1>;
> > @@ -47,3 +52,17 @@ examples:
> >              mode-recovery = <0x1>;
> >          };
> >      };
> > +  # Example 2: Reboot mode is stored in IMEM
> > +  - |
> > +    pmic {
> > +        #address-cells = <1>;
> > +        #size-cells = <0>;
> > +
> > +        pon@800 {
> > +            compatible = "qcom,pm8916-pon";
> > +            reg = <0x860065c>;
> 
> This is quite strange. pon@800 is a node of the PM8916 PMIC,
> so the reg should refer to the address inside the PMIC, not some memory
> address of the SoC. dtc will probably warn about this too since the unit
> address (@800) should match the first reg. (At least on W=1.)

Fair point.

> Actually we already have some devices using IMEM for the reboot mode,
> like this (qcom-msm8974.dtsi plus qcom-msm8974-fairphone-fp2.dts):
> 
> 	imem@fe805000 {
> 		compatible = "syscon", "simple-mfd";
> 		reg = <0xfe805000 0x1000>;
> 
> 		reboot-mode {
> 			compatible = "syscon-reboot-mode";
> 			offset = <0x65c>;
> 			mode-normal	= <0x77665501>;
> 			mode-bootloader	= <0x77665500>;
> 			mode-recovery	= <0x77665502>;
> 		};
> 	};
> 
> Perhaps it would be cleaner to add a property to disable the reboot mode
> functionality of pm8916-pon and then set it up like this?

Ah, yes, this is sensible.  Thanks for the msm8974 example!

Shawn

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

* Re: [PATCH 1/3] dt-bindings: power: reset: Convert qcom,pon to DT schema
  2021-07-12 15:45   ` Rob Herring
@ 2021-07-14 11:47     ` Shawn Guo
  0 siblings, 0 replies; 9+ messages in thread
From: Shawn Guo @ 2021-07-14 11:47 UTC (permalink / raw)
  To: Rob Herring
  Cc: Sebastian Reichel, Stephan Gerhold, Vinod Koul, Bjorn Andersson,
	devicetree, linux-arm-msm, linux-pm

On Mon, Jul 12, 2021 at 09:45:21AM -0600, Rob Herring wrote:
> On Mon, Jul 05, 2021 at 10:50:30AM +0800, Shawn Guo wrote:
> > It converts qcom,pon DT bindings from legacy bare text to YAML format.
> > 
> > Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> > ---
> >  .../bindings/power/reset/qcom,pon.txt         | 49 -------------------
> >  .../bindings/power/reset/qcom,pon.yaml        | 49 +++++++++++++++++++
> >  2 files changed, 49 insertions(+), 49 deletions(-)
> >  delete mode 100644 Documentation/devicetree/bindings/power/reset/qcom,pon.txt
> >  create mode 100644 Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
> > 
> > diff --git a/Documentation/devicetree/bindings/power/reset/qcom,pon.txt b/Documentation/devicetree/bindings/power/reset/qcom,pon.txt
> > deleted file mode 100644
> > index 0c0dc3a1e693..000000000000
> > --- a/Documentation/devicetree/bindings/power/reset/qcom,pon.txt
> > +++ /dev/null
> > @@ -1,49 +0,0 @@
> > -Qualcomm PON Device
> > -
> > -The Power On device for Qualcomm PM8xxx is MFD supporting pwrkey
> > -and resin along with the Android reboot-mode.
> > -
> > -This DT node has pwrkey and resin as sub nodes.
> > -
> > -Required Properties:
> > --compatible: Must be one of:
> > -	"qcom,pm8916-pon"
> > -	"qcom,pms405-pon"
> > -	"qcom,pm8998-pon"
> > -
> > --reg: Specifies the physical address of the pon register
> > -
> > -Optional subnode:
> > --pwrkey: Specifies the subnode pwrkey and should follow the
> > - qcom,pm8941-pwrkey.txt description.
> > --resin: Specifies the subnode resin and should follow the
> > - qcom,pm8xxx-pwrkey.txt description.
> > -
> > -The rest of the properties should follow the generic reboot-mode description
> > -found in reboot-mode.txt
> > -
> > -Example:
> > -
> > -	pon@800 {
> > -		compatible = "qcom,pm8916-pon";
> > -
> > -		reg = <0x800>;
> > -		mode-bootloader = <0x2>;
> > -		mode-recovery = <0x1>;
> > -
> > -		pwrkey {
> > -			compatible = "qcom,pm8941-pwrkey";
> > -			interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>;
> > -			debounce = <15625>;
> > -			bias-pull-up;
> > -			linux,code = <KEY_POWER>;
> > -		};
> > -
> > -		resin {
> > -			compatible = "qcom,pm8941-resin";
> > -			interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_BOTH>;
> > -			debounce = <15625>;
> > -			bias-pull-up;
> > -			linux,code = <KEY_VOLUMEDOWN>;
> > -		};
> > -	};
> > diff --git a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
> > new file mode 100644
> > index 000000000000..7764c804af1d
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
> > @@ -0,0 +1,49 @@
> > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/power/reset/qcom,pon.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Qualcomm PON Device
> > +
> > +maintainers:
> > +  - Vinod Koul <vkoul@kernel.org>
> > +
> > +description: |
> > +  The Power On device for Qualcomm PM8xxx is MFD supporting pwrkey
> > +  and resin along with the Android reboot-mode.
> 
> allOf:
>   - $ref: /schemas/power/reset/reboot-mode.yaml#
> 
> And then...
> 
> > +
> > +properties:
> > +  compatible:
> > +    enum:
> > +      - qcom,pm8916-pon
> > +      - qcom,pms405-pon
> > +      - qcom,pm8998-pon
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +patternProperties:
> > +  "^mode-.+":
> > +    $ref: /schemas/types.yaml#/definitions/uint32
> > +    description: Vendor-specific mode value written to the mode register
> 
> Drop this.

Drop the description line only or the whole "^mode-.+" block?  I got the
following from dt_binding_check if dropping the whole block.

 pon@800: 'compatible', 'reg' do not match any of the regexes: '^mode-.*$', 'pinctrl-[0-9]+'

> 
> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +
> > +additionalProperties: false
> 
> unevaluatedProperties: false

Replace additionalProperties with unevaluatedProperties, right?

Shawn

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

* Re: [PATCH 1/3] dt-bindings: power: reset: Convert qcom,pon to DT schema
  2021-07-05  2:50 ` [PATCH 1/3] dt-bindings: power: reset: Convert qcom,pon to DT schema Shawn Guo
@ 2021-07-12 15:45   ` Rob Herring
  2021-07-14 11:47     ` Shawn Guo
  0 siblings, 1 reply; 9+ messages in thread
From: Rob Herring @ 2021-07-12 15:45 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Sebastian Reichel, Stephan Gerhold, Vinod Koul, Bjorn Andersson,
	devicetree, linux-arm-msm, linux-pm

On Mon, Jul 05, 2021 at 10:50:30AM +0800, Shawn Guo wrote:
> It converts qcom,pon DT bindings from legacy bare text to YAML format.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> ---
>  .../bindings/power/reset/qcom,pon.txt         | 49 -------------------
>  .../bindings/power/reset/qcom,pon.yaml        | 49 +++++++++++++++++++
>  2 files changed, 49 insertions(+), 49 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/power/reset/qcom,pon.txt
>  create mode 100644 Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
> 
> diff --git a/Documentation/devicetree/bindings/power/reset/qcom,pon.txt b/Documentation/devicetree/bindings/power/reset/qcom,pon.txt
> deleted file mode 100644
> index 0c0dc3a1e693..000000000000
> --- a/Documentation/devicetree/bindings/power/reset/qcom,pon.txt
> +++ /dev/null
> @@ -1,49 +0,0 @@
> -Qualcomm PON Device
> -
> -The Power On device for Qualcomm PM8xxx is MFD supporting pwrkey
> -and resin along with the Android reboot-mode.
> -
> -This DT node has pwrkey and resin as sub nodes.
> -
> -Required Properties:
> --compatible: Must be one of:
> -	"qcom,pm8916-pon"
> -	"qcom,pms405-pon"
> -	"qcom,pm8998-pon"
> -
> --reg: Specifies the physical address of the pon register
> -
> -Optional subnode:
> --pwrkey: Specifies the subnode pwrkey and should follow the
> - qcom,pm8941-pwrkey.txt description.
> --resin: Specifies the subnode resin and should follow the
> - qcom,pm8xxx-pwrkey.txt description.
> -
> -The rest of the properties should follow the generic reboot-mode description
> -found in reboot-mode.txt
> -
> -Example:
> -
> -	pon@800 {
> -		compatible = "qcom,pm8916-pon";
> -
> -		reg = <0x800>;
> -		mode-bootloader = <0x2>;
> -		mode-recovery = <0x1>;
> -
> -		pwrkey {
> -			compatible = "qcom,pm8941-pwrkey";
> -			interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>;
> -			debounce = <15625>;
> -			bias-pull-up;
> -			linux,code = <KEY_POWER>;
> -		};
> -
> -		resin {
> -			compatible = "qcom,pm8941-resin";
> -			interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_BOTH>;
> -			debounce = <15625>;
> -			bias-pull-up;
> -			linux,code = <KEY_VOLUMEDOWN>;
> -		};
> -	};
> diff --git a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
> new file mode 100644
> index 000000000000..7764c804af1d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
> @@ -0,0 +1,49 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/power/reset/qcom,pon.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Qualcomm PON Device
> +
> +maintainers:
> +  - Vinod Koul <vkoul@kernel.org>
> +
> +description: |
> +  The Power On device for Qualcomm PM8xxx is MFD supporting pwrkey
> +  and resin along with the Android reboot-mode.

allOf:
  - $ref: /schemas/power/reset/reboot-mode.yaml#

And then...

> +
> +properties:
> +  compatible:
> +    enum:
> +      - qcom,pm8916-pon
> +      - qcom,pms405-pon
> +      - qcom,pm8998-pon
> +
> +  reg:
> +    maxItems: 1
> +
> +patternProperties:
> +  "^mode-.+":
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description: Vendor-specific mode value written to the mode register

Drop this.

> +
> +required:
> +  - compatible
> +  - reg
> +
> +additionalProperties: false

unevaluatedProperties: false

> +
> +examples:
> +  - |
> +    pmic {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        pon@800 {
> +            compatible = "qcom,pm8916-pon";
> +            reg = <0x800>;
> +            mode-bootloader = <0x2>;
> +            mode-recovery = <0x1>;
> +        };
> +    };
> -- 
> 2.17.1
> 
> 

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

* [PATCH 1/3] dt-bindings: power: reset: Convert qcom,pon to DT schema
  2021-07-05  2:50 [PATCH 0/3] Add 'qcom,pon-reboot-not-used' support in PON driver Shawn Guo
@ 2021-07-05  2:50 ` Shawn Guo
  2021-07-12 15:45   ` Rob Herring
  0 siblings, 1 reply; 9+ messages in thread
From: Shawn Guo @ 2021-07-05  2:50 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Stephan Gerhold, Rob Herring, Vinod Koul, Bjorn Andersson,
	devicetree, linux-arm-msm, linux-pm, Shawn Guo

It converts qcom,pon DT bindings from legacy bare text to YAML format.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 .../bindings/power/reset/qcom,pon.txt         | 49 -------------------
 .../bindings/power/reset/qcom,pon.yaml        | 49 +++++++++++++++++++
 2 files changed, 49 insertions(+), 49 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/power/reset/qcom,pon.txt
 create mode 100644 Documentation/devicetree/bindings/power/reset/qcom,pon.yaml

diff --git a/Documentation/devicetree/bindings/power/reset/qcom,pon.txt b/Documentation/devicetree/bindings/power/reset/qcom,pon.txt
deleted file mode 100644
index 0c0dc3a1e693..000000000000
--- a/Documentation/devicetree/bindings/power/reset/qcom,pon.txt
+++ /dev/null
@@ -1,49 +0,0 @@
-Qualcomm PON Device
-
-The Power On device for Qualcomm PM8xxx is MFD supporting pwrkey
-and resin along with the Android reboot-mode.
-
-This DT node has pwrkey and resin as sub nodes.
-
-Required Properties:
--compatible: Must be one of:
-	"qcom,pm8916-pon"
-	"qcom,pms405-pon"
-	"qcom,pm8998-pon"
-
--reg: Specifies the physical address of the pon register
-
-Optional subnode:
--pwrkey: Specifies the subnode pwrkey and should follow the
- qcom,pm8941-pwrkey.txt description.
--resin: Specifies the subnode resin and should follow the
- qcom,pm8xxx-pwrkey.txt description.
-
-The rest of the properties should follow the generic reboot-mode description
-found in reboot-mode.txt
-
-Example:
-
-	pon@800 {
-		compatible = "qcom,pm8916-pon";
-
-		reg = <0x800>;
-		mode-bootloader = <0x2>;
-		mode-recovery = <0x1>;
-
-		pwrkey {
-			compatible = "qcom,pm8941-pwrkey";
-			interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>;
-			debounce = <15625>;
-			bias-pull-up;
-			linux,code = <KEY_POWER>;
-		};
-
-		resin {
-			compatible = "qcom,pm8941-resin";
-			interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_BOTH>;
-			debounce = <15625>;
-			bias-pull-up;
-			linux,code = <KEY_VOLUMEDOWN>;
-		};
-	};
diff --git a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
new file mode 100644
index 000000000000..7764c804af1d
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
@@ -0,0 +1,49 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/reset/qcom,pon.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm PON Device
+
+maintainers:
+  - Vinod Koul <vkoul@kernel.org>
+
+description: |
+  The Power On device for Qualcomm PM8xxx is MFD supporting pwrkey
+  and resin along with the Android reboot-mode.
+
+properties:
+  compatible:
+    enum:
+      - qcom,pm8916-pon
+      - qcom,pms405-pon
+      - qcom,pm8998-pon
+
+  reg:
+    maxItems: 1
+
+patternProperties:
+  "^mode-.+":
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Vendor-specific mode value written to the mode register
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    pmic {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        pon@800 {
+            compatible = "qcom,pm8916-pon";
+            reg = <0x800>;
+            mode-bootloader = <0x2>;
+            mode-recovery = <0x1>;
+        };
+    };
-- 
2.17.1


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

end of thread, other threads:[~2021-07-14 11:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-04  7:40 [PATCH 0/3] Add 'qcom,mode-in-imem' support in PON driver Shawn Guo
2021-07-04  7:40 ` [PATCH 1/3] dt-bindings: power: reset: Convert qcom,pon to DT schema Shawn Guo
2021-07-04  7:40 ` [PATCH 2/3] dt-bindings: qcom,pon: Add 'qcom,mode-in-imem' support Shawn Guo
2021-07-04  9:36   ` Stephan Gerhold
2021-07-05  2:41     ` Shawn Guo
2021-07-04  7:40 ` [PATCH 3/3] power: reset: qcom-pon: Add support for 'qcom,mode-in-imem' Shawn Guo
2021-07-05  2:50 [PATCH 0/3] Add 'qcom,pon-reboot-not-used' support in PON driver Shawn Guo
2021-07-05  2:50 ` [PATCH 1/3] dt-bindings: power: reset: Convert qcom,pon to DT schema Shawn Guo
2021-07-12 15:45   ` Rob Herring
2021-07-14 11:47     ` Shawn Guo

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).