Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bcd72003 authored by Tobin Davis's avatar Tobin Davis Committed by Jaroslav Kysela
Browse files

[ALSA] HDA: Enable chipset gcap usage



This patch removes hardcoded values for the number of streams supported
by the southbridge in most chipsets, and reads these values from the
chipset directly.  Most systems are hardwired for 4 streams in each
direction, but newer chipsets change that capability.

Signed-off-by: default avatarTobin Davis <tdavis@dsl-only.net>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@perex.cz>
parent fb920b7d
Loading
Loading
Loading
Loading
+36 −20
Original line number Diff line number Diff line
@@ -1708,6 +1708,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
{
	struct azx *chip;
	int err;
	unsigned short gcap;
	static struct snd_device_ops ops = {
		.dev_free = azx_dev_free,
	};
@@ -1775,6 +1776,20 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
	pci_set_master(pci);
	synchronize_irq(chip->irq);

	gcap = azx_readw(chip, GCAP);
	snd_printdd("chipset global capabilities = 0x%x\n", gcap);

	if (gcap) {
		/* read number of streams from GCAP register instead of using
		 * hardcoded value
		 */
		chip->playback_streams = (gcap & (0xF << 12)) >> 12;
		chip->capture_streams = (gcap & (0xF << 8)) >> 8;
		chip->playback_index_offset = (gcap & (0xF << 12)) >> 12;
		chip->capture_index_offset = 0;
	} else {
		/* gcap didn't give any info, switching to old method */

		switch (chip->driver_type) {
		case AZX_DRIVER_ULI:
			chip->playback_streams = ULI_NUM_PLAYBACK;
@@ -1795,6 +1810,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
			chip->capture_index_offset = ICH6_CAPTURE_INDEX;
			break;
		}
	}
	chip->num_streams = chip->playback_streams + chip->capture_streams;
	chip->azx_dev = kcalloc(chip->num_streams, sizeof(*chip->azx_dev),
				GFP_KERNEL);