From: Takashi Iwai <tiwai@suse.de>
To: Pekka Pietikainen <pp@netppl.fi>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: ac3 now works on VIA8233 (with a tiny patch)
Date: Tue, 28 Jan 2003 12:15:52 +0100 [thread overview]
Message-ID: <s5hd6mhmsnr.wl@alsa2.suse.de> (raw)
In-Reply-To: <20030128103000.GA5022@netppl.fi>
[-- 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);
prev parent reply other threads:[~2003-01-28 11:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[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 message]
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=s5hd6mhmsnr.wl@alsa2.suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@lists.sourceforge.net \
--cc=pp@netppl.fi \
/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