diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-02-19 05:36:35 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-04-24 06:00:12 -0400 |
commit | 8b6ed8e70d9a7c39748a9902d64138e070d4064b (patch) | |
tree | 5051073d3b623542f5de74b0e960b444c7e519e1 /sound/pci | |
parent | 49c88b85b53767f97eb8c9171cb0b976c62a0114 (diff) |
[ALSA] hda-intel - Clean up stream definitions
Clean up the code to define playback/capture streams.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/hda/hda_intel.c | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 66dceffa1217..cf1a1d0124fe 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -185,21 +185,15 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 }; | |||
185 | 185 | ||
186 | /* max number of SDs */ | 186 | /* max number of SDs */ |
187 | /* ICH, ATI and VIA have 4 playback and 4 capture */ | 187 | /* ICH, ATI and VIA have 4 playback and 4 capture */ |
188 | #define ICH6_CAPTURE_INDEX 0 | ||
189 | #define ICH6_NUM_CAPTURE 4 | 188 | #define ICH6_NUM_CAPTURE 4 |
190 | #define ICH6_PLAYBACK_INDEX 4 | ||
191 | #define ICH6_NUM_PLAYBACK 4 | 189 | #define ICH6_NUM_PLAYBACK 4 |
192 | 190 | ||
193 | /* ULI has 6 playback and 5 capture */ | 191 | /* ULI has 6 playback and 5 capture */ |
194 | #define ULI_CAPTURE_INDEX 0 | ||
195 | #define ULI_NUM_CAPTURE 5 | 192 | #define ULI_NUM_CAPTURE 5 |
196 | #define ULI_PLAYBACK_INDEX 5 | ||
197 | #define ULI_NUM_PLAYBACK 6 | 193 | #define ULI_NUM_PLAYBACK 6 |
198 | 194 | ||
199 | /* ATI HDMI has 1 playback and 0 capture */ | 195 | /* ATI HDMI has 1 playback and 0 capture */ |
200 | #define ATIHDMI_CAPTURE_INDEX 0 | ||
201 | #define ATIHDMI_NUM_CAPTURE 0 | 196 | #define ATIHDMI_NUM_CAPTURE 0 |
202 | #define ATIHDMI_PLAYBACK_INDEX 0 | ||
203 | #define ATIHDMI_NUM_PLAYBACK 1 | 197 | #define ATIHDMI_NUM_PLAYBACK 1 |
204 | 198 | ||
205 | /* this number is statically defined for simplicity */ | 199 | /* this number is statically defined for simplicity */ |
@@ -1846,38 +1840,31 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, | |||
1846 | if ((gcap & 0x01) && !pci_set_dma_mask(pci, DMA_64BIT_MASK)) | 1840 | if ((gcap & 0x01) && !pci_set_dma_mask(pci, DMA_64BIT_MASK)) |
1847 | pci_set_consistent_dma_mask(pci, DMA_64BIT_MASK); | 1841 | pci_set_consistent_dma_mask(pci, DMA_64BIT_MASK); |
1848 | 1842 | ||
1849 | if (gcap) { | 1843 | /* read number of streams from GCAP register instead of using |
1850 | /* read number of streams from GCAP register instead of using | 1844 | * hardcoded value |
1851 | * hardcoded value | 1845 | */ |
1852 | */ | 1846 | chip->capture_streams = (gcap >> 8) & 0x0f; |
1853 | chip->playback_streams = (gcap & (0xF << 12)) >> 12; | 1847 | chip->playback_streams = (gcap >> 12) & 0x0f; |
1854 | chip->capture_streams = (gcap & (0xF << 8)) >> 8; | 1848 | if (!chip->playback_streams && !chip->capture_streams) { |
1855 | chip->playback_index_offset = chip->capture_streams; | ||
1856 | chip->capture_index_offset = 0; | ||
1857 | } else { | ||
1858 | /* gcap didn't give any info, switching to old method */ | 1849 | /* gcap didn't give any info, switching to old method */ |
1859 | 1850 | ||
1860 | switch (chip->driver_type) { | 1851 | switch (chip->driver_type) { |
1861 | case AZX_DRIVER_ULI: | 1852 | case AZX_DRIVER_ULI: |
1862 | chip->playback_streams = ULI_NUM_PLAYBACK; | 1853 | chip->playback_streams = ULI_NUM_PLAYBACK; |
1863 | chip->capture_streams = ULI_NUM_CAPTURE; | 1854 | chip->capture_streams = ULI_NUM_CAPTURE; |
1864 | chip->playback_index_offset = ULI_PLAYBACK_INDEX; | ||
1865 | chip->capture_index_offset = ULI_CAPTURE_INDEX; | ||
1866 | break; | 1855 | break; |
1867 | case AZX_DRIVER_ATIHDMI: | 1856 | case AZX_DRIVER_ATIHDMI: |
1868 | chip->playback_streams = ATIHDMI_NUM_PLAYBACK; | 1857 | chip->playback_streams = ATIHDMI_NUM_PLAYBACK; |
1869 | chip->capture_streams = ATIHDMI_NUM_CAPTURE; | 1858 | chip->capture_streams = ATIHDMI_NUM_CAPTURE; |
1870 | chip->playback_index_offset = ATIHDMI_PLAYBACK_INDEX; | ||
1871 | chip->capture_index_offset = ATIHDMI_CAPTURE_INDEX; | ||
1872 | break; | 1859 | break; |
1873 | default: | 1860 | default: |
1874 | chip->playback_streams = ICH6_NUM_PLAYBACK; | 1861 | chip->playback_streams = ICH6_NUM_PLAYBACK; |
1875 | chip->capture_streams = ICH6_NUM_CAPTURE; | 1862 | chip->capture_streams = ICH6_NUM_CAPTURE; |
1876 | chip->playback_index_offset = ICH6_PLAYBACK_INDEX; | ||
1877 | chip->capture_index_offset = ICH6_CAPTURE_INDEX; | ||
1878 | break; | 1863 | break; |
1879 | } | 1864 | } |
1880 | } | 1865 | } |
1866 | chip->capture_index_offset = 0; | ||
1867 | chip->playback_index_offset = chip->capture_streams; | ||
1881 | chip->num_streams = chip->playback_streams + chip->capture_streams; | 1868 | chip->num_streams = chip->playback_streams + chip->capture_streams; |
1882 | chip->azx_dev = kcalloc(chip->num_streams, sizeof(*chip->azx_dev), | 1869 | chip->azx_dev = kcalloc(chip->num_streams, sizeof(*chip->azx_dev), |
1883 | GFP_KERNEL); | 1870 | GFP_KERNEL); |