Skip to contentSkip to conversation

dt-bindings: rockchip: Add support for rk809 audio codec

PATCH Superseded Tim Lunn 4 participants 15 messages Jan 16, 2024 – Jan 17, 2024

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Tim Lunn

author
#0 lore raw

cover dt-bindings: rockchip: Add support for rk809 audio codec

Rockchip RK809 shares the same audio codec as the rk817 mfd, it is also using the same rk817_codec driver. However it is missing from the bindings.

This series documents the audio codec properties in rockchip,rk809.yaml bindings and updates example.

Tim Lunn (3):
dt-bindings: rockchip: Add rk809 support for rk817 audio codec
dt-bindings: rockchip: rk809 fix compatible string in examples
dt-bindings: rockchip: Update rk809 example with audio codec
properties

 .../bindings/mfd/rockchip,rk809.yaml          | 40 +++++++++++++++++--
 1 file changed, 37 insertions(+), 3 deletions(-)
Signature · 1 line
2.40.1
author
#1 lore raw

PATCH 1/3 dt-bindings: rockchip: Add rk809 support for rk817 audio codec

Rockchip RK809 shares the same audio codec as the rk817 mfd, it is also using the same rk817_codec driver. However it is missing from the bindings.

Update dt-binding documentation for rk809 to include the audio codec properties. This fixes the following warning from dtb check:

pmic@20: '#sound-dai-cells', 'assigned-clock-parents', 'assigned-clocks',
'clock-names', 'clocks', 'codec' do not match any of the regexes:
'pinctrl-[0-9]+'

---

 .../bindings/mfd/rockchip,rk809.yaml          | 30 ++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml +29 -1
index 839c0521f1e5..bac2e751e2f2 100644
@@ -12,7 +12,7 @@ maintainers:
 
 description: |
   Rockchip RK809 series PMIC. This device consists of an i2c controlled MFD
-  that includes regulators, an RTC, and power button.
+  that includes regulators, an RTC, a power button, and an audio codec.
 
 properties:
   compatible:
@@ -93,6 +93,34 @@ properties:
         unevaluatedProperties: false
     unevaluatedProperties: false
 
+  clocks:
+    description:
+      The input clock for the audio codec.
+
+  clock-names:
+    description:
+      The clock name for the codec clock.
+    items:
+      - const: mclk
+
+  '#sound-dai-cells':
+    description:
+      Needed for the interpretation of sound dais.
+    const: 0
+
+  codec:
+    description: |
+      The child node for the codec to hold additional properties. If no
+      additional properties are required for the codec, this node can be
+      omitted.
+    type: object
+    additionalProperties: false
+    properties:
+      rockchip,mic-in-differential:
+        type: boolean
+        description:
+          Describes if the microphone uses differential mode.
+
 allOf:
   - if:
       properties:
Signature · 1 line
2.40.1
author
#8 lore raw

PATCH 2/3 dt-bindings: rockchip: rk809 fix compatible string in examples

In reply to Tim Lunn

Fix typo in the example specifying wrong compatible string

---

 Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml +2 -2
index bac2e751e2f2..3f31478932c2 100644
@@ -154,8 +154,8 @@ examples:
         #address-cells = <1>;
         #size-cells = <0>;
 
-        rk808: pmic@1b {
-            compatible = "rockchip,rk808";
+        rk809: pmic@1b {
+            compatible = "rockchip,rk809";
             reg = <0x1b>;
             #clock-cells = <1>;
             clock-output-names = "xin32k", "rk808-clkout2";
Signature · 1 line
2.40.1
author
#13 lore raw

PATCH 3/3 dt-bindings: rockchip: Update rk809 example with audio codec properties

In reply to Tim Lunn

Update the example provided to include the properties for using rk817 audio codec.

---

 Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml | 6 ++++++
 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml +6 -0
index 3f31478932c2..c9c676d0922d 100644
@@ -161,10 +161,13 @@ examples:
             clock-output-names = "xin32k", "rk808-clkout2";
             interrupt-parent = <&gpio3>;
             interrupts = <10 IRQ_TYPE_LEVEL_LOW>;
+            clock-names = "mclk";
+            clocks = <&cru SCLK_I2S1_OUT>;
             pinctrl-names = "default";
             pinctrl-0 = <&pmic_int_l_pin>;
             rockchip,system-power-controller;
             wakeup-source;
+            #sound-dai-cells = <0>;
 
             vcc1-supply = <&vcc_sysin>;
             vcc2-supply = <&vcc_sysin>;
@@ -312,5 +315,8 @@ examples:
                     };
                 };
             };
+            rk817_codec: codec {
+                rockchip,mic-in-differential;
+            };
         };
     };
Signature · 1 line
2.40.1
maintainer
#9 lore raw

Re: [PATCH 2/3] dt-bindings: rockchip: rk809 fix compatible string in examples

In reply to Tim Lunn
Quoted 8 lines · Tim Lunn

Fix typo in the example specifying wrong compatible string

---

 Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/rockchip,rk809.example.dtb: pmic@1b: 'vcc10-supply', 'vcc11-supply', 'vcc12-supply' do not match any of the regexes: 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/mfd/rockchip,rk809.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

maintainer
#14 lore raw

Re: [PATCH 3/3] dt-bindings: rockchip: Update rk809 example with audio codec properties

In reply to Tim Lunn
Quoted 9 lines · Tim Lunn

Update the example provided to include the properties for using rk817 audio codec.

---

 Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml | 6 ++++++
 1 file changed, 6 insertions(+)

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:
Error: Documentation/devicetree/bindings/mfd/rockchip,rk809.example.dts:39.32-33 syntax error FATAL ERROR: Unable to parse input tree
make[2]: *** [scripts/Makefile.lib:419: Documentation/devicetree/bindings/mfd/rockchip,rk809.example.dtb] Error 1 make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/builds/robherring/dt-review-ci/linux/Makefile:1424: dt_binding_check] Error 2
make: *** [Makefile:234: __sub-make] Error 2

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

maintainer
#2 lore raw

Re: [PATCH 1/3] dt-bindings: rockchip: Add rk809 support for rk817 audio codec

In reply to Tim Lunn
Quoted 31 lines · Tim Lunn

Rockchip RK809 shares the same audio codec as the rk817 mfd, it is also using the same rk817_codec driver. However it is missing from the bindings.

Update dt-binding documentation for rk809 to include the audio codec properties. This fixes the following warning from dtb check:

pmic@20: '#sound-dai-cells', 'assigned-clock-parents', 'assigned-clocks',
'clock-names', 'clocks', 'codec' do not match any of the regexes:

   'pinctrl-[0-9]+'

---

 .../bindings/mfd/rockchip,rk809.yaml          | 30 ++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml +1 -1
index 839c0521f1e5..bac2e751e2f2 100644
@@ -12,7 +12,7 @@ maintainers:
 
 description: |
   Rockchip RK809 series PMIC. This device consists of an i2c controlled MFD
-  that includes regulators, an RTC, and power button.
+  that includes regulators, an RTC, a power button, and an audio codec.
 
 properties:
   compatible:

Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml properties: · line 98

Quoted 6 lines
Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml +3 -0
@@ -93,6 +93,34 @@ properties:
         unevaluatedProperties: false
     unevaluatedProperties: false
 
+  clocks:
+    description:
+      The input clock for the audio codec.

How many clocks? (maxItems: 1)

You can drop the description.

Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml properties: · line 102

Quoted 4 lines
Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml +4 -0
+
+  clock-names:
+    description:
+      The clock name for the codec clock.

Drop.

Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml properties: · line 108

Quoted 6 lines
Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml +6 -0
+    items:
+      - const: mclk
+
+  '#sound-dai-cells':
+    description:
+      Needed for the interpretation of sound dais.

Common property, don't need the description.

Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml properties: · line 115

Quoted 7 lines
Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml +7 -0
+    const: 0
+
+  codec:
+    description: |
+      The child node for the codec to hold additional properties. If no
+      additional properties are required for the codec, this node can be
+      omitted.

Why do you need a child node here? Just put the 1 property in the parent node.

Quoted 14 lines
Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml +8 -0
+    type: object
+    additionalProperties: false
+    properties:
+      rockchip,mic-in-differential:
+        type: boolean
+        description:
+          Describes if the microphone uses differential mode.
+
 allOf:
   - if:
       properties:
Signature · 1 line
2.40.1
#11 lore raw

Re: [PATCH 2/3] dt-bindings: rockchip: rk809 fix compatible string in examples

Quoted 5 lines · Rob Herring
Quoted 2 lines · Tim Lunn

Fix typo in the example specifying wrong compatible string

Quoted 8 lines
Quoted 6 lines

---

 Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Err, withdrawn. This doesn't pass tests.

Rob

#12 lore raw

Re: [PATCH 2/3] dt-bindings: rockchip: rk809 fix compatible string in examples

In reply to Tim Lunn
Quoted 13 lines · Tim Lunn

Fix typo in the example specifying wrong compatible string

---

 Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml +0 -0
index bac2e751e2f2..3f31478932c2 100644

Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml examples: · line 157

Quoted 6 lines
Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml +1 -2
@@ -154,8 +154,8 @@ examples:
         #address-cells = <1>;
         #size-cells = <0>;
 
-        rk808: pmic@1b {
-            compatible = "rockchip,rk808";
+        rk809: pmic@1b {

You can just drop the label... Is it used here?

Best regards,
Krzysztof

author
#3 lore raw

Re: [PATCH 1/3] dt-bindings: rockchip: Add rk809 support for rk817 audio codec

In reply to Rob Herring

Hi Rob,

Quoted 35 lines · Rob Herring
Quoted 34 lines · Tim Lunn

Rockchip RK809 shares the same audio codec as the rk817 mfd, it is also using the same rk817_codec driver. However it is missing from the bindings.

Update dt-binding documentation for rk809 to include the audio codec properties. This fixes the following warning from dtb check:

pmic@20: '#sound-dai-cells', 'assigned-clock-parents', 'assigned-clocks',
'clock-names', 'clocks', 'codec' do not match any of the regexes:
'pinctrl-[0-9]+'

---

  .../bindings/mfd/rockchip,rk809.yaml          | 30 ++++++++++++++++++-
  1 file changed, 29 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml +1 -1
index 839c0521f1e5..bac2e751e2f2 100644
@@ -12,7 +12,7 @@ maintainers:
 
  description: |
    Rockchip RK809 series PMIC. This device consists of an i2c controlled MFD
-  that includes regulators, an RTC, and power button.
+  that includes regulators, an RTC, a power button, and an audio codec.
 
  properties:
    compatible:
@@ -93,6 +93,34 @@ properties:
          unevaluatedProperties: false
      unevaluatedProperties: false
 
Quoted 6 lines

Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml properties: · line 98

Quoted 3 lines
Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml +3 -0
+  clocks:
+    description:
+      The input clock for the audio codec.

How many clocks? (maxItems: 1)

You can drop the description.

Yes just 1 clock, i will fix this.

Quoted 6 lines

Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml properties: · line 102

Quoted 5 lines
Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml +4 -0
+
+  clock-names:
+    description:
+      The clock name for the codec clock.

Drop.

Just drop the description? I dont think can drop the clock names as the driver use the name to lookup clock:

devm_clk_get(pdev->dev.parent, "mclk");

Quoted 8 lines

Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml properties: · line 108

Quoted 7 lines
Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml +6 -0
+    items:
+      - const: mclk
+
+  '#sound-dai-cells':
+    description:
+      Needed for the interpretation of sound dais.

Common property, don't need the description.

Ok

Quoted 10 lines

Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml properties: · line 115

Quoted 8 lines
Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml +7 -0
+    const: 0
+
+  codec:
+    description: |
+      The child node for the codec to hold additional properties. If no
+      additional properties are required for the codec, this node can be
+      omitted.

Why do you need a child node here? Just put the 1 property in the parent node.

This is how the existing rk817 codec driver was setup. I suppose it was copied from downstream, where there are more properties than just the one. I don't know if there was any intention (or need) to implement those other properties.

Quoted 15 lines
Quoted 15 lines
Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml +8 -0
+    type: object
+    additionalProperties: false
+    properties:
+      rockchip,mic-in-differential:
+        type: boolean
+        description:
+          Describes if the microphone uses differential mode.
+
  allOf:
    - if:
        properties:
Signature · 1 line
2.40.1
#4 lore raw

Re: [PATCH 1/3] dt-bindings: rockchip: Add rk809 support for rk817 audio codec

Quoted 10 lines · Tim Lunn
Quoted 1 line

You can drop the description.

Yes just 1 clock, i will fix this.

Quoted 6 lines

Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml properties: · line 102

Quoted 5 lines
Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml +4 -0
+
+  clock-names:
+    description:
+      The clock name for the codec clock.

Drop.

Just drop the description? I dont think can drop the clock names as the driver use the name to lookup clock:

Description. But anyway the problem is that adding clocks should be separate patch with its own explanation.

Quoted 19 lines

devm_clk_get(pdev->dev.parent, "mclk");

Quoted 8 lines

Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml properties: · line 108

Quoted 7 lines
Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml +6 -0
+    items:
+      - const: mclk
+
+  '#sound-dai-cells':
+    description:
+      Needed for the interpretation of sound dais.

Common property, don't need the description.

Ok

Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml +7 -0
+    const: 0
+
+  codec:
+    description: |
+      The child node for the codec to hold additional properties. If no
+      additional properties are required for the codec, this node can be
+      omitted.
Quoted 7 lines
Quoted 2 lines

Why do you need a child node here? Just put the 1 property in the parent node.

This is how the existing rk817 codec driver was setup. I suppose it was copied from downstream, where there are more properties than just the one. I don't know if there was any intention (or need) to implement those other properties.

Quoted 1 line

You need to clearly express ABI requirements in the commit msg. Otherwise you will get a review like for new bindings.

Best regards,
Krzysztof

author
#5 lore raw

Re: [PATCH 1/3] dt-bindings: rockchip: Add rk809 support for rk817 audio codec

Quoted 7 lines · Krzysztof Kozlowski
Quoted 6 lines · Tim Lunn
Quoted 1 line

You can drop the description.

Yes just 1 clock, i will fix this.

Quoted 4 lines
Quoted 4 lines
Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml +4 -0
+
+  clock-names:
+    description:
+      The clock name for the codec clock.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Drop.

Just drop the description? I dont think can drop the clock names as the driver use the name to lookup clock:

Description. But anyway the problem is that adding clocks should be separate patch with its own explanation.

Right, but I am not actually adding any clocks, just documenting what is already there. There are already boards using this codec with rk809 in dts files and is working fine from driver side.

Quoted 18 lines
Quoted 18 lines

devm_clk_get(pdev->dev.parent, "mclk");

Quoted 7 lines

Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml properties: · line 108

Quoted 6 lines
Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml +6 -0
+    items:
+      - const: mclk
+
+  '#sound-dai-cells':
+    description:
+      Needed for the interpretation of sound dais.

Common property, don't need the description.

Ok

Quoted 7 lines
Quoted 7 lines
Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml +7 -0
+    const: 0
+
+  codec:
+    description: |
+      The child node for the codec to hold additional properties. If no
+      additional properties are required for the codec, this node can be
+      omitted.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Why do you need a child node here? Just put the 1 property in the parent node.

This is how the existing rk817 codec driver was setup. I suppose it was copied from downstream, where there are more properties than just the one. I don't know if there was any intention (or need) to implement those other properties.

You need to clearly express ABI requirements in the commit msg. Otherwise you will get a review like for new bindings.

Got it, I will clarify this and future commit messages

Regards
   Tim

Quoted 4 lines

Best regards,
Krzysztof

#6 lore raw

Re: [PATCH 1/3] dt-bindings: rockchip: Add rk809 support for rk817 audio codec

Quoted 9 lines · Tim Lunn
Quoted 7 lines · Krzysztof Kozlowski
Quoted 6 lines · Tim Lunn
Quoted 1 line

You can drop the description.

Yes just 1 clock, i will fix this.

Quoted 4 lines
Quoted 4 lines
Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml +4 -0
+
+  clock-names:
+    description:
+      The clock name for the codec clock.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Drop.

Just drop the description? I dont think can drop the clock names as the driver use the name to lookup clock:

Description. But anyway the problem is that adding clocks should be separate patch with its own explanation.

Right, but I am not actually adding any clocks, just documenting what is already there.

You are. Binding did not have any clocks, now it has.

Quoted 2 lines

There are already boards using this codec with rk809 in dts files and is working fine from driver side.

Best regards,
Krzysztof

author
#7 lore raw

Re: [PATCH 1/3] dt-bindings: rockchip: Add rk809 support for rk817 audio codec

Quoted 10 lines · Krzysztof Kozlowski
Quoted 9 lines · Tim Lunn
Quoted 8 lines · Krzysztof Kozlowski
Quoted 7 lines · Tim Lunn
Quoted 1 line

You can drop the description.

Yes just 1 clock, i will fix this.

Quoted 5 lines

Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml properties: · line 102

Quoted 4 lines
Documentation/devicetree/bindings/mfd/rockchip,rk809.yaml +4 -0
+
+  clock-names:
+    description:
+      The clock name for the codec clock.

Drop.

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Just drop the description? I dont think can drop the clock names as the driver use the name to lookup clock:

Description. But anyway the problem is that adding clocks should be separate patch with its own explanation.

Right, but I am not actually adding any clocks, just documenting what is already there.

You are. Binding did not have any clocks, now it has.

Ok, I will split the clocks into a separate patch.

Quoted 8 lines
Quoted 3 lines

There are already boards using this codec with rk809 in dts files and is working fine from driver side.

Best regards,
Krzysztof