mirror of
https://github.com/torvalds/linux.git
synced 2024-11-15 08:31:55 +00:00
[ALSA] hda-intel - Clean up stream definitions
Clean up the code to define playback/capture streams. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
49c88b85b5
commit
8b6ed8e70d
@ -185,21 +185,15 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
|
|||||||
|
|
||||||
/* max number of SDs */
|
/* max number of SDs */
|
||||||
/* ICH, ATI and VIA have 4 playback and 4 capture */
|
/* ICH, ATI and VIA have 4 playback and 4 capture */
|
||||||
#define ICH6_CAPTURE_INDEX 0
|
|
||||||
#define ICH6_NUM_CAPTURE 4
|
#define ICH6_NUM_CAPTURE 4
|
||||||
#define ICH6_PLAYBACK_INDEX 4
|
|
||||||
#define ICH6_NUM_PLAYBACK 4
|
#define ICH6_NUM_PLAYBACK 4
|
||||||
|
|
||||||
/* ULI has 6 playback and 5 capture */
|
/* ULI has 6 playback and 5 capture */
|
||||||
#define ULI_CAPTURE_INDEX 0
|
|
||||||
#define ULI_NUM_CAPTURE 5
|
#define ULI_NUM_CAPTURE 5
|
||||||
#define ULI_PLAYBACK_INDEX 5
|
|
||||||
#define ULI_NUM_PLAYBACK 6
|
#define ULI_NUM_PLAYBACK 6
|
||||||
|
|
||||||
/* ATI HDMI has 1 playback and 0 capture */
|
/* ATI HDMI has 1 playback and 0 capture */
|
||||||
#define ATIHDMI_CAPTURE_INDEX 0
|
|
||||||
#define ATIHDMI_NUM_CAPTURE 0
|
#define ATIHDMI_NUM_CAPTURE 0
|
||||||
#define ATIHDMI_PLAYBACK_INDEX 0
|
|
||||||
#define ATIHDMI_NUM_PLAYBACK 1
|
#define ATIHDMI_NUM_PLAYBACK 1
|
||||||
|
|
||||||
/* this number is statically defined for simplicity */
|
/* this number is statically defined for simplicity */
|
||||||
@ -1846,38 +1840,31 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
|
|||||||
if ((gcap & 0x01) && !pci_set_dma_mask(pci, DMA_64BIT_MASK))
|
if ((gcap & 0x01) && !pci_set_dma_mask(pci, DMA_64BIT_MASK))
|
||||||
pci_set_consistent_dma_mask(pci, DMA_64BIT_MASK);
|
pci_set_consistent_dma_mask(pci, DMA_64BIT_MASK);
|
||||||
|
|
||||||
if (gcap) {
|
/* read number of streams from GCAP register instead of using
|
||||||
/* read number of streams from GCAP register instead of using
|
* hardcoded value
|
||||||
* hardcoded value
|
*/
|
||||||
*/
|
chip->capture_streams = (gcap >> 8) & 0x0f;
|
||||||
chip->playback_streams = (gcap & (0xF << 12)) >> 12;
|
chip->playback_streams = (gcap >> 12) & 0x0f;
|
||||||
chip->capture_streams = (gcap & (0xF << 8)) >> 8;
|
if (!chip->playback_streams && !chip->capture_streams) {
|
||||||
chip->playback_index_offset = chip->capture_streams;
|
|
||||||
chip->capture_index_offset = 0;
|
|
||||||
} else {
|
|
||||||
/* gcap didn't give any info, switching to old method */
|
/* gcap didn't give any info, switching to old method */
|
||||||
|
|
||||||
switch (chip->driver_type) {
|
switch (chip->driver_type) {
|
||||||
case AZX_DRIVER_ULI:
|
case AZX_DRIVER_ULI:
|
||||||
chip->playback_streams = ULI_NUM_PLAYBACK;
|
chip->playback_streams = ULI_NUM_PLAYBACK;
|
||||||
chip->capture_streams = ULI_NUM_CAPTURE;
|
chip->capture_streams = ULI_NUM_CAPTURE;
|
||||||
chip->playback_index_offset = ULI_PLAYBACK_INDEX;
|
|
||||||
chip->capture_index_offset = ULI_CAPTURE_INDEX;
|
|
||||||
break;
|
break;
|
||||||
case AZX_DRIVER_ATIHDMI:
|
case AZX_DRIVER_ATIHDMI:
|
||||||
chip->playback_streams = ATIHDMI_NUM_PLAYBACK;
|
chip->playback_streams = ATIHDMI_NUM_PLAYBACK;
|
||||||
chip->capture_streams = ATIHDMI_NUM_CAPTURE;
|
chip->capture_streams = ATIHDMI_NUM_CAPTURE;
|
||||||
chip->playback_index_offset = ATIHDMI_PLAYBACK_INDEX;
|
|
||||||
chip->capture_index_offset = ATIHDMI_CAPTURE_INDEX;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
chip->playback_streams = ICH6_NUM_PLAYBACK;
|
chip->playback_streams = ICH6_NUM_PLAYBACK;
|
||||||
chip->capture_streams = ICH6_NUM_CAPTURE;
|
chip->capture_streams = ICH6_NUM_CAPTURE;
|
||||||
chip->playback_index_offset = ICH6_PLAYBACK_INDEX;
|
|
||||||
chip->capture_index_offset = ICH6_CAPTURE_INDEX;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
chip->capture_index_offset = 0;
|
||||||
|
chip->playback_index_offset = chip->capture_streams;
|
||||||
chip->num_streams = chip->playback_streams + chip->capture_streams;
|
chip->num_streams = chip->playback_streams + chip->capture_streams;
|
||||||
chip->azx_dev = kcalloc(chip->num_streams, sizeof(*chip->azx_dev),
|
chip->azx_dev = kcalloc(chip->num_streams, sizeof(*chip->azx_dev),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
|
Loading…
Reference in New Issue
Block a user