diff mbox series

[v2] dt-bindings: soc: bcm: Convert raspberrypi,bcm2835-power to Dt schema

Message ID 20241022-raspberrypi-bcm2835-power-v2-1-1a4a8a8a5737@gmail.com (mailing list archive)
State New, archived
Headers show
Series [v2] dt-bindings: soc: bcm: Convert raspberrypi,bcm2835-power to Dt schema | expand

Commit Message

Karan Sanghavi Oct. 22, 2024, 6:17 p.m. UTC
Convert the raspberrypi,bcm2835-power binding to Dt schema

Signed-off-by: Karan Sanghavi <karansanghvi98@gmail.com>
---
Changes in v2:
- Added original file maintainers
- Removed unnecessary headers from example and formating from description 
- Link to v1: https://lore.kernel.org/r/20241019-raspberrypi-bcm2835-power-v1-1-75e924dc3745@gmail.com
---
 .../bindings/soc/bcm/raspberrypi,bcm2835-power.txt | 47 ----------------------
 .../soc/bcm/raspberrypi,bcm2835-power.yaml         | 42 +++++++++++++++++++
 2 files changed, 42 insertions(+), 47 deletions(-)


---
base-commit: 8e929cb546ee42c9a61d24fae60605e9e3192354
change-id: 20241019-raspberrypi-bcm2835-power-5a4231be8959

Best regards,

Comments

Krzysztof Kozlowski Oct. 23, 2024, 7:12 a.m. UTC | #1
On Tue, Oct 22, 2024 at 06:17:03PM +0000, Karan Sanghavi wrote:
> Convert the raspberrypi,bcm2835-power binding to Dt schema
> 
> Signed-off-by: Karan Sanghavi <karansanghvi98@gmail.com>
> ---
> Changes in v2:
> - Added original file maintainers
> - Removed unnecessary headers from example and formating from description 
> - Link to v1: https://lore.kernel.org/r/20241019-raspberrypi-bcm2835-power-v1-1-75e924dc3745@gmail.com
> ---

> @@ -0,0 +1,42 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/soc/bcm/raspberrypi,bcm2835-power.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Broadcom BCM2835 power domain driver

Drop "driver"

> +
> +maintainers:
> +  - Alexander Aring <alex.aring@gmail.com>
> +  - Eric Anholt <eric@anholt.net>
> +
> +description:
> +  The Raspberry Pi power domain driver manages power for various subsystems

Drop "driver"

> +  in the Raspberry Pi BCM2835 SoC.
> +
> +properties:
> +  compatible:
> +    enum:
> +      - raspberrypi,bcm2835-power
> +
> +  firmware:
> +    $ref: /schemas/types.yaml#/definitions/phandle

phandle to what? Missing description.

> +
> +  '#power-domain-cells':

Use consistent quotes, either ' or ".

> +    const: 1
> +
> +required:
> +  - compatible
> +  - firmware
> +  - "#power-domain-cells"
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    power: power {

Drop label. Node name: power-controller

I don't think this passes tests because of this. See power-domain.yaml
schema.

Best regards,
Krzysztof
Krzysztof Kozlowski Oct. 23, 2024, 7:13 a.m. UTC | #2
On 23/10/2024 09:12, Krzysztof Kozlowski wrote:
> On Tue, Oct 22, 2024 at 06:17:03PM +0000, Karan Sanghavi wrote:
>> Convert the raspberrypi,bcm2835-power binding to Dt schema
>>
>> Signed-off-by: Karan Sanghavi <karansanghvi98@gmail.com>
>> ---
>> Changes in v2:
>> - Added original file maintainers
>> - Removed unnecessary headers from example and formating from description 
>> - Link to v1: https://lore.kernel.org/r/20241019-raspberrypi-bcm2835-power-v1-1-75e924dc3745@gmail.com
>> ---
> 
>> @@ -0,0 +1,42 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/soc/bcm/raspberrypi,bcm2835-power.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#

Ah, and this is of course not part of soc directory, but power, so move
it there.

Best regards,
Krzysztof
Karan Sanghavi Oct. 25, 2024, 6:22 p.m. UTC | #3
On Wed, Oct 23, 2024 at 09:12:53AM +0200, Krzysztof Kozlowski wrote:
> On Tue, Oct 22, 2024 at 06:17:03PM +0000, Karan Sanghavi wrote:
> > Convert the raspberrypi,bcm2835-power binding to Dt schema
> > 
> > Signed-off-by: Karan Sanghavi <karansanghvi98@gmail.com>
> > ---
> > Changes in v2:
> > - Added original file maintainers
> > - Removed unnecessary headers from example and formating from description 
> > - Link to v1: https://lore.kernel.org/r/20241019-raspberrypi-bcm2835-power-v1-1-75e924dc3745@gmail.com
> > ---
> 
> > @@ -0,0 +1,42 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/soc/bcm/raspberrypi,bcm2835-power.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Broadcom BCM2835 power domain driver
> 
> Drop "driver"
> 
> > +
> > +maintainers:
> > +  - Alexander Aring <alex.aring@gmail.com>
> > +  - Eric Anholt <eric@anholt.net>
> > +
> > +description:
> > +  The Raspberry Pi power domain driver manages power for various subsystems
> 
> Drop "driver"
> 
> > +  in the Raspberry Pi BCM2835 SoC.
> > +
> > +properties:
> > +  compatible:
> > +    enum:
> > +      - raspberrypi,bcm2835-power
> > +
> > +  firmware:
> > +    $ref: /schemas/types.yaml#/definitions/phandle
> 
> phandle to what? Missing description.
> 
> > +
> > +  '#power-domain-cells':
> 
> Use consistent quotes, either ' or ".
> 
> > +    const: 1
> > +
> > +required:
> > +  - compatible
> > +  - firmware
> > +  - "#power-domain-cells"
> > +
> > +unevaluatedProperties: false
> > +
> > +examples:
> > +  - |
> > +    power: power {
> 
> Drop label. Node name: power-controller
> 
> I don't think this passes tests because of this. See power-domain.yaml
> schema.
>

Below code is from bcm2711-rpi-4-b.dts decompiled from the dtb file.

firmware {
         compatible = "raspberrypi,bcm2835-firmware\0simple-mfd";
         mboxes = <0x1d>;
         phandle = <0x1e>;
        ...
};

power {
         compatible = "raspberrypi,bcm2835-power";
         firmware = <0x1e>;
         #power-domain-cells = <0x01>;
         phandle = <0x0b>;
};

I had a doubt that as above the raspberrypi,bcm2835-power compatible node
is defined with power keyword, so should I still rename the node as
power-controll or keep it has power?

Also it does passes the dt_binding_check and CHECK_DTBS=y broadcom/bcm2711-rpi-4-b.dtb
but does gives the message as
soc: power: 'ranges' is a required property
so do I need to add the range property here?

> Best regards,
> Krzysztof
>
Krzysztof Kozlowski Oct. 26, 2024, 11:26 a.m. UTC | #4
On 25/10/2024 20:22, Karan Sanghavi wrote:
>>> +
>>> +examples:
>>> +  - |
>>> +    power: power {
>>
>> Drop label. Node name: power-controller
>>
>> I don't think this passes tests because of this. See power-domain.yaml
>> schema.
>>
> 
> Below code is from bcm2711-rpi-4-b.dts decompiled from the dtb file.

Uh? Why would we ever care about decompiling some DTBs?


> 
> firmware {
>          compatible = "raspberrypi,bcm2835-firmware\0simple-mfd";
>          mboxes = <0x1d>;
>          phandle = <0x1e>;
>         ...
> };
> 
> power {
>          compatible = "raspberrypi,bcm2835-power";
>          firmware = <0x1e>;
>          #power-domain-cells = <0x01>;
>          phandle = <0x0b>;
> };
> 
> I had a doubt that as above the raspberrypi,bcm2835-power compatible node
> is defined with power keyword, so should I still rename the node as
> power-controll or keep it has power?

I don't understand your arguments. Schema expects this to have proper
name (see bindings). DT spec as well.

> 
> Also it does passes the dt_binding_check and CHECK_DTBS=y broadcom/bcm2711-rpi-4-b.dtb
> but does gives the message as
> soc: power: 'ranges' is a required property
> so do I need to add the range property here?

I have no clue what you are testing here. We do not care about some out
of tree DTB. And if you ask about upstream, then take conversions tasks
after reading this:

https://social.kernel.org/notice/Ai9hYRUKo8suzX3zNY

BTW, your patch has patch errors which *have to be fixed* as well. Apply
your patch to see them. Run checkpatch.

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/soc/bcm/raspberrypi,bcm2835-power.txt b/Documentation/devicetree/bindings/soc/bcm/raspberrypi,bcm2835-power.txt
deleted file mode 100644
index 30942cf7992b..000000000000
--- a/Documentation/devicetree/bindings/soc/bcm/raspberrypi,bcm2835-power.txt
+++ /dev/null
@@ -1,47 +0,0 @@ 
-Raspberry Pi power domain driver
-
-Required properties:
-
-- compatible:		Should be "raspberrypi,bcm2835-power".
-- firmware:		Reference to the RPi firmware device node.
-- #power-domain-cells:	Should be <1>, we providing multiple power domains.
-
-The valid defines for power domain are:
-
- RPI_POWER_DOMAIN_I2C0
- RPI_POWER_DOMAIN_I2C1
- RPI_POWER_DOMAIN_I2C2
- RPI_POWER_DOMAIN_VIDEO_SCALER
- RPI_POWER_DOMAIN_VPU1
- RPI_POWER_DOMAIN_HDMI
- RPI_POWER_DOMAIN_USB
- RPI_POWER_DOMAIN_VEC
- RPI_POWER_DOMAIN_JPEG
- RPI_POWER_DOMAIN_H264
- RPI_POWER_DOMAIN_V3D
- RPI_POWER_DOMAIN_ISP
- RPI_POWER_DOMAIN_UNICAM0
- RPI_POWER_DOMAIN_UNICAM1
- RPI_POWER_DOMAIN_CCP2RX
- RPI_POWER_DOMAIN_CSI2
- RPI_POWER_DOMAIN_CPI
- RPI_POWER_DOMAIN_DSI0
- RPI_POWER_DOMAIN_DSI1
- RPI_POWER_DOMAIN_TRANSPOSER
- RPI_POWER_DOMAIN_CCP2TX
- RPI_POWER_DOMAIN_CDP
- RPI_POWER_DOMAIN_ARM
-
-Example:
-
-power: power {
-	compatible = "raspberrypi,bcm2835-power";
-	firmware = <&firmware>;
-	#power-domain-cells = <1>;
-};
-
-Example for using power domain:
-
-&usb {
-       power-domains = <&power RPI_POWER_DOMAIN_USB>;
-};
diff --git a/Documentation/devicetree/bindings/soc/bcm/raspberrypi,bcm2835-power.yaml b/Documentation/devicetree/bindings/soc/bcm/raspberrypi,bcm2835-power.yaml
new file mode 100644
index 000000000000..bc4223428bac
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/bcm/raspberrypi,bcm2835-power.yaml
@@ -0,0 +1,42 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/bcm/raspberrypi,bcm2835-power.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom BCM2835 power domain driver
+
+maintainers:
+  - Alexander Aring <alex.aring@gmail.com>
+  - Eric Anholt <eric@anholt.net>
+
+description:
+  The Raspberry Pi power domain driver manages power for various subsystems
+  in the Raspberry Pi BCM2835 SoC.
+
+properties:
+  compatible:
+    enum:
+      - raspberrypi,bcm2835-power
+
+  firmware:
+    $ref: /schemas/types.yaml#/definitions/phandle
+
+  '#power-domain-cells':
+    const: 1
+
+required:
+  - compatible
+  - firmware
+  - "#power-domain-cells"
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    power: power {
+      compatible = "raspberrypi,bcm2835-power";
+      firmware = <&firmware>;
+      #power-domain-cells = <1>;
+    };
+