Update of /cvsroot/alsa/alsa-kernel/ppc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11932/ppc

Modified Files:
        tumbler.c 
Log Message:
added input source switch to select mic/line-in.



Index: tumbler.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/ppc/tumbler.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- tumbler.c   4 Mar 2004 17:53:06 -0000       1.27
+++ tumbler.c   9 Mar 2004 13:21:44 -0000       1.28
@@ -94,6 +94,7 @@
        unsigned int mix_vol[VOL_IDX_LAST_MIX][2]; /* stereo volumes for tas3004 */
        int drc_range;
        int drc_enable;
+       int capture_source;
 } pmac_tumbler_t;
 
 
@@ -135,8 +136,8 @@
                TAS_REG_MCS, (1<<6)|(2<<4)|0,
                /* normal operation, all-pass mode */
                TAS_REG_MCS2, (1<<1),
-               /* normal output, no deemphasis, A input, power-up */
-               TAS_REG_ACS, 2,
+               /* normal output, no deemphasis, A input, power-up, line-in */
+               TAS_REG_ACS, 0,
                0, /* terminator */
        };
        return send_init_client(i2c, regs);
@@ -681,6 +682,52 @@
        return 0;
 }
 
+static int snapper_set_capture_source(pmac_tumbler_t *mix)
+{
+       return snd_pmac_keywest_write_byte(&mix->i2c, TAS_REG_ACS,
+                                          mix->capture_source ? 2 : 0);
+}
+
+static int snapper_info_capture_source(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t 
*uinfo)
+{
+       static char *texts[2] = {
+               "Line", "Mic"
+       };
+       uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
+       uinfo->count = 1;
+       uinfo->value.integer.min = 0;
+       uinfo->value.integer.max = 1;
+       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 snapper_get_capture_source(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t 
*ucontrol)
+{
+       pmac_t *chip = snd_kcontrol_chip(kcontrol);
+       pmac_tumbler_t *mix = chip->mixer_data;
+
+       snd_assert(mix, return -ENODEV);
+       ucontrol->value.integer.value[0] = mix->capture_source;
+       return 0;
+}
+
+static int snapper_put_capture_source(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t 
*ucontrol)
+{
+       pmac_t *chip = snd_kcontrol_chip(kcontrol);
+       pmac_tumbler_t *mix = chip->mixer_data;
+       int change;
+
+       snd_assert(mix, return -ENODEV);
+       change = ucontrol->value.integer.value[0] != mix->capture_source;
+       if (change) {
+               mix->capture_source = !!ucontrol->value.integer.value[0];
+               snapper_set_capture_source(mix);
+       }
+       return change;
+}
+
 #define DEFINE_SNAPPER_MIX(xname,idx,ofs) { \
        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,\
        .name = xname, \
@@ -754,6 +801,12 @@
          .get = tumbler_get_drc_value,
          .put = tumbler_put_drc_value
        },
+       { .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+         .name = "Input Source", /* FIXME: "Capture Source" doesn't work properly */
+         .info = snapper_info_capture_source,
+         .get = snapper_get_capture_source,
+         .put = snapper_put_capture_source
+       },
 };
 
 static snd_kcontrol_new_t tumbler_hp_sw __initdata = {
@@ -932,6 +985,7 @@
                tumbler_set_mono_volume(mix, &snapper_bass_vol_info);
                tumbler_set_mono_volume(mix, &snapper_treble_vol_info);
                snapper_set_drc(mix);
+               snapper_set_capture_source(mix);
        }
        tumbler_set_master_volume(mix);
        if (chip->update_automute)



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to