All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: ac3 now works on VIA8233 (with a tiny patch)
       [not found] <20030127182444.GA1974@netppl.fi>
@ 2003-01-28  9:50 ` Takashi Iwai
  2003-01-28  9:55 ` Takashi Iwai
  1 sibling, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2003-01-28  9:50 UTC (permalink / raw)
  To: Pekka Pietikainen; +Cc: alsa-devel

At Mon, 27 Jan 2003 20:24:44 +0200,
Pekka Pietikainen wrote:
> 
> Hi
> 
> I just tried the latest cvs, and now ac3 output works just fine 
> (and plain old PCM output through SPDIF too). I needed the following patch
> to VIA8233.conf, though. I did manage to get the driver in a state where
> there was no output at all until a module reload once (mixer settings didn't 
> help), but I can't reproduce it anymore and that was while tweaking
> VIA8233.conf.

could you tell me which ac97 codec chip is used?
the spdif signal should be routed via slot 10/11 when the device 0,0,3
is used as originally designed.  with your patch, the signal seems
routed via the front slots 3/4 (or 6/9, 7/8).  the slots usage is
dependent on the ac97 codec, and i thought the set up of ALC650 was
fixed recently.

/proc/asound/card0/ac97#0 and ac97#0regs will be helpful for
debugging.


thanks,

Takashi


-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com

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

* Re: ac3 now works on VIA8233 (with a tiny patch)
       [not found] <20030127182444.GA1974@netppl.fi>
  2003-01-28  9:50 ` ac3 now works on VIA8233 (with a tiny patch) Takashi Iwai
@ 2003-01-28  9:55 ` Takashi Iwai
       [not found]   ` <20030128103000.GA5022@netppl.fi>
  1 sibling, 1 reply; 3+ messages in thread
From: Takashi Iwai @ 2003-01-28  9:55 UTC (permalink / raw)
  To: Pekka Pietikainen; +Cc: alsa-devel

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

Hi it's me again,

just took at your earlier posts, i found the reason.
instead of changing the device, AC97-SPSA must be changed to 3.

please try the attached patch.


Takashi

[-- Attachment #2: via-spdif.dif --]
[-- Type: application/octet-stream, Size: 537 bytes --]

Index: alsa-lib/src/conf/cards/VIA8233.conf
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-lib/src/conf/cards/VIA8233.conf,v
retrieving revision 1.1
diff -u -r1.1 VIA8233.conf
--- alsa-lib/src/conf/cards/VIA8233.conf	10 Jan 2003 17:48:56 -0000	1.1
+++ alsa-lib/src/conf/cards/VIA8233.conf	28 Jan 2003 09:54:15 -0000
@@ -66,7 +66,7 @@
 				name "IEC958 Playback AC97-SPSA"
 				lock true
 				preserve true
-				value 0
+				value 3
 			}
 			{
 				name "IEC958 Playback Default"

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

* Re: ac3 now works on VIA8233 (with a tiny patch)
       [not found]   ` <20030128103000.GA5022@netppl.fi>
@ 2003-01-28 11:15     ` Takashi Iwai
  0 siblings, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2003-01-28 11:15 UTC (permalink / raw)
  To: Pekka Pietikainen; +Cc: alsa-devel

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

At Tue, 28 Jan 2003 12:30:00 +0200,
Pekka Pietikainen wrote:
> 
> On Tue, Jan 28, 2003 at 10:55:42AM +0100, Takashi Iwai wrote:
> > Hi it's me again,
> > 
> > just took at your earlier posts, i found the reason.
> > instead of changing the device, AC97-SPSA must be changed to 3.
> > 
> > please try the attached patch.
> I tried the patch and it seems to work fine as long as alsamixer
> has AC97-SPSA set to 3 before using AC3. If it's at anything
> else, the output is just some horrible noise.

thanks for testing.  ok, this must be fixed...
could you try the one below?


> The mixer setting does
> change to 3 when the application starts (and goes back to 0 when it stops), 
> but apparently that happens too late. When the application 
> is running, the mixer control has no effect at all. Feature?
> Bug? Application bug? (I tried mplayer and xine and both did the same) 
> Oh well, at least it's usable now :)

it's a feature.  the control is locked during the pcm is opened.


Takashi

[-- Attachment #2: via-spdif.dif --]
[-- Type: application/octet-stream, Size: 4879 bytes --]

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.51
diff -u -r1.51 ac97_codec.c
--- alsa-kernel/pci/ac97/ac97_codec.c	27 Jan 2003 10:36:08 -0000	1.51
+++ alsa-kernel/pci/ac97/ac97_codec.c	28 Jan 2003 11:14:25 -0000
@@ -849,6 +849,34 @@
 	return change;
 }
 
+static int snd_ac97_put_spsa(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+{
+	ac97_t *ac97 = snd_kcontrol_chip(kcontrol);
+	int reg = kcontrol->private_value & 0xff;
+	int shift = (kcontrol->private_value >> 8) & 0xff;
+	int mask = (kcontrol->private_value >> 16) & 0xff;
+	// int invert = (kcontrol->private_value >> 24) & 0xff;
+	unsigned short value, old, new;
+
+	value = (ucontrol->value.integer.value[0] & mask);
+
+	mask <<= shift;
+	value <<= shift;
+	spin_lock(&ac97->reg_lock);
+	old = ac97->regs[reg];
+	new = (old & ~mask) | value;
+	spin_unlock(&ac97->reg_lock);
+
+	if (old != new) {
+		int change;
+		snd_ac97_update_bits(ac97, AC97_EXTENDED_STATUS, AC97_EA_SPDIF, 0);
+		change = snd_ac97_update_bits(ac97, reg, mask, value);
+		snd_ac97_update_bits(ac97, AC97_EXTENDED_STATUS, AC97_EA_SPDIF, AC97_EA_SPDIF);
+		return change;
+	}
+	return 0;
+}
+
 static const snd_kcontrol_new_t snd_ac97_controls_spdif[5] = {
 	{
 		.access = SNDRV_CTL_ELEM_ACCESS_READ,
@@ -873,7 +901,15 @@
 	},
 
 	AC97_SINGLE(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH),AC97_EXTENDED_STATUS, 2, 1, 0),
-	AC97_SINGLE(SNDRV_CTL_NAME_IEC958("",PLAYBACK,NONE) "AC97-SPSA",AC97_EXTENDED_STATUS, 4, 3, 0)
+	// AC97_SINGLE(SNDRV_CTL_NAME_IEC958("",PLAYBACK,NONE) "AC97-SPSA",AC97_EXTENDED_STATUS, 4, 3, 0)
+	{
+		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+		.name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,NONE) "AC97-SPSA",
+		.info = snd_ac97_info_single,
+		.get = snd_ac97_get_single,
+		.put = snd_ac97_put_spsa,
+		.private_value = AC97_EXTENDED_STATUS | (4 << 8) | (3 << 16) | (0 << 24),
+	},
 };
 
 static const snd_kcontrol_new_t snd_ac97_cirrus_controls_spdif[2] = {
@@ -995,9 +1031,6 @@
 	/* 8: reserved */
 	AC97_SINGLE("Line-In As Surround", AC97_ALC650_MULTICH, 9, 1, 0),
 	AC97_SINGLE("Mic As Center/LFE", AC97_ALC650_MULTICH, 10, 1, 0),
-	AC97_SINGLE("IEC958 Capture Switch", AC97_ALC650_MULTICH, 11, 1, 0),
-	AC97_SINGLE("Analog to IEC958 Output", AC97_ALC650_MULTICH, 12, 1, 0),
-	AC97_SINGLE("IEC958 Input Monitor", AC97_ALC650_MULTICH, 13, 1, 0),
 #if 0 /* always set in patch_alc650 */
 	AC97_SINGLE("IEC958 Input Clock Enable", AC97_ALC650_CLOCK, 0, 1, 0),
 	AC97_SINGLE("IEC958 Input Pin Enable", AC97_ALC650_CLOCK, 1, 1, 0),
@@ -1008,6 +1041,12 @@
 #endif
 };
 
+static const snd_kcontrol_new_t snd_ac97_spdif_controls_alc650[] = {
+	AC97_SINGLE("IEC958 Capture Switch", AC97_ALC650_MULTICH, 11, 1, 0),
+	AC97_SINGLE("Analog to IEC958 Output", AC97_ALC650_MULTICH, 12, 1, 0),
+	AC97_SINGLE("IEC958 Input Monitor", AC97_ALC650_MULTICH, 13, 1, 0),
+};
+
 /* The following snd_ac97_ymf753_... items added by David Shust (dshust@shustring.com) */
 
 /* It is possible to indicate to the Yamaha YMF753 the type of speakers being used. */
@@ -1658,6 +1697,11 @@
 		for (idx = 0; idx < ARRAY_SIZE(snd_ac97_controls_alc650); idx++)
 			if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_alc650[idx], ac97))) < 0)
 				return err;
+		if (ac97->ext_id & AC97_EI_SPDIF) {
+			for (idx = 0; idx < ARRAY_SIZE(snd_ac97_spdif_controls_alc650); idx++)
+				if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_spdif_controls_alc650[idx], ac97))) < 0)
+					return err;
+		}
 		break;
 	case AC97_ID_VT1616:
 		if (snd_ac97_try_bit(ac97, 0x5a, 9))
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.7
diff -u -r1.7 ac97_patch.c
--- alsa-kernel/pci/ac97/ac97_patch.c	24 Jan 2003 11:09:17 -0000	1.7
+++ alsa-kernel/pci/ac97/ac97_patch.c	28 Jan 2003 10:46:32 -0000
@@ -355,13 +355,19 @@
 {
 	unsigned short val;
 
-	/* enable spdif in */
-	snd_ac97_write_cache(ac97, AC97_ALC650_CLOCK,
-			     snd_ac97_read(ac97, AC97_ALC650_CLOCK) | 0x03);
+	/* check spdif */
+	val = snd_ac97_read(ac97, AC97_EXTENDED_STATUS);
+	if (val & AC97_EA_SPCV) {
+		/* enable spdif in */
+		snd_ac97_write_cache(ac97, AC97_ALC650_CLOCK,
+				     snd_ac97_read(ac97, AC97_ALC650_CLOCK) | 0x03);
+	} else
+		ac97->ext_id &= ~AC97_EI_SPDIF; /* disable extended-id */
+
 	val = snd_ac97_read(ac97, AC97_ALC650_MULTICH);
 	val &= ~0xc000; /* slot: 3,4,7,8,6,9 */
-	snd_ac97_write_cache(ac97, AC97_ALC650_MULTICH,
-			     val | 0x03);
+	snd_ac97_write_cache(ac97, AC97_ALC650_MULTICH, val | 0x03);
+
 	/* 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);

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

end of thread, other threads:[~2003-01-28 11:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20030127182444.GA1974@netppl.fi>
2003-01-28  9:50 ` ac3 now works on VIA8233 (with a tiny patch) Takashi Iwai
2003-01-28  9:55 ` Takashi Iwai
     [not found]   ` <20030128103000.GA5022@netppl.fi>
2003-01-28 11:15     ` Takashi Iwai

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.