At Tue, 28 Aug 2007 05:08:02 +0300, Maxim Levitsky wrote: > > From 204b216691b2d74e100bc321654ddadd2ff710af Mon Sep 17 00:00:00 2001 > From: Maxim Levitsky <maximlevitsky@xxxxxxxxx> > Date: Tue, 28 Aug 2007 01:06:00 +0300 > Subject: [PATCH] HDA: add support for analog loopback to STAC9204/9205/922x/927x > > --- > sound/pci/hda/patch_sigmatel.c | 59 ++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 59 insertions(+), 0 deletions(-) > > diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c > index 12b318e..a1f55d1 100644 > --- a/sound/pci/hda/patch_sigmatel.c > +++ b/sound/pci/hda/patch_sigmatel.c > @@ -128,6 +128,7 @@ struct sigmatel_spec { > /* i/o switches */ > unsigned int io_switch[2]; > unsigned int clfe_swap; > + unsigned int aloopback; > > struct hda_pcm pcm_rec[2]; /* PCM information */ > > @@ -277,6 +278,50 @@ static int stac92xx_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e > spec->mux_nids[adc_idx], &spec->cur_mux[adc_idx]); > } > > +static int stac92xx_aloopback_info(struct snd_kcontrol *kcontrol, > + struct snd_ctl_elem_info *uinfo) > +{ > + uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; > + uinfo->count = 1; > + uinfo->value.integer.min = 0; > + uinfo->value.integer.max = 1; > + return 0; > +} Use snd_ctl_boolean_mono_info(). > +static int stac92xx_aloopback_get(struct snd_kcontrol *kcontrol, > + struct snd_ctl_elem_value *ucontrol) > +{ > + struct hda_codec *codec = snd_kcontrol_chip(kcontrol); > + struct sigmatel_spec *spec = codec->spec; > + > + ucontrol->value.integer.value[0] = spec->aloopback; > + return 0; > +} > + > +static int stac92xx_aloopback_put(struct snd_kcontrol *kcontrol, > + struct snd_ctl_elem_value *ucontrol) > +{ > + struct hda_codec *codec = snd_kcontrol_chip(kcontrol); > + struct sigmatel_spec *spec = codec->spec; > + unsigned int dac_mode; > + > + spec->aloopback = ucontrol->value.integer.value[0]; > + > + dac_mode = snd_hda_codec_read(codec, codec->afg, 0, > + kcontrol->private_value & 0xFFFF, 0x0); > + > + if (spec->aloopback) > + dac_mode |= 0x40; > + else > + dac_mode &= ~0x40; > + > + snd_hda_codec_write(codec, codec->afg, 0, > + kcontrol->private_value >> 16, dac_mode); > + > + return 1; > +} Check the value change, and use snd_hda_codec_write_cache(). Takashi _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxx http://mailman.alsa-project.org/mailman/listinfo/alsa-devel