[alsa-devel] alsactl adds volume controls?

Colin Guthrie gmane at colin.guthr.ie
Fri Oct 8 15:21:54 CEST 2010


'Twas brillig, and Clemens Ladisch at 07/10/10 09:05 did gyre and gimble:
> Please try this patch.
> 
> --- a/sound/pci/hda/patch_sigmatel.c
> +++ b/sound/pci/hda/patch_sigmatel.c
> @@ -606,6 +606,24 @@ static hda_nid_t stac9205_pin_nids[12] = {
>  	0x21, 0x22,
>  };
>  
> +static int stac92xx_minmute_volume_tlv(struct snd_kcontrol *control,
> +				       int op_flag, unsigned int size,
> +				       unsigned int __user *_tlv)
> +{
> +	int ret;
> +	unsigned int val;
> +
> +	ret = snd_hda_mixer_amp_tlv(control, op_flag, size, _tlv);
> +	if (ret >= 0) {
> +		if (get_user(val, _tlv + 3))
> +			return -EFAULT;
> +		val |= 0x10000; /* min is mute */
> +		if (put_user(val, _tlv + 3))
> +			return -EFAULT;
> +	}
> +	return ret;
> +}
> +
>  static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol,
>  				   struct snd_ctl_elem_info *uinfo)
>  {
> @@ -959,6 +977,21 @@ static struct hda_verb stac9205_core_init[] = {
>  	{}
>  };
>  
> +#define STAC_MINMUTE_VOLUME(xname, xnid) \
> +	{ \
> +		.iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
> +		.name = xname, \
> +		.subdevice = HDA_SUBDEV_AMP_FLAG, \
> +		.access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \
> +			  SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
> +			  SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \
> +		.info = snd_hda_mixer_amp_volume_info, \
> +		.get = snd_hda_mixer_amp_volume_get, \
> +		.put = snd_hda_mixer_amp_volume_put, \
> +		.tlv = { .c = stac92xx_minmute_volume_tlv }, \
> +		.private_value = HDA_COMPOSE_AMP_VAL(xnid, 3, 0, HDA_OUTPUT), \
> +	}
> +
>  #define STAC_MONO_MUX \
>  	{ \
>  		.iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
> @@ -992,7 +1025,7 @@ static struct hda_verb stac9205_core_init[] = {
>  	}
>  
>  static struct snd_kcontrol_new stac9200_mixer[] = {
> -	HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT),
> +	STAC_MINMUTE_VOLUME("Master Playback Volume", 0xb),
>  	HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT),
>  	HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT),
>  	HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT),


Seemed to do something. Now, rather than printing -46.5dB then the
Master slider is down at 0, it prints "mute".

Is this the extent of the fix? i.e. to correctly report that the bottom
value is muted?

If so, then is there a way to tell this via an API so that I can tell PA
to not control the slider down to it's 0 value in order to avoid the
auto mute?

Col


-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]



More information about the Alsa-devel mailing list