diff options
author | Takashi Iwai <tiwai@suse.de> | 2012-08-03 12:01:40 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-09-06 12:08:31 -0400 |
commit | e36e3b86c78cee9c7435eb33e0ef8a788193e812 (patch) | |
tree | a44ed8a8f0e7b832048d4fbd94a9041823cf1979 /sound/pci/via82xx.c | |
parent | 833a493b7ed2eb8f9059338a0ebf06bebbb6ae93 (diff) |
ALSA: Implement channel maps for standard onboard AC97 drivers
Just set the channel maps depending on the hardware availability.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/via82xx.c')
-rw-r--r-- | sound/pci/via82xx.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index e3d32e2d574e..f0b4efdb483c 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c | |||
@@ -1440,6 +1440,7 @@ static void init_viadev(struct via82xx *chip, int idx, unsigned int reg_offset, | |||
1440 | static int __devinit snd_via8233_pcm_new(struct via82xx *chip) | 1440 | static int __devinit snd_via8233_pcm_new(struct via82xx *chip) |
1441 | { | 1441 | { |
1442 | struct snd_pcm *pcm; | 1442 | struct snd_pcm *pcm; |
1443 | struct snd_pcm_chmap *chmap; | ||
1443 | int i, err; | 1444 | int i, err; |
1444 | 1445 | ||
1445 | chip->playback_devno = 0; /* x 4 */ | 1446 | chip->playback_devno = 0; /* x 4 */ |
@@ -1467,6 +1468,12 @@ static int __devinit snd_via8233_pcm_new(struct via82xx *chip) | |||
1467 | snd_dma_pci_data(chip->pci), | 1468 | snd_dma_pci_data(chip->pci), |
1468 | 64*1024, VIA_MAX_BUFSIZE); | 1469 | 64*1024, VIA_MAX_BUFSIZE); |
1469 | 1470 | ||
1471 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | ||
1472 | snd_pcm_std_chmaps, 2, 0, | ||
1473 | &chmap); | ||
1474 | if (err < 0) | ||
1475 | return err; | ||
1476 | |||
1470 | /* PCM #1: multi-channel playback and 2nd capture */ | 1477 | /* PCM #1: multi-channel playback and 2nd capture */ |
1471 | err = snd_pcm_new(chip->card, chip->card->shortname, 1, 1, 1, &pcm); | 1478 | err = snd_pcm_new(chip->card, chip->card->shortname, 1, 1, 1, &pcm); |
1472 | if (err < 0) | 1479 | if (err < 0) |
@@ -1484,6 +1491,14 @@ static int __devinit snd_via8233_pcm_new(struct via82xx *chip) | |||
1484 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, | 1491 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, |
1485 | snd_dma_pci_data(chip->pci), | 1492 | snd_dma_pci_data(chip->pci), |
1486 | 64*1024, VIA_MAX_BUFSIZE); | 1493 | 64*1024, VIA_MAX_BUFSIZE); |
1494 | |||
1495 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | ||
1496 | snd_pcm_alt_chmaps, 6, 0, | ||
1497 | &chmap); | ||
1498 | if (err < 0) | ||
1499 | return err; | ||
1500 | chip->ac97->chmaps[SNDRV_PCM_STREAM_PLAYBACK] = chmap; | ||
1501 | |||
1487 | return 0; | 1502 | return 0; |
1488 | } | 1503 | } |
1489 | 1504 | ||
@@ -1493,6 +1508,7 @@ static int __devinit snd_via8233_pcm_new(struct via82xx *chip) | |||
1493 | static int __devinit snd_via8233a_pcm_new(struct via82xx *chip) | 1508 | static int __devinit snd_via8233a_pcm_new(struct via82xx *chip) |
1494 | { | 1509 | { |
1495 | struct snd_pcm *pcm; | 1510 | struct snd_pcm *pcm; |
1511 | struct snd_pcm_chmap *chmap; | ||
1496 | int err; | 1512 | int err; |
1497 | 1513 | ||
1498 | chip->multi_devno = 0; | 1514 | chip->multi_devno = 0; |
@@ -1519,6 +1535,13 @@ static int __devinit snd_via8233a_pcm_new(struct via82xx *chip) | |||
1519 | snd_dma_pci_data(chip->pci), | 1535 | snd_dma_pci_data(chip->pci), |
1520 | 64*1024, VIA_MAX_BUFSIZE); | 1536 | 64*1024, VIA_MAX_BUFSIZE); |
1521 | 1537 | ||
1538 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, | ||
1539 | snd_pcm_alt_chmaps, 6, 0, | ||
1540 | &chmap); | ||
1541 | if (err < 0) | ||
1542 | return err; | ||
1543 | chip->ac97->chmaps[SNDRV_PCM_STREAM_PLAYBACK] = chmap; | ||
1544 | |||
1522 | /* SPDIF supported? */ | 1545 | /* SPDIF supported? */ |
1523 | if (! ac97_can_spdif(chip->ac97)) | 1546 | if (! ac97_can_spdif(chip->ac97)) |
1524 | return 0; | 1547 | return 0; |