diff options
author | Takashi Iwai <tiwai@suse.de> | 2012-08-03 18:03:17 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-09-06 18:08:33 +0200 |
commit | 8d50cdc1f52843d4fe593c2613528c3f6677949a (patch) | |
tree | c450ff29cffdf9c0bf51f47c1b47247d301fff9c /sound/pci/ctxfi/ctpcm.c | |
parent | f49921b894ec338696e47d985acc09df3cddbfd1 (diff) | |
download | op-kernel-dev-8d50cdc1f52843d4fe593c2613528c3f6677949a.zip op-kernel-dev-8d50cdc1f52843d4fe593c2613528c3f6677949a.tar.gz |
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/ctxfi/ctpcm.c')
-rw-r--r-- | sound/pci/ctxfi/ctpcm.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/sound/pci/ctxfi/ctpcm.c b/sound/pci/ctxfi/ctpcm.c index d021876..6c19142 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 = { .page = snd_pcm_sgbuf_ops_page, }; +static const struct snd_pcm_chmap_elem surround_map[] = { + { .channels = 1, + .map = { SNDRV_CHMAP_RC } }, + { .channels = 2, + .map = { SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } }, + { } +}; + +static const struct snd_pcm_chmap_elem clfe_map[] = { + { .channels = 1, + .map = { SNDRV_CHMAP_FC } }, + { .channels = 2, + .map = { SNDRV_CHMAP_FC, SNDRV_CHMAP_LFE } }, + { } +}; + +static const struct snd_pcm_chmap_elem side_map[] = { + { .channels = 1, + .map = { SNDRV_CHMAP_RC } }, + { .channels = 2, + .map = { SNDRV_CHMAP_SL, SNDRV_CHMAP_SR } }, + { } +}; + /* Create ALSA pcm device */ int ct_alsa_pcm_create(struct ct_atc *atc, enum CTALSADEVS device, const char *device_name) { struct snd_pcm *pcm; + const struct snd_pcm_chmap_elem *map; + int chs; int err; int playback_count, capture_count; @@ -427,6 +453,30 @@ int ct_alsa_pcm_create(struct ct_atc *atc, snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, snd_dma_pci_data(atc->pci), 128*1024, 128*1024); + chs = 2; + switch (device) { + case FRONT: + chs = 8; + map = snd_pcm_std_chmaps; + break; + case SURROUND: + map = surround_map; + break; + case CLFE: + map = clfe_map; + break; + case SIDE: + map = side_map; + break; + default: + map = snd_pcm_std_chmaps; + break; + } + err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, map, chs, + 0, NULL); + if (err < 0) + return err; + #ifdef CONFIG_PM_SLEEP atc->pcms[device] = pcm; #endif |