Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: klem.dev@gmail.com
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH 5/6] ESI W192M : Add text Line in/Mic for selecting input gain state
Date: Mon, 16 Mar 2015 08:51:23 +0100	[thread overview]
Message-ID: <s5h7fuhqt1g.wl-tiwai@suse.de> (raw)
In-Reply-To: <550621f3.28eec20a.543a.fffffbe6@mx.google.com>

At Mon, 16 Mar 2015 01:20:54 +0100,
klem.dev@gmail.com wrote:
> 
> From: Clément Guedez <klem.dev@gmail.com>
> 
> Add text Line in/Mic for selecting input gain state in mixer for ESI W192M.

What I meant is to change control name "Line Switch" to a different
suffix (oh, anyway there is a typo in the original code, it's written
as "switch", not "Switch"...)

The type of control element is identified by a string name rule in
some levels.  When a control is named as "XXX Switch", it's taken as a
boolean control.  For enum control, we usually take "Enum" suffix so
that alsa-lib simple mixer interface can recognize it as an enumerated
control.

(Hm, it's not mentioned in Documentation/sound/alsa/ControlNames.txt.
 An update is needed...)


Takashi

> 
> Signed-off-by: Clément Guedez <klem.dev@gmail.com>
> 
> diff --git a/sound/pci/ice1712/wtm.c b/sound/pci/ice1712/wtm.c
> index c7ffafa..a6e7afa 100644
> --- a/sound/pci/ice1712/wtm.c
> +++ b/sound/pci/ice1712/wtm.c
> @@ -339,8 +339,14 @@ static int stac9460_adc_vol_put(struct snd_kcontrol *kcontrol,
>  /*
>   * MIC / LINE switch fonction
>   */
> +static int stac9460_mic_sw_info(struct snd_kcontrol *kcontrol,
> +				struct snd_ctl_elem_info *uinfo)
> +{
> +	static const char * const texts[2] = { "Line In", "Mic" };
> +
> +	return snd_ctl_enum_info(uinfo, 1, 2, texts);
> +}
>  
> -#define stac9460_mic_sw_info		snd_ctl_boolean_mono_info
>  
>  static int stac9460_mic_sw_get(struct snd_kcontrol *kcontrol,
>  				struct snd_ctl_elem_value *ucontrol)
> @@ -354,7 +360,7 @@ static int stac9460_mic_sw_get(struct snd_kcontrol *kcontrol,
>  		val = stac9460_get(ice, STAC946X_GENERAL_PURPOSE);
>  	else
>  		val = stac9460_2_get(ice, STAC946X_GENERAL_PURPOSE);
> -	ucontrol->value.integer.value[0] = ~val>>7 & 0x1;
> +	ucontrol->value.enumerated.item[0] = (val >> 7) & 0x1;
>  	return 0;
>  }
>  
> @@ -370,7 +376,7 @@ static int stac9460_mic_sw_put(struct snd_kcontrol *kcontrol,
>  		old = stac9460_get(ice, STAC946X_GENERAL_PURPOSE);
>  	else
>  		old = stac9460_2_get(ice, STAC946X_GENERAL_PURPOSE);
> -	new = (~ucontrol->value.integer.value[0] << 7 & 0x80) | (old & ~0x80);
> +	new = (ucontrol->value.enumerated.item[0] << 7 & 0x80) | (old & ~0x80);
>  	change = (new != old);
>  	if (change) {
>  		if (id == 0)
> -- 
> 2.1.4
> 
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2015-03-16  7:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1426465255-19005-1-git-send-email-me>
2015-03-16  0:20 ` [PATCH 2/6] ESI W192M : Update eeprom structure to C99 standard klem.dev
2015-03-16  0:20 ` [PATCH 3/6] ESI W192M : Enable midi i/o of port envy24 chip as available klem.dev
2015-03-16  0:20 ` [PATCH 4/6] ESI W192M : Add TLV support for control value in dB scale klem.dev
2015-03-16  0:20 ` [PATCH 5/6] ESI W192M : Add text Line in/Mic for selecting input gain state klem.dev
2015-03-16  7:51   ` Takashi Iwai [this message]
2015-03-16 14:54     ` Clément Guedez
2015-03-16 14:55       ` Takashi Iwai
2015-03-16  0:20 ` [PATCH 6/6] ESI W192M : Add sampling rate control of the ADC/DAC klem.dev
     [not found] <1426641991-3694-1-git-send-email-me>
2015-03-18  1:26 ` [PATCH 5/6] ESI W192M : Add text Line in/Mic for selecting input gain state klem.dev
     [not found] <1426300302-20542-1-git-send-email-me>
2015-03-14  2:31 ` klem.dev
2015-03-14  8:10   ` Takashi Iwai
2015-03-14 13:45     ` Clément Guedez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5h7fuhqt1g.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=klem.dev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox