aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-08-03 12:03:17 -0400
committerTakashi Iwai <tiwai@suse.de>2012-09-06 12:08:33 -0400
commit8d50cdc1f52843d4fe593c2613528c3f6677949a (patch)
treec450ff29cffdf9c0bf51f47c1b47247d301fff9c /sound/pci
parentf49921b894ec338696e47d985acc09df3cddbfd1 (diff)
ALSA: ctxfi: Implement channel maps
Assign the multi-channel map to front PCM, and other channel map to each other channel PCM. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/ctxfi/ctpcm.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/sound/pci/ctxfi/ctpcm.c b/sound/pci/ctxfi/ctpcm.c
index d021876901bb..6c191429b126 100644
--- a/sound/pci/ctxfi/ctpcm.c
+++ b/sound/pci/ctxfi/ctpcm.c
@@ -395,12 +395,38 @@ static struct snd_pcm_ops ct_pcm_capture_ops = {
395 .page = snd_pcm_sgbuf_ops_page, 395 .page = snd_pcm_sgbuf_ops_page,
396}; 396};
397 397
398static const struct snd_pcm_chmap_elem surround_map[] = {
399 { .channels = 1,
400 .map = { SNDRV_CHMAP_RC } },
401 { .channels = 2,
402 .map = { SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } },
403 { }
404};
405
406static const struct snd_pcm_chmap_elem clfe_map[] = {
407 { .channels = 1,
408 .map = { SNDRV_CHMAP_FC } },
409 { .channels = 2,
410 .map = { SNDRV_CHMAP_FC, SNDRV_CHMAP_LFE } },
411 { }
412};
413
414static const struct snd_pcm_chmap_elem side_map[] = {
415 { .channels = 1,
416 .map = { SNDRV_CHMAP_RC } },
417 { .channels = 2,
418 .map = { SNDRV_CHMAP_SL, SNDRV_CHMAP_SR } },
419 { }
420};
421
398/* Create ALSA pcm device */ 422/* Create ALSA pcm device */
399int ct_alsa_pcm_create(struct ct_atc *atc, 423int ct_alsa_pcm_create(struct ct_atc *atc,
400 enum CTALSADEVS device, 424 enum CTALSADEVS device,
401 const char *device_name) 425 const char *device_name)
402{ 426{
403 struct snd_pcm *pcm; 427 struct snd_pcm *pcm;
428 const struct snd_pcm_chmap_elem *map;
429 int chs;
404 int err; 430 int err;
405 int playback_count, capture_count; 431 int playback_count, capture_count;
406 432
@@ -427,6 +453,30 @@ int ct_alsa_pcm_create(struct ct_atc *atc,
427 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, 453 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
428 snd_dma_pci_data(atc->pci), 128*1024, 128*1024); 454 snd_dma_pci_data(atc->pci), 128*1024, 128*1024);
429 455
456 chs = 2;
457 switch (device) {
458 case FRONT:
459 chs = 8;
460 map = snd_pcm_std_chmaps;
461 break;
462 case SURROUND:
463 map = surround_map;
464 break;
465 case CLFE:
466 map = clfe_map;
467 break;
468 case SIDE:
469 map = side_map;
470 break;
471 default:
472 map = snd_pcm_std_chmaps;
473 break;
474 }
475 err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, map, chs,
476 0, NULL);
477 if (err < 0)
478 return err;
479
430#ifdef CONFIG_PM_SLEEP 480#ifdef CONFIG_PM_SLEEP
431 atc->pcms[device] = pcm; 481 atc->pcms[device] = pcm;
432#endif 482#endif