Re: [PATCH] ac97_patch.c ac97_codec.{ch} - enable 'Smart 5.1' UAJ on VIA vt1618 ac97 codec

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At Thu, 15 Mar 2007 11:41:06 -0700,
John Utz wrote:
> 
> > "Surround Back is Aux In"
> 
> ME => I can probably rethink this into a 2 way enum

Yes, that's better.

> > "Universal Audio Jack 0 (Speaker)"
> > "Universal Audio Jack 1 (Line In)"
> > "Universal Audio Jack 2 (Mic In)"
> 
> They are pretty uncommon as mixer names.
> Especially, parentheses in mixer names are not good.
> 
> ME => UAJ is a non vendor-specific tech, it's on the VT1618 and the ALC880(?)
> ME => it might be abstractable and provide driver simplification for UAJ chips.
> ME => I put it in the label because the user might gain insight from it
> ME => I will change it thusly:
> ME =>
> ME => Universal Audio Jack Speaker
> ME => Universal Audio Jack Line In
> ME => Universal Audio Jack Mic In
> ME =>
> ME => Would this be acceptable?

Well, the term "Universal Audio Jack" itself is OK (although "Speaker
Jack" or "Line-In Jack" would be more intuitive), but we should have
some obvious suffix.
So, how about a control like "Universal Audio Jack Mode" or "Speaker
Jack Mode" with enums?

> > Setting these 3 new controls to the settings to:
> >
> >   "DAC Mixed (5.1 Out)", "Reserved (5.1 Out)", "Reserved (5.1 Out)"
> 
> Can we simply use "5.1 Out"?
> 
> ME => This is the nub of the problem! The vt1618 docs are less than clear.
> ME => I wanted to communicate the uncertainty of this setting to the user.
> ME => By experimentation, i made 5.1 work on *ONE* board (MSI CN700T)
> ME => by setting the register to weird values:
> ME =>
> ME =>    DAC Mixed, Reserved, Reserved
> ME =>
> ME => What if this breaks other implementations?
> ME =>
> ME => The chip has both UAJ pins and dedicated output pins and some
> ME => boards will probably use the dedicated output pins instead of
> ME => the UAJ. If the mixer has something that says 5.1 Out, a user
> ME => seeking surround will set it! :-)

Hm, but the word "Reserved" is pretty strange that it really plays any
role...


> > allows 6 channel output to be played using the following command:
> >
> >   aplay -Dhw:0,1 chan-id.wav
> >
> > Note that 6 bits would require an impractical 64 way enum, thus the 3 controls.
> >
> > Changelog Entry
> >
> > ====
> >
> > [PATCH] ALSA: Smart 5.1 / Universal Audio Jack for VIA 1618 codec
> >
> > This patch provides Universal Audio Jack support by way of 3 4 way enums that allows
> > the user to choose 1 of 64 possible settings for the vt1618's version of what via
> > calls 'Smart 5.1'
> >
> > A new codec patch function is implemented:
> >
> >    patch_vt1618
> >
> > Several functions are added for reading/writing the Universal Audio Jack register:
> >
> >    snd_ac97_vt1618_UAJ{012}_{putget}
> >
> > A new pair of ac97_codec functions are added to allow for reading and writing paged
> > out registers:
> >
> >    snd_ac97_read_page
> >    snd_ac97_write_page
> 
> They are not necessarily exported at all as long as they are used in
> ac97_* code.
> 
> ME => so, i should not export them? ie: EXPORT_SYMBOL(snd_ac97_write_page)
> ME => why are the other ones exported? ie: EXPORT_SYMBOL(snd_ac97_write_cache)

Becuase snd_ac97_write_cache() is used in outside of snd-ac97-codec
module.  The sound driver may access AC97 codec register via this
function.

> In the latest version, even they could be static
> 
> ME => so all of them should be static?

Yes.

> since ac97_patch.c is included from ac97_codec.c.
> 
> ME => AHA! that explains something i noticed when merging yesterday.
> ME => all the patch_foo decls are gone in ac97_patch.h!

Exactly.

> That is, you can use even snd_ac97_page_save() and
> snd_ac97_page_restore() from ac97_patch.c.  (You need forward function
> declarations, though.)
> 
> Or, even better to create more generic version of paged register
> accessor, and rewrite snd_ac97_get/put_volsw(), too...
> 
> ME => umm, did i not make generic page read and write? am i misunderstanding you?

Well, what I thought is like below:

First, change snd_ac97_page_save() without using kcontrol, such as,

static int snd_ac97_page_save(struct snd_ac97 *ac97, int reg,
			      unsigned short page)

and from snd_ac97_{get|put}_volsw(), call through another function
like:

static int snd_ac97_page_save_for_volsw(struct snd_ac97 *ac97, int reg,
					struct snd_kcontrol *kcontrol)
{
	if (kcontrol->private_value & (1<<25))
		return snd_ac97_page_save(ac97, reg,
					  (kcontrol->private_value >> 26) & 0x0f);
	return -1;
}

Then, define like below:

static unsigned short snd_ac97_read_page(struct snd_ac97 *ac97,
	unsigned short reg, unsigned short page)
{
	int page_save;
	unsigned short ret;

	page_save = snd_ac97_page_save(ac97, reg, page);
	ret = snd_ac97_read(ac97, reg);
	snd_ac97_page_restore(ac97, page_save);
	return ret;
}

static void snd_ac97_write_page(struct snd_ac97 *ac97,
		unsigned short reg, unsigned short val,
		unsigned short page)
{
	int page_save;

	page_save = snd_ac97_page_save(ac97, reg, page);
	snd_ac97_write(ac97, reg, value);
	snd_ac97_page_restore(ac97, page_save);
}


Takashi

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux