[alsa-devel] [PATCH - ice1724 1/4] ALSA: ice1724 - Create capture pcm only for ADC-enabled configurations

pavel.hofman at ivitera.com pavel.hofman at ivitera.com
Thu Jan 5 22:01:55 CET 2012


From: Pavel Hofman <pavel.hofman at ivitera.com>

Add the capture pcm only if there is at least one ADC configured in
the SYSCONF register.

Signed-off-by: Pavel Hofman <pavel.hofman at ivitera.com>

diff --git a/pci/ice1712/ice1724.c b/pci/ice1712/ice1724.c
index 4353e76..2a0be2c 100644
--- a/pci/ice1712/ice1724.c
+++ b/pci/ice1712/ice1724.c
@@ -1117,14 +1117,18 @@ static struct snd_pcm_ops snd_vt1724_capture_pro_ops = {
 static int __devinit snd_vt1724_pcm_profi(struct snd_ice1712 *ice, int device)
 {
 	struct snd_pcm *pcm;
-	int err;
+	int capt, err;
 
-	err = snd_pcm_new(ice->card, "ICE1724", device, 1, 1, &pcm);
+	capt = (~ice->eeprom.data[ICE_EEP2_SYSCONF] & VT1724_CFG_ADC_MASK) ?
+		1 : 0;
+	err = snd_pcm_new(ice->card, "ICE1724", device, 1, capt, &pcm);
 	if (err < 0)
 		return err;
 
 	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_vt1724_playback_pro_ops);
-	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_vt1724_capture_pro_ops);
+	if (capt)
+		snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
+			&snd_vt1724_capture_pro_ops);
 
 	pcm->private_data = ice;
 	pcm->info_flags = 0;
-- 
1.7.0.4



More information about the Alsa-devel mailing list