All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Richard Chan <rspchan@starhub.net.sg>
Cc: alsa-devel@lists.sourceforge.net
Subject: Testers of via82xx 5.1 output (Re: ALC655 in CVS: Are Center/LFE switched with Surround?)
Date: Wed, 19 Nov 2003 18:50:28 +0100	[thread overview]
Message-ID: <s5hfzgk1c4b.wl@alsa2.suse.de> (raw)
In-Reply-To: <3FBB9BBE.20203@starhub.net.sg>

[-- Attachment #1: Type: text/plain, Size: 1215 bytes --]

At Thu, 20 Nov 2003 00:35:10 +0800,
Richard Chan wrote:
> 
> Alas, the new VIA82XX.conf doesn't fix the problem.
> (ALC655 does not have the "Slot Modify" feature of ALC650).
> Also I realise I still need a plug with slave.channels 6
 
oh yeah, you're right, ALC655 is not completely compatible with
ALC655...

ok, the attached patch is a quick hack for better supporting ALC655
and ALC658.  it includes the swap of via82xx 5.1 output (again).

IIRC, the slot assignment was determined by reports of someone else,
and we confirmed that is the correct order.  but, apparently, it's not
true on your board.
possibly this depends on the codec or mobo..?  not sure, why the slots
are swapped on yours.

***

so, now the "CALL FOR TESTS".

does anyone have 5.1 output-capable boards with VIA823x chipset?
the VIA8233A is exception.  it needs a different way to handle.
if it's one of the others, VIA8233,A,C or 8235, please check whether
the jack assignment of 5.1 output is correct.

regardless whether the output is correct or not, please give the
feedback together with the info, which ac97 codec is on it.  see
/proc/asound/card0/ac97#0 for that.

oh, don't forget to update to 1.0.0pre1 version!


thanks,

Takashi

[-- Attachment #2: via-alc655-fix.dif --]
[-- Type: application/octet-stream, Size: 7338 bytes --]

Index: alsa-kernel/pci/via82xx.c
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/via82xx.c,v
retrieving revision 1.76
diff -u -r1.76 via82xx.c
--- alsa-kernel/pci/via82xx.c	18 Nov 2003 15:23:27 -0000	1.76
+++ alsa-kernel/pci/via82xx.c	19 Nov 2003 17:34:39 -0000
@@ -972,8 +972,10 @@
 		case 2: slots = (1<<0) | (2<<4); break;
 		case 3: slots = (1<<0) | (2<<4) | (5<<8); break;
 		case 4: slots = (1<<0) | (2<<4) | (3<<8) | (4<<12); break;
-		case 5: slots = (1<<0) | (2<<4) | (3<<8) | (4<<12) | (5<<16); break;
-		case 6: slots = (1<<0) | (2<<4) | (3<<8) | (4<<12) | (5<<16) | (6<<20); break;
+		// case 5: slots = (1<<0) | (2<<4) | (3<<8) | (4<<12) | (5<<16); break;
+		case 5: slots = (1<<0) | (2<<4) | (5<<8) | (6<<12) | (3<<16); break;
+		// case 6: slots = (1<<0) | (2<<4) | (3<<8) | (4<<12) | (5<<16) | (6<<20); break;
+		case 6: slots = (1<<0) | (2<<4) | (5<<8) | (6<<12) | (3<<16) | (4<<20); break;
 		default: slots = 0; break;
 		}
 	}
Index: alsa-kernel/pci/ac97/ac97_codec.c
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/ac97/ac97_codec.c,v
retrieving revision 1.101
diff -u -r1.101 ac97_codec.c
--- alsa-kernel/pci/ac97/ac97_codec.c	18 Nov 2003 11:48:28 -0000	1.101
+++ alsa-kernel/pci/ac97/ac97_codec.c	19 Nov 2003 17:35:25 -0000
@@ -112,7 +112,8 @@
 { 0x414c4721, 0xfffffff0, "ALC650D",		patch_alc650,	NULL },
 { 0x414c4722, 0xfffffff0, "ALC650E",		patch_alc650,	NULL },
 { 0x414c4723, 0xfffffff0, "ALC650F",		patch_alc650,	NULL },
-{ 0x414c4760, 0xfffffff0, "ALC655",		patch_alc650,	NULL },
+{ 0x414c4760, 0xfffffff0, "ALC655",		patch_alc655,	NULL },
+{ 0x414c4780, 0xfffffff0, "ALC658",		patch_alc655,	NULL },
 { 0x414c4730, 0xffffffff, "ALC101",		NULL,		NULL },
 { 0x414c4740, 0xfffffff0, "ALC202",		NULL,		NULL },
 { 0x414c4750, 0xfffffff0, "ALC250",		NULL,		NULL },
@@ -1985,9 +1986,9 @@
 	snd_ac97_write(ac97, AC97_GENERAL_PURPOSE, 0);
 
 	snd_ac97_write(ac97, AC97_POWERDOWN, ac97->regs[AC97_POWERDOWN]);
-	snd_ac97_write(ac97, AC97_MASTER, 0x8000);
+	snd_ac97_write(ac97, AC97_MASTER, 0x8101);
 	for (i = 0; i < 10; i++) {
-		if (snd_ac97_read(ac97, AC97_MASTER) == 0x8000)
+		if (snd_ac97_read(ac97, AC97_MASTER) == 0x8101)
 			break;
 		mdelay(1);
 	}
@@ -1996,7 +1997,7 @@
 	if (ac97->bus->init)
 		ac97->bus->init(ac97);
 
-	is_ad18xx = (ac97->id & 0xffffff40) == AC97_ID_AD1881;
+	is_ad18xx = (ac97->flags & AC97_AD_MULTI);
 	if (is_ad18xx) {
 		/* restore the AD18xx codec configurations */
 		for (codec = 0; codec < 3; codec++) {
Index: alsa-kernel/pci/ac97/ac97_patch.c
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/ac97/ac97_patch.c,v
retrieving revision 1.31
diff -u -r1.31 ac97_patch.c
--- alsa-kernel/pci/ac97/ac97_patch.c	3 Nov 2003 18:03:53 -0000	1.31
+++ alsa-kernel/pci/ac97/ac97_patch.c	19 Nov 2003 17:37:37 -0000
@@ -983,6 +983,8 @@
 	/* 7: Independent Master Volume Left */
 	/* 8: reserved */
 	AC97_SINGLE("Line-In As Surround", AC97_ALC650_MULTICH, 9, 1, 0),
+	/* 10: mic, see below */
+	/* 11-13: in IEC958 controls */
 	AC97_SINGLE("Swap Surround Slot", AC97_ALC650_MULTICH, 14, 1, 0),
 #if 0 /* always set in patch_alc650 */
 	AC97_SINGLE("IEC958 Input Clock Enable", AC97_ALC650_CLOCK, 0, 1, 0),
@@ -1109,6 +1111,98 @@
 	return 0;
 }
 
+static const snd_kcontrol_new_t snd_ac97_controls_alc655[] = {
+	AC97_SINGLE("Duplicate Front", AC97_ALC650_MULTICH, 0, 1, 0),
+	AC97_SINGLE("Line-In As Surround", AC97_ALC650_MULTICH, 9, 1, 0),
+	AC97_SINGLE("Mic As Center/LFE", AC97_ALC650_MULTICH, 10, 1, 0),
+};
+
+static int alc655_iec958_route_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
+{
+	static char *texts_655[3] = { "PCM", "Analog In", "IEC958 In" };
+	static char *texts_658[4] = { "PCM", "Analog1 In", "Analog2 In", "IEC958 In" };
+	ac97_t *ac97 = snd_kcontrol_chip(kcontrol);
+
+	uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
+	uinfo->count = 1;
+	uinfo->value.enumerated.items = ac97->spec.dev_flags ? 4 : 3;
+	if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
+		uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
+	strcpy(uinfo->value.enumerated.name,
+	       ac97->spec.dev_flags ?
+	       texts_658[uinfo->value.enumerated.item] :
+	       texts_655[uinfo->value.enumerated.item]);
+	return 0;
+
+}
+
+static int alc655_iec958_route_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+{
+	ac97_t *ac97 = snd_kcontrol_chip(kcontrol);
+	unsigned short val;
+
+	val = ac97->regs[AC97_ALC650_MULTICH];
+	val = (val >> 12) & 3;
+	if (ac97->spec.dev_flags && val == 3)
+		val = 0;
+	ucontrol->value.enumerated.item[0] = val;
+	return 0;
+}
+
+static int alc655_iec958_route_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+{
+	ac97_t *ac97 = snd_kcontrol_chip(kcontrol);
+	return snd_ac97_update_bits(ac97, AC97_ALC650_MULTICH, 3 << 12,
+				    (unsigned short)ucontrol->value.enumerated.item[0]);
+}
+
+static const snd_kcontrol_new_t snd_ac97_spdif_controls_alc655[] = {
+        AC97_SINGLE("IEC958 Capture Switch", AC97_ALC650_MULTICH, 11, 1, 0),
+        AC97_SINGLE("IEC958 Input Monitor", AC97_ALC650_MULTICH, 14, 1, 0),
+	{
+		.iface  = SNDRV_CTL_ELEM_IFACE_MIXER,
+		.name   = "IEC958 Playback Route",
+		.info   = alc655_iec958_route_info,
+		.get    = alc655_iec958_route_get,
+		.put    = alc655_iec958_route_put,
+	},
+};
+
+static int patch_alc655_specific(ac97_t * ac97)
+{
+	int err;
+
+	if ((err = patch_build_controls(ac97, snd_ac97_controls_alc655, ARRAY_SIZE(snd_ac97_controls_alc655))) < 0)
+		return err;
+	if (ac97->ext_id & AC97_EI_SPDIF) {
+		if ((err = patch_build_controls(ac97, snd_ac97_spdif_controls_alc655, ARRAY_SIZE(snd_ac97_spdif_controls_alc655))) < 0)
+			return err;
+	}
+	return 0;
+}
+
+static struct snd_ac97_build_ops patch_alc655_ops = {
+	.build_specific	= patch_alc655_specific
+};
+
+int patch_alc655(ac97_t * ac97)
+{
+	ac97->spec.dev_flags = (ac97->id == 0x414c4780); /* ALC658 */
+
+	ac97->build_ops = &patch_alc655_ops;
+
+	/* enable spdif in */
+	snd_ac97_write_cache(ac97, AC97_ALC650_CLOCK,
+			     snd_ac97_read(ac97, AC97_ALC650_MULTICH) | 0x8000);
+	snd_ac97_write_cache(ac97, AC97_ALC650_CLOCK,
+			     snd_ac97_read(ac97, AC97_ALC650_CLOCK) | 0x02);
+
+	/* full DAC volume */
+	snd_ac97_write_cache(ac97, AC97_ALC650_SURR_DAC_VOL, 0x0808);
+	snd_ac97_write_cache(ac97, AC97_ALC650_LFE_DAC_VOL, 0x0808);
+	return 0;
+}
+
 static const snd_kcontrol_new_t snd_ac97_cm9738_controls[] = {
 	AC97_SINGLE("Line-In As Surround", AC97_CM9738_VENDOR_CTRL, 10, 1, 0),
 	AC97_SINGLE("Duplicate Front", AC97_CM9738_VENDOR_CTRL, 13, 1, 0),
Index: alsa-kernel/pci/ac97/ac97_patch.h
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/ac97/ac97_patch.h,v
retrieving revision 1.11
diff -u -r1.11 ac97_patch.h
--- alsa-kernel/pci/ac97/ac97_patch.h	3 Nov 2003 18:03:53 -0000	1.11
+++ alsa-kernel/pci/ac97/ac97_patch.h	19 Nov 2003 17:34:39 -0000
@@ -46,6 +46,7 @@
 int patch_ad1981b(ac97_t * ac97);
 int patch_ad1985(ac97_t * ac97);
 int patch_alc650(ac97_t * ac97);
+int patch_alc655(ac97_t * ac97);
 int patch_cm9738(ac97_t * ac97);
 int patch_cm9739(ac97_t * ac97);
 int patch_vt1616(ac97_t * ac97);

  reply	other threads:[~2003-11-19 17:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-19 15:04 ALC655 in CVS: Are Center/LFE switched with Surround? Richard Chan
2003-11-19 15:26 ` Takashi Iwai
2003-11-19 15:44   ` Richard Chan
2003-11-19 16:35   ` Richard Chan
2003-11-19 17:50     ` Takashi Iwai [this message]
2003-11-20 10:29   ` Testers of via82xx 5.1 output - report - swapped output still there Richard Chan
2003-11-20 10:53     ` Takashi Iwai
     [not found]       ` <3FBCD55C.5020604@starhub.net.sg>
2003-11-20 15:49         ` Takashi Iwai

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=s5hfzgk1c4b.wl@alsa2.suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=rspchan@starhub.net.sg \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.