diff mbox series

[1/3] ASoC: dt-bindings: irondevice, sma1303: Rework binding and add missing properties

Message ID 20230203094239.25700-1-kiseok.jo@irondevice.com (mailing list archive)
State New, archived
Headers show
Series [1/3] ASoC: dt-bindings: irondevice, sma1303: Rework binding and add missing properties | expand

Commit Message

Ki-Seok Jo Feb. 3, 2023, 9:42 a.m. UTC
Fix according to the writing-schema.rst file and tested.
Add the missing property as compatible, reg, sys-clk-id.

Signed-off-by: Kiseok Jo <kiseok.jo@irondevice.com>
---
 .../bindings/sound/irondevice,sma1303.yaml    | 35 +++++++++++++++++--
 1 file changed, 32 insertions(+), 3 deletions(-)


base-commit: afdf57285d1e16a1bbdbf6cc33fb22fb6c8e7860

Comments

Mark Brown Feb. 3, 2023, 1:37 p.m. UTC | #1
On Fri, Feb 03, 2023 at 09:42:37AM +0000, Kiseok Jo wrote:

> +  sys-clk-id:
> +    description:
> +      select the using system clock.
> +      0 = External Clock 19.2MHz
> +      1 = External Clock 24.576MHz
> +      2 = Using PLL in MCLK
> +      3 = Using PLL in BCLK
> +    $ref: "/schemas/types.yaml#/definitions/uint32"
> +    maximum: 3
> +    default: 3

We really shouldn't have this as a custom property, we should be using
a combination of the clock bindings.

In the driver this would turn into using clk_get() to get the MCLK, then
we can query the rate with clk_get_rate() and use option 0 or 1 if the
rate matches, or the PLL otherwise.  If we fail to get MCLK then we can
fall back to using BCLK.
Rob Herring Feb. 3, 2023, 10:01 p.m. UTC | #2
On Fri, Feb 03, 2023 at 09:42:37AM +0000, Kiseok Jo wrote:
> Fix according to the writing-schema.rst file and tested.
> Add the missing property as compatible, reg, sys-clk-id.
> 
> Signed-off-by: Kiseok Jo <kiseok.jo@irondevice.com>
> ---
>  .../bindings/sound/irondevice,sma1303.yaml    | 35 +++++++++++++++++--
>  1 file changed, 32 insertions(+), 3 deletions(-)

What's the output of 'make dt_binding_check'? Asking since linux-next 
has been broken in different ways with this schema.

Rob
Ki-Seok Jo Feb. 4, 2023, 1:17 a.m. UTC | #3
> > Fix according to the writing-schema.rst file and tested.
> > Add the missing property as compatible, reg, sys-clk-id.
> >
> > Signed-off-by: Kiseok Jo <kiseok.jo@irondevice.com>
> > ---
> >  .../bindings/sound/irondevice,sma1303.yaml    | 35 +++++++++++++++++--
> >  1 file changed, 32 insertions(+), 3 deletions(-)
> 
> What's the output of 'make dt_binding_check'? Asking since linux-next has
> been broken in different ways with this schema.
> 
> Rob

2 logs and 2 files output below:
  DTEX  irondevice,sma1303.example.dts
  DTC_CHK  irondevice,sma1303.example.dtb

And I didn't see any other error, so I thought it was okay.
Is there anything else I need to check or how? I'll try it.

Thank you!

Best Regard,
Kiseok Jo
Ki-Seok Jo Feb. 4, 2023, 1:20 a.m. UTC | #4
> 
> > +  sys-clk-id:
> > +    description:
> > +      select the using system clock.
> > +      0 = External Clock 19.2MHz
> > +      1 = External Clock 24.576MHz
> > +      2 = Using PLL in MCLK
> > +      3 = Using PLL in BCLK
> > +    $ref: "/schemas/types.yaml#/definitions/uint32"
> > +    maximum: 3
> > +    default: 3
> 
> We really shouldn't have this as a custom property, we should be using a
> combination of the clock bindings.
> 
> In the driver this would turn into using clk_get() to get the MCLK, then
> we can query the rate with clk_get_rate() and use option 0 or 1 if the
> rate matches, or the PLL otherwise.  If we fail to get MCLK then we can
> fall back to using BCLK.

Okay, I got it.
I'll make it based on what you sent me using other drivers.
Thanks, your feedback.

Best regards,
Kiseok Jo
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/sound/irondevice,sma1303.yaml b/Documentation/devicetree/bindings/sound/irondevice,sma1303.yaml
index 162c52606635..2c6158277aee 100644
--- a/Documentation/devicetree/bindings/sound/irondevice,sma1303.yaml
+++ b/Documentation/devicetree/bindings/sound/irondevice,sma1303.yaml
@@ -10,22 +10,51 @@  maintainers:
   - Kiseok Jo <kiseok.jo@irondevice.com>
 
 description:
-  SMA1303 digital class-D audio amplifier with an integrated boost converter.
+  SMA1303 digital class-D audio amplifier
+  with an integrated boost converter.
 
 allOf:
-  - $ref: name-prefix.yaml#
+  - $ref: dai-common.yaml#
+
+properties:
+  compatible:
+    enum:
+      - irondevice,sma1303
+
+  reg:
+    maxItems: 1
+
+  '#sound-dai-cells':
+    const: 1
+
+  sys-clk-id:
+    description:
+      select the using system clock.
+      0 = External Clock 19.2MHz
+      1 = External Clock 24.576MHz
+      2 = Using PLL in MCLK
+      3 = Using PLL in BCLK
+    $ref: "/schemas/types.yaml#/definitions/uint32"
+    maximum: 3
+    default: 3
 
 required:
   - compatible
   - reg
+  - '#sound-dai-cells'
 
 additionalProperties: false
 
 examples:
   - |
-    i2c_bus {
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
         amplifier@1e {
             compatible = "irondevice,sma1303";
             reg = <0x1e>;
+            #sound-dai-cells = <1>;
+            sys-clk-id = <3>;
         };
     };