Skip to contentSkip to conversation

ASoC: meson: add internal DAC support

PATCH Superseded Jerome Brunet 2 participants 6 messages Feb 19, 2020

Subsystems (5)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Jerome Brunet

author maintainer
#0 lore raw

cover ASoC: meson: add internal DAC support

This patchset adds support for the internal audio DAC provided on the Amlogic gxl, g12a and sm1 SoC families. On each of these SoC families, there is glue between this codec on the audio provider. The architecture is similar to the one used for the synopsys hdmi codec on these SoCs

Jerome Brunet (2):
ASoC: meson: add t9015 internal codec binding documentation
ASoC: meson: add t9015 internal DAC driver

 .../bindings/sound/amlogic,t9015.yaml         |  58 ++++
 sound/soc/meson/Kconfig                       |   8 +
 sound/soc/meson/Makefile                      |   2 +
 sound/soc/meson/t9015.c                       | 320 ++++++++++++++++++
 4 files changed, 388 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/amlogic,t9015.yaml
 create mode 100644 sound/soc/meson/t9015.c
Signature · 1 line
2.24.1
author maintainer
#1 lore raw

PATCH 1/2 ASoC: meson: add t9015 internal codec binding documentation

Add the DT binding documention of the internal DAC found in the Amlogic gxl, g12a and sm1 SoC family.

---
 .../bindings/sound/amlogic,t9015.yaml         | 58 +++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/amlogic,t9015.yaml
Documentation/devicetree/bindings/sound/amlogic,t9015.yaml new file +58 -0
new file mode 100644
index 000000000000..b7c38c2b5b54
@@ -0,0 +1,58 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/amlogic,t9015.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Amlogic T9015 Internal Audio DAC
+
+maintainers:
+  - Jerome Brunet <[email protected]>
+
+properties:
+  $nodename:
+    pattern: "^audio-controller@.*"
+
+  "#sound-dai-cells":
+    const: 0
+
+  compatible:
+    items:
+      - const: amlogic,t9015
+
+  clocks:
+    items:
+      - description: Peripheral clock
+
+  clock-names:
+    items:
+      - const: pclk
+
+  reg:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+required:
+  - "#sound-dai-cells"
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - resets
+
+examples:
+  - |
+    #include <dt-bindings/clock/g12a-clkc.h>
+    #include <dt-bindings/reset/amlogic,meson-g12a-reset.h>
+
+    acodec: audio-controller@32000 {
+        compatible = "amlogic,t9015";
+        reg = <0x0 0x32000 0x0 0x14>;
+        #sound-dai-cells = <0>;
+        clocks = <&clkc CLKID_AUDIO_CODEC>;
+        clock-names = "pclk";
+        resets = <&reset RESET_AUDIO_CODEC>;
+    };
+
Signature · 1 line
2.24.1
author maintainer
#2 lore raw

PATCH 2/2 ASoC: meson: add t9015 internal DAC driver

In reply to Jerome Brunet

Add the codec driver of the internal DAC found on Amlogic gxl, g12a and sm1 family.

---
 sound/soc/meson/Kconfig  |   8 +
 sound/soc/meson/Makefile |   2 +
 sound/soc/meson/t9015.c  | 320 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 330 insertions(+)
 create mode 100644 sound/soc/meson/t9015.c
sound/soc/meson/Kconfig +8 -0
index 22d2af75b59e..897a706dcda0 100644
@@ -6,6 +6,7 @@ config SND_MESON_AIU
 	tristate "Amlogic AIU"
 	select SND_MESON_CODEC_GLUE
 	select SND_PCM_IEC958
+	imply SND_SOC_MESON_T9015
 	imply SND_SOC_HDMI_CODEC if DRM_MESON_DW_HDMI
 	help
 	  Select Y or M to add support for the Audio output subsystem found
@@ -116,4 +117,11 @@ config SND_MESON_G12A_TOHDMITX
 	help
 	  Select Y or M to add support for HDMI audio on the g12a SoC
 	  family
+
+config SND_SOC_MESON_T9015
+	tristate "Amlogic T9015 DAC"
+	select REGMAP_MMIO
+	help
+	  Say Y or M if you want to add support for the internal DAC found
+	  on GXL, G12 and SM1 SoC family.
 endmenu
sound/soc/meson/Makefile +2 -0
index f9c90c391498..3c9d48846816 100644
@@ -23,6 +23,7 @@ snd-soc-meson-card-utils-objs := meson-card-utils.o
 snd-soc-meson-codec-glue-objs := meson-codec-glue.o
 snd-soc-meson-gx-sound-card-objs := gx-card.o
 snd-soc-meson-g12a-tohdmitx-objs := g12a-tohdmitx.o
+snd-soc-meson-t9015-objs := t9015.o
 
 obj-$(CONFIG_SND_MESON_AIU) += snd-soc-meson-aiu.o
 obj-$(CONFIG_SND_MESON_AXG_FIFO) += snd-soc-meson-axg-fifo.o
@@ -40,3 +41,4 @@ obj-$(CONFIG_SND_MESON_CARD_UTILS) += snd-soc-meson-card-utils.o
 obj-$(CONFIG_SND_MESON_CODEC_GLUE) += snd-soc-meson-codec-glue.o
 obj-$(CONFIG_SND_MESON_GX_SOUND_CARD) += snd-soc-meson-gx-sound-card.o
 obj-$(CONFIG_SND_MESON_G12A_TOHDMITX) += snd-soc-meson-g12a-tohdmitx.o
+obj-$(CONFIG_SND_SOC_MESON_T9015) += snd-soc-meson-t9015.o
sound/soc/meson/t9015.c new file +320 -0

320 lines not on this page · raw message

Signature · 1 line
2.24.1
maintainer
#3 lore raw

Re: [PATCH 2/2] ASoC: meson: add t9015 internal DAC driver

On Wed, Feb 19, 2020 at 02:36:46PM +0100, Jerome Brunet wrote:

Looks good, couple of small things below:

sound/soc/meson/t9015.c line 118

Quoted 3 lines
sound/soc/meson/t9015.c new file +3 -0
+static const struct snd_kcontrol_new t9015_snd_controls[] = {
+	/* Volume Controls */
+	SOC_SINGLE("Playback Mute", VOL_CTRL1, DAC_SOFT_MUTE, 1, 0),

This should be Switch (see control-names.rst).

sound/soc/meson/t9015.c line 126

Quoted 3 lines
sound/soc/meson/t9015.c new file +3 -0
+	SOC_SINGLE("Volume Ramp Enable", VOL_CTRL1, VC_RAMP_MODE, 1, 0),
+	SOC_SINGLE("Mute Ramp Enable", VOL_CTRL1, MUTE_MODE, 1, 0),
+	SOC_SINGLE("Unmute Ramp Enable", VOL_CTRL1, UNMUTE_MODE, 1, 0),

These too.

sound/soc/meson/t9015.c line 130

Quoted 3 lines
sound/soc/meson/t9015.c new file +3 -0
+	/* Channel Src */
+	SOC_ENUM("Right DAC Source", dacr_in_enum),
+	SOC_ENUM("Left DAC Source",  dacl_in_enum),

Ideally these would be moved into DAPM (using an AIF_IN widget for the DAI).

author maintainer
#4 lore raw

Re: [PATCH 2/2] ASoC: meson: add t9015 internal DAC driver

Quoted 6 lines · Mark Brown

sound/soc/meson/t9015.c line 130

Quoted 3 lines
sound/soc/meson/t9015.c new file +3 -0
+	/* Channel Src */
+	SOC_ENUM("Right DAC Source", dacr_in_enum),
+	SOC_ENUM("Left DAC Source",  dacl_in_enum),

Ideally these would be moved into DAPM (using an AIF_IN widget for the DAI).

I can (I initially did) but I don't think it is worth it.

I would split Playback into 2 AIF for Left and Right, then add a mux to select one them if front of both DAC. It will had 4 widgets and 6 routes but it won't allow turn anything on or off. There is no PM improvement.

Do you still want me to change this ?

maintainer
#5 lore raw

Re: [PATCH 2/2] ASoC: meson: add t9015 internal DAC driver

Quoted 9 lines · Jerome Brunet
Quoted 6 lines · Mark Brown

sound/soc/meson/t9015.c line 130

Quoted 3 lines
sound/soc/meson/t9015.c new file +3 -0
+	/* Channel Src */
+	SOC_ENUM("Right DAC Source", dacr_in_enum),
+	SOC_ENUM("Left DAC Source",  dacl_in_enum),

Ideally these would be moved into DAPM (using an AIF_IN widget for the DAI).

Quoted 7 lines

I can (I initially did) but I don't think it is worth it.

I would split Playback into 2 AIF for Left and Right, then add a mux to select one them if front of both DAC. It will had 4 widgets and 6 routes but it won't allow turn anything on or off. There is no PM improvement.

Do you still want me to change this ?

It can help us track things like external amps connected to the DACs, especially when we manage to get to the point of tracking individual audio streams over DAI links.