Skip to contentSkip to conversation

ASoC: dt-bindings: Add cmx655 codec

PATCH Superseded Nikola Jelic 2 participants 3 messages Feb 10, 2025 – Feb 12, 2025

Subsystems (3)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 ASoC: dt-bindings: Add cmx655 codec

---
V2 -> V3: fixed dt_binding_check + yamllint warnings V1 -> V2: removed the txt file, fixed review remarks

---
 .../bindings/sound/cml,cmx655d.yaml           | 78 +++++++++++++++++++
 .../devicetree/bindings/vendor-prefixes.yaml  |  2 +
 2 files changed, 80 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/cml,cmx655d.yaml
Documentation/devicetree/bindings/sound/cml,cmx655d.yaml new file +78 -0
new file mode 100644
index 000000000000..1648f606bf48
@@ -0,0 +1,78 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/cml,cmx655d.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: CML Micro CMX655D codec
+
+maintainers:
+  - Richard Walton <[email protected]>
+  - Nikola Jelic <[email protected]>
+
+description:
+  The CMX655D is an ultra-low power voice codec.
+
+allOf:
+  - $ref: dai-common.yaml#
+
+properties:
+  compatible:
+    enum:
+      - cml,cmx655d
+
+  reg:
+    description: Local bus address
+    maxItems: 1
+
+  "#sound-dai-cells":
+    description: The first cell indicating the audio interface
+    const: 0
+
+  reset-gpios:
+    description: GPIO used for codec reset, negative logic
+    maxItems: 1
+
+  interrupts:
+    description: Interrupt for the CMX655D IRQ line
+    maxItems: 1
+
+  interrupt-names:
+    description: Interrupt name for the CMX655D IRQ line
+    maxItems: 1
+
+  cml,classd-oc-reset-attempts:
+    description: Maximum number of times to reset CMX655 class-D
+      following a overcurrent event.
+      >10000 = disable limit.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 1
+    maximum: 10001
+    default: 5
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/gpio/gpio.h>
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        status = "okay";
+        audio-codec@54 {
+            compatible = "cml,cmx655d";
+            #sound-dai-cells = <0>;
+            reg = <0x54>;
+            reset-gpios = <&gpio 24 GPIO_ACTIVE_LOW>;
+            interrupt-parent = <&gpio>;
+            interrupts = <25 IRQ_TYPE_EDGE_RISING>;
+            cml,classd-oc-reset-attempts = <5>;
+        };
+
+    };
+...
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index 333491cba969..bdb42c22325a 100644
@@ -308,6 +308,8 @@ patternProperties:
     description: Carl Cloos Schweisstechnik GmbH.
   "^cloudengines,.*":
     description: Cloud Engines, Inc.
+  "^cml,.*":
+    description: CML Micro, Ltd.
   "^cnm,.*":
     description: Chips&Media, Inc.
   "^cnxt,.*":
Signature · 1 line
2.47.2
#1 lore raw

PATCH v4 2/2 ASoC: codecs: cmx655: Add CML's CMX655D codec

---
V3 -> V4: Kernel test robot remarks
V2 -> V3: Review remarks
V1 -> V2: Review remarks, code style + various other fixes

---
 sound/soc/codecs/Kconfig      |   16 +
 sound/soc/codecs/Makefile     |    6 +
 sound/soc/codecs/cmx655-i2c.c |   59 ++
 sound/soc/codecs/cmx655-spi.c |   59 ++
 sound/soc/codecs/cmx655.c     | 1050 +++++++++++++++++++++++++++++++++
 sound/soc/codecs/cmx655.h     |  154 +++++
 6 files changed, 1344 insertions(+)
 create mode 100644 sound/soc/codecs/cmx655-i2c.c
 create mode 100644 sound/soc/codecs/cmx655-spi.c
 create mode 100644 sound/soc/codecs/cmx655.c
 create mode 100644 sound/soc/codecs/cmx655.h
sound/soc/codecs/Kconfig +16 -0
index ee35f3aa5521..d06b4eb8f1e5 100644
@@ -63,6 +63,7 @@ config SND_SOC_ALL_CODECS
 	imply SND_SOC_BT_SCO
 	imply SND_SOC_BD28623
 	imply SND_SOC_CHV3_CODEC
+	imply SND_SOC_CMX655
 	imply SND_SOC_CQ0093VC
 	imply SND_SOC_CROS_EC_CODEC
 	imply SND_SOC_CS35L32
@@ -747,6 +748,21 @@ config SND_SOC_CPCAP
 	tristate "Motorola CPCAP codec"
 	depends on MFD_CPCAP || COMPILE_TEST
 
+config SND_SOC_CMX655D
+	tristate
+
+config SND_SOC_CMX655D_I2C
+       tristate "CMX655D codec (I2C)"
+       depends on I2C
+       select SND_SOC_CMX655D
+       select REGMAP_I2C
+
+config SND_SOC_CMX655D_SPI
+       tristate "CMX655D codec (SPI)"
+       depends on SPI
+       select SND_SOC_CMX655D
+       select REGMAP_SPI
+
 config SND_SOC_CQ0093VC
 	tristate
 
sound/soc/codecs/Makefile +6 -0
index d7ad795603c1..130d29e2e574 100644
@@ -58,6 +58,9 @@ snd-soc-aw88399-y := aw88399.o
 snd-soc-bd28623-y := bd28623.o
 snd-soc-bt-sco-y := bt-sco.o
 snd-soc-chv3-codec-y := chv3-codec.o
+snd-soc-cmx655-y := cmx655.o
+snd-soc-cmx655-i2c-y := cmx655-i2c.o
+snd-soc-cmx655-spi-y := cmx655-spi.o
 snd-soc-cpcap-y := cpcap.o
 snd-soc-cq93vc-y := cq93vc.o
 snd-soc-cros-ec-codec-y := cros_ec_codec.o
@@ -475,6 +478,9 @@ obj-$(CONFIG_SND_SOC_AW88399)	+= snd-soc-aw88399.o
 obj-$(CONFIG_SND_SOC_BD28623)	+= snd-soc-bd28623.o
 obj-$(CONFIG_SND_SOC_BT_SCO)	+= snd-soc-bt-sco.o
 obj-$(CONFIG_SND_SOC_CHV3_CODEC) += snd-soc-chv3-codec.o
+obj-$(CONFIG_SND_SOC_CMX655D) += snd-soc-cmx655.o
+obj-$(CONFIG_SND_SOC_CMX655D_I2C) += snd-soc-cmx655-i2c.o
+obj-$(CONFIG_SND_SOC_CMX655D_SPI) += snd-soc-cmx655-spi.o
 obj-$(CONFIG_SND_SOC_CQ0093VC) += snd-soc-cq93vc.o
 obj-$(CONFIG_SND_SOC_CPCAP)	+= snd-soc-cpcap.o
 obj-$(CONFIG_SND_SOC_CROS_EC_CODEC)	+= snd-soc-cros-ec-codec.o
sound/soc/codecs/cmx655-i2c.c new file +59 -0

59 lines not on this page · raw message

sound/soc/codecs/cmx655-spi.c new file +59 -0

59 lines not on this page · raw message

sound/soc/codecs/cmx655.c new file +1050 -0

1,050 lines not on this page · raw message

sound/soc/codecs/cmx655.h new file +154 -0

154 lines not on this page · raw message

Signature · 1 line
2.47.2
#2 lore raw
In reply to Nikola Jelic
Quoted 2 lines · Nikola Jelic

Nothing improved here. Respond to previous comments or implement them.

Some things got better in this patch, thank you. Other did not. Maybe there is misunderstanding about my comments, but you never replied to them, so I would assume you will be implementing them fully. If something is unclear, ask responding inline.

Quoted 30 lines

---
V2 -> V3: fixed dt_binding_check + yamllint warnings V1 -> V2: removed the txt file, fixed review remarks

---
 .../bindings/sound/cml,cmx655d.yaml           | 78 +++++++++++++++++++
 .../devicetree/bindings/vendor-prefixes.yaml  |  2 +
 2 files changed, 80 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/cml,cmx655d.yaml
Documentation/devicetree/bindings/sound/cml,cmx655d.yaml new file +15 -0
new file mode 100644
index 000000000000..1648f606bf48
@@ -0,0 +1,78 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/cml,cmx655d.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: CML Micro CMX655D codec
+
+maintainers:
+  - Richard Walton <[email protected]>
+  - Nikola Jelic <[email protected]>
+
+description:
+  The CMX655D is an ultra-low power voice codec.
+

Documentation/devicetree/bindings/sound/cml,cmx655d.yaml line 25

Quoted 10 lines
Documentation/devicetree/bindings/sound/cml,cmx655d.yaml new file +10 -0
+allOf:
+  - $ref: dai-common.yaml#
+
+properties:
+  compatible:
+    enum:
+      - cml,cmx655d
+
+  reg:
+    description: Local bus address

Drop, why did this appear?

Documentation/devicetree/bindings/sound/cml,cmx655d.yaml line 29

Quoted 4 lines
Documentation/devicetree/bindings/sound/cml,cmx655d.yaml new file +4 -0
+    maxItems: 1
+
+  "#sound-dai-cells":
+    description: The first cell indicating the audio interface

Drop, redundant. It wasn't here before and I did not ask for this, so why?

Documentation/devicetree/bindings/sound/cml,cmx655d.yaml line 37

Quoted 8 lines
Documentation/devicetree/bindings/sound/cml,cmx655d.yaml new file +8 -0
+    const: 0
+
+  reset-gpios:
+    description: GPIO used for codec reset, negative logic
+    maxItems: 1
+
+  interrupts:
+    description: Interrupt for the CMX655D IRQ line

Drop

Documentation/devicetree/bindings/sound/cml,cmx655d.yaml line 41

Quoted 4 lines
Documentation/devicetree/bindings/sound/cml,cmx655d.yaml new file +4 -0
+    maxItems: 1
+
+  interrupt-names:
+    description: Interrupt name for the CMX655D IRQ line

Nothing improved. Maybe there was some misunderstanding. I asked to look at other bindings doing this. Where do you see syntax like that for interrupt-names? What syntax do you see for interrupt-names?

Documentation/devicetree/bindings/sound/cml,cmx655d.yaml line 51

Quoted 10 lines
Documentation/devicetree/bindings/sound/cml,cmx655d.yaml new file +10 -0
+    maxItems: 1
+
+  cml,classd-oc-reset-attempts:
+    description: Maximum number of times to reset CMX655 class-D
+      following a overcurrent event.
+      >10000 = disable limit.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 1
+    maximum: 10001
+    default: 5

Still no answer why this is board configurable.

Quoted 5 lines
Documentation/devicetree/bindings/sound/cml,cmx655d.yaml new file +5 -0
+
+required:
+  - compatible
+  - reg
+

Documentation/devicetree/bindings/sound/cml,cmx655d.yaml line 66

Quoted 10 lines
Documentation/devicetree/bindings/sound/cml,cmx655d.yaml new file +10 -0
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/gpio/gpio.h>
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        status = "okay";

Another ignored comment.

Documentation/devicetree/bindings/sound/cml,cmx655d.yaml line 70

Quoted 4 lines
Documentation/devicetree/bindings/sound/cml,cmx655d.yaml new file +4 -0
+        audio-codec@54 {
+            compatible = "cml,cmx655d";
+            #sound-dai-cells = <0>;
+            reg = <0x54>;

Another...

Best regards,
Krzysztof