ALSA: ice1724 - limit channels for multi-channel playback

Limit the available channels for multi-channel playback device to
the real number of channels.  Until now, always up to 8 channels
are created, which are simply useless without the real outputs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Takashi Iwai 2008-08-29 16:17:25 +02:00 committed by Jaroslav Kysela
parent eee75a6ca7
commit a6b936b956
1 changed files with 3 additions and 2 deletions

View File

@ -942,7 +942,7 @@ static int snd_vt1724_playback_pro_open(struct snd_pcm_substream *substream)
{ {
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); struct snd_ice1712 *ice = snd_pcm_substream_chip(substream);
int chs; int chs, num_indeps;
runtime->private_data = (void *)&vt1724_playback_pro_reg; runtime->private_data = (void *)&vt1724_playback_pro_reg;
ice->playback_pro_substream = substream; ice->playback_pro_substream = substream;
@ -952,7 +952,8 @@ static int snd_vt1724_playback_pro_open(struct snd_pcm_substream *substream)
set_rate_constraints(ice, substream); set_rate_constraints(ice, substream);
mutex_lock(&ice->open_mutex); mutex_lock(&ice->open_mutex);
/* calculate the currently available channels */ /* calculate the currently available channels */
for (chs = 0; chs < 3; chs++) { num_indeps = ice->num_total_dacs / 2 - 1;
for (chs = 0; chs < num_indeps; chs++) {
if (ice->pcm_reserved[chs]) if (ice->pcm_reserved[chs])
break; break;
} }