Skip to contentSkip to conversation

Unify NVIDIA Tegra ASoC machine drivers

PATCH Superseded Dmitry Osipenko 4 participants 14 messages May 23, 2021 – May 25, 2021

Subsystems (3)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v3 cover Unify NVIDIA Tegra ASoC machine drivers

During review of the RT5631 machine driver, Jon Hunter suggested that it will be better to squash all the current ASoC machine drivers into a single one. This suggestion is implemented by this patchset. The RT5631 support will come later with the ASUS Transformer changes.

This series needs to be approved by Jaroslav Kysela before it can be merged.

Changelog:

v3: - Added components string as was suggested by Jaroslav Kysela to v2.

- Renamed MCLK rate function that is used by max98090 and other codecs to make it look more generic. Added option for specifying CLK ID per device. This all was suggested by Jon Hunter to v2.

v2: - Dropped use of of_device_compatible_match(), like it was suggested
by Rob Herring in a review comment to v1.

- Added patch that sets card's driver_name of as Tegra ASoC drivers. In a comment to v1 Jaroslav Kysela suggested that the Tegra drivers don't set the card name properly and he was right.

I opened pull request with the new Tegra UCMs and updated lookup paths for older UCMs [1].

[1] https://github.com/alsa-project/alsa-ucm-conf/pull/92

Dmitry Osipenko (4):
ASoC: tegra: Set driver_name=tegra for all machine drivers
ASoC: tegra: Unify ASoC machine drivers
ASoC: tegra: Specify components string for each card
ASoC: tegra: Specify components string for Nexus 7

 sound/soc/tegra/Kconfig              |  12 +
 sound/soc/tegra/Makefile             |  18 +-
 sound/soc/tegra/tegra_alc5632.c      | 259 ---------
 sound/soc/tegra/tegra_asoc_machine.c | 761 +++++++++++++++++++++++++++
 sound/soc/tegra/tegra_asoc_machine.h |  47 ++
 sound/soc/tegra/tegra_max98090.c     | 276 ----------
 sound/soc/tegra/tegra_rt5640.c       | 222 --------
 sound/soc/tegra/tegra_rt5677.c       | 324 ------------
 sound/soc/tegra/tegra_sgtl5000.c     | 211 --------
 sound/soc/tegra/tegra_wm8753.c       | 185 -------
 sound/soc/tegra/tegra_wm8903.c       | 358 +++----------
 sound/soc/tegra/tegra_wm9712.c       | 166 ------
 sound/soc/tegra/trimslice.c          | 172 ------
 13 files changed, 894 insertions(+), 2117 deletions(-)
 delete mode 100644 sound/soc/tegra/tegra_alc5632.c
 create mode 100644 sound/soc/tegra/tegra_asoc_machine.c
 create mode 100644 sound/soc/tegra/tegra_asoc_machine.h
 delete mode 100644 sound/soc/tegra/tegra_max98090.c
 delete mode 100644 sound/soc/tegra/tegra_rt5640.c
 delete mode 100644 sound/soc/tegra/tegra_rt5677.c
 delete mode 100644 sound/soc/tegra/tegra_sgtl5000.c
 delete mode 100644 sound/soc/tegra/tegra_wm8753.c
 delete mode 100644 sound/soc/tegra/tegra_wm9712.c
 delete mode 100644 sound/soc/tegra/trimslice.c
Signature · 1 line
2.30.2
#1 lore raw

PATCH v3 1/4 ASoC: tegra: Set driver_name=tegra for all machine drivers

The driver_name="tegra" is now required by the newer ALSA UCMs, otherwise Tegra UCMs don't match by the path/name.

All Tegra machine drivers are specifying the card's name, but it has no effect if model name is specified in the device-tree since it overrides the card's name. We need to set the driver_name to "tegra" in order to get a usable lookup path for the updated ALSA UCMs. The new UCM lookup path has a form of driver_name/card_name.

The old lookup paths that are based on driver module name continue to work as before. Note that UCM matching never worked for Tegra ASoC drivers if they were compiled as built-in, this is fixed by supporting the new naming scheme.

---
 sound/soc/tegra/tegra_alc5632.c  | 1 +
 sound/soc/tegra/tegra_max98090.c | 1 +
 sound/soc/tegra/tegra_rt5640.c   | 1 +
 sound/soc/tegra/tegra_rt5677.c   | 1 +
 sound/soc/tegra/tegra_sgtl5000.c | 1 +
 sound/soc/tegra/tegra_wm8753.c   | 1 +
 sound/soc/tegra/tegra_wm8903.c   | 1 +
 sound/soc/tegra/tegra_wm9712.c   | 1 +
 sound/soc/tegra/trimslice.c      | 1 +
 9 files changed, 9 insertions(+)
sound/soc/tegra/tegra_alc5632.c +1 -0
index 0a0efd24e4b0..81ea6ceba689 100644
@@ -139,6 +139,7 @@ static struct snd_soc_dai_link tegra_alc5632_dai = {
 
 static struct snd_soc_card snd_soc_tegra_alc5632 = {
 	.name = "tegra-alc5632",
+	.driver_name = "tegra",
 	.owner = THIS_MODULE,
 	.dai_link = &tegra_alc5632_dai,
 	.num_links = 1,
sound/soc/tegra/tegra_max98090.c +1 -0
index 00c19704057b..5a649810c0c8 100644
@@ -182,6 +182,7 @@ static struct snd_soc_dai_link tegra_max98090_dai = {
 
 static struct snd_soc_card snd_soc_tegra_max98090 = {
 	.name = "tegra-max98090",
+	.driver_name = "tegra",
 	.owner = THIS_MODULE,
 	.dai_link = &tegra_max98090_dai,
 	.num_links = 1,
sound/soc/tegra/tegra_rt5640.c +1 -0
index 9afba37a3b08..3344f16258be 100644
@@ -132,6 +132,7 @@ static struct snd_soc_dai_link tegra_rt5640_dai = {
 
 static struct snd_soc_card snd_soc_tegra_rt5640 = {
 	.name = "tegra-rt5640",
+	.driver_name = "tegra",
 	.owner = THIS_MODULE,
 	.dai_link = &tegra_rt5640_dai,
 	.num_links = 1,
sound/soc/tegra/tegra_rt5677.c +1 -0
index d30f8b6deda4..0f03e97d9355 100644
@@ -175,6 +175,7 @@ static struct snd_soc_dai_link tegra_rt5677_dai = {
 
 static struct snd_soc_card snd_soc_tegra_rt5677 = {
 	.name = "tegra-rt5677",
+	.driver_name = "tegra",
 	.owner = THIS_MODULE,
 	.dai_link = &tegra_rt5677_dai,
 	.num_links = 1,
sound/soc/tegra/tegra_sgtl5000.c +1 -0
index 885332170c77..ef6a553e0b7d 100644
@@ -97,6 +97,7 @@ static struct snd_soc_dai_link tegra_sgtl5000_dai = {
 
 static struct snd_soc_card snd_soc_tegra_sgtl5000 = {
 	.name = "tegra-sgtl5000",
+	.driver_name = "tegra",
 	.owner = THIS_MODULE,
 	.dai_link = &tegra_sgtl5000_dai,
 	.num_links = 1,
sound/soc/tegra/tegra_wm8753.c +1 -0
index efd793886689..27089077f2ea 100644
@@ -101,6 +101,7 @@ static struct snd_soc_dai_link tegra_wm8753_dai = {
 
 static struct snd_soc_card snd_soc_tegra_wm8753 = {
 	.name = "tegra-wm8753",
+	.driver_name = "tegra",
 	.owner = THIS_MODULE,
 	.dai_link = &tegra_wm8753_dai,
 	.num_links = 1,
sound/soc/tegra/tegra_wm8903.c +1 -0
index e4863fa37b0c..f219c26d66a3 100644
@@ -235,6 +235,7 @@ static struct snd_soc_dai_link tegra_wm8903_dai = {
 
 static struct snd_soc_card snd_soc_tegra_wm8903 = {
 	.name = "tegra-wm8903",
+	.driver_name = "tegra",
 	.owner = THIS_MODULE,
 	.dai_link = &tegra_wm8903_dai,
 	.num_links = 1,
sound/soc/tegra/tegra_wm9712.c +1 -0
index 4f09a178049d..c66da161c85a 100644
@@ -54,6 +54,7 @@ static struct snd_soc_dai_link tegra_wm9712_dai = {
 
 static struct snd_soc_card snd_soc_tegra_wm9712 = {
 	.name = "tegra-wm9712",
+	.driver_name = "tegra",
 	.owner = THIS_MODULE,
 	.dai_link = &tegra_wm9712_dai,
 	.num_links = 1,
sound/soc/tegra/trimslice.c +1 -0
index 6c1cc3d0ac33..cb4c8f72e4e6 100644
@@ -94,6 +94,7 @@ static struct snd_soc_dai_link trimslice_tlv320aic23_dai = {
 
 static struct snd_soc_card snd_soc_trimslice = {
 	.name = "tegra-trimslice",
+	.driver_name = "tegra",
 	.owner = THIS_MODULE,
 	.dai_link = &trimslice_tlv320aic23_dai,
 	.num_links = 1,
Signature · 1 line
2.30.2
#2 lore raw

PATCH v3 2/4 ASoC: tegra: Unify ASoC machine drivers

In reply to Dmitry Osipenko

Squash all machine drivers into a single-universal one. This reduces code duplication, eases addition of a new drivers and upgrades older code to a modern Linux kernel APIs.

---
 sound/soc/tegra/Kconfig              |  12 +
 sound/soc/tegra/Makefile             |  18 +-
 sound/soc/tegra/tegra_alc5632.c      | 260 ----------
 sound/soc/tegra/tegra_asoc_machine.c | 733 +++++++++++++++++++++++++++
 sound/soc/tegra/tegra_asoc_machine.h |  46 ++
 sound/soc/tegra/tegra_max98090.c     | 277 ----------
 sound/soc/tegra/tegra_rt5640.c       | 223 --------
 sound/soc/tegra/tegra_rt5677.c       | 325 ------------
 sound/soc/tegra/tegra_sgtl5000.c     | 212 --------
 sound/soc/tegra/tegra_wm8753.c       | 186 -------
 sound/soc/tegra/tegra_wm8903.c       | 358 +++----------
 sound/soc/tegra/tegra_wm9712.c       | 167 ------
 sound/soc/tegra/trimslice.c          | 173 -------
 13 files changed, 864 insertions(+), 2126 deletions(-)
 delete mode 100644 sound/soc/tegra/tegra_alc5632.c
 create mode 100644 sound/soc/tegra/tegra_asoc_machine.c
 create mode 100644 sound/soc/tegra/tegra_asoc_machine.h
 delete mode 100644 sound/soc/tegra/tegra_max98090.c
 delete mode 100644 sound/soc/tegra/tegra_rt5640.c
 delete mode 100644 sound/soc/tegra/tegra_rt5677.c
 delete mode 100644 sound/soc/tegra/tegra_sgtl5000.c
 delete mode 100644 sound/soc/tegra/tegra_wm8753.c
 delete mode 100644 sound/soc/tegra/tegra_wm9712.c
 delete mode 100644 sound/soc/tegra/trimslice.c
sound/soc/tegra/Kconfig +12 -0
index a4e6760944d0..83c87f35a7d3 100644
@@ -117,9 +117,13 @@ config SND_SOC_TEGRA_AUDIO_GRAPH_CARD
 	  few things for Tegra audio. Most of the code is re-used from
 	  audio graph driver and the same DT bindings are used.
 
+config SND_SOC_TEGRA_MACHINE_DRV
+	tristate
+
 config SND_SOC_TEGRA_RT5640
 	tristate "SoC Audio support for Tegra boards using an RT5640 codec"
 	depends on I2C && GPIOLIB
+	select SND_SOC_TEGRA_MACHINE_DRV
 	select SND_SOC_RT5640
 	help
 	  Say Y or M here if you want to add support for SoC audio on Tegra
@@ -128,6 +132,7 @@ config SND_SOC_TEGRA_RT5640
 config SND_SOC_TEGRA_WM8753
 	tristate "SoC Audio support for Tegra boards using a WM8753 codec"
 	depends on I2C && GPIOLIB
+	select SND_SOC_TEGRA_MACHINE_DRV
 	select SND_SOC_WM8753
 	help
 	  Say Y or M here if you want to add support for SoC audio on Tegra
@@ -136,6 +141,7 @@ config SND_SOC_TEGRA_WM8753
 config SND_SOC_TEGRA_WM8903
 	tristate "SoC Audio support for Tegra boards using a WM8903 codec"
 	depends on I2C && GPIOLIB
+	select SND_SOC_TEGRA_MACHINE_DRV
 	select SND_SOC_WM8903
 	help
 	  Say Y or M here if you want to add support for SoC audio on Tegra
@@ -145,6 +151,7 @@ config SND_SOC_TEGRA_WM8903
 config SND_SOC_TEGRA_WM9712
 	tristate "SoC Audio support for Tegra boards using a WM9712 codec"
 	depends on GPIOLIB
+	select SND_SOC_TEGRA_MACHINE_DRV
 	select SND_SOC_TEGRA20_AC97
 	select SND_SOC_WM9712
 	help
@@ -154,6 +161,7 @@ config SND_SOC_TEGRA_WM9712
 config SND_SOC_TEGRA_TRIMSLICE
 	tristate "SoC Audio support for TrimSlice board"
 	depends on I2C
+	select SND_SOC_TEGRA_MACHINE_DRV
 	select SND_SOC_TLV320AIC23_I2C
 	help
 	  Say Y or M here if you want to add support for SoC audio on the
@@ -162,6 +170,7 @@ config SND_SOC_TEGRA_TRIMSLICE
 config SND_SOC_TEGRA_ALC5632
 	tristate "SoC Audio support for Tegra boards using an ALC5632 codec"
 	depends on I2C && GPIOLIB
+	select SND_SOC_TEGRA_MACHINE_DRV
 	select SND_SOC_ALC5632
 	help
 	  Say Y or M here if you want to add support for SoC audio on the
@@ -170,6 +179,7 @@ config SND_SOC_TEGRA_ALC5632
 config SND_SOC_TEGRA_MAX98090
 	tristate "SoC Audio support for Tegra boards using a MAX98090 codec"
 	depends on I2C && GPIOLIB
+	select SND_SOC_TEGRA_MACHINE_DRV
 	select SND_SOC_MAX98090
 	help
 	  Say Y or M here if you want to add support for SoC audio on Tegra
@@ -178,6 +188,7 @@ config SND_SOC_TEGRA_MAX98090
 config SND_SOC_TEGRA_RT5677
 	tristate "SoC Audio support for Tegra boards using a RT5677 codec"
 	depends on I2C && GPIOLIB
+	select SND_SOC_TEGRA_MACHINE_DRV
 	select SND_SOC_RT5677
 	help
 	  Say Y or M here if you want to add support for SoC audio on Tegra
@@ -186,6 +197,7 @@ config SND_SOC_TEGRA_RT5677
 config SND_SOC_TEGRA_SGTL5000
 	tristate "SoC Audio support for Tegra boards using a SGTL5000 codec"
 	depends on I2C && GPIOLIB
+	select SND_SOC_TEGRA_MACHINE_DRV
 	select SND_SOC_SGTL5000
 	help
 	  Say Y or M here if you want to add support for SoC audio on Tegra
sound/soc/tegra/Makefile +2 -16
index b17dd6eef92a..b930ea7c75f1 100644
@@ -29,24 +29,10 @@ obj-$(CONFIG_SND_SOC_TEGRA186_DSPK) += snd-soc-tegra186-dspk.o
 obj-$(CONFIG_SND_SOC_TEGRA210_ADMAIF) += snd-soc-tegra210-admaif.o
 
 # Tegra machine Support
-snd-soc-tegra-rt5640-objs := tegra_rt5640.o
-snd-soc-tegra-rt5677-objs := tegra_rt5677.o
-snd-soc-tegra-wm8753-objs := tegra_wm8753.o
 snd-soc-tegra-wm8903-objs := tegra_wm8903.o
-snd-soc-tegra-wm9712-objs := tegra_wm9712.o
-snd-soc-tegra-trimslice-objs := trimslice.o
-snd-soc-tegra-alc5632-objs := tegra_alc5632.o
-snd-soc-tegra-max98090-objs := tegra_max98090.o
-snd-soc-tegra-sgtl5000-objs := tegra_sgtl5000.o
+snd-soc-tegra-machine-objs := tegra_asoc_machine.o
 snd-soc-tegra-audio-graph-card-objs := tegra_audio_graph_card.o
 
-obj-$(CONFIG_SND_SOC_TEGRA_RT5640) += snd-soc-tegra-rt5640.o
-obj-$(CONFIG_SND_SOC_TEGRA_RT5677) += snd-soc-tegra-rt5677.o
-obj-$(CONFIG_SND_SOC_TEGRA_WM8753) += snd-soc-tegra-wm8753.o
 obj-$(CONFIG_SND_SOC_TEGRA_WM8903) += snd-soc-tegra-wm8903.o
-obj-$(CONFIG_SND_SOC_TEGRA_WM9712) += snd-soc-tegra-wm9712.o
-obj-$(CONFIG_SND_SOC_TEGRA_TRIMSLICE) += snd-soc-tegra-trimslice.o
-obj-$(CONFIG_SND_SOC_TEGRA_ALC5632) += snd-soc-tegra-alc5632.o
-obj-$(CONFIG_SND_SOC_TEGRA_MAX98090) += snd-soc-tegra-max98090.o
-obj-$(CONFIG_SND_SOC_TEGRA_SGTL5000) += snd-soc-tegra-sgtl5000.o
+obj-$(CONFIG_SND_SOC_TEGRA_MACHINE_DRV) += snd-soc-tegra-machine.o
 obj-$(CONFIG_SND_SOC_TEGRA_AUDIO_GRAPH_CARD) += snd-soc-tegra-audio-graph-card.o
sound/soc/tegra/tegra_alc5632.c deleted +0 -260

260 lines not on this page · raw message

sound/soc/tegra/tegra_asoc_machine.c new file +733 -0

733 lines not on this page · raw message

sound/soc/tegra/tegra_asoc_machine.h new file +46 -0

46 lines not on this page · raw message

sound/soc/tegra/tegra_max98090.c deleted +0 -277

277 lines not on this page · raw message

sound/soc/tegra/tegra_rt5640.c deleted +0 -223

223 lines not on this page · raw message

sound/soc/tegra/tegra_rt5677.c deleted +0 -325

325 lines not on this page · raw message

sound/soc/tegra/tegra_sgtl5000.c deleted +0 -212

212 lines not on this page · raw message

sound/soc/tegra/tegra_wm8753.c deleted +0 -186

186 lines not on this page · raw message

sound/soc/tegra/tegra_wm8903.c +71 -287

427 lines not on this page · raw message

sound/soc/tegra/tegra_wm9712.c deleted +0 -167

167 lines not on this page · raw message

sound/soc/tegra/trimslice.c deleted +0 -173

49 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.30.2

Part of the diff is not shown here. View the raw message.

#3 lore raw

Re: [PATCH v3 2/4] ASoC: tegra: Unify ASoC machine drivers

I love your patch! Yet something to improve:

Hi Dmitry,

I love your patch! Yet something to improve:

[auto build test ERROR on tegra/for-next]
[also build test ERROR on v5.13-rc3 next-20210521]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Dmitry-Osipenko/Unify-NVIDIA-Tegra-ASoC-machine-drivers/20210524-074623
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux.git for-next
config: powerpc64-randconfig-r013-20210524 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 93d1e5822ed64abd777eb94ea9899e96c4c39fbe)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install powerpc64 cross compiling tool for clang build
# apt-get install binutils-powerpc64-linux-gnu
# https://github.com/0day-ci/linux/commit/ff26440d1eb7f190888e3a7256210fe9da2ddf47
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Dmitry-Osipenko/Unify-NVIDIA-Tegra-ASoC-machine-drivers/20210524-074623 git checkout ff26440d1eb7f190888e3a7256210fe9da2ddf47
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc64

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

In file included from sound/soc/tegra/tegra_asoc_machine.c:18:
In file included from include/sound/soc.h:18:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:10:
In file included from arch/powerpc/include/asm/hardirq.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:619:
arch/powerpc/include/asm/io-defs.h:45:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] DEF_PCI_AC_NORET(insw, (unsigned long p, void *b, unsigned long c), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'

                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:178:1: note: expanded from here
   __do_insw
   ^
   arch/powerpc/include/asm/io.h:557:56: note: expanded from macro '__do_insw'
   #define __do_insw(p, b, n)      readsw((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
                                          ~~~~~~~~~~~~~~~~~~~~~^
   In file included from sound/soc/tegra/tegra_asoc_machine.c:18:
   In file included from include/sound/soc.h:18:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:47:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(insl, (unsigned long p, void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:180:1: note: expanded from here
   __do_insl
   ^
   arch/powerpc/include/asm/io.h:558:56: note: expanded from macro '__do_insl'
   #define __do_insl(p, b, n)      readsl((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
                                          ~~~~~~~~~~~~~~~~~~~~~^
   In file included from sound/soc/tegra/tegra_asoc_machine.c:18:
   In file included from include/sound/soc.h:18:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:49:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(outsb, (unsigned long p, const void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:182:1: note: expanded from here
   __do_outsb
   ^
   arch/powerpc/include/asm/io.h:559:58: note: expanded from macro '__do_outsb'
   #define __do_outsb(p, b, n)     writesb((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
                                           ~~~~~~~~~~~~~~~~~~~~~^
   In file included from sound/soc/tegra/tegra_asoc_machine.c:18:
   In file included from include/sound/soc.h:18:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:51:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(outsw, (unsigned long p, const void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:184:1: note: expanded from here
   __do_outsw
   ^
   arch/powerpc/include/asm/io.h:560:58: note: expanded from macro '__do_outsw'
   #define __do_outsw(p, b, n)     writesw((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
                                           ~~~~~~~~~~~~~~~~~~~~~^
   In file included from sound/soc/tegra/tegra_asoc_machine.c:18:
   In file included from include/sound/soc.h:18:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:10:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:53:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(outsl, (unsigned long p, const void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:186:1: note: expanded from here
   __do_outsl
   ^
   arch/powerpc/include/asm/io.h:561:58: note: expanded from macro '__do_outsl'
   #define __do_outsl(p, b, n)     writesl((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
                                           ~~~~~~~~~~~~~~~~~~~~~^
>> sound/soc/tegra/tegra_asoc_machine.c:73:21: error: no member named 'dapm_event' in 'struct tegra_asoc_data'
           if (machine->asoc->dapm_event) {
               ~~~~~~~~~~~~~  ^
   sound/soc/tegra/tegra_asoc_machine.c:74:28: error: no member named 'dapm_event' in 'struct tegra_asoc_data'
                   int ret = machine->asoc->dapm_event(w, k, event);
                             ~~~~~~~~~~~~~  ^

12 warnings and 2 errors generated.

vim +73 sound/soc/tegra/tegra_asoc_machine.c

    66	
    67	static int tegra_machine_event(struct snd_soc_dapm_widget *w,
    68				       struct snd_kcontrol *k, int event)
    69	{
    70		struct snd_soc_dapm_context *dapm = w->dapm;
    71		struct tegra_machine *machine = snd_soc_card_get_drvdata(dapm->card);
    72	
  > 73		if (machine->asoc->dapm_event) {
    74			int ret = machine->asoc->dapm_event(w, k, event);
    75			if (ret <= 0)
    76				return ret;
    77		}
    78	
    79		if (!strcmp(w->name, "Int Spk") || !strcmp(w->name, "Speakers"))
    80			gpiod_set_value_cansleep(machine->gpiod_spkr_en,
    81						 SND_SOC_DAPM_EVENT_ON(event));
    82	
    83		if (!strcmp(w->name, "Mic Jack"))
    84			gpiod_set_value_cansleep(machine->gpiod_ext_mic_en,
    85						 SND_SOC_DAPM_EVENT_ON(event));
    86	
    87		if (!strcmp(w->name, "Int Mic"))
    88			gpiod_set_value_cansleep(machine->gpiod_int_mic_en,
    89						 SND_SOC_DAPM_EVENT_ON(event));
    90	
    91		if (!strcmp(w->name, "Headphone") || !strcmp(w->name, "Headphone Jack"))
    92			gpiod_set_value_cansleep(machine->gpiod_hp_mute,
    93						 !SND_SOC_DAPM_EVENT_ON(event));
    94	
    95		return 0;
    96	}
    97	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#4 lore raw

Re: [PATCH v3 2/4] ASoC: tegra: Unify ASoC machine drivers

24.05.2021 05:34, kernel test robot пишет:

Quoted 7 lines
    66	
    67	static int tegra_machine_event(struct snd_soc_dapm_widget *w,
    68				       struct snd_kcontrol *k, int event)
    69	{
    70		struct snd_soc_dapm_context *dapm = w->dapm;
    71		struct tegra_machine *machine = snd_soc_card_get_drvdata(dapm->card);
    72	
Quoted 5 lines
Quoted 1 line

73 if (machine->asoc->dapm_event) {

    74			int ret = machine->asoc->dapm_event(w, k, event);
    75			if (ret <= 0)
    76				return ret;
    77		}

That dapm_event hook indeed shouldn't belong to this patch. I changed my build scripts to compile-test sound drivers. This will be fixed in v4.

#5 lore raw

PATCH v3 3/4 ASoC: tegra: Specify components string for each card

In reply to Dmitry Osipenko

Specify components string for each card of each supported device. It's a free form string that describes audio hardware configuration. This information is useful for ALSA UCM rules. It allows to generalize UCM rules, potentially removing a need to add new UCM rule for each device.

This patch also adds asoc->components hook that allows to specify components description per device.

---
 sound/soc/tegra/tegra_asoc_machine.c | 9 +++++++++
 sound/soc/tegra/tegra_asoc_machine.h | 1 +
 sound/soc/tegra/tegra_wm8903.c       | 1 +
 3 files changed, 11 insertions(+)
sound/soc/tegra/tegra_asoc_machine.c +9 -0
index 17579decceda..a81f2ebfc00c 100644
@@ -399,6 +399,8 @@ int tegra_asoc_machine_probe(struct platform_device *pdev)
 
 	if (asoc->add_common_snd_ops)
 		card->dai_link->ops = &tegra_machine_snd_ops;
+	if (asoc->components)
+		card->components = asoc->components;
 
 	if (!card->owner)
 		card->owner = THIS_MODULE;
@@ -434,6 +436,7 @@ static struct snd_soc_dai_link tegra_wm8753_dai = {
 };
 
 static struct snd_soc_card snd_soc_tegra_wm8753 = {
+	.components = "codec:wm8753",
 	.dai_link = &tegra_wm8753_dai,
 	.num_links = 1,
 	.fully_routed = true,
@@ -466,6 +469,7 @@ static struct snd_soc_dai_link tegra_wm9712_dai = {
 };
 
 static struct snd_soc_card snd_soc_tegra_wm9712 = {
+	.components = "codec:wm9712",
 	.dai_link = &tegra_wm9712_dai,
 	.num_links = 1,
 	.fully_routed = true,
@@ -527,6 +531,7 @@ static struct snd_soc_dai_link tegra_sgtl5000_dai = {
 };
 
 static struct snd_soc_card snd_soc_tegra_sgtl5000 = {
+	.components = "codec:sgtl5000",
 	.dai_link = &tegra_sgtl5000_dai,
 	.num_links = 1,
 	.fully_routed = true,
@@ -569,6 +574,7 @@ static struct snd_soc_dai_link tegra_tlv320aic23_dai = {
 };
 
 static struct snd_soc_card snd_soc_tegra_trimslice = {
+	.components = "codec:tlv320aic23",
 	.dai_link = &tegra_tlv320aic23_dai,
 	.num_links = 1,
 	.dapm_widgets = trimslice_dapm_widgets,
@@ -616,6 +622,7 @@ static struct snd_soc_dai_link tegra_rt5677_dai = {
 };
 
 static struct snd_soc_card snd_soc_tegra_rt5677 = {
+	.components = "codec:rt5677",
 	.dai_link = &tegra_rt5677_dai,
 	.num_links = 1,
 	.fully_routed = true,
@@ -649,6 +656,7 @@ static struct snd_soc_dai_link tegra_rt5640_dai = {
 };
 
 static struct snd_soc_card snd_soc_tegra_rt5640 = {
+	.components = "codec:rt5640",
 	.dai_link = &tegra_rt5640_dai,
 	.num_links = 1,
 	.fully_routed = true,
@@ -681,6 +689,7 @@ static struct snd_soc_dai_link tegra_rt5632_dai = {
 };
 
 static struct snd_soc_card snd_soc_tegra_rt5632 = {
+	.components = "codec:rt5632",
 	.dai_link = &tegra_rt5632_dai,
 	.num_links = 1,
 	.fully_routed = true,
sound/soc/tegra/tegra_asoc_machine.h +1 -0
index 080c1a26073a..fa325bfb2c8a 100644
@@ -15,6 +15,7 @@ struct snd_soc_pcm_runtime;
 struct tegra_asoc_data {
 	unsigned int (*mclk_rate)(unsigned int srate);
 	struct snd_soc_card *card;
+	const char *components;
 	unsigned int mclk_id;
 	bool hp_jack_gpio_active_low;
 	bool add_common_dapm_widgets;
sound/soc/tegra/tegra_wm8903.c +1 -0
index a3ec1f50bcb8..3f4f582fb02f 100644
@@ -108,6 +108,7 @@ static struct snd_soc_dai_link tegra_wm8903_dai = {
 };
 
 static struct snd_soc_card snd_soc_tegra_wm8903 = {
+	.components = "codec:wm8903",
 	.owner = THIS_MODULE,
 	.dai_link = &tegra_wm8903_dai,
 	.num_links = 1,
Signature · 1 line
2.30.2
maintainer Acked-by on v3 3/4
#6 lore raw

Re: [PATCH v3 3/4] ASoC: tegra: Specify components string for each card

Dne 24. 05. 21 v 1:44 Dmitry Osipenko napsal(a):

Quoted 10 lines

Specify components string for each card of each supported device. It's a free form string that describes audio hardware configuration. This information is useful for ALSA UCM rules. It allows to generalize UCM rules, potentially removing a need to add new UCM rule for each device.

This patch also adds asoc->components hook that allows to specify components description per device.

Signature · 2 lines
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
#7 lore raw

PATCH v3 4/4 ASoC: tegra: Specify components string for Nexus 7

In reply to Dmitry Osipenko

Specify components string for Nexus 7 using the Intel BayTrail components format. This may allow us to create a more generic UCM for RT5640 codec.

---
 sound/soc/tegra/tegra_asoc_machine.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
sound/soc/tegra/tegra_asoc_machine.c +19 -0
index a81f2ebfc00c..87e0a47040a5 100644
@@ -671,6 +671,24 @@ static const struct tegra_asoc_data tegra_rt5640_data = {
 	.add_hp_jack = true,
 };
 
+/*
+ * Speaker: Connected to SPO L/R P/N pins, stereo.
+ * Internal Microphone: Digital, connected to DMIC1_DAT IN2P/N pins.
+ * Headphones: Connected to HPOL/R pins.
+ * Headset Microphone: Unconnected.
+ *
+ * IF2_DAC/ADC are unpopulated.
+ */
+static const struct tegra_asoc_data tegra_rt5640_grouper_data = {
+	.components = "codec:rt5640 cfg-spk:2 cfg-mic:dmic1 aif:1",
+	.mclk_rate = tegra_machine_mclk_rate_256,
+	.card = &snd_soc_tegra_rt5640,
+	.add_common_dapm_widgets = true,
+	.add_common_controls = true,
+	.add_common_snd_ops = true,
+	.add_hp_jack = true,
+};
+
 /* RT5632 machine */
 
 SND_SOC_DAILINK_DEFS(rt5632_hifi,
@@ -712,6 +730,7 @@ static const struct of_device_id tegra_machine_of_match[] = {
 	{ .compatible = "nvidia,tegra-audio-wm8753", .data = &tegra_wm8753_data },
 	{ .compatible = "nvidia,tegra-audio-rt5677", .data = &tegra_rt5677_data },
 	{ .compatible = "nvidia,tegra-audio-rt5640", .data = &tegra_rt5640_data },
+	{ .compatible = "nvidia,tegra-audio-rt5640-grouper", .data = &tegra_rt5640_grouper_data },
 	{ .compatible = "nvidia,tegra-audio-alc5632", .data = &tegra_rt5632_data },
 	{},
 };
Signature · 1 line
2.30.2
maintainer
#8 lore raw

Re: [PATCH v3 4/4] ASoC: tegra: Specify components string for Nexus 7

Dne 24. 05. 21 v 1:44 Dmitry Osipenko napsal(a):

Quoted 16 lines

Specify components string for Nexus 7 using the Intel BayTrail components format. This may allow us to create a more generic UCM for RT5640 codec.

---
 sound/soc/tegra/tegra_asoc_machine.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
sound/soc/tegra/tegra_asoc_machine.c +0 -0
index a81f2ebfc00c..87e0a47040a5 100644
@@ -671,6 +671,24 @@ static const struct tegra_asoc_data tegra_rt5640_data = {
 	.add_hp_jack = true,
 };
 

sound/soc/tegra/tegra_asoc_machine.c static const struct tegra_asoc_data tegra_rt5640_data = { · line 683

Quoted 10 lines
sound/soc/tegra/tegra_asoc_machine.c +10 -0
+/*
+ * Speaker: Connected to SPO L/R P/N pins, stereo.
+ * Internal Microphone: Digital, connected to DMIC1_DAT IN2P/N pins.
+ * Headphones: Connected to HPOL/R pins.
+ * Headset Microphone: Unconnected.
+ *
+ * IF2_DAC/ADC are unpopulated.
+ */
+static const struct tegra_asoc_data tegra_rt5640_grouper_data = {
+	.components = "codec:rt5640 cfg-spk:2 cfg-mic:dmic1 aif:1",

Perhaps, it may be better to handle this string via the DT config (create new function like snd_soc_of_parse_card_name()).

The "codec:rt5640" should be set in the driver (it's fixed), but the "cfg-spk:2 cfg-mic:dmic1 aif:1" part is suitable for the DT config.

Jaroslav

Signature · 2 lines
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
#9 lore raw

Re: [PATCH v3 4/4] ASoC: tegra: Specify components string for Nexus 7

24.05.2021 13:54, Jaroslav Kysela пишет:

Quoted 31 lines

Dne 24. 05. 21 v 1:44 Dmitry Osipenko napsal(a):

Quoted 16 lines

Specify components string for Nexus 7 using the Intel BayTrail components format. This may allow us to create a more generic UCM for RT5640 codec.

---
 sound/soc/tegra/tegra_asoc_machine.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
sound/soc/tegra/tegra_asoc_machine.c +0 -0
index a81f2ebfc00c..87e0a47040a5 100644
@@ -671,6 +671,24 @@ static const struct tegra_asoc_data tegra_rt5640_data = {
 	.add_hp_jack = true,
 };
 

sound/soc/tegra/tegra_asoc_machine.c static const struct tegra_asoc_data tegra_rt5640_data = { · line 683

Quoted 10 lines
sound/soc/tegra/tegra_asoc_machine.c +10 -0
+/*
+ * Speaker: Connected to SPO L/R P/N pins, stereo.
+ * Internal Microphone: Digital, connected to DMIC1_DAT IN2P/N pins.
+ * Headphones: Connected to HPOL/R pins.
+ * Headset Microphone: Unconnected.
+ *
+ * IF2_DAC/ADC are unpopulated.
+ */
+static const struct tegra_asoc_data tegra_rt5640_grouper_data = {
+	.components = "codec:rt5640 cfg-spk:2 cfg-mic:dmic1 aif:1",

Perhaps, it may be better to handle this string via the DT config (create new function like snd_soc_of_parse_card_name()).

Quoted 2 lines

The "codec:rt5640" should be set in the driver (it's fixed), but the "cfg-spk:2 cfg-mic:dmic1 aif:1" part is suitable for the DT config.

Not sure that this is possible. The DT is an ABI, while components string has no specification. Any changes to the components string will require DT update.

I think it's much more feasible to have a database of components within kernel driver, like Intel sound driver does it for ACPI devices.

maintainer
#10 lore raw

Re: [PATCH v3 4/4] ASoC: tegra: Specify components string for Nexus 7

Quoted 35 lines · Dmitry Osipenko

24.05.2021 13:54, Jaroslav Kysela пишет:

Quoted 31 lines

Dne 24. 05. 21 v 1:44 Dmitry Osipenko napsal(a):

Quoted 16 lines

Specify components string for Nexus 7 using the Intel BayTrail components format. This may allow us to create a more generic UCM for RT5640 codec.

---
 sound/soc/tegra/tegra_asoc_machine.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
sound/soc/tegra/tegra_asoc_machine.c +0 -0
index a81f2ebfc00c..87e0a47040a5 100644
@@ -671,6 +671,24 @@ static const struct tegra_asoc_data tegra_rt5640_data = {
 	.add_hp_jack = true,
 };
 

sound/soc/tegra/tegra_asoc_machine.c static const struct tegra_asoc_data tegra_rt5640_data = { · line 683

Quoted 10 lines
sound/soc/tegra/tegra_asoc_machine.c +10 -0
+/*
+ * Speaker: Connected to SPO L/R P/N pins, stereo.
+ * Internal Microphone: Digital, connected to DMIC1_DAT IN2P/N pins.
+ * Headphones: Connected to HPOL/R pins.
+ * Headset Microphone: Unconnected.
+ *
+ * IF2_DAC/ADC are unpopulated.
+ */
+static const struct tegra_asoc_data tegra_rt5640_grouper_data = {
+	.components = "codec:rt5640 cfg-spk:2 cfg-mic:dmic1 aif:1",

Perhaps, it may be better to handle this string via the DT config (create new function like snd_soc_of_parse_card_name()).

Quoted 2 lines

The "codec:rt5640" should be set in the driver (it's fixed), but the "cfg-spk:2 cfg-mic:dmic1 aif:1" part is suitable for the DT config.

Quoted 6 lines

Not sure that this is possible. The DT is an ABI, while components string has no specification. Any changes to the components string will require DT update.

I think it's much more feasible to have a database of components within kernel driver, like Intel sound driver does it for ACPI devices.

There is no other possibility for ACPI. And while the components string is part of the ALSA ABI, it should not be changed in an incompatible way. Only new information should be added. The DT solution seems more flexible to me. For example the stereo/mono speaker or the AIF number can be set without the driver modification for rt5640.

Jaroslav

Signature · 2 lines
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
#11 lore raw

Re: [PATCH v3 4/4] ASoC: tegra: Specify components string for Nexus 7

25.05.2021 19:24, Jaroslav Kysela пишет:

Quoted 40 lines · Dmitry Osipenko
Quoted 39 lines

24.05.2021 13:54, Jaroslav Kysela пишет:

Quoted 31 lines

Dne 24. 05. 21 v 1:44 Dmitry Osipenko napsal(a):

Quoted 16 lines

Specify components string for Nexus 7 using the Intel BayTrail components format. This may allow us to create a more generic UCM for RT5640 codec.

---
 sound/soc/tegra/tegra_asoc_machine.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
sound/soc/tegra/tegra_asoc_machine.c +0 -0
index a81f2ebfc00c..87e0a47040a5 100644
@@ -671,6 +671,24 @@ static const struct tegra_asoc_data tegra_rt5640_data = {
 	.add_hp_jack = true,
 };
 

sound/soc/tegra/tegra_asoc_machine.c static const struct tegra_asoc_data tegra_rt5640_data = { · line 683

Quoted 10 lines
sound/soc/tegra/tegra_asoc_machine.c +10 -0
+/*
+ * Speaker: Connected to SPO L/R P/N pins, stereo.
+ * Internal Microphone: Digital, connected to DMIC1_DAT IN2P/N pins.
+ * Headphones: Connected to HPOL/R pins.
+ * Headset Microphone: Unconnected.
+ *
+ * IF2_DAC/ADC are unpopulated.
+ */
+static const struct tegra_asoc_data tegra_rt5640_grouper_data = {
+	.components = "codec:rt5640 cfg-spk:2 cfg-mic:dmic1 aif:1",

Perhaps, it may be better to handle this string via the DT config (create new function like snd_soc_of_parse_card_name()).

Quoted 2 lines

The "codec:rt5640" should be set in the driver (it's fixed), but the "cfg-spk:2 cfg-mic:dmic1 aif:1" part is suitable for the DT config.

Not sure that this is possible. The DT is an ABI, while components string has no specification. Any changes to the components string will require DT update.

Quoted 8 lines
Quoted 2 lines

I think it's much more feasible to have a database of components within kernel driver, like Intel sound driver does it for ACPI devices.

There is no other possibility for ACPI. And while the components string is part of the ALSA ABI, it should not be changed in an incompatible way. Only new information should be added. The DT solution seems more flexible to me. For example the stereo/mono speaker or the AIF number can be set without the driver modification for rt5640.

Everything that goes into device-tree needs a firm specification. We can't add it into device-tree since there is no specification for the components string other than something that Intel driver made up for its own needs. So either we could add the components string to the kernel driver right now or not add it.

I think the best option would be to drop this patch for now.

maintainer
#12 lore raw

Re: [PATCH v3 4/4] ASoC: tegra: Specify components string for Nexus 7

In reply to Dmitry Osipenko
Quoted 38 lines · Dmitry Osipenko

Specify components string for Nexus 7 using the Intel BayTrail components format. This may allow us to create a more generic UCM for RT5640 codec.

---
 sound/soc/tegra/tegra_asoc_machine.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
sound/soc/tegra/tegra_asoc_machine.c +18 -0
index a81f2ebfc00c..87e0a47040a5 100644
@@ -671,6 +671,24 @@ static const struct tegra_asoc_data tegra_rt5640_data = {
 	.add_hp_jack = true,
 };
 
+/*
+ * Speaker: Connected to SPO L/R P/N pins, stereo.
+ * Internal Microphone: Digital, connected to DMIC1_DAT IN2P/N pins.
+ * Headphones: Connected to HPOL/R pins.
+ * Headset Microphone: Unconnected.
+ *
+ * IF2_DAC/ADC are unpopulated.
+ */
+static const struct tegra_asoc_data tegra_rt5640_grouper_data = {
+	.components = "codec:rt5640 cfg-spk:2 cfg-mic:dmic1 aif:1",
+	.mclk_rate = tegra_machine_mclk_rate_256,
+	.card = &snd_soc_tegra_rt5640,
+	.add_common_dapm_widgets = true,
+	.add_common_controls = true,
+	.add_common_snd_ops = true,
+	.add_hp_jack = true,
+};
+
 /* RT5632 machine */
 
 SND_SOC_DAILINK_DEFS(rt5632_hifi,

sound/soc/tegra/tegra_asoc_machine.c static const struct of_device_id tegra_machine_of_match[] = { · line 733

Quoted 4 lines
sound/soc/tegra/tegra_asoc_machine.c +1 -0
@@ -712,6 +730,7 @@ static const struct of_device_id tegra_machine_of_match[] = {
 	{ .compatible = "nvidia,tegra-audio-wm8753", .data = &tegra_wm8753_data },
 	{ .compatible = "nvidia,tegra-audio-rt5677", .data = &tegra_rt5677_data },
 	{ .compatible = "nvidia,tegra-audio-rt5640", .data = &tegra_rt5640_data },
+	{ .compatible = "nvidia,tegra-audio-rt5640-grouper", .data = &tegra_rt5640_grouper_data },

Is there any harm always populating the components data for rt5640? I did not see any existing UCM support for Tegra+rt5640 platforms in ALSA.

Jon

Signature · 1 line
nvpublic
#13 lore raw

Re: [PATCH v3 4/4] ASoC: tegra: Specify components string for Nexus 7

25.05.2021 11:40, Jon Hunter пишет:

Quoted 38 lines · Dmitry Osipenko
Quoted 36 lines

Specify components string for Nexus 7 using the Intel BayTrail components format. This may allow us to create a more generic UCM for RT5640 codec.

---
 sound/soc/tegra/tegra_asoc_machine.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
sound/soc/tegra/tegra_asoc_machine.c +18 -0
index a81f2ebfc00c..87e0a47040a5 100644
@@ -671,6 +671,24 @@ static const struct tegra_asoc_data tegra_rt5640_data = {
 	.add_hp_jack = true,
 };
 
+/*
+ * Speaker: Connected to SPO L/R P/N pins, stereo.
+ * Internal Microphone: Digital, connected to DMIC1_DAT IN2P/N pins.
+ * Headphones: Connected to HPOL/R pins.
+ * Headset Microphone: Unconnected.
+ *
+ * IF2_DAC/ADC are unpopulated.
+ */
+static const struct tegra_asoc_data tegra_rt5640_grouper_data = {
+	.components = "codec:rt5640 cfg-spk:2 cfg-mic:dmic1 aif:1",
+	.mclk_rate = tegra_machine_mclk_rate_256,
+	.card = &snd_soc_tegra_rt5640,
+	.add_common_dapm_widgets = true,
+	.add_common_controls = true,
+	.add_common_snd_ops = true,
+	.add_hp_jack = true,
+};
+
 /* RT5632 machine */
 
Quoted 10 lines

sound/soc/tegra/tegra_asoc_machine.c static const struct of_device_id tegra_machine_of_match[] = { · line 733

Quoted 6 lines
sound/soc/tegra/tegra_asoc_machine.c +1 -0
 SND_SOC_DAILINK_DEFS(rt5632_hifi,
@@ -712,6 +730,7 @@ static const struct of_device_id tegra_machine_of_match[] = {
 	{ .compatible = "nvidia,tegra-audio-wm8753", .data = &tegra_wm8753_data },
 	{ .compatible = "nvidia,tegra-audio-rt5677", .data = &tegra_rt5677_data },
 	{ .compatible = "nvidia,tegra-audio-rt5640", .data = &tegra_rt5640_data },
+	{ .compatible = "nvidia,tegra-audio-rt5640-grouper", .data = &tegra_rt5640_grouper_data },

Is there any harm always populating the components data for rt5640? I did not see any existing UCM support for Tegra+rt5640 platforms in ALSA.

The previous patch sets components for each card, including RT5640. This patch sets individual components configuration that is unique to the Nexus 7, it overrides the default components string of the card that was set by the previous patch. Other devices may have a different h/w configuration.

The universal UCM needs to know the full h/w configuration, otherwise it doesn't know how to set up mixers and switches properly. The exact bytcr-rt5640 UCM works on Tegra if couple switches that unique to BayTrail are made conditional in the UCM.