]> err.no Git - linux-2.6/blobdiff - sound/pci/ca0106/ca0106_mixer.c
Documentation: correct values in MPC8548E SEC example node
[linux-2.6] / sound / pci / ca0106 / ca0106_mixer.c
index 0730dc7c66e570926138c4d6dcb5c7913269ba31..146eed70dce6e62a06a32a24d31f6524cb3d1a5e 100644 (file)
@@ -73,7 +73,8 @@
 
 #include "ca0106.h"
 
-static int snd_ca0106_shared_spdif_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
+static int snd_ca0106_shared_spdif_info(struct snd_kcontrol *kcontrol,
+                                       struct snd_ctl_elem_info *uinfo)
 {
        uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
        uinfo->count = 1;
@@ -82,19 +83,19 @@ static int snd_ca0106_shared_spdif_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_i
        return 0;
 }
 
-static int snd_ca0106_shared_spdif_get(snd_kcontrol_t * kcontrol,
-                                       snd_ctl_elem_value_t * ucontrol)
+static int snd_ca0106_shared_spdif_get(struct snd_kcontrol *kcontrol,
+                                       struct snd_ctl_elem_value *ucontrol)
 {
-       ca0106_t *emu = snd_kcontrol_chip(kcontrol);
+       struct snd_ca0106 *emu = snd_kcontrol_chip(kcontrol);
 
        ucontrol->value.enumerated.item[0] = emu->spdif_enable;
        return 0;
 }
 
-static int snd_ca0106_shared_spdif_put(snd_kcontrol_t * kcontrol,
-                                       snd_ctl_elem_value_t * ucontrol)
+static int snd_ca0106_shared_spdif_put(struct snd_kcontrol *kcontrol,
+                                       struct snd_ctl_elem_value *ucontrol)
 {
-       ca0106_t *emu = snd_kcontrol_chip(kcontrol);
+       struct snd_ca0106 *emu = snd_kcontrol_chip(kcontrol);
        unsigned int val;
        int change = 0;
        u32 mask;
@@ -125,10 +126,11 @@ static int snd_ca0106_shared_spdif_put(snd_kcontrol_t * kcontrol,
         return change;
 }
 
-static int snd_ca0106_capture_source_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
+static int snd_ca0106_capture_source_info(struct snd_kcontrol *kcontrol,
+                                         struct snd_ctl_elem_info *uinfo)
 {
        static char *texts[6] = {
-               "SPDIF out", "i2s mixer out", "SPDIF in", "i2s in", "AC97 in", "SRC out"
+               "IEC958 out", "i2s mixer out", "IEC958 in", "i2s in", "AC97 in", "SRC out"
        };
 
        uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
@@ -140,19 +142,19 @@ static int snd_ca0106_capture_source_info(snd_kcontrol_t *kcontrol, snd_ctl_elem
        return 0;
 }
 
-static int snd_ca0106_capture_source_get(snd_kcontrol_t * kcontrol,
-                                       snd_ctl_elem_value_t * ucontrol)
+static int snd_ca0106_capture_source_get(struct snd_kcontrol *kcontrol,
+                                       struct snd_ctl_elem_value *ucontrol)
 {
-       ca0106_t *emu = snd_kcontrol_chip(kcontrol);
+       struct snd_ca0106 *emu = snd_kcontrol_chip(kcontrol);
 
        ucontrol->value.enumerated.item[0] = emu->capture_source;
        return 0;
 }
 
-static int snd_ca0106_capture_source_put(snd_kcontrol_t * kcontrol,
-                                       snd_ctl_elem_value_t * ucontrol)
+static int snd_ca0106_capture_source_put(struct snd_kcontrol *kcontrol,
+                                       struct snd_ctl_elem_value *ucontrol)
 {
-       ca0106_t *emu = snd_kcontrol_chip(kcontrol);
+       struct snd_ca0106 *emu = snd_kcontrol_chip(kcontrol);
        unsigned int val;
        int change = 0;
        u32 mask;
@@ -169,7 +171,78 @@ static int snd_ca0106_capture_source_put(snd_kcontrol_t * kcontrol,
         return change;
 }
 
-static int snd_ca0106_capture_mic_line_in_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
+static int snd_ca0106_i2c_capture_source_info(struct snd_kcontrol *kcontrol,
+                                         struct snd_ctl_elem_info *uinfo)
+{
+       static char *texts[6] = {
+               "Phone", "Mic", "Line in", "Aux"
+       };
+
+       uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
+       uinfo->count = 1;
+       uinfo->value.enumerated.items = 4;
+       if (uinfo->value.enumerated.item > 3)
+                uinfo->value.enumerated.item = 3;
+       strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
+       return 0;
+}
+
+static int snd_ca0106_i2c_capture_source_get(struct snd_kcontrol *kcontrol,
+                                       struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_ca0106 *emu = snd_kcontrol_chip(kcontrol);
+
+       ucontrol->value.enumerated.item[0] = emu->i2c_capture_source;
+       return 0;
+}
+
+static int snd_ca0106_i2c_capture_source_put(struct snd_kcontrol *kcontrol,
+                                       struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_ca0106 *emu = snd_kcontrol_chip(kcontrol);
+       unsigned int source_id;
+       unsigned int ngain, ogain;
+       int change = 0;
+       u32 source;
+       /* If the capture source has changed,
+        * update the capture volume from the cached value
+        * for the particular source.
+        */
+       source_id = ucontrol->value.enumerated.item[0] ;
+       change = (emu->i2c_capture_source != source_id);
+       if (change) {
+               snd_ca0106_i2c_write(emu, ADC_MUX, 0); /* Mute input */
+               ngain = emu->i2c_capture_volume[source_id][0]; /* Left */
+               ogain = emu->i2c_capture_volume[emu->i2c_capture_source][0]; /* Left */
+               if (ngain != ogain)
+                       snd_ca0106_i2c_write(emu, ADC_ATTEN_ADCL, ((ngain) & 0xff));
+               ngain = emu->i2c_capture_volume[source_id][1]; /* Left */
+               ogain = emu->i2c_capture_volume[emu->i2c_capture_source][1]; /* Left */
+               if (ngain != ogain)
+                       snd_ca0106_i2c_write(emu, ADC_ATTEN_ADCR, ((ngain) & 0xff));
+               source = 1 << source_id;
+               snd_ca0106_i2c_write(emu, ADC_MUX, source); /* Set source */
+               emu->i2c_capture_source = source_id;
+       }
+        return change;
+}
+
+static int snd_ca0106_capture_line_in_side_out_info(struct snd_kcontrol *kcontrol,
+                                              struct snd_ctl_elem_info *uinfo)
+{
+       static char *texts[2] = { "Side out", "Line in" };
+
+       uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
+       uinfo->count = 1;
+       uinfo->value.enumerated.items = 2;
+       if (uinfo->value.enumerated.item > 1)
+                uinfo->value.enumerated.item = 1;
+       strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
+       return 0;
+}
+
+static int snd_ca0106_capture_mic_line_in_info(struct snd_kcontrol *kcontrol,
+                                              struct snd_ctl_elem_info *uinfo)
 {
        static char *texts[2] = { "Line in", "Mic in" };
 
@@ -182,19 +255,19 @@ static int snd_ca0106_capture_mic_line_in_info(snd_kcontrol_t *kcontrol, snd_ctl
        return 0;
 }
 
-static int snd_ca0106_capture_mic_line_in_get(snd_kcontrol_t * kcontrol,
-                                       snd_ctl_elem_value_t * ucontrol)
+static int snd_ca0106_capture_mic_line_in_get(struct snd_kcontrol *kcontrol,
+                                       struct snd_ctl_elem_value *ucontrol)
 {
-       ca0106_t *emu = snd_kcontrol_chip(kcontrol);
+       struct snd_ca0106 *emu = snd_kcontrol_chip(kcontrol);
 
        ucontrol->value.enumerated.item[0] = emu->capture_mic_line_in;
        return 0;
 }
 
-static int snd_ca0106_capture_mic_line_in_put(snd_kcontrol_t * kcontrol,
-                                       snd_ctl_elem_value_t * ucontrol)
+static int snd_ca0106_capture_mic_line_in_put(struct snd_kcontrol *kcontrol,
+                                       struct snd_ctl_elem_value *ucontrol)
 {
-       ca0106_t *emu = snd_kcontrol_chip(kcontrol);
+       struct snd_ca0106 *emu = snd_kcontrol_chip(kcontrol);
        unsigned int val;
        int change = 0;
        u32 tmp;
@@ -204,41 +277,52 @@ static int snd_ca0106_capture_mic_line_in_put(snd_kcontrol_t * kcontrol,
        if (change) {
                emu->capture_mic_line_in = val;
                if (val) {
-                       snd_ca0106_i2c_write(emu, ADC_MUX, ADC_MUX_PHONE); /* Mute input */
+                       //snd_ca0106_i2c_write(emu, ADC_MUX, 0); /* Mute input */
                        tmp = inl(emu->port+GPIO) & ~0x400;
                        tmp = tmp | 0x400;
                        outl(tmp, emu->port+GPIO);
-                       snd_ca0106_i2c_write(emu, ADC_MUX, ADC_MUX_MIC);
+                       //snd_ca0106_i2c_write(emu, ADC_MUX, ADC_MUX_MIC);
                } else {
-                       snd_ca0106_i2c_write(emu, ADC_MUX, ADC_MUX_PHONE); /* Mute input */
+                       //snd_ca0106_i2c_write(emu, ADC_MUX, 0); /* Mute input */
                        tmp = inl(emu->port+GPIO) & ~0x400;
                        outl(tmp, emu->port+GPIO);
-                       snd_ca0106_i2c_write(emu, ADC_MUX, ADC_MUX_LINEIN);
+                       //snd_ca0106_i2c_write(emu, ADC_MUX, ADC_MUX_LINEIN);
                }
        }
         return change;
 }
 
-static snd_kcontrol_new_t snd_ca0106_capture_mic_line_in __devinitdata =
+static struct snd_kcontrol_new snd_ca0106_capture_mic_line_in __devinitdata =
 {
        .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
-       .name =         "Mic/Line in Capture",
+       .name =         "Shared Mic/Line in Capture Switch",
        .info =         snd_ca0106_capture_mic_line_in_info,
        .get =          snd_ca0106_capture_mic_line_in_get,
        .put =          snd_ca0106_capture_mic_line_in_put
 };
 
-static int snd_ca0106_spdif_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
+static struct snd_kcontrol_new snd_ca0106_capture_line_in_side_out __devinitdata =
+{
+       .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
+       .name =         "Shared Line in/Side out Capture Switch",
+       .info =         snd_ca0106_capture_line_in_side_out_info,
+       .get =          snd_ca0106_capture_mic_line_in_get,
+       .put =          snd_ca0106_capture_mic_line_in_put
+};
+
+
+static int snd_ca0106_spdif_info(struct snd_kcontrol *kcontrol,
+                                struct snd_ctl_elem_info *uinfo)
 {
        uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
        uinfo->count = 1;
        return 0;
 }
 
-static int snd_ca0106_spdif_get(snd_kcontrol_t * kcontrol,
-                                 snd_ctl_elem_value_t * ucontrol)
+static int snd_ca0106_spdif_get(struct snd_kcontrol *kcontrol,
+                                 struct snd_ctl_elem_value *ucontrol)
 {
-       ca0106_t *emu = snd_kcontrol_chip(kcontrol);
+       struct snd_ca0106 *emu = snd_kcontrol_chip(kcontrol);
        unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
 
        ucontrol->value.iec958.status[0] = (emu->spdif_bits[idx] >> 0) & 0xff;
@@ -248,8 +332,8 @@ static int snd_ca0106_spdif_get(snd_kcontrol_t * kcontrol,
         return 0;
 }
 
-static int snd_ca0106_spdif_get_mask(snd_kcontrol_t * kcontrol,
-                                     snd_ctl_elem_value_t * ucontrol)
+static int snd_ca0106_spdif_get_mask(struct snd_kcontrol *kcontrol,
+                                     struct snd_ctl_elem_value *ucontrol)
 {
        ucontrol->value.iec958.status[0] = 0xff;
        ucontrol->value.iec958.status[1] = 0xff;
@@ -258,10 +342,10 @@ static int snd_ca0106_spdif_get_mask(snd_kcontrol_t * kcontrol,
         return 0;
 }
 
-static int snd_ca0106_spdif_put(snd_kcontrol_t * kcontrol,
-                                 snd_ctl_elem_value_t * ucontrol)
+static int snd_ca0106_spdif_put(struct snd_kcontrol *kcontrol,
+                                 struct snd_ctl_elem_value *ucontrol)
 {
-       ca0106_t *emu = snd_kcontrol_chip(kcontrol);
+       struct snd_ca0106 *emu = snd_kcontrol_chip(kcontrol);
        unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
        int change;
        unsigned int val;
@@ -278,7 +362,8 @@ static int snd_ca0106_spdif_put(snd_kcontrol_t * kcontrol,
         return change;
 }
 
-static int snd_ca0106_volume_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
+static int snd_ca0106_volume_info(struct snd_kcontrol *kcontrol,
+                                 struct snd_ctl_elem_info *uinfo)
 {
         uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
         uinfo->count = 2;
@@ -287,10 +372,10 @@ static int snd_ca0106_volume_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
         return 0;
 }
 
-static int snd_ca0106_volume_get(snd_kcontrol_t * kcontrol,
-                                snd_ctl_elem_value_t * ucontrol)
+static int snd_ca0106_volume_get(struct snd_kcontrol *kcontrol,
+                                struct snd_ctl_elem_value *ucontrol)
 {
-        ca0106_t *emu = snd_kcontrol_chip(kcontrol);
+        struct snd_ca0106 *emu = snd_kcontrol_chip(kcontrol);
         unsigned int value;
        int channel_id, reg;
 
@@ -303,10 +388,10 @@ static int snd_ca0106_volume_get(snd_kcontrol_t * kcontrol,
         return 0;
 }
 
-static int snd_ca0106_volume_put(snd_kcontrol_t * kcontrol,
-                                snd_ctl_elem_value_t * ucontrol)
+static int snd_ca0106_volume_put(struct snd_kcontrol *kcontrol,
+                                struct snd_ctl_elem_value *ucontrol)
 {
-        ca0106_t *emu = snd_kcontrol_chip(kcontrol);
+        struct snd_ca0106 *emu = snd_kcontrol_chip(kcontrol);
         unsigned int oval, nval;
        int channel_id, reg;
 
@@ -324,17 +409,83 @@ static int snd_ca0106_volume_put(snd_kcontrol_t * kcontrol,
        return 1;
 }
 
+static int snd_ca0106_i2c_volume_info(struct snd_kcontrol *kcontrol,
+                                 struct snd_ctl_elem_info *uinfo)
+{
+        uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
+        uinfo->count = 2;
+        uinfo->value.integer.min = 0;
+        uinfo->value.integer.max = 255;
+        return 0;
+}
+
+static int snd_ca0106_i2c_volume_get(struct snd_kcontrol *kcontrol,
+                                struct snd_ctl_elem_value *ucontrol)
+{
+        struct snd_ca0106 *emu = snd_kcontrol_chip(kcontrol);
+       int source_id;
+
+       source_id = kcontrol->private_value;
+
+        ucontrol->value.integer.value[0] = emu->i2c_capture_volume[source_id][0];
+        ucontrol->value.integer.value[1] = emu->i2c_capture_volume[source_id][1];
+        return 0;
+}
+
+static int snd_ca0106_i2c_volume_put(struct snd_kcontrol *kcontrol,
+                                struct snd_ctl_elem_value *ucontrol)
+{
+        struct snd_ca0106 *emu = snd_kcontrol_chip(kcontrol);
+        unsigned int ogain;
+        unsigned int ngain;
+       int source_id;
+       int change = 0;
+
+       source_id = kcontrol->private_value;
+       ogain = emu->i2c_capture_volume[source_id][0]; /* Left */
+       ngain = ucontrol->value.integer.value[0];
+       if (ngain > 0xff)
+               return 0;
+       if (ogain != ngain) {
+               if (emu->i2c_capture_source == source_id)
+                       snd_ca0106_i2c_write(emu, ADC_ATTEN_ADCL, ((ngain) & 0xff) );
+               emu->i2c_capture_volume[source_id][0] = ucontrol->value.integer.value[0];
+               change = 1;
+       }
+       ogain = emu->i2c_capture_volume[source_id][1]; /* Right */
+       ngain = ucontrol->value.integer.value[1];
+       if (ngain > 0xff)
+               return 0;
+       if (ogain != ngain) {
+               if (emu->i2c_capture_source == source_id)
+                       snd_ca0106_i2c_write(emu, ADC_ATTEN_ADCR, ((ngain) & 0xff));
+               emu->i2c_capture_volume[source_id][1] = ucontrol->value.integer.value[1];
+               change = 1;
+       }
+
+       return change;
+}
+
 #define CA_VOLUME(xname,chid,reg) \
 {                                                              \
        .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,     \
-       .info = snd_ca0106_volume_info,                         \
-       .get =          snd_ca0106_volume_get,                  \
-       .put =          snd_ca0106_volume_put,                  \
+       .info =  snd_ca0106_volume_info,                        \
+       .get =   snd_ca0106_volume_get,                         \
+       .put =   snd_ca0106_volume_put,                         \
        .private_value = ((chid) << 8) | (reg)                  \
 }
 
+#define I2C_VOLUME(xname,chid) \
+{                                                              \
+       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,     \
+       .info =  snd_ca0106_i2c_volume_info,                    \
+       .get =   snd_ca0106_i2c_volume_get,                     \
+       .put =   snd_ca0106_i2c_volume_put,                     \
+       .private_value = chid                                   \
+}
+
 
-static snd_kcontrol_new_t snd_ca0106_volume_ctls[] __devinitdata = {
+static struct snd_kcontrol_new snd_ca0106_volume_ctls[] __devinitdata = {
        CA_VOLUME("Analog Front Playback Volume",
                  CONTROL_FRONT_CHANNEL, PLAYBACK_VOLUME2),
         CA_VOLUME("Analog Rear Playback Volume",
@@ -344,18 +495,23 @@ static snd_kcontrol_new_t snd_ca0106_volume_ctls[] __devinitdata = {
         CA_VOLUME("Analog Side Playback Volume",
                  CONTROL_UNKNOWN_CHANNEL, PLAYBACK_VOLUME2),
 
-        CA_VOLUME("SPDIF Front Playback Volume",
+        CA_VOLUME("IEC958 Front Playback Volume",
                  CONTROL_FRONT_CHANNEL, PLAYBACK_VOLUME1),
-       CA_VOLUME("SPDIF Rear Playback Volume",
+       CA_VOLUME("IEC958 Rear Playback Volume",
                  CONTROL_REAR_CHANNEL, PLAYBACK_VOLUME1),
-       CA_VOLUME("SPDIF Center/LFE Playback Volume",
+       CA_VOLUME("IEC958 Center/LFE Playback Volume",
                  CONTROL_CENTER_LFE_CHANNEL, PLAYBACK_VOLUME1),
-       CA_VOLUME("SPDIF Unknown Playback Volume",
+       CA_VOLUME("IEC958 Unknown Playback Volume",
                  CONTROL_UNKNOWN_CHANNEL, PLAYBACK_VOLUME1),
 
         CA_VOLUME("CAPTURE feedback Playback Volume",
                  1, CAPTURE_CONTROL),
 
+        I2C_VOLUME("Phone Capture Volume", 0),
+        I2C_VOLUME("Mic Capture Volume", 1),
+        I2C_VOLUME("Line in Capture Volume", 2),
+        I2C_VOLUME("Aux Capture Volume", 3),
+
        {
                .access =       SNDRV_CTL_ELEM_ACCESS_READ,
                .iface =        SNDRV_CTL_ELEM_IFACE_PCM,
@@ -366,18 +522,25 @@ static snd_kcontrol_new_t snd_ca0106_volume_ctls[] __devinitdata = {
        },
        {
                .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
-               .name =         "SPDIF Out",
+               .name =         "IEC958 Playback Switch",
                .info =         snd_ca0106_shared_spdif_info,
                .get =          snd_ca0106_shared_spdif_get,
                .put =          snd_ca0106_shared_spdif_put
        },
        {
                .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
-               .name =         "Capture Source",
+               .name =         "Digital Capture Source",
                .info =         snd_ca0106_capture_source_info,
                .get =          snd_ca0106_capture_source_get,
                .put =          snd_ca0106_capture_source_put
        },
+       {
+               .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
+               .name =         "Capture Source",
+               .info =         snd_ca0106_i2c_capture_source_info,
+               .get =          snd_ca0106_i2c_capture_source_get,
+               .put =          snd_ca0106_i2c_capture_source_put
+       },
        {
                .iface =        SNDRV_CTL_ELEM_IFACE_PCM,
                .name =         SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT),
@@ -388,18 +551,18 @@ static snd_kcontrol_new_t snd_ca0106_volume_ctls[] __devinitdata = {
        },
 };
 
-static int __devinit remove_ctl(snd_card_t *card, const char *name)
+static int __devinit remove_ctl(struct snd_card *card, const char *name)
 {
-       snd_ctl_elem_id_t id;
+       struct snd_ctl_elem_id id;
        memset(&id, 0, sizeof(id));
        strcpy(id.name, name);
        id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
        return snd_ctl_remove_id(card, &id);
 }
 
-static snd_kcontrol_t __devinit *ctl_find(snd_card_t *card, const char *name)
+static struct snd_kcontrol __devinit *ctl_find(struct snd_card *card, const char *name)
 {
-       snd_ctl_elem_id_t sid;
+       struct snd_ctl_elem_id sid;
        memset(&sid, 0, sizeof(sid));
        /* FIXME: strcpy is bad. */
        strcpy(sid.name, name);
@@ -407,9 +570,9 @@ static snd_kcontrol_t __devinit *ctl_find(snd_card_t *card, const char *name)
        return snd_ctl_find_id(card, &sid);
 }
 
-static int __devinit rename_ctl(snd_card_t *card, const char *src, const char *dst)
+static int __devinit rename_ctl(struct snd_card *card, const char *src, const char *dst)
 {
-       snd_kcontrol_t *kctl = ctl_find(card, src);
+       struct snd_kcontrol *kctl = ctl_find(card, src);
        if (kctl) {
                strcpy(kctl->id.name, dst);
                return 0;
@@ -417,10 +580,10 @@ static int __devinit rename_ctl(snd_card_t *card, const char *src, const char *d
        return -ENOENT;
 }
 
-int __devinit snd_ca0106_mixer(ca0106_t *emu)
+int __devinit snd_ca0106_mixer(struct snd_ca0106 *emu)
 {
        int i, err;
-        snd_card_t *card = emu->card;
+        struct snd_card *card = emu->card;
        char **c;
        static char *ca0106_remove_ctls[] = {
                "Master Mono Playback Switch",
@@ -472,7 +635,10 @@ int __devinit snd_ca0106_mixer(ca0106_t *emu)
                        return err;
        }
        if (emu->details->i2c_adc == 1) {
-               err = snd_ctl_add(card, snd_ctl_new1(&snd_ca0106_capture_mic_line_in, emu));
+               if (emu->details->gpio_type == 1)
+                       err = snd_ctl_add(card, snd_ctl_new1(&snd_ca0106_capture_mic_line_in, emu));
+               else  /* gpio_type == 2 */
+                       err = snd_ctl_add(card, snd_ctl_new1(&snd_ca0106_capture_line_in_side_out, emu));
                if (err < 0)
                        return err;
        }