diff mbox series

[V3,4/5] dt-bindings: input: pm8941-pwrkey: Convert pm8941 power key binding to yaml

Message ID 1620630064-16354-5-git-send-email-skakit@codeaurora.org
State New
Headers show
Series Add support for PMK8350 PON_HLOS PMIC peripheral | expand

Commit Message

Satya Priya May 10, 2021, 7:01 a.m. UTC
Convert qcom pm8941 power key binding from .txt to .yaml format.

Signed-off-by: satya priya <skakit@codeaurora.org>
---
Changes in V2:
 - Fixed bot errors, took reference from input.yaml for "linux,code"
 - Added one complete example for powerkey and resin, and referenced it
   in main PON binding.
 - Moved this patch to the end of the series.

Changes in V3:
 - Moved this patch before PON binding patch.
 - As per Rob's comments, added allOf at the beginning of binding.
   Added maxItems for interrupts.
 - Added 'unevaluatedProperties' instead of 'additionalProperties' as
   we are using allOf.
 
 .../bindings/input/qcom,pm8941-pwrkey.txt          | 55 --------------
 .../bindings/input/qcom,pm8941-pwrkey.yaml         | 87 ++++++++++++++++++++++
 2 files changed, 87 insertions(+), 55 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
 create mode 100644 Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml

Comments

Satya Priya May 12, 2021, 4:47 a.m. UTC | #1
On 2021-05-10 21:54, Rob Herring wrote:
> On Mon, May 10, 2021 at 09:01:39AM -0500, Rob Herring wrote:
>> On Mon, 10 May 2021 12:31:03 +0530, satya priya wrote:
>> > Convert qcom pm8941 power key binding from .txt to .yaml format.
>> >
>> > Signed-off-by: satya priya <skakit@codeaurora.org>
>> > ---
>> > Changes in V2:
>> >  - Fixed bot errors, took reference from input.yaml for "linux,code"
>> >  - Added one complete example for powerkey and resin, and referenced it
>> >    in main PON binding.
>> >  - Moved this patch to the end of the series.
>> >
>> > Changes in V3:
>> >  - Moved this patch before PON binding patch.
>> >  - As per Rob's comments, added allOf at the beginning of binding.
>> >    Added maxItems for interrupts.
>> >  - Added 'unevaluatedProperties' instead of 'additionalProperties' as
>> >    we are using allOf.
>> >
>> >  .../bindings/input/qcom,pm8941-pwrkey.txt          | 55 --------------
>> >  .../bindings/input/qcom,pm8941-pwrkey.yaml         | 87 ++++++++++++++++++++++
>> >  2 files changed, 87 insertions(+), 55 deletions(-)
>> >  delete mode 100644 Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
>> >  create mode 100644 Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml
>> >
>> 
>> My bot found errors running 'make DT_CHECKER_FLAGS=-m 
>> dt_binding_check'
>> on your patch (DT_CHECKER_FLAGS is new in v5.13):
>> 
>> yamllint warnings/errors:
>> 
>> dtschema/dtc warnings/errors:
>> Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.example.dt.yaml:0:0: 
>> /example-0/spmi@c440000/pmic@0/pon_hlos@1300: failed to match any 
>> schema with compatible: ['qcom,pm8998-pon']
> 
> You have the same example in patch 5, so drop the example here. That
> will fix this circular dependency.

Earlier I have dropped example from qcom-pon.yaml. Now, I will add the 
example there and drop here.
Dmitry Torokhov June 2, 2021, 4:37 a.m. UTC | #2
On Wed, May 12, 2021 at 10:17:43AM +0530, skakit@codeaurora.org wrote:
> On 2021-05-10 21:54, Rob Herring wrote:
> > On Mon, May 10, 2021 at 09:01:39AM -0500, Rob Herring wrote:
> > > On Mon, 10 May 2021 12:31:03 +0530, satya priya wrote:
> > > > Convert qcom pm8941 power key binding from .txt to .yaml format.
> > > >
> > > > Signed-off-by: satya priya <skakit@codeaurora.org>
> > > > ---
> > > > Changes in V2:
> > > >  - Fixed bot errors, took reference from input.yaml for "linux,code"
> > > >  - Added one complete example for powerkey and resin, and referenced it
> > > >    in main PON binding.
> > > >  - Moved this patch to the end of the series.
> > > >
> > > > Changes in V3:
> > > >  - Moved this patch before PON binding patch.
> > > >  - As per Rob's comments, added allOf at the beginning of binding.
> > > >    Added maxItems for interrupts.
> > > >  - Added 'unevaluatedProperties' instead of 'additionalProperties' as
> > > >    we are using allOf.
> > > >
> > > >  .../bindings/input/qcom,pm8941-pwrkey.txt          | 55 --------------
> > > >  .../bindings/input/qcom,pm8941-pwrkey.yaml         | 87 ++++++++++++++++++++++
> > > >  2 files changed, 87 insertions(+), 55 deletions(-)
> > > >  delete mode 100644 Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
> > > >  create mode 100644 Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml
> > > >
> > > 
> > > My bot found errors running 'make DT_CHECKER_FLAGS=-m
> > > dt_binding_check'
> > > on your patch (DT_CHECKER_FLAGS is new in v5.13):
> > > 
> > > yamllint warnings/errors:
> > > 
> > > dtschema/dtc warnings/errors:
> > > Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.example.dt.yaml:0:0:
> > > /example-0/spmi@c440000/pmic@0/pon_hlos@1300: failed to match any
> > > schema with compatible: ['qcom,pm8998-pon']
> > 
> > You have the same example in patch 5, so drop the example here. That
> > will fix this circular dependency.
> 
> Earlier I have dropped example from qcom-pon.yaml. Now, I will add the
> example there and drop here.

It sounds to me you want to combine patches 4 and 5 since they depend on
each other.

Thanks.
Satya Priya June 2, 2021, 10:31 a.m. UTC | #3
On 2021-06-02 10:07, Dmitry Torokhov wrote:
> On Wed, May 12, 2021 at 10:17:43AM +0530, skakit@codeaurora.org wrote:
>> On 2021-05-10 21:54, Rob Herring wrote:
>> > On Mon, May 10, 2021 at 09:01:39AM -0500, Rob Herring wrote:
>> > > On Mon, 10 May 2021 12:31:03 +0530, satya priya wrote:
>> > > > Convert qcom pm8941 power key binding from .txt to .yaml format.
>> > > >
>> > > > Signed-off-by: satya priya <skakit@codeaurora.org>
>> > > > ---
>> > > > Changes in V2:
>> > > >  - Fixed bot errors, took reference from input.yaml for "linux,code"
>> > > >  - Added one complete example for powerkey and resin, and referenced it
>> > > >    in main PON binding.
>> > > >  - Moved this patch to the end of the series.
>> > > >
>> > > > Changes in V3:
>> > > >  - Moved this patch before PON binding patch.
>> > > >  - As per Rob's comments, added allOf at the beginning of binding.
>> > > >    Added maxItems for interrupts.
>> > > >  - Added 'unevaluatedProperties' instead of 'additionalProperties' as
>> > > >    we are using allOf.
>> > > >
>> > > >  .../bindings/input/qcom,pm8941-pwrkey.txt          | 55 --------------
>> > > >  .../bindings/input/qcom,pm8941-pwrkey.yaml         | 87 ++++++++++++++++++++++
>> > > >  2 files changed, 87 insertions(+), 55 deletions(-)
>> > > >  delete mode 100644 Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
>> > > >  create mode 100644 Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml
>> > > >
>> > >
>> > > My bot found errors running 'make DT_CHECKER_FLAGS=-m
>> > > dt_binding_check'
>> > > on your patch (DT_CHECKER_FLAGS is new in v5.13):
>> > >
>> > > yamllint warnings/errors:
>> > >
>> > > dtschema/dtc warnings/errors:
>> > > Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.example.dt.yaml:0:0:
>> > > /example-0/spmi@c440000/pmic@0/pon_hlos@1300: failed to match any
>> > > schema with compatible: ['qcom,pm8998-pon']
>> >
>> > You have the same example in patch 5, so drop the example here. That
>> > will fix this circular dependency.
>> 
>> Earlier I have dropped example from qcom-pon.yaml. Now, I will add the
>> example there and drop here.
> 
> It sounds to me you want to combine patches 4 and 5 since they depend 
> on
> each other.
> 

No, the idea was to have one complete example, instead of bits. So, 
initially I have removed the example part from qcom-pon.yaml and added 
full example here, but it was causing a circular dependency issue. Rob 
suggested to move it back to qcom-pon.yaml to fix issue.

I have posted V4 making that change.
https://lore.kernel.org/patchwork/patch/1425638/

Thanks,
Satya Priya

> Thanks.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt b/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
deleted file mode 100644
index 6cd08bc..0000000
--- a/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
+++ /dev/null
@@ -1,55 +0,0 @@ 
-Qualcomm PM8941 PMIC Power Key
-
-PROPERTIES
-
-- compatible:
-	Usage: required
-	Value type: <string>
-	Definition: must be one of:
-		    "qcom,pm8941-pwrkey"
-		    "qcom,pm8941-resin"
-		    "qcom,pmk8350-pwrkey"
-		    "qcom,pmk8350-resin"
-
-- reg:
-	Usage: required
-	Value type: <prop-encoded-array>
-	Definition: base address of registers for block
-
-- interrupts:
-	Usage: required
-	Value type: <prop-encoded-array>
-	Definition: key change interrupt; The format of the specifier is
-		    defined by the binding document describing the node's
-		    interrupt parent.
-
-- debounce:
-	Usage: optional
-	Value type: <u32>
-	Definition: time in microseconds that key must be pressed or released
-		    for state change interrupt to trigger.
-
-- bias-pull-up:
-	Usage: optional
-	Value type: <empty>
-	Definition: presence of this property indicates that the KPDPWR_N pin
-		    should be configured for pull up.
-
-- linux,code:
-	Usage: optional
-	Value type: <u32>
-	Definition: The input key-code associated with the power key.
-		    Use the linux event codes defined in
-		    include/dt-bindings/input/linux-event-codes.h
-		    When property is omitted KEY_POWER is assumed.
-
-EXAMPLE
-
-	pwrkey@800 {
-		compatible = "qcom,pm8941-pwrkey";
-		reg = <0x800>;
-		interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>;
-		debounce = <15625>;
-		bias-pull-up;
-		linux,code = <KEY_POWER>;
-	};
diff --git a/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml b/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml
new file mode 100644
index 0000000..0736fa3
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml
@@ -0,0 +1,87 @@ 
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/qcom,pm8941-pwrkey.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm PM8941 PMIC Power Key
+
+maintainers:
+  - Courtney Cavin <courtney.cavin@sonymobile.com>
+  - Vinod Koul <vkoul@kernel.org>
+
+allOf:
+  - $ref: input.yaml#
+
+properties:
+  compatible:
+    enum:
+      - qcom,pm8941-pwrkey
+      - qcom,pm8941-resin
+      - qcom,pmk8350-pwrkey
+      - qcom,pmk8350-resin
+
+  interrupts:
+    maxItems: 1
+
+  debounce:
+    description: |
+          Time in microseconds that key must be pressed or
+          released for state change interrupt to trigger.
+    $ref: /schemas/types.yaml#/definitions/uint32
+
+  bias-pull-up:
+    description: |
+           Presence of this property indicates that the KPDPWR_N
+           pin should be configured for pull up.
+    $ref: /schemas/types.yaml#/definitions/flag
+
+  linux,code:
+    description: |
+           The input key-code associated with the power key.
+           Use the linux event codes defined in
+           include/dt-bindings/input/linux-event-codes.h
+           When property is omitted KEY_POWER is assumed.
+
+required:
+  - compatible
+  - interrupts
+
+unevaluatedProperties: false
+
+examples:
+  - |
+   #include <dt-bindings/interrupt-controller/irq.h>
+   #include <dt-bindings/input/linux-event-codes.h>
+   #include <dt-bindings/spmi/spmi.h>
+   spmi_bus: spmi@c440000 {
+     reg = <0x0c440000 0x1100>;
+     #address-cells = <2>;
+     #size-cells = <0>;
+     pmk8350: pmic@0 {
+       reg = <0x0 SPMI_USID>;
+       #address-cells = <1>;
+       #size-cells = <0>;
+       pmk8350_pon: pon_hlos@1300 {
+         reg = <0x1300>;
+         compatible = "qcom,pm8998-pon";
+
+         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>;
+         };
+       };
+     };
+   };
+...