diff options
author | Takashi Iwai <tiwai@suse.de> | 2012-09-12 09:52:09 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-09-12 09:52:09 -0400 |
commit | 21147f91f1be57c4cfc24e538e93c30636513ce8 (patch) | |
tree | f59298c3ef12900d487ddc50cf27bfad4166c9d6 /sound | |
parent | 1fe4d42e0e28c2c004b06dd590702604f47c2402 (diff) |
ALSA: ca0106: Define channel maps
Provide channel maps for individual stereo streams of CA0106.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/ca0106/ca0106_main.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c index fc6787699ba9..65c55910566b 100644 --- a/sound/pci/ca0106/ca0106_main.c +++ b/sound/pci/ca0106/ca0106_main.c | |||
@@ -1334,10 +1334,29 @@ static irqreturn_t snd_ca0106_interrupt(int irq, void *dev_id) | |||
1334 | return IRQ_HANDLED; | 1334 | return IRQ_HANDLED; |
1335 | } | 1335 | } |
1336 | 1336 | ||
1337 | static const struct snd_pcm_chmap_elem surround_map[] = { | ||
1338 | { .channels = 2, | ||
1339 | .map = { SNDRV_CHMAP_RL, SNDRV_CHMAP_RR } }, | ||
1340 | { } | ||
1341 | }; | ||
1342 | |||
1343 | static const struct snd_pcm_chmap_elem clfe_map[] = { | ||
1344 | { .channels = 2, | ||
1345 | .map = { SNDRV_CHMAP_FC, SNDRV_CHMAP_LFE } }, | ||
1346 | { } | ||
1347 | }; | ||
1348 | |||
1349 | static const struct snd_pcm_chmap_elem side_map[] = { | ||
1350 | { .channels = 2, | ||
1351 | .map = { SNDRV_CHMAP_SL, SNDRV_CHMAP_SR } }, | ||
1352 | { } | ||
1353 | }; | ||
1354 | |||
1337 | static int __devinit snd_ca0106_pcm(struct snd_ca0106 *emu, int device) | 1355 | static int __devinit snd_ca0106_pcm(struct snd_ca0106 *emu, int device) |
1338 | { | 1356 | { |
1339 | struct snd_pcm *pcm; | 1357 | struct snd_pcm *pcm; |
1340 | struct snd_pcm_substream *substream; | 1358 | struct snd_pcm_substream *substream; |
1359 | const struct snd_pcm_chmap_elem *map = NULL; | ||
1341 | int err; | 1360 | int err; |
1342 | 1361 | ||
1343 | err = snd_pcm_new(emu->card, "ca0106", device, 1, 1, &pcm); | 1362 | err = snd_pcm_new(emu->card, "ca0106", device, 1, 1, &pcm); |
@@ -1350,18 +1369,22 @@ static int __devinit snd_ca0106_pcm(struct snd_ca0106 *emu, int device) | |||
1350 | case 0: | 1369 | case 0: |
1351 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ca0106_playback_front_ops); | 1370 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ca0106_playback_front_ops); |
1352 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_ca0106_capture_0_ops); | 1371 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_ca0106_capture_0_ops); |
1372 | map = snd_pcm_std_chmaps; | ||
1353 | break; | 1373 | break; |
1354 | case 1: | 1374 | case 1: |
1355 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ca0106_playback_rear_ops); | 1375 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ca0106_playback_rear_ops); |
1356 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_ca0106_capture_1_ops); | 1376 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_ca0106_capture_1_ops); |
1377 | map = surround_map; | ||
1357 | break; | 1378 | break; |
1358 | case 2: | 1379 | case 2: |
1359 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ca0106_playback_center_lfe_ops); | 1380 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ca0106_playback_center_lfe_ops); |
1360 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_ca0106_capture_2_ops); | 1381 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_ca0106_capture_2_ops); |
1382 | map = clfe_map; | ||
1361 | break; | 1383 | break; |
1362 | case 3: | 1384 | case 3: |
1363 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ca0106_playback_unknown_ops); | 1385 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ca0106_playback_unknown_ops); |
1364 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_ca0106_capture_3_ops); | 1386 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_ca0106_capture_3_ops); |
1387 | map = side_map; | ||
1365 | break; | 1388 | break; |
1366 | } | 1389 | } |
1367 | 1390 | ||
@@ -1388,6 +1411,11 @@ static int __devinit snd_ca0106_pcm(struct snd_ca0106 *emu, int device) | |||
1388 | return err; | 1411 | return err; |
1389 | } | 1412 | } |
1390 | 1413 | ||
1414 | err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, map, 2, | ||
1415 | 1 << 2, NULL); | ||
1416 | if (err < 0) | ||
1417 | return err; | ||
1418 | |||
1391 | emu->pcm[device] = pcm; | 1419 | emu->pcm[device] = pcm; |
1392 | 1420 | ||
1393 | return 0; | 1421 | return 0; |