Skip to contentSkip to conversation

ASoC: meson: g12a: add internal audio DAC support

PATCH Applied Jerome Brunet 3 participants 6 messages Feb 21, 2020 – Apr 16, 2020

Subsystems (5)
lore
Share & tools
lore

Jerome Brunet

author maintainer
#0 lore raw

v2 cover ASoC: meson: g12a: add internal audio DAC support

Like the gxl, the Amlogic g12a and sm1 SoC families have a t9015 internal audio DAC. On these more recent SoCs, any of the 3 TDM outputs can be routed to the internal DAC. This routing is done by a small glue device called 'toacodec'. This patchset adds support for it.

This was tested on the amlogic reference design g12a-u200.

Changes since v1 [0]:
* Fixup patch 2 which was left in an intermediate state after rebasing, missing part of the changes. Thanks to Sergey Bolshakov for reporting it.

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

Jerome Brunet (3):
ASoC: meson: g12a: add toacodec dt-binding documentation
ASoC: meson: g12a: add internal DAC glue driver
ASoC: meson: axg-card: add toacodec support

 .../bindings/sound/amlogic,g12a-toacodec.yaml |  51 ++++
 .../dt-bindings/sound/meson-g12a-toacodec.h   |  10 +
 sound/soc/meson/Kconfig                       |   9 +
 sound/soc/meson/Makefile                      |   2 +
 sound/soc/meson/axg-card.c                    |   3 +-
 sound/soc/meson/g12a-toacodec.c               | 252 ++++++++++++++++++
 6 files changed, 326 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/sound/amlogic,g12a-toacodec.yaml
 create mode 100644 include/dt-bindings/sound/meson-g12a-toacodec.h
 create mode 100644 sound/soc/meson/g12a-toacodec.c
Signature · 1 line
2.24.1
author maintainer
#1 lore raw

PATCH v2 1/3 ASoC: meson: g12a: add toacodec dt-binding documentation

Add the DT bindings and documentation of the internal audio DAC glue found on Amlogic g12a and sm1 SoC families

---
 .../bindings/sound/amlogic,g12a-toacodec.yaml | 51 +++++++++++++++++++
 .../dt-bindings/sound/meson-g12a-toacodec.h   | 10 ++++
 2 files changed, 61 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/amlogic,g12a-toacodec.yaml
 create mode 100644 include/dt-bindings/sound/meson-g12a-toacodec.h
Documentation/devicetree/bindings/sound/amlogic,g12a-toacodec.yaml new file +51 -0
new file mode 100644
index 000000000000..f778d3371fde
@@ -0,0 +1,51 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/amlogic,g12a-toacodec.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Amlogic G12a Internal DAC Control Glue
+
+maintainers:
+  - Jerome Brunet <[email protected]>
+
+properties:
+  $nodename:
+    pattern: "^audio-controller@.*"
+
+  "#sound-dai-cells":
+    const: 1
+
+  compatible:
+    oneOf:
+      - items:
+        - const:
+            amlogic,g12a-toacodec
+      - items:
+        - enum:
+          - amlogic,sm1-toacodec
+        - const:
+            amlogic,g12a-toacodec
+
+  reg:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+required:
+  - "#sound-dai-cells"
+  - compatible
+  - reg
+  - resets
+
+examples:
+  - |
+    #include <dt-bindings/reset/amlogic,meson-g12a-audio-reset.h>
+
+    toacodec: audio-controller@740 {
+        compatible = "amlogic,g12a-toacodec";
+        reg = <0x0 0x740 0x0 0x4>;
+        #sound-dai-cells = <1>;
+        resets = <&clkc_audio AUD_RESET_TOACODEC>;
+    };
include/dt-bindings/sound/meson-g12a-toacodec.h new file +10 -0
new file mode 100644
index 000000000000..69d7a75592a2
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __DT_MESON_G12A_TOACODEC_H
+#define __DT_MESON_G12A_TOACODEC_H
+
+#define TOACODEC_IN_A	0
+#define TOACODEC_IN_B	1
+#define TOACODEC_IN_C	2
+#define TOACODEC_OUT	3
+
+#endif /* __DT_MESON_G12A_TOACODEC_H */
Signature · 1 line
2.24.1
author maintainer
#2 lore raw

PATCH v2 2/3 ASoC: meson: g12a: add internal DAC glue driver

In reply to Jerome Brunet

Add support for the internal audio DAC glue found on the Amlogic g12a and sm1 SoC families. This allows to connect the TDM outputs of the SoC to the internal t9015 audio DAC.

---
 sound/soc/meson/Kconfig         |   9 ++
 sound/soc/meson/Makefile        |   2 +
 sound/soc/meson/g12a-toacodec.c | 252 ++++++++++++++++++++++++++++++++
 3 files changed, 263 insertions(+)
 create mode 100644 sound/soc/meson/g12a-toacodec.c
sound/soc/meson/Kconfig +9 -0
index d27e9180b453..8b6295283989 100644
@@ -109,6 +109,15 @@ config SND_MESON_GX_SOUND_CARD
 	help
 	  Select Y or M to add support for the GXBB/GXL SoC sound card
 
+config SND_MESON_G12A_TOACODEC
+	tristate "Amlogic G12A To Internal DAC Control Support"
+	select SND_MESON_CODEC_GLUE
+	select REGMAP_MMIO
+	imply SND_SOC_MESON_T9015
+	help
+	  Select Y or M to add support for the internal audio DAC on the
+	  g12a SoC family
+
 config SND_MESON_G12A_TOHDMITX
 	tristate "Amlogic G12A To HDMI TX Control Support"
 	select REGMAP_MMIO
sound/soc/meson/Makefile +2 -0
index 3c9d48846816..e446bc980481 100644
@@ -22,6 +22,7 @@ snd-soc-meson-axg-pdm-objs := axg-pdm.o
 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-toacodec-objs := g12a-toacodec.o
 snd-soc-meson-g12a-tohdmitx-objs := g12a-tohdmitx.o
 snd-soc-meson-t9015-objs := t9015.o
 
@@ -40,5 +41,6 @@ obj-$(CONFIG_SND_MESON_AXG_PDM) += snd-soc-meson-axg-pdm.o
 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_TOACODEC) += snd-soc-meson-g12a-toacodec.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/g12a-toacodec.c new file +252 -0

252 lines not on this page · raw message

Signature · 1 line
2.24.1
maintainer
#3 lore raw

Applied "ASoC: meson: g12a: add internal DAC glue driver" to the asoc tree

The patch

ASoC: meson: g12a: add internal DAC glue driver

has been applied to the asoc tree at

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

From af2618a2eee8531e134c42194143c2f4faef94ba Mon Sep 17 00:00:00 2001
From: Jerome Brunet <[email protected]>
Date: Fri, 21 Feb 2020 16:36:06 +0100
Subject: [PATCH] ASoC: meson: g12a: add internal DAC glue driver

Add support for the internal audio DAC glue found on the Amlogic g12a and sm1 SoC families. This allows to connect the TDM outputs of the SoC to the internal t9015 audio DAC.

---
 sound/soc/meson/Kconfig         |   9 ++
 sound/soc/meson/Makefile        |   2 +
 sound/soc/meson/g12a-toacodec.c | 252 ++++++++++++++++++++++++++++++++
 3 files changed, 263 insertions(+)
 create mode 100644 sound/soc/meson/g12a-toacodec.c
sound/soc/meson/Kconfig +9 -0
index d27e9180b453..8b6295283989 100644
@@ -109,6 +109,15 @@ config SND_MESON_GX_SOUND_CARD
 	help
 	  Select Y or M to add support for the GXBB/GXL SoC sound card
 
+config SND_MESON_G12A_TOACODEC
+	tristate "Amlogic G12A To Internal DAC Control Support"
+	select SND_MESON_CODEC_GLUE
+	select REGMAP_MMIO
+	imply SND_SOC_MESON_T9015
+	help
+	  Select Y or M to add support for the internal audio DAC on the
+	  g12a SoC family
+
 config SND_MESON_G12A_TOHDMITX
 	tristate "Amlogic G12A To HDMI TX Control Support"
 	select REGMAP_MMIO
sound/soc/meson/Makefile +2 -0
index 3c9d48846816..e446bc980481 100644
@@ -22,6 +22,7 @@ snd-soc-meson-axg-pdm-objs := axg-pdm.o
 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-toacodec-objs := g12a-toacodec.o
 snd-soc-meson-g12a-tohdmitx-objs := g12a-tohdmitx.o
 snd-soc-meson-t9015-objs := t9015.o
 
@@ -40,5 +41,6 @@ obj-$(CONFIG_SND_MESON_AXG_PDM) += snd-soc-meson-axg-pdm.o
 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_TOACODEC) += snd-soc-meson-g12a-toacodec.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/g12a-toacodec.c new file +252 -0

252 lines not on this page · raw message

Signature · 1 line
2.20.1
author maintainer
#4 lore raw

PATCH v2 3/3 ASoC: meson: axg-card: add toacodec support

In reply to Jerome Brunet

Make sure the axg audio card driver recognise the dai_link as a codec-to-codec link if the cpu dai is the internal dac glue.

---
 sound/soc/meson/axg-card.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
sound/soc/meson/axg-card.c +2 -1
index 372dc696cc8e..48651631bdcf 100644
@@ -303,7 +303,8 @@ static int axg_card_cpu_is_tdm_iface(struct device_node *np)
 
 static int axg_card_cpu_is_codec(struct device_node *np)
 {
-	return of_device_is_compatible(np, DT_PREFIX "g12a-tohdmitx");
+	return of_device_is_compatible(np, DT_PREFIX "g12a-tohdmitx") ||
+		of_device_is_compatible(np, DT_PREFIX "g12a-toacodec");
 }
 
 static int axg_card_add_link(struct snd_soc_card *card, struct device_node *np,
Signature · 7 lines
2.24.1


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
#5 lore raw
In reply to Jerome Brunet
This series was applied to khilman/linux-amlogic.git (refs/heads/for-next).

Hello:

This series was applied to khilman/linux-amlogic.git (refs/heads/for-next).

Quoted 8 lines · On Fri, 21 Feb 2020 16:36:04 +0100 you wrote:

Like the gxl, the Amlogic g12a and sm1 SoC families have a t9015 internal audio DAC. On these more recent SoCs, any of the 3 TDM outputs can be routed to the internal DAC. This routing is done by a small glue device called 'toacodec'. This patchset adds support for it.

This was tested on the amlogic reference design g12a-u200.

[...]

Here is a summary with links:
- [v2,1/3] ASoC: meson: g12a: add toacodec dt-binding documentation

    https://git.kernel.org/khilman/linux-amlogic/c/bd56e593da19de22284951c33ce5c419258171bf
  - [v2,2/3] ASoC: meson: g12a: add internal DAC glue driver
    https://git.kernel.org/khilman/linux-amlogic/c/af2618a2eee8531e134c42194143c2f4faef94ba
  - [v2,3/3] ASoC: meson: axg-card: add toacodec support
    https://git.kernel.org/khilman/linux-amlogic/c/b38c4a8a0291c31a660cd77761202ebb18332fb7

You are awesome, thank you!

Signature · 7 lines
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/pwbot

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic