Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* why would an scontrol think that it should have 2 items instead of just 1?
@ 2007-08-08 22:28 John L. Utz III
  2007-08-10  7:33 ` Clemens Ladisch
  0 siblings, 1 reply; 3+ messages in thread
From: John L. Utz III @ 2007-08-08 22:28 UTC (permalink / raw)
  To: ALSA devel

Hello

The VT1618 codec has a register value that turns on the Surround Side
Output (it's off by default)

I have implemented the control, but I am getting a really weird result,
i have a bogus 'Item1' that shouldnt exist:

jutz-gntdv alsa-driver # amixer sset Side On
Simple mixer control 'Side',0
  Capabilities: pvolume pswitch enum
  Items: 'On' 'Off'
  Item0: 'On'
  Item1: 'On'
jutz-gntdv alsa-driver # amixer sset Side Off
Simple mixer control 'Side',0
  Capabilities: pvolume pswitch enum
  Items: 'On' 'Off'
  Item0: 'Off'
  Item1: 'On'

This wasnt always there, it just showed up during development. Is the
number of items cached in a temp file somewhere that i just need to
remove?

Here's the mixer element:

	{
		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
		.name  = "Side",
		.info  = snd_ac97_vt1618_surside_info,
		.get   = snd_ac97_vt1618_surside_get,
		.put   = snd_ac97_vt1618_surside_put
	},

Here's the function impls:

/* surround side power up or down */

static int snd_ac97_vt1618_surside_info(struct snd_kcontrol *kcontrol,
				     struct snd_ctl_elem_info *uinfo)
{
	static const char* texts[] = {"On", "Off"};
	return ac97_enum_text_info(kcontrol, uinfo, texts, 2);
}

static int snd_ac97_vt1618_surside_get(struct snd_kcontrol *kcontrol,
				       struct snd_ctl_elem_value
*ucontrol) {
	struct snd_ac97 *pac97 = snd_kcontrol_chip(kcontrol);
  
	ucontrol->value.enumerated.item[0] = 
		(snd_ac97_read(pac97, 0x5c) & 0x0008) >> 3;

	return 0;
}

static int snd_ac97_vt1618_surside_put(struct snd_kcontrol *kcontrol,
				       struct snd_ctl_elem_value
*ucontrol) {
  //0x5c,  3, 1,
	struct snd_ac97 *pac97 = snd_kcontrol_chip(kcontrol);

	snd_ac97_update_bits(pac97, 0x5c, 0x0008,
			     ucontrol->value.enumerated.item[0] << 3);
	return 0;
}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: why would an scontrol think that it should have 2 items instead of just 1?
  2007-08-08 22:28 why would an scontrol think that it should have 2 items instead of just 1? John L. Utz III
@ 2007-08-10  7:33 ` Clemens Ladisch
  2007-08-10 17:46   ` Solved! Tnx Clemens! " John L. Utz III
  0 siblings, 1 reply; 3+ messages in thread
From: Clemens Ladisch @ 2007-08-10  7:33 UTC (permalink / raw)
  To: John L. Utz III, ALSA devel

John L. Utz III wrote:
> The VT1618 codec has a register value that turns on the Surround Side
> Output (it's off by default)
> 
> I have implemented the control, but I am getting a really weird result,
> i have a bogus 'Item1' that shouldnt exist:
> 
> jutz-gntdv alsa-driver # amixer sset Side On
> Simple mixer control 'Side',0
>   Capabilities: pvolume pswitch enum
>   Items: 'On' 'Off'
>   Item0: 'On'
>   Item1: 'On'
> jutz-gntdv alsa-driver # amixer sset Side Off
> Simple mixer control 'Side',0
>   Capabilities: pvolume pswitch enum
>   Items: 'On' 'Off'
>   Item0: 'Off'
>   Item1: 'On'

How does this control look like in the output of "amixer controls"?


Regards,
Clemens

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Solved! Tnx Clemens! Re: why would an scontrol think that it should have 2 items instead of just 1?
  2007-08-10  7:33 ` Clemens Ladisch
@ 2007-08-10 17:46   ` John L. Utz III
  0 siblings, 0 replies; 3+ messages in thread
From: John L. Utz III @ 2007-08-10 17:46 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: ALSA devel

Hi Clemens!

Tnx for the question!

On Fri, 10 Aug 2007 09:33:48 +0200
"Clemens Ladisch" <cladisch@fastmail.net> wrote:

> John L. Utz III wrote:
> > The VT1618 codec has a register value that turns on the Surround
> > Side Output (it's off by default)
> > 
> > I have implemented the control, but I am getting a really weird
> > result, i have a bogus 'Item1' that shouldnt exist:
> > 
> > jutz-gntdv alsa-driver # amixer sset Side On
> > Simple mixer control 'Side',0
> >   Capabilities: pvolume pswitch enum
> >   Items: 'On' 'Off'
> >   Item0: 'On'
> >   Item1: 'On'
> > jutz-gntdv alsa-driver # amixer sset Side Off
> > Simple mixer control 'Side',0
> >   Capabilities: pvolume pswitch enum
> >   Items: 'On' 'Off'
> >   Item0: 'Off'
> >   Item1: 'On'
> 
> How does this control look like in the output of "amixer controls"?

This is an *excellent* question because the results of looking are damn
odd! :

jutz-gntdv alsa-driver # amixer controls | grep Side
numid=10,iface=MIXER,name='Jack Side'
numid=9,iface=MIXER,name='Side'
numid=4,iface=MIXER,name='Side Playback Switch'
numid=3,iface=MIXER,name='Side Playback Volume'

I think that my 'Side' enable twiddler was colliding with my 'Side'
Volume and Switch twiddlers, because once i changed 'Side' to 'Side
Enable' the problem went away:

jutz-gntdv alsa-driver # amixer sget Side\ Enable
Simple mixer control 'Side Enable',0
  Capabilities: enum
  Items: 'On' 'Off'
  Item0: 'Off'




> 
> Regards,
> Clemens
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-08-10 17:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-08 22:28 why would an scontrol think that it should have 2 items instead of just 1? John L. Utz III
2007-08-10  7:33 ` Clemens Ladisch
2007-08-10 17:46   ` Solved! Tnx Clemens! " John L. Utz III

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox