Skip to contentSkip to conversation

ALSA: hda - Remove dependency on bus->pci in hda_beep.c

PATCH In review Takashi Iwai 3 participants 14 messages Feb 15, 2014 – Feb 27, 2014 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 ALSA: hda - Remove dependency on bus->pci in hda_beep.c

The default parent device can be obtained directly via card object, so we don't need to rely on pci->dev.parent. Since there is no access to pci_dev, we can reduce the inclusion of linux/pci.h, too.

---
 sound/pci/hda/hda_beep.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sound/pci/hda/hda_beep.c +1 -2
index 0589b39cda6e..d8c437a94559 100644
@@ -20,7 +20,6 @@
  */
 
 #include <linux/input.h>
-#include <linux/pci.h>
 #include <linux/slab.h>
 #include <linux/workqueue.h>
 #include <linux/export.h>
@@ -167,7 +166,7 @@ static int snd_hda_do_attach(struct hda_beep *beep)
 	input_dev->evbit[0] = BIT_MASK(EV_SND);
 	input_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE);
 	input_dev->event = snd_hda_beep_event;
-	input_dev->dev.parent = &codec->bus->pci->dev;
+	input_dev->dev.parent = codec->bus->card->dev;
 	input_set_drvdata(input_dev, beep);
 
 	err = input_register_device(input_dev);
Signature · 1 line
1.8.5.2
#1 lore raw

PATCH 2/3 ALSA: hda/realtek - Allow NULL bus->pci

Realtek codec driver contains some codes referring to the PCI subdevice IDs, but most of them are optional, typically for checking the codec name variants. Add NULL checks appropriately so that it can work without PCI assignment.

---
 sound/pci/hda/patch_realtek.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
sound/pci/hda/patch_realtek.c +11 -4
index 86857b674302..c5405f319cfe 100644
@@ -395,6 +395,8 @@ static int alc_auto_parse_customize_define(struct hda_codec *codec)
 		goto do_sku;
 	}
 
+	if (!codec->bus->pci)
+		return -1;
 	ass = codec->subsystem_id & 0xffff;
 	if (ass != codec->bus->pci->subsystem_device && (ass & 1))
 		goto do_sku;
@@ -483,7 +485,8 @@ static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
 	}
 
 	ass = codec->subsystem_id & 0xffff;
-	if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
+	if (codec->bus->pci &&
+	    ass != codec->bus->pci->subsystem_device && (ass & 1))
 		goto do_sku;
 
 	/* invalid SSID, check the special NID pin defcfg instead */
@@ -966,6 +969,8 @@ static int alc_codec_rename_from_preset(struct hda_codec *codec)
 			return alc_codec_rename(codec, p->name);
 	}
 
+	if (!codec->bus->pci)
+		return 0;
 	for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
 		if (q->codec_vendor_id != codec->vendor_id)
 			continue;
@@ -4502,13 +4507,15 @@ static int patch_alc269(struct hda_codec *codec)
 		spec->codec_variant = ALC269_TYPE_ALC269VA;
 		switch (alc_get_coef0(codec) & 0x00f0) {
 		case 0x0010:
-			if (codec->bus->pci->subsystem_vendor == 0x1025 &&
+			if (codec->bus->pci &&
+			    codec->bus->pci->subsystem_vendor == 0x1025 &&
 			    spec->cdefine.platform_type == 1)
 				err = alc_codec_rename(codec, "ALC271X");
 			spec->codec_variant = ALC269_TYPE_ALC269VB;
 			break;
 		case 0x0020:
-			if (codec->bus->pci->subsystem_vendor == 0x17aa &&
+			if (codec->bus->pci &&
+			    codec->bus->pci->subsystem_vendor == 0x17aa &&
 			    codec->bus->pci->subsystem_device == 0x21f3)
 				err = alc_codec_rename(codec, "ALC3202");
 			spec->codec_variant = ALC269_TYPE_ALC269VC;
@@ -5309,7 +5316,7 @@ static int patch_alc662(struct hda_codec *codec)
 		spec->gen.beep_nid = 0x01;
 
 	if ((alc_get_coef0(codec) & (1 << 14)) &&
-	    codec->bus->pci->subsystem_vendor == 0x1025 &&
+	    codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
 	    spec->cdefine.platform_type == 1) {
 		err = alc_codec_rename(codec, "ALC272X");
 		if (err < 0)
Signature · 1 line
1.8.5.2
#2 lore raw

PATCH 3/3 ALSA: hda - Remove superfluous inclusion of linux/pci.h

In reply to Takashi Iwai

Some codec drivers still have it since using PCI_VENDOR_ID_*.

---
 sound/pci/hda/hda_codec.c      | 1 -
 sound/pci/hda/hda_hwdep.c      | 1 -
 sound/pci/hda/patch_analog.c   | 1 -
 sound/pci/hda/patch_ca0110.c   | 1 -
 sound/pci/hda/patch_ca0132.c   | 1 -
 sound/pci/hda/patch_cirrus.c   | 1 -
 sound/pci/hda/patch_cmedia.c   | 1 -
 sound/pci/hda/patch_conexant.c | 1 -
 8 files changed, 8 deletions(-)
sound/pci/hda/hda_codec.c +0 -1
index dafcf82139e2..4be322b0d745 100644
@@ -23,7 +23,6 @@
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
-#include <linux/pci.h>
 #include <linux/mutex.h>
 #include <linux/module.h>
 #include <linux/async.h>
sound/pci/hda/hda_hwdep.c +0 -1
index 72d8389fb399..53c961992d0c 100644
@@ -20,7 +20,6 @@
 
 #include <linux/init.h>
 #include <linux/slab.h>
-#include <linux/pci.h>
 #include <linux/compat.h>
 #include <linux/mutex.h>
 #include <linux/ctype.h>
sound/pci/hda/patch_analog.c +0 -1
index df3652ad15ef..1eb00a6d3ef5 100644
@@ -21,7 +21,6 @@
 
 #include <linux/init.h>
 #include <linux/slab.h>
-#include <linux/pci.h>
 #include <linux/module.h>
 
 #include <sound/core.h>
sound/pci/hda/patch_ca0110.c +0 -1
index 30b3a4bc06ee..5e65999e0d8e 100644
@@ -20,7 +20,6 @@
 
 #include <linux/init.h>
 #include <linux/slab.h>
-#include <linux/pci.h>
 #include <linux/module.h>
 #include <sound/core.h>
 #include "hda_codec.h"
sound/pci/hda/patch_ca0132.c +0 -1
index 54d14793725a..4c5132cdb0cf 100644
@@ -24,7 +24,6 @@
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
-#include <linux/pci.h>
 #include <linux/mutex.h>
 #include <linux/module.h>
 #include <linux/firmware.h>
sound/pci/hda/patch_cirrus.c +0 -1
index fc492ac24caa..387f0b551889 100644
@@ -20,7 +20,6 @@
 
 #include <linux/init.h>
 #include <linux/slab.h>
-#include <linux/pci.h>
 #include <linux/module.h>
 #include <sound/core.h>
 #include <sound/tlv.h>
sound/pci/hda/patch_cmedia.c +0 -1
index 139ef301c914..d782292b1ba9 100644
@@ -23,7 +23,6 @@
 
 #include <linux/init.h>
 #include <linux/slab.h>
-#include <linux/pci.h>
 #include <linux/module.h>
 #include <sound/core.h>
 #include "hda_codec.h"
sound/pci/hda/patch_conexant.c +0 -1
index 59e3aeac2233..13a416060eb8 100644
@@ -23,7 +23,6 @@
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
-#include <linux/pci.h>
 #include <linux/module.h>
 #include <sound/core.h>
 #include <sound/jack.h>
Signature · 1 line
1.8.5.2
#3 lore raw
In reply to Takashi Iwai

At Sat, 15 Feb 2014 10:17:33 +0100,

Quoted 6 lines · Takashi Iwai

The default parent device can be obtained directly via card object, so we don't need to rely on pci->dev.parent. Since there is no access to pci_dev, we can reduce the inclusion of linux/pci.h, too.

I forgot the cover page: these tree patches are trivial cleanups of hda-codec drivers (not the controller) to work without PCI device assignment. The idea was triggered by Dylan's question.

Takashi

Quoted 33 lines
---
 sound/pci/hda/hda_beep.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sound/pci/hda/hda_beep.c +1 -2
index 0589b39cda6e..d8c437a94559 100644
@@ -20,7 +20,6 @@
  */
 
 #include <linux/input.h>
-#include <linux/pci.h>
 #include <linux/slab.h>
 #include <linux/workqueue.h>
 #include <linux/export.h>
@@ -167,7 +166,7 @@ static int snd_hda_do_attach(struct hda_beep *beep)
 	input_dev->evbit[0] = BIT_MASK(EV_SND);
 	input_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE);
 	input_dev->event = snd_hda_beep_event;
-	input_dev->dev.parent = &codec->bus->pci->dev;
+	input_dev->dev.parent = codec->bus->card->dev;
 	input_set_drvdata(input_dev, beep);
 
 	err = input_register_device(input_dev);
Signature · 6 lines
1.8.5.2

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Reviewed-by
#4 lore raw
Quoted 7 lines · Takashi Iwai

At Sat, 15 Feb 2014 10:17:33 +0100,

Quoted 5 lines · Takashi Iwai

The default parent device can be obtained directly via card object, so we don't need to rely on pci->dev.parent. Since there is no access to pci_dev, we can reduce the inclusion of linux/pci.h, too.

Quoted 5 lines
Quoted 1 line

I forgot the cover page: these tree patches are trivial cleanups of hda-codec drivers (not the controller) to work without PCI device assignment. The idea was triggered by Dylan's question.

The series seems fine to me, so briefly,

#5 lore raw
Quoted 8 lines · Stephen Warren
Quoted 7 lines · Takashi Iwai

At Sat, 15 Feb 2014 10:17:33 +0100,

Quoted 5 lines · Takashi Iwai

The default parent device can be obtained directly via card object, so we don't need to rely on pci->dev.parent. Since there is no access to pci_dev, we can reduce the inclusion of linux/pci.h, too.

Quoted 9 lines
Quoted 5 lines
Quoted 1 line

I forgot the cover page: these tree patches are trivial cleanups of hda-codec drivers (not the controller) to work without PCI device assignment. The idea was triggered by Dylan's question.

The series seems fine to me, so briefly,

Thanks Takashi,

I tested this series on a Haswell and IvyBridge system. Looks good to me as well.

#6 lore raw
In reply to Stephen Warren

At Tue, 18 Feb 2014 11:04:19 -0700,

Quoted 9 lines · Stephen Warren
Quoted 7 lines · Takashi Iwai

At Sat, 15 Feb 2014 10:17:33 +0100,

Quoted 5 lines · Takashi Iwai

The default parent device can be obtained directly via card object, so we don't need to rely on pci->dev.parent. Since there is no access to pci_dev, we can reduce the inclusion of linux/pci.h, too.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

I forgot the cover page: these tree patches are trivial cleanups of hda-codec drivers (not the controller) to work without PCI device assignment. The idea was triggered by Dylan's question.

The series seems fine to me, so briefly,

Thanks. Any chance to work on / submit other changes for Tegra HD-audio support?

As already mentioned, I think a cleaner way would be to write hda_platform.c instead of hacking hda_intel.c with ifdefs. Some code in hda_intel.c (e.g. bus ops and PCM callbacks) can be moved out, either as a new helper module or just merging into snd-hda-codec helper module, so that they can be used by both hda_intel.c and hda_platform.c.

Ideally, we may rename hda_intel.c with hda_pci.c, but I'm afraid this would bring too many regressions for module options.

Takashi

#7 lore raw
Quoted 17 lines · Takashi Iwai

At Tue, 18 Feb 2014 11:04:19 -0700,

Quoted 15 lines · Stephen Warren
Quoted 12 lines · Takashi Iwai

At Sat, 15 Feb 2014 10:17:33 +0100,

Quoted 6 lines · Takashi Iwai

The default parent device can be obtained directly via card object, so we don't need to rely on pci->dev.parent. Since there is no access to pci_dev, we can reduce the inclusion of linux/pci.h, too.

I forgot the cover page: these tree patches are trivial cleanups of hda-codec drivers (not the controller) to work without PCI device assignment. The idea was triggered by Dylan's question.

Quoted 5 lines
Quoted 2 lines

The series seems fine to me, so briefly,

Thanks. Any chance to work on / submit other changes for Tegra HD-audio support?

That's the plan, hopefully I'll be able to find time to throw together an RFC by the end of the week.

Quoted 7 lines

As already mentioned, I think a cleaner way would be to write hda_platform.c instead of hacking hda_intel.c with ifdefs. Some code in hda_intel.c (e.g. bus ops and PCM callbacks) can be moved out, either as a new helper module or just merging into snd-hda-codec helper module, so that they can be used by both hda_intel.c and hda_platform.c.

That sounds like a good idea. There aren't a lot of differences, mostly isolated to init and suspend/resume. That should be easy to put in hda_platform.

Thanks,

Dylan

Quoted 6 lines

Ideally, we may rename hda_intel.c with hda_pci.c, but I'm afraid this would bring too many regressions for module options.

Takashi

#8 lore raw

At Wed, 19 Feb 2014 07:16:38 -0800,

Quoted 19 lines · Dylan Reid
Quoted 17 lines · Takashi Iwai

At Tue, 18 Feb 2014 11:04:19 -0700,

Quoted 15 lines · Stephen Warren
Quoted 12 lines · Takashi Iwai

At Sat, 15 Feb 2014 10:17:33 +0100,

Quoted 6 lines · Takashi Iwai

The default parent device can be obtained directly via card object, so we don't need to rely on pci->dev.parent. Since there is no access to pci_dev, we can reduce the inclusion of linux/pci.h, too.

I forgot the cover page: these tree patches are trivial cleanups of hda-codec drivers (not the controller) to work without PCI device assignment. The idea was triggered by Dylan's question.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

The series seems fine to me, so briefly,

Thanks. Any chance to work on / submit other changes for Tegra HD-audio support?

That's the plan, hopefully I'll be able to find time to throw together an RFC by the end of the week.

Since there was no patch appearing yet, I merged my latest development branch to for-next branch, which includes lots of changes in hda_intel.c and hda_codec.c. If any, please rebase your patches to it.

thanks,

Takashi

#9 lore raw
Quoted 27 lines · Takashi Iwai

At Wed, 19 Feb 2014 07:16:38 -0800,

Quoted 25 lines · Dylan Reid
Quoted 22 lines · Takashi Iwai

At Tue, 18 Feb 2014 11:04:19 -0700,

Quoted 9 lines · Stephen Warren
Quoted 7 lines · Takashi Iwai

At Sat, 15 Feb 2014 10:17:33 +0100,

Quoted 5 lines · Takashi Iwai

The default parent device can be obtained directly via card object, so we don't need to rely on pci->dev.parent. Since there is no access to pci_dev, we can reduce the inclusion of linux/pci.h, too.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

I forgot the cover page: these tree patches are trivial cleanups of hda-codec drivers (not the controller) to work without PCI device assignment. The idea was triggered by Dylan's question.

The series seems fine to me, so briefly,

Thanks. Any chance to work on / submit other changes for Tegra HD-audio support?

Quoted 7 lines
Quoted 2 lines

That's the plan, hopefully I'll be able to find time to throw together an RFC by the end of the week.

Since there was no patch appearing yet, I merged my latest development branch to for-next branch, which includes lots of changes in hda_intel.c and hda_codec.c. If any, please rebase your patches to it.

Thanks for the heads up. I've got a series that is almost ready, I'm still trying to tease part of the build out from under CONFIG_PCI in the hda makefile. I'll try to button that up and get a the whole lot rebased on top of the for-next branch.

Dylan

Quoted 5 lines

thanks,

Takashi

#10 lore raw

At Thu, 27 Feb 2014 08:44:48 -0800,

Quoted 32 lines · Dylan Reid
Quoted 30 lines · Takashi Iwai

At Wed, 19 Feb 2014 07:16:38 -0800,

Quoted 27 lines · Dylan Reid
Quoted 17 lines · Takashi Iwai

At Tue, 18 Feb 2014 11:04:19 -0700,

Quoted 15 lines · Stephen Warren
Quoted 12 lines · Takashi Iwai

At Sat, 15 Feb 2014 10:17:33 +0100,

Quoted 6 lines · Takashi Iwai

The default parent device can be obtained directly via card object, so we don't need to rely on pci->dev.parent. Since there is no access to pci_dev, we can reduce the inclusion of linux/pci.h, too.

I forgot the cover page: these tree patches are trivial cleanups of hda-codec drivers (not the controller) to work without PCI device assignment. The idea was triggered by Dylan's question.

Quoted 5 lines
Quoted 2 lines

The series seems fine to me, so briefly,

Thanks. Any chance to work on / submit other changes for Tegra HD-audio support?

That's the plan, hopefully I'll be able to find time to throw together an RFC by the end of the week.

Quoted 8 lines
Quoted 4 lines

Since there was no patch appearing yet, I merged my latest development branch to for-next branch, which includes lots of changes in hda_intel.c and hda_codec.c. If any, please rebase your patches to it.

Thanks for the heads up. I've got a series that is almost ready, I'm still trying to tease part of the build out from under CONFIG_PCI in the hda makefile.

I don't think we have a dependency on CONFIG_PCI in Makefile. Kconfig has a dependency, but it can be easily reduced by a patch like below.

Of course, it'd be better to move the whole hda directory out of pci, but we can do it later at any time once via git.

Quoted 2 lines

I'll try to button that up and get a the whole lot
rebased on top of the for-next branch.

Thanks!

Takashi

---

sound/pci/Kconfig +2 -2
index 8756c8e32922..56d93bf45025 100644
@@ -578,8 +578,6 @@ config SND_FM801_TEA575X_BOOL
 	  FM801 chip with a TEA5757 tuner (MediaForte SF256-PCS, SF256-PCP and
 	  SF64-PCR) into the snd-fm801 driver.
 
-source "sound/pci/hda/Kconfig"
-
 config SND_HDSP
 	tristate "RME Hammerfall DSP Audio"
 	select FW_LOADER
@@ -889,3 +887,5 @@ config SND_YMFPCI
 	  will be called snd-ymfpci.
 
 endif	# SND_PCI
+
+source "sound/pci/hda/Kconfig"
sound/pci/hda/Kconfig +1 -0
index f2032dd7e35e..6fc769da6949 100644
@@ -1,5 +1,6 @@
 menuconfig SND_HDA_INTEL
 	tristate "Intel HD Audio"
+	depends on (PCI || SOMETHING_YOU_WANT)
 	select SND_PCM
 	select SND_VMASTER
 	select SND_KCTL_JACK
#11 lore raw
Quoted 39 lines · Takashi Iwai

At Thu, 27 Feb 2014 08:44:48 -0800,

Quoted 37 lines · Dylan Reid
Quoted 34 lines · Takashi Iwai

At Wed, 19 Feb 2014 07:16:38 -0800,

Quoted 19 lines · Dylan Reid
Quoted 17 lines · Takashi Iwai

At Tue, 18 Feb 2014 11:04:19 -0700,

Quoted 15 lines · Stephen Warren
Quoted 12 lines · Takashi Iwai

At Sat, 15 Feb 2014 10:17:33 +0100,

Quoted 6 lines · Takashi Iwai

The default parent device can be obtained directly via card object, so we don't need to rely on pci->dev.parent. Since there is no access to pci_dev, we can reduce the inclusion of linux/pci.h, too.

I forgot the cover page: these tree patches are trivial cleanups of hda-codec drivers (not the controller) to work without PCI device assignment. The idea was triggered by Dylan's question.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

The series seems fine to me, so briefly,

Thanks. Any chance to work on / submit other changes for Tegra HD-audio support?

That's the plan, hopefully I'll be able to find time to throw together an RFC by the end of the week.

Since there was no patch appearing yet, I merged my latest development branch to for-next branch, which includes lots of changes in hda_intel.c and hda_codec.c. If any, please rebase your patches to it.

Quoted 6 lines
Quoted 3 lines

Thanks for the heads up. I've got a series that is almost ready, I'm still trying to tease part of the build out from under CONFIG_PCI in the hda makefile.

I don't think we have a dependency on CONFIG_PCI in Makefile. Kconfig has a dependency, but it can be easily reduced by a patch like below.

Sounds good. I was looking at re-using some of the config options (HDMI codec and power save) for the platform driver as well. Maybe something like the following. SND_HDA would build the helper module and hda-codec that are used by both hda_intel and a platform driver.

Quoted 3 lines

Of course, it'd be better to move the whole hda directory out of pci, but we can do it later at any time once via git.

I can add that to the end of the series or it can move it whenever is convenient, not sure how many pending patch sets it would disrupt.

Thanks!

Dylan

Quoted 34 lines
Quoted 3 lines

I'll try to button that up and get a the whole lot
rebased on top of the for-next branch.

Thanks!

Takashi

---

sound/pci/Kconfig +2 -2
index 8756c8e32922..56d93bf45025 100644
@@ -578,8 +578,6 @@ config SND_FM801_TEA575X_BOOL
          FM801 chip with a TEA5757 tuner (MediaForte SF256-PCS, SF256-PCP and
          SF64-PCR) into the snd-fm801 driver.
 
-source "sound/pci/hda/Kconfig"
-
 config SND_HDSP
        tristate "RME Hammerfall DSP Audio"
        select FW_LOADER
@@ -889,3 +887,5 @@ config SND_YMFPCI
          will be called snd-ymfpci.
 
 endif  # SND_PCI
+
+source "sound/pci/hda/Kconfig"
sound/pci/hda/Kconfig +0 -0
index f2032dd7e35e..6fc769da6949 100644

sound/pci/hda/Kconfig line 6

Quoted 6 lines
sound/pci/hda/Kconfig +1 -0
@@ -1,5 +1,6 @@
 menuconfig SND_HDA_INTEL
        tristate "Intel HD Audio"
+       depends on (PCI || SOMETHING_YOU_WANT)
        select SND_PCM
        select SND_VMASTER
        select SND_KCTL_JACK

---

sound/pci/Kconfig +2 -2
index 8756c8e..56d93bf 100644
@@ -578,8 +578,6 @@ config SND_FM801_TEA575X_BOOL
          FM801 chip with a TEA5757 tuner (MediaForte SF256-PCS, SF256-PCP and
          SF64-PCR) into the snd-fm801 driver.
 
-source "sound/pci/hda/Kconfig"
-
 config SND_HDSP
        tristate "RME Hammerfall DSP Audio"
        select FW_LOADER
@@ -889,3 +887,5 @@ config SND_YMFPCI
          will be called snd-ymfpci.
 
 endif  # SND_PCI
+
+source "sound/pci/hda/Kconfig"
sound/pci/hda/Kconfig +48 -20

90 lines not on this page · raw message

sound/pci/hda/Makefile +6 -2
index c5fa8e7..a964b6e 100644
@@ -1,4 +1,6 @@
-snd-hda-intel-objs := hda_shared.o hda_intel.o
+snd-hda-intel-objs := hda_intel.o
+snd-hda-shared-objs := hda_shared.o
+snd-hda-tegra-objs := hda_tegra.o
 # for haswell power well
 snd-hda-intel-$(CONFIG_SND_HDA_I915) +=        hda_i915.o
 
@@ -25,7 +27,8 @@ snd-hda-codec-via-objs :=     patch_via.o
 snd-hda-codec-hdmi-objs :=     patch_hdmi.o hda_eld.o
 
 # common driver
-obj-$(CONFIG_SND_HDA_INTEL) := snd-hda-codec.o
+obj-$(CONFIG_SND_HDA) := snd-hda-codec.o
+obj-$(CONFIG_SND_HDA) += snd-hda-shared.o
 
 # codec drivers
 obj-$(CONFIG_SND_HDA_GENERIC) += snd-hda-codec-generic.o
@@ -45,3 +48,4 @@ obj-$(CONFIG_SND_HDA_CODEC_HDMI) += snd-hda-codec-hdmi.o
 # otherwise the codec patches won't be hooked before the PCI probe
 # when built in kernel
 obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-intel.o
+obj-$(CONFIG_SND_HDA_TEGRA) += snd-hda-tegra.o
#12 lore raw

At Thu, 27 Feb 2014 09:32:21 -0800,

Quoted 45 lines · Dylan Reid
Quoted 43 lines · Takashi Iwai

At Thu, 27 Feb 2014 08:44:48 -0800,

Quoted 40 lines · Dylan Reid
Quoted 27 lines · Takashi Iwai

At Wed, 19 Feb 2014 07:16:38 -0800,

Quoted 25 lines · Dylan Reid
Quoted 22 lines · Takashi Iwai

At Tue, 18 Feb 2014 11:04:19 -0700,

Quoted 9 lines · Stephen Warren
Quoted 7 lines · Takashi Iwai

At Sat, 15 Feb 2014 10:17:33 +0100,

Quoted 5 lines · Takashi Iwai

The default parent device can be obtained directly via card object, so we don't need to rely on pci->dev.parent. Since there is no access to pci_dev, we can reduce the inclusion of linux/pci.h, too.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

I forgot the cover page: these tree patches are trivial cleanups of hda-codec drivers (not the controller) to work without PCI device assignment. The idea was triggered by Dylan's question.

The series seems fine to me, so briefly,

Thanks. Any chance to work on / submit other changes for Tegra HD-audio support?

Quoted 7 lines
Quoted 2 lines

That's the plan, hopefully I'll be able to find time to throw together an RFC by the end of the week.

Since there was no patch appearing yet, I merged my latest development branch to for-next branch, which includes lots of changes in hda_intel.c and hda_codec.c. If any, please rebase your patches to it.

Thanks for the heads up. I've got a series that is almost ready, I'm still trying to tease part of the build out from under CONFIG_PCI in the hda makefile.

Quoted 7 lines
Quoted 2 lines

I don't think we have a dependency on CONFIG_PCI in Makefile. Kconfig has a dependency, but it can be easily reduced by a patch like below.

Sounds good. I was looking at re-using some of the config options (HDMI codec and power save) for the platform driver as well. Maybe something like the following. SND_HDA would build the helper module and hda-codec that are used by both hda_intel and a platform driver.

I think we can simply allow building all HD-audio codec drivers when CONFIG_SND_HDA is set. They are basically independent from the controller type. There are also other selectable items like hwdep support. The diff in sound/pci/hda would be like below.

Takashi

--

sound/pci/hda/Kconfig +39 -16
index f2032dd7e35e..4cbf46e59d1c 100644
@@ -1,8 +1,15 @@
-menuconfig SND_HDA_INTEL
-	tristate "Intel HD Audio"
+menu "HD-Audio"
+
+config SND_HDA
+	tristate
 	select SND_PCM
 	select SND_VMASTER
 	select SND_KCTL_JACK
+
+config SND_HDA_INTEL
+	tristate "HD Audio PCI"
+	depends on SND_PCI
+	select SND_HDA
 	help
 	  Say Y here to include support for Intel "High Definition
 	  Audio" (Azalia) and its compatible devices.
@@ -13,7 +20,21 @@ menuconfig SND_HDA_INTEL
 	  To compile this driver as a module, choose M here: the module
 	  will be called snd-hda-intel.
 
-if SND_HDA_INTEL
+config SND_HDA_TEGRA
+       tristate "Tegra HD Audio"
+       select SND_HDA
+       help
+         Say Y here to support the HDA controller present in Nvidia
+         Tegra SoCs
+
+         This options enables support for the HD Audio controller
+         present in some Nvidia Tegra SoCs, used to communicate audio
+         to the HDMI output.
+
+         To compile this driver as a module, choose M here: the module
+         will be called snd-hda-tegra.
+
+if SND_HDA
 
 config SND_HDA_DSP_LOADER
 	bool
@@ -49,7 +70,7 @@ config SND_HDA_RECONFIG
 
 config SND_HDA_INPUT_BEEP
 	bool "Support digital beep via input layer"
-	depends on INPUT=y || INPUT=SND_HDA_INTEL
+	depends on INPUT=y || INPUT=SND_HDA
 	help
 	  Say Y here to build a digital beep interface for HD-audio
 	  driver. This interface is used to generate digital beeps.
@@ -90,7 +111,7 @@ config SND_HDA_CODEC_REALTEK
 	  snd-hda-intel driver, such as ALC880.
 
 comment "Set to Y if you want auto-loading the codec driver"
-	depends on SND_HDA_INTEL=y && SND_HDA_CODEC_REALTEK=m
+	depends on SND_HDA=y && SND_HDA_CODEC_REALTEK=m
 
 config SND_HDA_CODEC_ANALOG
 	tristate "Build Analog Device HD-audio codec support"
@@ -100,7 +121,7 @@ config SND_HDA_CODEC_ANALOG
 	  snd-hda-intel driver, such as AD1986A.
 
 comment "Set to Y if you want auto-loading the codec driver"
-	depends on SND_HDA_INTEL=y && SND_HDA_CODEC_ANALOG=m
+	depends on SND_HDA=y && SND_HDA_CODEC_ANALOG=m
 
 config SND_HDA_CODEC_SIGMATEL
 	tristate "Build IDT/Sigmatel HD-audio codec support"
@@ -110,7 +131,7 @@ config SND_HDA_CODEC_SIGMATEL
 	  snd-hda-intel driver, such as STAC9200.
 
 comment "Set to Y if you want auto-loading the codec driver"
-	depends on SND_HDA_INTEL=y && SND_HDA_CODEC_SIGMATEL=m
+	depends on SND_HDA=y && SND_HDA_CODEC_SIGMATEL=m
 
 config SND_HDA_CODEC_VIA
 	tristate "Build VIA HD-audio codec support"
@@ -120,7 +141,7 @@ config SND_HDA_CODEC_VIA
 	  snd-hda-intel driver, such as VT1708.
 
 comment "Set to Y if you want auto-loading the codec driver"
-	depends on SND_HDA_INTEL=y && SND_HDA_CODEC_VIA=m
+	depends on SND_HDA=y && SND_HDA_CODEC_VIA=m
 
 config SND_HDA_CODEC_HDMI
 	tristate "Build HDMI/DisplayPort HD-audio codec support"
@@ -130,7 +151,7 @@ config SND_HDA_CODEC_HDMI
 	  Intel and Nvidia HDMI/DisplayPort codecs.
 
 comment "Set to Y if you want auto-loading the codec driver"
-	depends on SND_HDA_INTEL=y && SND_HDA_CODEC_HDMI=m
+	depends on SND_HDA=y && SND_HDA_CODEC_HDMI=m
 
 config SND_HDA_I915
 	bool
@@ -145,7 +166,7 @@ config SND_HDA_CODEC_CIRRUS
 	  snd-hda-intel driver, such as CS4206.
 
 comment "Set to Y if you want auto-loading the codec driver"
-	depends on SND_HDA_INTEL=y && SND_HDA_CODEC_CIRRUS=m
+	depends on SND_HDA=y && SND_HDA_CODEC_CIRRUS=m
 
 config SND_HDA_CODEC_CONEXANT
 	tristate "Build Conexant HD-audio codec support"
@@ -155,7 +176,7 @@ config SND_HDA_CODEC_CONEXANT
 	  snd-hda-intel driver, such as CX20549.
 
 comment "Set to Y if you want auto-loading the codec driver"
-	depends on SND_HDA_INTEL=y && SND_HDA_CODEC_CONEXANT=m
+	depends on SND_HDA=y && SND_HDA_CODEC_CONEXANT=m
 
 config SND_HDA_CODEC_CA0110
 	tristate "Build Creative CA0110-IBG codec support"
@@ -165,7 +186,7 @@ config SND_HDA_CODEC_CA0110
 	  snd-hda-intel driver, found on some Creative X-Fi cards.
 
 comment "Set to Y if you want auto-loading the codec driver"
-	depends on SND_HDA_INTEL=y && SND_HDA_CODEC_CA0110=m
+	depends on SND_HDA=y && SND_HDA_CODEC_CA0110=m
 
 config SND_HDA_CODEC_CA0132
 	tristate "Build Creative CA0132 codec support"
@@ -174,7 +195,7 @@ config SND_HDA_CODEC_CA0132
 	  snd-hda-intel driver.
 
 comment "Set to Y if you want auto-loading the codec driver"
-	depends on SND_HDA_INTEL=y && SND_HDA_CODEC_CA0132=m
+	depends on SND_HDA=y && SND_HDA_CODEC_CA0132=m
 
 config SND_HDA_CODEC_CA0132_DSP
 	bool "Support new DSP code for CA0132 codec"
@@ -196,7 +217,7 @@ config SND_HDA_CODEC_CMEDIA
 	  snd-hda-intel driver, such as CMI9880.
 
 comment "Set to Y if you want auto-loading the codec driver"
-	depends on SND_HDA_INTEL=y && SND_HDA_CODEC_CMEDIA=m
+	depends on SND_HDA=y && SND_HDA_CODEC_CMEDIA=m
 
 config SND_HDA_CODEC_SI3054
 	tristate "Build Silicon Labs 3054 HD-modem codec support"
@@ -205,7 +226,7 @@ config SND_HDA_CODEC_SI3054
 	  (and compatibles) support in snd-hda-intel driver.
 
 comment "Set to Y if you want auto-loading the codec driver"
-	depends on SND_HDA_INTEL=y && SND_HDA_CODEC_SI3054=m
+	depends on SND_HDA=y && SND_HDA_CODEC_SI3054=m
 
 config SND_HDA_GENERIC
 	tristate "Enable generic HD-audio codec parser"
@@ -214,7 +235,7 @@ config SND_HDA_GENERIC
 	  in snd-hda-intel driver.
 
 comment "Set to Y if you want auto-loading the codec driver"
-	depends on SND_HDA_INTEL=y && SND_HDA_GENERIC=m
+	depends on SND_HDA=y && SND_HDA_GENERIC=m
 
 config SND_HDA_POWER_SAVE_DEFAULT
 	int "Default time-out for HD-audio power-save mode"
@@ -225,3 +246,5 @@ config SND_HDA_POWER_SAVE_DEFAULT
 	  power-save mode.  0 means to disable the power-save mode.
 
 endif
+
+endmenu
#13 lore raw
Quoted 55 lines · Takashi Iwai

At Thu, 27 Feb 2014 09:32:21 -0800,

Quoted 45 lines · Dylan Reid
Quoted 43 lines · Takashi Iwai

At Thu, 27 Feb 2014 08:44:48 -0800,

Quoted 40 lines · Dylan Reid
Quoted 27 lines · Takashi Iwai

At Wed, 19 Feb 2014 07:16:38 -0800,

Quoted 25 lines · Dylan Reid
Quoted 22 lines · Takashi Iwai

At Tue, 18 Feb 2014 11:04:19 -0700,

Quoted 9 lines · Stephen Warren
Quoted 7 lines · Takashi Iwai

At Sat, 15 Feb 2014 10:17:33 +0100,

Quoted 5 lines · Takashi Iwai

The default parent device can be obtained directly via card object, so we don't need to rely on pci->dev.parent. Since there is no access to pci_dev, we can reduce the inclusion of linux/pci.h, too.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

I forgot the cover page: these tree patches are trivial cleanups of hda-codec drivers (not the controller) to work without PCI device assignment. The idea was triggered by Dylan's question.

The series seems fine to me, so briefly,

Thanks. Any chance to work on / submit other changes for Tegra HD-audio support?

Quoted 7 lines
Quoted 2 lines

That's the plan, hopefully I'll be able to find time to throw together an RFC by the end of the week.

Since there was no patch appearing yet, I merged my latest development branch to for-next branch, which includes lots of changes in hda_intel.c and hda_codec.c. If any, please rebase your patches to it.

Thanks for the heads up. I've got a series that is almost ready, I'm still trying to tease part of the build out from under CONFIG_PCI in the hda makefile.

Quoted 7 lines
Quoted 2 lines

I don't think we have a dependency on CONFIG_PCI in Makefile. Kconfig has a dependency, but it can be easily reduced by a patch like below.

Sounds good. I was looking at re-using some of the config options (HDMI codec and power save) for the platform driver as well. Maybe something like the following. SND_HDA would build the helper module and hda-codec that are used by both hda_intel and a platform driver.

Quoted 4 lines

I think we can simply allow building all HD-audio codec drivers when CONFIG_SND_HDA is set. They are basically independent from the controller type. There are also other selectable items like hwdep support. The diff in sound/pci/hda would be like below.

Thanks I'll work off of that. It will need a change include/sound/core.h to define snd_pci_quirk without CONFIG_PCI since the codecs use that, and maybe stub out a couple of the pci specific functions. That seems reasonable to me.

Dylan

Quoted 173 lines

Takashi

--

sound/pci/hda/Kconfig +39 -16
index f2032dd7e35e..4cbf46e59d1c 100644
@@ -1,8 +1,15 @@
-menuconfig SND_HDA_INTEL
-       tristate "Intel HD Audio"
+menu "HD-Audio"
+
+config SND_HDA
+       tristate
        select SND_PCM
        select SND_VMASTER
        select SND_KCTL_JACK
+
+config SND_HDA_INTEL
+       tristate "HD Audio PCI"
+       depends on SND_PCI
+       select SND_HDA
        help
          Say Y here to include support for Intel "High Definition
          Audio" (Azalia) and its compatible devices.
@@ -13,7 +20,21 @@ menuconfig SND_HDA_INTEL
          To compile this driver as a module, choose M here: the module
          will be called snd-hda-intel.
 
-if SND_HDA_INTEL
+config SND_HDA_TEGRA
+       tristate "Tegra HD Audio"
+       select SND_HDA
+       help
+         Say Y here to support the HDA controller present in Nvidia
+         Tegra SoCs
+
+         This options enables support for the HD Audio controller
+         present in some Nvidia Tegra SoCs, used to communicate audio
+         to the HDMI output.
+
+         To compile this driver as a module, choose M here: the module
+         will be called snd-hda-tegra.
+
+if SND_HDA
 
 config SND_HDA_DSP_LOADER
        bool
@@ -49,7 +70,7 @@ config SND_HDA_RECONFIG
 
 config SND_HDA_INPUT_BEEP
        bool "Support digital beep via input layer"
-       depends on INPUT=y || INPUT=SND_HDA_INTEL
+       depends on INPUT=y || INPUT=SND_HDA
        help
          Say Y here to build a digital beep interface for HD-audio
          driver. This interface is used to generate digital beeps.
@@ -90,7 +111,7 @@ config SND_HDA_CODEC_REALTEK
          snd-hda-intel driver, such as ALC880.
 
 comment "Set to Y if you want auto-loading the codec driver"
-       depends on SND_HDA_INTEL=y && SND_HDA_CODEC_REALTEK=m
+       depends on SND_HDA=y && SND_HDA_CODEC_REALTEK=m
 
 config SND_HDA_CODEC_ANALOG
        tristate "Build Analog Device HD-audio codec support"
@@ -100,7 +121,7 @@ config SND_HDA_CODEC_ANALOG
          snd-hda-intel driver, such as AD1986A.
 
 comment "Set to Y if you want auto-loading the codec driver"
-       depends on SND_HDA_INTEL=y && SND_HDA_CODEC_ANALOG=m
+       depends on SND_HDA=y && SND_HDA_CODEC_ANALOG=m
 
 config SND_HDA_CODEC_SIGMATEL
        tristate "Build IDT/Sigmatel HD-audio codec support"
@@ -110,7 +131,7 @@ config SND_HDA_CODEC_SIGMATEL
          snd-hda-intel driver, such as STAC9200.
 
 comment "Set to Y if you want auto-loading the codec driver"
-       depends on SND_HDA_INTEL=y && SND_HDA_CODEC_SIGMATEL=m
+       depends on SND_HDA=y && SND_HDA_CODEC_SIGMATEL=m
 
 config SND_HDA_CODEC_VIA
        tristate "Build VIA HD-audio codec support"
@@ -120,7 +141,7 @@ config SND_HDA_CODEC_VIA
          snd-hda-intel driver, such as VT1708.
 
 comment "Set to Y if you want auto-loading the codec driver"
-       depends on SND_HDA_INTEL=y && SND_HDA_CODEC_VIA=m
+       depends on SND_HDA=y && SND_HDA_CODEC_VIA=m
 
 config SND_HDA_CODEC_HDMI
        tristate "Build HDMI/DisplayPort HD-audio codec support"
@@ -130,7 +151,7 @@ config SND_HDA_CODEC_HDMI
          Intel and Nvidia HDMI/DisplayPort codecs.
 
 comment "Set to Y if you want auto-loading the codec driver"
-       depends on SND_HDA_INTEL=y && SND_HDA_CODEC_HDMI=m
+       depends on SND_HDA=y && SND_HDA_CODEC_HDMI=m
 
 config SND_HDA_I915
        bool
@@ -145,7 +166,7 @@ config SND_HDA_CODEC_CIRRUS
          snd-hda-intel driver, such as CS4206.
 
 comment "Set to Y if you want auto-loading the codec driver"
-       depends on SND_HDA_INTEL=y && SND_HDA_CODEC_CIRRUS=m
+       depends on SND_HDA=y && SND_HDA_CODEC_CIRRUS=m
 
 config SND_HDA_CODEC_CONEXANT
        tristate "Build Conexant HD-audio codec support"
@@ -155,7 +176,7 @@ config SND_HDA_CODEC_CONEXANT
          snd-hda-intel driver, such as CX20549.
 
 comment "Set to Y if you want auto-loading the codec driver"
-       depends on SND_HDA_INTEL=y && SND_HDA_CODEC_CONEXANT=m
+       depends on SND_HDA=y && SND_HDA_CODEC_CONEXANT=m
 
 config SND_HDA_CODEC_CA0110
        tristate "Build Creative CA0110-IBG codec support"
@@ -165,7 +186,7 @@ config SND_HDA_CODEC_CA0110
          snd-hda-intel driver, found on some Creative X-Fi cards.
 
 comment "Set to Y if you want auto-loading the codec driver"
-       depends on SND_HDA_INTEL=y && SND_HDA_CODEC_CA0110=m
+       depends on SND_HDA=y && SND_HDA_CODEC_CA0110=m
 
 config SND_HDA_CODEC_CA0132
        tristate "Build Creative CA0132 codec support"
@@ -174,7 +195,7 @@ config SND_HDA_CODEC_CA0132
          snd-hda-intel driver.
 
 comment "Set to Y if you want auto-loading the codec driver"
-       depends on SND_HDA_INTEL=y && SND_HDA_CODEC_CA0132=m
+       depends on SND_HDA=y && SND_HDA_CODEC_CA0132=m
 
 config SND_HDA_CODEC_CA0132_DSP
        bool "Support new DSP code for CA0132 codec"
@@ -196,7 +217,7 @@ config SND_HDA_CODEC_CMEDIA
          snd-hda-intel driver, such as CMI9880.
 
 comment "Set to Y if you want auto-loading the codec driver"
-       depends on SND_HDA_INTEL=y && SND_HDA_CODEC_CMEDIA=m
+       depends on SND_HDA=y && SND_HDA_CODEC_CMEDIA=m
 
 config SND_HDA_CODEC_SI3054
        tristate "Build Silicon Labs 3054 HD-modem codec support"
@@ -205,7 +226,7 @@ config SND_HDA_CODEC_SI3054
          (and compatibles) support in snd-hda-intel driver.
 
 comment "Set to Y if you want auto-loading the codec driver"
-       depends on SND_HDA_INTEL=y && SND_HDA_CODEC_SI3054=m
+       depends on SND_HDA=y && SND_HDA_CODEC_SI3054=m
 
 config SND_HDA_GENERIC
        tristate "Enable generic HD-audio codec parser"
@@ -214,7 +235,7 @@ config SND_HDA_GENERIC
          in snd-hda-intel driver.
 
 comment "Set to Y if you want auto-loading the codec driver"
-       depends on SND_HDA_INTEL=y && SND_HDA_GENERIC=m
+       depends on SND_HDA=y && SND_HDA_GENERIC=m
 
 config SND_HDA_POWER_SAVE_DEFAULT
        int "Default time-out for HD-audio power-save mode"
@@ -225,3 +246,5 @@ config SND_HDA_POWER_SAVE_DEFAULT
          power-save mode.  0 means to disable the power-save mode.
 
 endif
+
+endmenu