aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_intel.c
diff options
context:
space:
mode:
authorTobin Davis <tdavis@dsl-only.net>2008-01-15 05:23:55 -0500
committerJaroslav Kysela <perex@perex.cz>2008-01-31 11:29:58 -0500
commitbcd7200394bde40e3735054fc660b6f5012638b3 (patch)
tree2fce8f3b086f8de06ae244c5c5026c50d4fe7cd1 /sound/pci/hda/hda_intel.c
parentfb920b7d8b65f253671073d40d490d0968151680 (diff)
[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: Tobin Davis <tdavis@dsl-only.net> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci/hda/hda_intel.c')
-rw-r--r--sound/pci/hda/hda_intel.c56
1 files changed, 36 insertions, 20 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 25f35fa9706e..5f2c3ca863db 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1708,12 +1708,13 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
1708{ 1708{
1709 struct azx *chip; 1709 struct azx *chip;
1710 int err; 1710 int err;
1711 unsigned short gcap;
1711 static struct snd_device_ops ops = { 1712 static struct snd_device_ops ops = {
1712 .dev_free = azx_dev_free, 1713 .dev_free = azx_dev_free,
1713 }; 1714 };
1714 1715
1715 *rchip = NULL; 1716 *rchip = NULL;
1716 1717
1717 err = pci_enable_device(pci); 1718 err = pci_enable_device(pci);
1718 if (err < 0) 1719 if (err < 0)
1719 return err; 1720 return err;
@@ -1775,25 +1776,40 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
1775 pci_set_master(pci); 1776 pci_set_master(pci);
1776 synchronize_irq(chip->irq); 1777 synchronize_irq(chip->irq);
1777 1778
1778 switch (chip->driver_type) { 1779 gcap = azx_readw(chip, GCAP);
1779 case AZX_DRIVER_ULI: 1780 snd_printdd("chipset global capabilities = 0x%x\n", gcap);
1780 chip->playback_streams = ULI_NUM_PLAYBACK; 1781
1781 chip->capture_streams = ULI_NUM_CAPTURE; 1782 if (gcap) {
1782 chip->playback_index_offset = ULI_PLAYBACK_INDEX; 1783 /* read number of streams from GCAP register instead of using
1783 chip->capture_index_offset = ULI_CAPTURE_INDEX; 1784 * hardcoded value
1784 break; 1785 */
1785 case AZX_DRIVER_ATIHDMI: 1786 chip->playback_streams = (gcap & (0xF << 12)) >> 12;
1786 chip->playback_streams = ATIHDMI_NUM_PLAYBACK; 1787 chip->capture_streams = (gcap & (0xF << 8)) >> 8;
1787 chip->capture_streams = ATIHDMI_NUM_CAPTURE; 1788 chip->playback_index_offset = (gcap & (0xF << 12)) >> 12;
1788 chip->playback_index_offset = ATIHDMI_PLAYBACK_INDEX; 1789 chip->capture_index_offset = 0;
1789 chip->capture_index_offset = ATIHDMI_CAPTURE_INDEX; 1790 } else {
1790 break; 1791 /* gcap didn't give any info, switching to old method */
1791 default: 1792
1792 chip->playback_streams = ICH6_NUM_PLAYBACK; 1793 switch (chip->driver_type) {
1793 chip->capture_streams = ICH6_NUM_CAPTURE; 1794 case AZX_DRIVER_ULI:
1794 chip->playback_index_offset = ICH6_PLAYBACK_INDEX; 1795 chip->playback_streams = ULI_NUM_PLAYBACK;
1795 chip->capture_index_offset = ICH6_CAPTURE_INDEX; 1796 chip->capture_streams = ULI_NUM_CAPTURE;
1796 break; 1797 chip->playback_index_offset = ULI_PLAYBACK_INDEX;
1798 chip->capture_index_offset = ULI_CAPTURE_INDEX;
1799 break;
1800 case AZX_DRIVER_ATIHDMI:
1801 chip->playback_streams = ATIHDMI_NUM_PLAYBACK;
1802 chip->capture_streams = ATIHDMI_NUM_CAPTURE;
1803 chip->playback_index_offset = ATIHDMI_PLAYBACK_INDEX;
1804 chip->capture_index_offset = ATIHDMI_CAPTURE_INDEX;
1805 break;
1806 default:
1807 chip->playback_streams = ICH6_NUM_PLAYBACK;
1808 chip->capture_streams = ICH6_NUM_CAPTURE;
1809 chip->playback_index_offset = ICH6_PLAYBACK_INDEX;
1810 chip->capture_index_offset = ICH6_CAPTURE_INDEX;
1811 break;
1812 }
1797 } 1813 }
1798 chip->num_streams = chip->playback_streams + chip->capture_streams; 1814 chip->num_streams = chip->playback_streams + chip->capture_streams;
1799 chip->azx_dev = kcalloc(chip->num_streams, sizeof(*chip->azx_dev), 1815 chip->azx_dev = kcalloc(chip->num_streams, sizeof(*chip->azx_dev),