Skip to contentSkip to conversation

ASoC: codecs: add support for ES8326

PATCH Superseded Zhu Ning 3 participants 4 messages Jul 18, 2022 – Jul 20, 2022

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Zhu Ning

author
#0 lore raw

PATCH 1/2 ASoC: codecs: add support for ES8326

The ES8326 codec is not compatible with ES8316 and requires a dedicated driver.

-----
v1
Changes:
1.remove 24kHz support
2.disables micbias during suspend and remove
3.regmap resync during resume
4.make irq optional
5.cancel_delay_work during suspend and remove
Unchanged:
1.dts about reg58,59. We ask OEMs to use a specific board layout for irq and jack detection.
a dts about it can be added, but only useful in rare situation.

---
 sound/soc/codecs/Kconfig  |   5 +
 sound/soc/codecs/Makefile |   2 +
 sound/soc/codecs/es8326.c | 806 ++++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/es8326.h | 187 +++++++++
 4 files changed, 1000 insertions(+)
 mode change 100644 => 100755 sound/soc/codecs/Kconfig
 mode change 100644 => 100755 sound/soc/codecs/Makefile
 create mode 100755 sound/soc/codecs/es8326.c
 create mode 100755 sound/soc/codecs/es8326.h
sound/soc/codecs/Kconfig +5 -0
old mode 100644
new mode 100755
index 6165db92a629..b0a15cce416d
@@ -98,6 +98,7 @@ config SND_SOC_ALL_CODECS
 	imply SND_SOC_DA9055
 	imply SND_SOC_DMIC
 	imply SND_SOC_ES8316
+	imply SND_SOC_ES8326
 	imply SND_SOC_ES8328_SPI
 	imply SND_SOC_ES8328_I2C
 	imply SND_SOC_ES7134
@@ -911,6 +912,10 @@ config SND_SOC_ES8316
 	tristate "Everest Semi ES8316 CODEC"
 	depends on I2C
 
+config SND_SOC_ES8326
+	tristate "Everest Semi ES8326 CODEC"
+	depends on I2C
+
 config SND_SOC_ES8328
 	tristate
 
sound/soc/codecs/Makefile +2 -0
old mode 100644
new mode 100755
index 28dc4edfd01f..ae9d789b5381
@@ -100,6 +100,7 @@ snd-soc-dmic-objs := dmic.o
 snd-soc-es7134-objs := es7134.o
 snd-soc-es7241-objs := es7241.o
 snd-soc-es8316-objs := es8316.o
+snd-soc-es8326-objs := es8326.o
 snd-soc-es8328-objs := es8328.o
 snd-soc-es8328-i2c-objs := es8328-i2c.o
 snd-soc-es8328-spi-objs := es8328-spi.o
@@ -452,6 +453,7 @@ obj-$(CONFIG_SND_SOC_DMIC)	+= snd-soc-dmic.o
 obj-$(CONFIG_SND_SOC_ES7134)	+= snd-soc-es7134.o
 obj-$(CONFIG_SND_SOC_ES7241)	+= snd-soc-es7241.o
 obj-$(CONFIG_SND_SOC_ES8316)    += snd-soc-es8316.o
+obj-$(CONFIG_SND_SOC_ES8326)    += snd-soc-es8326.o
 obj-$(CONFIG_SND_SOC_ES8328)	+= snd-soc-es8328.o
 obj-$(CONFIG_SND_SOC_ES8328_I2C)+= snd-soc-es8328-i2c.o
 obj-$(CONFIG_SND_SOC_ES8328_SPI)+= snd-soc-es8328-spi.o
sound/soc/codecs/es8326.c new file +806 -0

806 lines not on this page · raw message

sound/soc/codecs/es8326.h new file +187 -0

187 lines not on this page · raw message

Signature · 1 line
2.36.1
author
#1 lore raw

PATCH 2/2 dt-bindings: sound: es8326: Add dtbindings documentation

Add device tree binding documentation for Everest ES8326

---
 .../bindings/sound/everest,es8326.yaml        | 84 +++++++++++++++++++
 1 file changed, 84 insertions(+)
 create mode 100755 Documentation/devicetree/bindings/sound/everest,es8326.yaml
Documentation/devicetree/bindings/sound/everest,es8326.yaml new file +84 -0
new file mode 100755
index 000000000000..f6aa3c03d456
@@ -0,0 +1,84 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/everest,es8326.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Everest ES8326 audio CODEC
+
+maintainers:
+  - David Yang <[email protected]>
+
+properties:
+  compatible:
+    const: everest,es8326
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: clock for master clock (MCLK)
+
+  clock-names:
+    items:
+      - const: mclk
+
+  "#sound-dai-cells":
+    const: 0
+
+  everest,jack-pol:
+    description:
+      just the value of reg 57. Bit(3) decides whether the jack polarity is inverted.
+      Bit(2) decides whether the bottom on the headset is inverted.
+      Bit(1)/(0) decides the mic properity to be OMTP/CTIA or auto.
+    $ref: /schemas/types.yaml#/definitions/uint8-array
+    minimum: 0
+    maximum: 0x0f
+    default: 0x0f
+  
+  everest,mic1-src:
+    description:
+      the value of reg 2A when headset plugged.
+    $ref: /schemas/types.yaml#/definitions/uint8-array
+    minimum: 0x00
+    maximum: 0x77
+    default: 0x22
+
+  everest,mic2-src:
+    description:
+      the value of reg 2A when headset unplugged.
+    $ref: /schemas/types.yaml#/definitions/uint8-array
+    minimum: 0x00
+    maximum: 0x77
+    default: 0x44
+
+  everest,jack-detect-inverted:
+    description:
+      Defined to invert the jack detection.
+    $ref: /schemas/types.yaml#/definitions/flag
+
+required:
+  - compatible
+  - reg
+  - "#sound-dai-cells"
+
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c0 {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      es8326: codec@19 {
+        compatible = "everest,es8326";
+        reg = <0x19>;
+        clocks = <&clks 10>;
+        clock-names = "mclk";
+        #sound-dai-cells = <0>;
+        everest,mic1-src = [22];
+        everest,mic2-src = [44];
+        everest,jack-pol = [0e];
+      };
+    };
Signature · 1 line
2.36.1
#3 lore raw
In reply to Zhu Ning
Quoted 11 lines · Zhu Ning

The ES8326 codec is not compatible with ES8316 and requires a dedicated driver.

-----

sound/soc/codecs/es8326.c new file +5 -0
+static const struct snd_soc_component_driver soc_component_dev_es8326 = {
+	.probe = es8326_probe,
+	.remove = es8326_remove,
+	.resume = es8326_resume,
+	.suspend = es8326_suspend,

sound/soc/codecs/es8326.c line 719

Quoted 10 lines
sound/soc/codecs/es8326.c new file +10 -0
+	.set_bias_level = es8326_set_bias_level,
+	.set_jack = es8326_set_jack,
+
+	.dapm_widgets = es8326_dapm_widgets,
+	.num_dapm_widgets = ARRAY_SIZE(es8326_dapm_widgets),
+	.dapm_routes = es8326_dapm_routes,
+	.num_dapm_routes = ARRAY_SIZE(es8326_dapm_routes),
+	.controls = es8326_snd_controls,
+	.num_controls = ARRAY_SIZE(es8326_snd_controls),
+};

As this device sits behind an I2S link you need the endianness flag here to specify that the endian will be lost over the bus.

Thanks,
Charles

maintainer Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH v1 2/2] dt-bindings: sound: es8326: Add dtbindings documentation

In reply to Zhu Ning
Quoted 1 line · Zhu Ning

Add device tree binding documentation for Everest ES8326

For the subject, don't repeat 'bindings' and 'documentation' is redundant:

ASoC: dt-bindings: Add Everest ES8326 audio CODEC

Quoted 7 lines
---
 .../bindings/sound/everest,es8326.yaml        | 84 +++++++++++++++++++
 1 file changed, 84 insertions(+)
 create mode 100755 Documentation/devicetree/bindings/sound/everest,es8326.yaml

With that,