[alsa-devel] [PATCH 01/11] ALSA: hda - Add Stereo Downmix control for AD1986A

Takashi Iwai tiwai at suse.de
Thu Jan 30 12:59:58 CET 2014


At Tue, 28 Jan 2014 11:06:30 +0100,
Takashi Iwai wrote:
> 
> The stereo downmix control was dropped during the transition to the
> generic parser.  Let's re-add it.

Looking at the path again, this alone doesn't give anything useful, so
I removed this from the patch series.

It can be used only for multiple DACs, and we don't use multiple DACs
for a single output pin (no paths enabled).  And, yet, the input amps
for this widget must be activated accordingly, too.


Takashi


> 
> Signed-off-by: Takashi Iwai <tiwai at suse.de>
> ---
>  sound/pci/hda/patch_analog.c | 25 ++++++++++++++++++++++---
>  1 file changed, 22 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
> index 7a426ed491f2..11ec27a60276 100644
> --- a/sound/pci/hda/patch_analog.c
> +++ b/sound/pci/hda/patch_analog.c
> @@ -349,6 +349,12 @@ static int patch_ad1986a(struct hda_codec *codec)
>  		0x1e, 0x03,
>  		0
>  	};
> +	static const struct hda_verb downmix_verbs[] = {
> +		{ 0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, /* downmix off */
> +		{}
> +	};
> +	static const struct snd_kcontrol_new downmix_mixer =
> +		HDA_CODEC_MUTE("Stereo Downmix Switch", 0x09, 0x0, HDA_OUTPUT);
>  
>  	err = alloc_ad_spec(codec);
>  	if (err < 0)
> @@ -380,14 +386,27 @@ static int patch_ad1986a(struct hda_codec *codec)
>  	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
>  
>  	err = ad198x_parse_auto_config(codec, false);
> -	if (err < 0) {
> -		snd_hda_gen_free(codec);
> -		return err;
> +	if (err < 0)
> +		goto error;
> +
> +	/* stereo downmix control */
> +	err = snd_hda_add_verbs(codec, downmix_verbs);
> +	if (err < 0)
> +		goto error;
> +	if (spec->gen.multiout.num_dacs > 1) {
> +		if (!snd_hda_gen_add_kctl(&spec->gen, NULL, &downmix_mixer)) {
> +			err = -ENOMEM;
> +			goto error;
> +		}
>  	}
>  
>  	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
>  
>  	return 0;
> +
> + error:
> +	snd_hda_gen_free(codec);
> +	return err;
>  }
>  
>  
> -- 
> 1.8.5.2
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel at alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 


More information about the Alsa-devel mailing list