From: Mark Salazar <markTheCoder@justmyself.net>
To: alsa-devel@lists.sourceforge.net
Cc: Mark Salazar <markTheCoder@justmyself.net>
Subject: Re: [es18xx.c PATCH] #2/4 for Zoom Video - resolve number of record sources
Date: Mon, 26 Dec 2005 12:36:38 -0500 [thread overview]
Message-ID: <43B02A26.3080408@justmyself.net> (raw)
In-Reply-To: <43B01012.6080304@justmyself.net>
[-- Attachment #1: Type: text/plain, Size: 128 bytes --]
I surrender. Unable to make Thunderbird's wrapping function submit to
my will I just attach my patch message and slink away.
[-- Attachment #2: es18xx.CVSmod2.diff.msg --]
[-- Type: text/plain, Size: 4935 bytes --]
Second of 4 es18xx.c patches culminating in Zoom Video support.
This patch changes the 'record source' mux routines to reflect the fact that not all of the
supported chipsets have 8 possible inputs. Some have 4 and some have 5.
Testing:
This work was initially done on the source from the Debian Sarge ALSA package, then tested
on an ES1879 and an ES1878 machine. Patches were created against the Sarge code and then edited
to apply correctly to the ALSA cvs code. Lastly the patched ALSA cvs code was test for
successful compilation. No additional testing was done on the ALSA cvs version.
Applying:
cd alsa-driver/
cat ../../es18xx.CVSmod2.diff | patch -p1
Signed-off-by: Mark Salazar <markTheCoder@justmyself.net>
------
diff -Nur ../alsa-driverMod1/alsa-kernel/isa/es18xx.c ./alsa-kernel/isa/es18xx.c
--- ../alsa-driverMod1/alsa-kernel/isa/es18xx.c 2005-12-10 13:59:30.000000000 -0500
+++ ./alsa-kernel/isa/es18xx.c 2005-12-10 13:59:42.000000000 -0500
@@ -929,37 +929,116 @@
* MIXER part
*/
+/* Record source mux routines:
+ * Depending on the chipset this mux switches between 4, 5, or 8 possible inputs.
+ * bit table for the 4/5 source mux:
+ * reg 1C:
+ * b2 b1 b0 muxSource
+ * x 0 x microphone
+ * 0 1 x CD
+ * 1 1 0 line
+ * 1 1 1 mixer
+ * if it's "mixer" and it's a 5 source mux chipset then reg 7A bit 3 determines
+ * either the play mixer or the capture mixer.
+ *
+ * "map4Source" translates from source number to reg bit pattern
+ * "invMap4Source" translates from reg bit pattern to source number
+ */
+
static int snd_es18xx_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
- static char *texts[8] = {
+ static char *texts4Source[4] = {
+ "Mic", "CD", "Line", "Master"
+ };
+ static char *texts5Source[5] = {
+ "Mic", "CD", "Line", "Master", "Mix"
+ };
+ static char *texts8Source[8] = {
"Mic", "Mic Master", "CD", "AOUT",
"Mic1", "Mix", "Line", "Master"
};
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
uinfo->count = 1;
- uinfo->value.enumerated.items = 8;
- if (uinfo->value.enumerated.item > 7)
- uinfo->value.enumerated.item = 7;
- strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
+ struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
+ switch (chip->version) {
+ case 0x1868:
+ case 0x1878:
+ uinfo->value.enumerated.items = 4;
+ if (uinfo->value.enumerated.item > 3)
+ uinfo->value.enumerated.item = 3;
+ strcpy(uinfo->value.enumerated.name, texts4Source[uinfo->value.enumerated.item]);
+ break;
+ case 0x1887:
+ case 0x1888:
+ uinfo->value.enumerated.items = 5;
+ if (uinfo->value.enumerated.item > 4)
+ uinfo->value.enumerated.item = 4;
+ strcpy(uinfo->value.enumerated.name, texts5Source[uinfo->value.enumerated.item]);
+ break;
+ case 0x1869: /* DS somewhat contradictory for 1869: could be be 5 or 8 */
+ case 0x1879:
+ uinfo->value.enumerated.items = 8;
+ if (uinfo->value.enumerated.item > 7)
+ uinfo->value.enumerated.item = 7;
+ strcpy(uinfo->value.enumerated.name, texts8Source[uinfo->value.enumerated.item]);
+ break;
+ }
return 0;
}
static int snd_es18xx_get_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
+ static unsigned char invMap4Source[8] = {0, 0, 1, 1, 0, 0, 2, 3};
struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
- ucontrol->value.enumerated.item[0] = snd_es18xx_mixer_read(chip, 0x1c) & 0x07;
+ int muxSource = snd_es18xx_mixer_read(chip, 0x1c) & 0x07;
+ if (!(chip->version == 0x1869 || chip->version == 0x1879)) {
+ muxSource = invMap4Source[muxSource];
+ if (muxSource==3 &&
+ (chip->version == 0x1887 || chip->version == 0x1888) &&
+ (snd_es18xx_mixer_read(chip, 0x7a) & 0x08)
+ ) {
+ muxSource = 4;
+ }
+ }
+ ucontrol->value.enumerated.item[0] = muxSource;
return 0;
}
static int snd_es18xx_put_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
+ static unsigned char map4Source[4] = {0, 2, 6, 7};
struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol);
unsigned char val = ucontrol->value.enumerated.item[0];
-
- if (val > 7)
- return -EINVAL;
- return snd_es18xx_mixer_bits(chip, 0x1c, 0x07, val) != val;
+ unsigned char retVal = 0;
+
+ switch (chip->version) {
+ /* 5 source chips */
+ case 0x1887:
+ case 0x1888:
+ if (val > 4)
+ return -EINVAL;
+ if (val == 4){
+ retVal = snd_es18xx_mixer_bits(chip, 0x7a, 0x08, 0x08) != 0x08;
+ val = 3;
+ }else{
+ retVal = snd_es18xx_mixer_bits(chip, 0x7a, 0x08, 0x00) != 0x00;
+ }
+ /* 4 source chips */
+ case 0x1868:
+ case 0x1878:
+ if (val > 3)
+ return -EINVAL;
+ val = map4Source[val];
+ break;
+ /* 8 source chips */
+ case 0x1869:
+ case 0x1879:
+ if (val > 7)
+ return -EINVAL;
+ break;
+ }
+ return (snd_es18xx_mixer_bits(chip, 0x1c, 0x07, val) != val) || retVal;
}
static int snd_es18xx_info_spatializer_enable(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
next prev parent reply other threads:[~2005-12-26 17:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-26 15:45 [es18xx.c PATCH] #2/4 for Zoom Video - resolve number of record sources Mark Salazar
2005-12-26 17:36 ` Mark Salazar [this message]
2006-01-02 14:26 ` Takashi Iwai
2006-01-08 23:01 ` Mark Salazar
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=43B02A26.3080408@justmyself.net \
--to=markthecoder@justmyself.net \
--cc=alsa-devel@lists.sourceforge.net \
/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