diff mbox series

[1/2] ASoC: dt-bindings: Added schema for "nuvoton,nau8325"

Message ID 20240122095650.60523-1-wtli@nuvoton.com
State New
Headers show
Series [1/2] ASoC: dt-bindings: Added schema for "nuvoton,nau8325" | expand

Commit Message

WTLI Jan. 22, 2024, 9:56 a.m. UTC
Added a DT schema for describing nau8325 audio amplifiers.

Signed-off-by: Seven Lee <wtli@nuvoton.com>
---
 .../bindings/sound/nuvoton,nau8325.yaml       | 82 +++++++++++++++++++
 1 file changed, 82 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/nuvoton,nau8325.yaml

Comments

Conor Dooley Jan. 23, 2024, 8:34 a.m. UTC | #1
On Mon, Jan 22, 2024 at 07:40:51PM +0000, Mark Brown wrote:
> On Mon, Jan 22, 2024 at 06:00:14PM +0000, Conor Dooley wrote:
> > On Mon, Jan 22, 2024 at 05:56:49PM +0800, Seven Lee wrote:
> 
> > > +    enum:
> > > +      - 0 # VDDA
> > > +      - 1 # VDDA*1.5/1.8V
> > > +      - 2 # VDDA*1.6/1.8V
> > > +      - 3 # VDDA*1.7/1.8V
> 
> > I would also rather than this enum was used to have sensible values for
> > the enum itself (which I suppose means strings here), rather than the
> > register values. Seeing "nuvoton,dac-vref = <2>" in a devicetree is not
> > very meaningful IMO.
> 
> Do you have a concrete suggestion for how to more clearly write these
> directly?

I would use what's been given as the explanation comments for each of
the current enum values in the patch.
Mark Brown Jan. 23, 2024, 1:06 p.m. UTC | #2
On Tue, Jan 23, 2024 at 08:34:03AM +0000, Conor Dooley wrote:
> On Mon, Jan 22, 2024 at 07:40:51PM +0000, Mark Brown wrote:
> > On Mon, Jan 22, 2024 at 06:00:14PM +0000, Conor Dooley wrote:
> > > On Mon, Jan 22, 2024 at 05:56:49PM +0800, Seven Lee wrote:

> > > > +    enum:
> > > > +      - 0 # VDDA
> > > > +      - 1 # VDDA*1.5/1.8V
> > > > +      - 2 # VDDA*1.6/1.8V
> > > > +      - 3 # VDDA*1.7/1.8V

> > > I would also rather than this enum was used to have sensible values for
> > > the enum itself (which I suppose means strings here), rather than the
> > > register values. Seeing "nuvoton,dac-vref = <2>" in a devicetree is not
> > > very meaningful IMO.

> > Do you have a concrete suggestion for how to more clearly write these
> > directly?

> I would use what's been given as the explanation comments for each of
> the current enum values in the patch.

Given that none of *, / nor . are usable in defines that's going to need
a bit of massaging...
Conor Dooley Jan. 23, 2024, 4:02 p.m. UTC | #3
On Tue, Jan 23, 2024 at 01:06:45PM +0000, Mark Brown wrote:
> On Tue, Jan 23, 2024 at 08:34:03AM +0000, Conor Dooley wrote:
> > On Mon, Jan 22, 2024 at 07:40:51PM +0000, Mark Brown wrote:
> > > On Mon, Jan 22, 2024 at 06:00:14PM +0000, Conor Dooley wrote:
> > > > On Mon, Jan 22, 2024 at 05:56:49PM +0800, Seven Lee wrote:
> 
> > > > > +    enum:
> > > > > +      - 0 # VDDA
> > > > > +      - 1 # VDDA*1.5/1.8V
> > > > > +      - 2 # VDDA*1.6/1.8V
> > > > > +      - 3 # VDDA*1.7/1.8V
> 
> > > > I would also rather than this enum was used to have sensible values for
> > > > the enum itself (which I suppose means strings here), rather than the
> > > > register values. Seeing "nuvoton,dac-vref = <2>" in a devicetree is not
> > > > very meaningful IMO.
> 
> > > Do you have a concrete suggestion for how to more clearly write these
> > > directly?
> 
> > I would use what's been given as the explanation comments for each of
> > the current enum values in the patch.
> 
> Given that none of *, / nor . are usable in defines that's going to need
> a bit of massaging...

At the end of the day, if it is too painful on the driver, then I'll
live with another enum. This is one of the worse cases of this sort of
enum that is clearly a bunch of register values, given there's not a
"nice" explanation for them.
Conor Dooley Feb. 2, 2024, 4:34 p.m. UTC | #4
On Fri, Feb 02, 2024 at 06:04:12PM +0800, AS50 WTLi wrote:

> The privileged confidential information contained in this email is intended for use only by the addressees as indicated by the original sender of this email. If you are not the addressee indicated in this email or are not responsible for delivery of the email to such a person, please kindly reply to the sender indicating this fact and delete all copies of it from your computer and network server immediately. Your cooperation is highly appreciated. It is advised that any unauthorized use of confidential information of Nuvoton is strictly prohibited; and any information in this email irrelevant to the official business of Nuvoton shall be deemed as neither given nor endorsed by Nuvoton.


Please fix your mail setup, the quoting etc is broken (html mail?) and
you have this footer there, which is not really compatible with working
with public mailing lists!
Conor Dooley Feb. 2, 2024, 4:36 p.m. UTC | #5
> > At the end of the day, if it is too painful on the driver, then I'll
> > live with another enum. This is one of the worse cases of this sort of
> > enum that is clearly a bunch of register values, given there's not a
> > "nice" explanation for them.
> 
> 
> 
> 
> I will modify as follows,
> 
> +    enum:
> +      - VDDA
> +      - VDDA*1.5
> +      - VDDA*1.6
> +      - VDDA*1.7


To be clear, since I was not in my earlier mail, you can leave this as it
was, given Mark's complaints about what the handling for it in the driver
would look like with the special characters.

Thanks,
Conor.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/sound/nuvoton,nau8325.yaml b/Documentation/devicetree/bindings/sound/nuvoton,nau8325.yaml
new file mode 100644
index 000000000000..9105985357aa
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/nuvoton,nau8325.yaml
@@ -0,0 +1,82 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/nuvoton,nau8325.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NAU8325 audio Amplifier
+
+maintainers:
+  - Seven Lee <WTLI@nuvoton.com>
+
+allOf:
+  - $ref: dai-common.yaml#
+
+properties:
+  compatible:
+    const: nuvoton,nau8325
+
+  reg:
+    maxItems: 1
+
+  nuvoton,vref-impedance:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      VREF impedance selection.
+    enum:
+      - 0 # Open
+      - 1 # 25kOhm
+      - 2 # 125kOhm
+      - 3 # 2.5kOhm
+    default: 2
+
+  nuvoton,dac-vref:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      DAC Reference Voltage Setting.
+    enum:
+      - 0 # VDDA
+      - 1 # VDDA*1.5/1.8V
+      - 2 # VDDA*1.6/1.8V
+      - 3 # VDDA*1.7/1.8V
+    default: 2
+
+  nuvoton,alc-enable:
+    description:
+      Enable digital automatic level control (ALC) function.
+    type: boolean
+
+  nuvoton,clock-detection-disable:
+    description:
+      When clock detection is enabled, it will detect whether MCLK
+      and FS are within the range. MCLK range is from 2.048MHz to 24.576MHz.
+      FS range is from 8kHz to 96kHz.
+    type: boolean
+
+  nuvoton,clock-det-data:
+    description:
+      Request clock detection to require 2048 non-zero samples before enabling
+      the audio paths. If set then non-zero samples is required, otherwise it
+      doesn't matter.
+    type: boolean
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        codec@21 {
+            compatible = "nuvoton,nau8325";
+            reg = <0x21>;
+            nuvoton,vref-impedance = <2>;
+            nuvoton,dac-vref = <2>;
+            nuvoton,alc-enable;
+            nuvoton,clock-det-data;
+        };
+    };