ALSA: ice1724 - Create capture pcm only for ADC-enabled configurations
authorPavel Hofman <pavel.hofman@ivitera.com>
Tue, 10 Jan 2012 19:45:28 +0000 (20:45 +0100)
committerTakashi Iwai <tiwai@suse.de>
Wed, 11 Jan 2012 07:56:59 +0000 (08:56 +0100)
Add the capture pcm only if there is at least one ADC configured in
the SYSCONF register.

Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/ice1712/envy24ht.h
sound/pci/ice1712/ice1724.c

index a0c5e009bb4a23eaf4c4ddc97148ed34aea25f36..4ca33a800bc804c4fff992243eef70234c4f0990 100644 (file)
@@ -66,6 +66,7 @@ enum {
 #define     VT1724_CFG_CLOCK384  0x40  /* 16.9344Mhz, 44.1kHz*384 */
 #define   VT1724_CFG_MPU401    0x20            /* MPU401 UARTs */
 #define   VT1724_CFG_ADC_MASK  0x0c    /* one, two or one and S/PDIF, stereo ADCs */
+#define   VT1724_CFG_ADC_NONE  0x0c    /* no ADCs */
 #define   VT1724_CFG_DAC_MASK  0x03    /* one, two, three, four stereo DACs */
 
 #define VT1724_REG_AC97_CFG            0x05    /* byte */
index 9e18d3a3f03808ccfbda2d4941eca013326ed0c4..e797823ddc3a253ddfbf4f8bf0a7abbf5838e583 100644 (file)
@@ -1117,14 +1117,21 @@ 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);
+       if ((ice->eeprom.data[ICE_EEP2_SYSCONF] & VT1724_CFG_ADC_MASK) ==
+           VT1724_CFG_ADC_NONE)
+               capt = 0;
+       else
+               capt = 1;
+       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;