Skip to contentSkip to conversation

ASoC: skl: always select SND_SOC_HDAC_HDA

PATCH In review Arnd Bergmann 5 participants 11 messages Nov 2, 2018 – Nov 6, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: skl: always select SND_SOC_HDAC_HDA

The skylake sound support is written to work both with or without CONFIG_SND_SOC_HDAC_HDA, and uses an #ifdef to decide whether it should link against that. However, this fails with SND_SOC_ALL_CODECS=m or SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH=m when the Skylake support itself is built-in, with this link error:

sound/soc/intel/skylake/skl.o: In function `skl_probe':
skl.c:(.text+0x56c): undefined reference to `snd_soc_hdac_hda_get_ops'

Using an explicit 'select' here simplifies the logic and prevents it from happening, at the cost of always including the compile time dependency.

---
 sound/soc/intel/Kconfig       | 1 +
 sound/soc/intel/skylake/skl.c | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)
sound/soc/intel/Kconfig +1 -0
index 0caa1f4eb94d..c21ce7624af1 100644
@@ -109,6 +109,7 @@ config SND_SOC_INTEL_SKYLAKE
 	depends on PCI && ACPI
 	select SND_HDA_EXT_CORE
 	select SND_HDA_DSP_LOADER
+	select SND_SOC_HDAC_HDA
 	select SND_SOC_TOPOLOGY
 	select SND_SOC_INTEL_SST
 	select SND_SOC_ACPI_INTEL_MATCH
sound/soc/intel/skylake/skl.c +0 -2
index 29225623b4b4..1069ee265ce5 100644
@@ -870,9 +870,7 @@ static int skl_create(struct pci_dev *pci,
 	hbus = skl_to_hbus(skl);
 	bus = skl_to_bus(skl);
 
-#if IS_ENABLED(CONFIG_SND_SOC_HDAC_HDA)
 	ext_ops = snd_soc_hdac_hda_get_ops();
-#endif
 	snd_hdac_ext_bus_init(bus, &pci->dev, &bus_core_ops, io_ops, ext_ops);
 	bus->use_posbuf = 1;
 	skl->pci = pci;
Signature · 1 line
2.18.0
#1 lore raw
Quoted 6 lines · Arnd Bergmann

The skylake sound support is written to work both with or without CONFIG_SND_SOC_HDAC_HDA, and uses an #ifdef to decide whether it should link against that. However, this fails with SND_SOC_ALL_CODECS=m or SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH=m when the Skylake support itself is built-in, with this link error:

Quoted 6 lines

sound/soc/intel/skylake/skl.o: In function `skl_probe':
skl.c:(.text+0x56c): undefined reference to `snd_soc_hdac_hda_get_ops'

Using an explicit 'select' here simplifies the logic and prevents it from happening, at the cost of always including the compile time dependency.

Thanks Arnd for the report. I don't quite agree with the proposal, this should be similar to HDAC_HDMI which is not selected by default, and there's no reason to force the support for HDAudio when the vast majority of Skylake+ devices which enable this driver don't have any HDaudio codec.

Also the code is skl.c is already conditional, so this function should not be required.

Do you have a config that fails, I'd like to look at this further.

Quoted 33 lines
---
  sound/soc/intel/Kconfig       | 1 +
  sound/soc/intel/skylake/skl.c | 2 --
  2 files changed, 1 insertion(+), 2 deletions(-)
sound/soc/intel/Kconfig +1 -0
index 0caa1f4eb94d..c21ce7624af1 100644
@@ -109,6 +109,7 @@ config SND_SOC_INTEL_SKYLAKE
  	depends on PCI && ACPI
  	select SND_HDA_EXT_CORE
  	select SND_HDA_DSP_LOADER
+	select SND_SOC_HDAC_HDA
  	select SND_SOC_TOPOLOGY
  	select SND_SOC_INTEL_SST
  	select SND_SOC_ACPI_INTEL_MATCH
sound/soc/intel/skylake/skl.c +0 -2
index 29225623b4b4..1069ee265ce5 100644
@@ -870,9 +870,7 @@ static int skl_create(struct pci_dev *pci,
  	hbus = skl_to_hbus(skl);
  	bus = skl_to_bus(skl);
 
-#if IS_ENABLED(CONFIG_SND_SOC_HDAC_HDA)
  	ext_ops = snd_soc_hdac_hda_get_ops();
-#endif
  	snd_hdac_ext_bus_init(bus, &pci->dev, &bus_core_ops, io_ops, ext_ops);
  	bus->use_posbuf = 1;
  	skl->pci = pci;
#2 lore raw
Quoted 15 lines · Pierre-Louis Bossart
Quoted 6 lines · Arnd Bergmann

The skylake sound support is written to work both with or without CONFIG_SND_SOC_HDAC_HDA, and uses an #ifdef to decide whether it should link against that. However, this fails with SND_SOC_ALL_CODECS=m or SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH=m when the Skylake support itself is built-in, with this link error:

Quoted 6 lines

sound/soc/intel/skylake/skl.o: In function `skl_probe':
skl.c:(.text+0x56c): undefined reference to `snd_soc_hdac_hda_get_ops'

Using an explicit 'select' here simplifies the logic and prevents it from happening, at the cost of always including the compile time dependency.

Quoted 5 lines

Thanks Arnd for the report. I don't quite agree with the proposal, this should be similar to HDAC_HDMI which is not selected by default, and there's no reason to force the support for HDAudio when the vast majority of Skylake+ devices which enable this driver don't have any HDaudio codec.

Sure, feel free to treat this patch as a bug report and come up with a better fix.

Quoted 4 lines

Also the code is skl.c is already conditional, so this function should not be required.

Do you have a config that fails, I'd like to look at this further.

https://pastebin.com/4iYPGxkU is what first triggered this.

Arnd

#3 lore raw
Quoted 14 lines · Arnd Bergmann
Quoted 13 lines · Pierre-Louis Bossart
Quoted 12 lines · Arnd Bergmann

The skylake sound support is written to work both with or without CONFIG_SND_SOC_HDAC_HDA, and uses an #ifdef to decide whether it should link against that. However, this fails with SND_SOC_ALL_CODECS=m or SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH=m when the Skylake support itself is built-in, with this link error:

sound/soc/intel/skylake/skl.o: In function `skl_probe':
skl.c:(.text+0x56c): undefined reference to `snd_soc_hdac_hda_get_ops'

Using an explicit 'select' here simplifies the logic and prevents it from happening, at the cost of always including the compile time dependency.

Quoted 7 lines
Quoted 5 lines

Thanks Arnd for the report. I don't quite agree with the proposal, this should be similar to HDAC_HDMI which is not selected by default, and there's no reason to force the support for HDAudio when the vast majority of Skylake+ devices which enable this driver don't have any HDaudio codec.

Sure, feel free to treat this patch as a bug report and come up with a better fix.

I have to rewind my statement. Arnd is correct, the config cannot be the same as hdac_hdmi since there is a code dependency I completely missed.

So yes indeed we have to add a select HDAC_HDA statement under the SKYLAKE config - i just don't know of any other means to say "don't build HDAC_HDA as a module when SKYLAKE is buit-in"

That said, we can add a condition that will only select HDAC_HDA if required by the machine drivers selected. The patch below doesn't seem to have circular dependencies and compiles fine with Arnd's config. I thought of it while multitasking with "Home IT" work and haven't done any testing beyond compilation.  Arnd, can you give it a spin to see if this solves the issues?

sound/soc/codecs/Kconfig +0 -0
index 9cc4f1848c9b..91000924eb7c 100644
@@ -627,6 +627,14 @@ config SND_SOC_HDAC_HDA

        tristate
        select SND_HDA

+config SND_SOC_HDAC_HDA_CODEC
+       bool
+       help
+        This config is set by machine drivers who need SND_SOC_HDAC_HDA, +        which is selected by the platform drivers (Skylake or SOF) based +        on the value of this boolean. This indirection is required to deal +        with a code dependency between platform driver and codec driver. +
 config SND_SOC_ICS43432
        tristate

sound/soc/intel/Kconfig +0 -0
index 0caa1f4eb94d..25f3bca5e56d 100644
@@ -107,6 +107,7 @@ config SND_SOC_INTEL_SKYLAKE_SSP_CLK

 config SND_SOC_INTEL_SKYLAKE
        tristate "SKL/BXT/KBL/GLK/CNL... Platforms" depends on PCI && ACPI
+       select SND_SOC_HDAC_HDA if SND_SOC_HDAC_HDA_CODEC select SND_HDA_EXT_CORE
        select SND_HDA_DSP_LOADER
        select SND_SOC_TOPOLOGY

sound/soc/intel/boards/Kconfig +0 -0
index 73ca1350aa31..5e7d3f4aa3ff 100644
@@ -296,7 +296,7 @@ config SND_SOC_INTEL_KBL_DA7219_MAX98927_MACH

 config SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH
        tristate "SKL/KBL/BXT/APL with HDA Codecs"
        select SND_SOC_HDAC_HDMI
-       select SND_SOC_HDAC_HDA
+       select SND_SOC_HDAC_HDA_CODEC
        help
          This adds support for ASoC machine driver for Intel platforms SKL/KBL/BXT/APL with iDisp, HDA audio codecs.

sound/soc/intel/skylake/skl.c +0 -0
index 29225623b4b4..e0dda3fd689b 100644
@@ -870,7 +870,7 @@ static int skl_create(struct pci_dev *pci,

        hbus = skl_to_hbus(skl);
        bus = skl_to_bus(skl);

-#if IS_ENABLED(CONFIG_SND_SOC_HDAC_HDA)
+#if IS_ENABLED(CONFIG_SND_SOC_HDAC_HDA_CODEC)
        ext_ops = snd_soc_hdac_hda_get_ops();
 #endif
        snd_hdac_ext_bus_init(bus, &pci->dev, &bus_core_ops, io_ops, ext_ops);

#4 lore raw
Quoted 3 lines · Pierre-Louis Bossart

So yes indeed we have to add a select HDAC_HDA statement under the SKYLAKE config - i just don't know of any other means to say "don't build HDAC_HDA as a module when SKYLAKE is buit-in"

We have this ("strange") lines over the drivers:

config BAR
depends on FOO || FOO=n

which guarantees that FOO will be not module when BAR is built-in.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#5 lore raw
Quoted 8 lines · Andy Shevchenko
Quoted 5 lines · Pierre-Louis Bossart

So yes indeed we have to add a select HDAC_HDA statement under the SKYLAKE
config - i just don't know of any other means to say "don't build HDAC_HDA
as a module when SKYLAKE is buit-in"

Quoted 6 lines

We have this ("strange") lines over the drivers:

config BAR
depends on FOO || FOO=n

which guarantees that FOO will be not module when BAR is built-in.

That's what I normally use, but I could not figure this one out. One problem is that SND_SOC_ALL_CODECS selects SND_SOC_HDAC_HDA, and SND_SOC_ALL_CODECS itself
may be =m, causing the failure for SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH=y.

It might work with a separate dummy symbol:

config SND_SOC_HDAC_HDA_FORCE

         tristate
         depends on SND_SOC_ALL_CODECS != n
         default SND_SOC_INTEL_SKYLAKE
         select SND_SOC_HDAC_HDA

This would make SND_SOC_HDAC_HDA built-in even
with SND_SOC_ALL_CODECS=m and
SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH=n

It seems a bit ugly, and would need some testing.

Arnd

#6 lore raw
Quoted 31 lines · Arnd Bergmann
Quoted 8 lines · Andy Shevchenko
Quoted 5 lines · Pierre-Louis Bossart

So yes indeed we have to add a select HDAC_HDA statement under the SKYLAKE
config - i just don't know of any other means to say "don't build HDAC_HDA
as a module when SKYLAKE is buit-in"

Quoted 6 lines

We have this ("strange") lines over the drivers:

config BAR
depends on FOO || FOO=n

which guarantees that FOO will be not module when BAR is built-in.

That's what I normally use, but I could not figure this one out. One problem is that SND_SOC_ALL_CODECS selects SND_SOC_HDAC_HDA, and SND_SOC_ALL_CODECS itself
may be =m, causing the failure for SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH=y.

It might work with a separate dummy symbol:

config SND_SOC_HDAC_HDA_FORCE

         tristate
         depends on SND_SOC_ALL_CODECS != n
         default SND_SOC_INTEL_SKYLAKE
         select SND_SOC_HDAC_HDA
Quoted 5 lines

This would make SND_SOC_HDAC_HDA built-in even
with SND_SOC_ALL_CODECS=m and
SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH=n

It seems a bit ugly, and would need some testing.

The mixture of depends and select is often more confusing, so IMO, we should align with only select as Pierre's suggestion, in this particular case.

thanks,

Takashi

#7 lore raw
Quoted 21 lines
Quoted 21 lines
Quoted 7 lines

We have this ("strange") lines over the drivers:

config BAR
depends on FOO || FOO=n

which guarantees that FOO will be not module when BAR is built-in.

That's what I normally use, but I could not figure this one out. One problem is that SND_SOC_ALL_CODECS selects SND_SOC_HDAC_HDA, and SND_SOC_ALL_CODECS itself
may be =m, causing the failure for SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH=y.

It might work with a separate dummy symbol:

config SND_SOC_HDAC_HDA_FORCE

          tristate
          depends on SND_SOC_ALL_CODECS != n
          default SND_SOC_INTEL_SKYLAKE
          select SND_SOC_HDAC_HDA
Quoted 8 lines
Quoted 5 lines

This would make SND_SOC_HDAC_HDA built-in even
with SND_SOC_ALL_CODECS=m and
SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH=n

It seems a bit ugly, and would need some testing.

The mixture of depends and select is often more confusing, so IMO, we should align with only select as Pierre's suggestion, in this particular case.

I tried to avoid re-adding a "depends on" which we tried to remove last year, but there is still a conditional statement which assumes a very specific evaluation order.

1. SKYLAKE is enabled as m or y

2. that enables some machine drivers (through an if statement), some of which might select HDA audio

3. the selections done within the SKYLAKE config are conditional on the outcome of #2.

it seems to work but I don't know if it's by design or an accident :-). One could argue it's a hidden "depends on".

#8 lore raw
Quoted 14 lines · Pierre-Louis Bossart
Quoted 14 lines
Quoted 14 lines
Quoted 8 lines

We have this ("strange") lines over the drivers:

config BAR
depends on FOO || FOO=n

which guarantees that FOO will be not module when BAR is built-in.

That's what I normally use, but I could not figure this one out. One problem is that SND_SOC_ALL_CODECS selects SND_SOC_HDAC_HDA, and SND_SOC_ALL_CODECS itself
may be =m, causing the failure for SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH=y.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

It might work with a separate dummy symbol:

config SND_SOC_HDAC_HDA_FORCE

          tristate

          depends on SND_SOC_ALL_CODECS != n

Forgot to mention that AFAIU above line is no-op in symbols which are hidden.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

default SND_SOC_INTEL_SKYLAKE
select SND_SOC_HDAC_HDA

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#9 lore raw
Quoted 18 lines · Andy Shevchenko
Quoted 16 lines · Pierre-Louis Bossart
Quoted 16 lines
Quoted 16 lines
Quoted 8 lines

We have this ("strange") lines over the drivers:

config BAR
depends on FOO || FOO=n

which guarantees that FOO will be not module when BAR is built-in.

That's what I normally use, but I could not figure this one out. One problem is that SND_SOC_ALL_CODECS selects SND_SOC_HDAC_HDA, and SND_SOC_ALL_CODECS itself
may be =m, causing the failure for SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH=y.

It might work with a separate dummy symbol:

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

config SND_SOC_HDAC_HDA_FORCE

          tristate

          depends on SND_SOC_ALL_CODECS != n

Forgot to mention that AFAIU above line is no-op in symbols which are hidden.

It's not. In this case, it will prevent SND_SOC_HDAC_HDA_FORCE from being turned on by the 'default ...' line. In other cases, it can generate a warning if you have a hidden symbol that is selected by some other symbol while the dependency is missing.

Arnd

#10 lore raw
Quoted 9 lines · Arnd Bergmann
Quoted 8 lines · Andy Shevchenko
Quoted 4 lines · Pierre-Louis Bossart
Quoted 4 lines
Quoted 4 lines

config SND_SOC_HDAC_HDA_FORCE

          tristate

          depends on SND_SOC_ALL_CODECS != n
Quoted 8 lines
Quoted 3 lines

Forgot to mention that AFAIU above line is no-op in symbols which are hidden.

It's not. In this case, it will prevent SND_SOC_HDAC_HDA_FORCE from being turned on by the 'default ...' line. In other cases, it can generate a warning if you have a hidden symbol that is selected by some other symbol while the dependency is missing.

Something new to learn.
Thanks, Arnd, for describing this case.

Signature · 2 lines
With Best Regards,
Andy Shevchenko