Skip to contentSkip to conversation

ASoC: meson: add internal DAC support

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

Subsystems (5)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Jerome Brunet

author maintainer
#0 lore raw

v2 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

Changes since v1 [0]:
* Change some kcontrol names
* Move DAC sources to DAPM

[0]: https://lore.kernel.org/r/[email protected]/

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                       | 333 ++++++++++++++++++
 4 files changed, 401 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 v2 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 v2 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  | 333 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 343 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 +333 -0

333 lines not on this page · raw message

Signature · 1 line
2.24.1
maintainer
#3 lore raw

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

sound/soc/meson/t9015.c line 121

Quoted 3 lines · Jerome Brunet
sound/soc/meson/t9015.c new file +3 -0
+	SOC_SINGLE("Playback Mute Switch", VOL_CTRL1, DAC_SOFT_MUTE, 1, 0),
+	SOC_DOUBLE_TLV("Playback Volume", VOL_CTRL1, DACL_VC, DACR_VC,
+		       0xff, 0, dac_vol_tlv),

Sorry, that should just be plain "Playback Switch" - this can be used by applications to present a combined mute/volume control together with the Volume control (though as in this case there's no per-channel control it is possible some applications will struggle with that).

author maintainer
#4 lore raw

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

Quoted 9 lines · Mark Brown

sound/soc/meson/t9015.c line 121

Quoted 3 lines · Jerome Brunet
sound/soc/meson/t9015.c new file +3 -0
+	SOC_SINGLE("Playback Mute Switch", VOL_CTRL1, DAC_SOFT_MUTE, 1, 0),
+	SOC_DOUBLE_TLV("Playback Volume", VOL_CTRL1, DACL_VC, DACR_VC,
+		       0xff, 0, dac_vol_tlv),

Sorry, that should just be plain "Playback Switch" - this can be used by applications to present a combined mute/volume control together with the Volume control

Ah, Ok. I thought it was important to make difference between Mute (Playing silence) and a Stream stop ... I guess the app does not care about such detail. No problem, I'll fix this.

Quoted 2 lines

(though as in this case there's no per-channel control it is possible some applications will struggle with that).

alsamixer seems happy enough with it :)