aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-08-03 12:01:40 -0400
committerTakashi Iwai <tiwai@suse.de>2012-09-06 12:08:31 -0400
commite36e3b86c78cee9c7435eb33e0ef8a788193e812 (patch)
treea44ed8a8f0e7b832048d4fbd94a9041823cf1979
parent833a493b7ed2eb8f9059338a0ebf06bebbb6ae93 (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>
-rw-r--r--sound/pci/atiixp.c9
-rw-r--r--sound/pci/fm801.c7
-rw-r--r--sound/pci/intel8x0.c20
-rw-r--r--sound/pci/via82xx.c23
4 files changed, 59 insertions, 0 deletions
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index c744df5bb1c6..368df8b0853e 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -1250,6 +1250,7 @@ static struct atiixp_dma_ops snd_atiixp_spdif_dma_ops = {
1250static int __devinit snd_atiixp_pcm_new(struct atiixp *chip) 1250static int __devinit snd_atiixp_pcm_new(struct atiixp *chip)
1251{ 1251{
1252 struct snd_pcm *pcm; 1252 struct snd_pcm *pcm;
1253 struct snd_pcm_chmap *chmap;
1253 struct snd_ac97_bus *pbus = chip->ac97_bus; 1254 struct snd_ac97_bus *pbus = chip->ac97_bus;
1254 int err, i, num_pcms; 1255 int err, i, num_pcms;
1255 1256
@@ -1293,6 +1294,14 @@ static int __devinit snd_atiixp_pcm_new(struct atiixp *chip)
1293 snd_dma_pci_data(chip->pci), 1294 snd_dma_pci_data(chip->pci),
1294 64*1024, 128*1024); 1295 64*1024, 128*1024);
1295 1296
1297 err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK,
1298 snd_pcm_alt_chmaps, chip->max_channels, 0,
1299 &chmap);
1300 if (err < 0)
1301 return err;
1302 chmap->channel_mask = SND_PCM_CHMAP_MASK_2468;
1303 chip->ac97[0]->chmaps[SNDRV_PCM_STREAM_PLAYBACK] = chmap;
1304
1296 /* no SPDIF support on codec? */ 1305 /* no SPDIF support on codec? */
1297 if (chip->pcms[ATI_PCM_SPDIF] && ! chip->pcms[ATI_PCM_SPDIF]->rates) 1306 if (chip->pcms[ATI_PCM_SPDIF] && ! chip->pcms[ATI_PCM_SPDIF]->rates)
1298 return 0; 1307 return 0;
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index ce3e548de41d..cc2e91d15538 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -711,6 +711,13 @@ static int __devinit snd_fm801_pcm(struct fm801 *chip, int device, struct snd_pc
711 snd_dma_pci_data(chip->pci), 711 snd_dma_pci_data(chip->pci),
712 chip->multichannel ? 128*1024 : 64*1024, 128*1024); 712 chip->multichannel ? 128*1024 : 64*1024, 128*1024);
713 713
714 err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK,
715 snd_pcm_alt_chmaps,
716 chip->multichannel ? 6 : 2, 0,
717 NULL);
718 if (err < 0)
719 return err;
720
714 if (rpcm) 721 if (rpcm)
715 *rpcm = pcm; 722 *rpcm = pcm;
716 return 0; 723 return 0;
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index 5c4115289a9a..848102e5d864 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -1541,6 +1541,26 @@ static int __devinit snd_intel8x0_pcm1(struct intel8x0 *chip, int device,
1541 snd_dma_pci_data(chip->pci), 1541 snd_dma_pci_data(chip->pci),
1542 rec->prealloc_size, rec->prealloc_max_size); 1542 rec->prealloc_size, rec->prealloc_max_size);
1543 1543
1544 if (rec->ac97_idx == ICHD_PCMOUT && rec->playback_ops) {
1545 struct snd_pcm_chmap *chmap;
1546 int chs = 2;
1547 if (rec->ac97_idx == ICHD_PCMOUT) {
1548 if (chip->multi8)
1549 chs = 8;
1550 else if (chip->multi6)
1551 chs = 6;
1552 else if (chip->multi4)
1553 chs = 4;
1554 }
1555 err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK,
1556 snd_pcm_alt_chmaps, chs, 0,
1557 &chmap);
1558 if (err < 0)
1559 return err;
1560 chmap->channel_mask = SND_PCM_CHMAP_MASK_2468;
1561 chip->ac97[0]->chmaps[SNDRV_PCM_STREAM_PLAYBACK] = chmap;
1562 }
1563
1544 return 0; 1564 return 0;
1545} 1565}
1546 1566
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,
1440static int __devinit snd_via8233_pcm_new(struct via82xx *chip) 1440static 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)
1493static int __devinit snd_via8233a_pcm_new(struct via82xx *chip) 1508static 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;