From: Antonin ENFRUN <ae.tech@noos.fr>
To: alsa-devel@lists.sourceforge.net
Subject: PATCH] SPDIF out clock sync for via8235 / ALC650
Date: 26 Nov 2002 12:42:12 +0100 [thread overview]
Message-ID: <1038310932.5903.34.camel@petulant> (raw)
[-- Attachment #1: Type: text/plain, Size: 1095 bytes --]
I'm using alsa-driver 0.9.0rc6 on an Asus A7V8X (via8235 southbridge and
ALC650 -ac97 compatible- codec).
PCM output is fine on the main analog channel, but SPDIF out is not
working for any FS != 48khz. Looking at the source, the SPDIF out is
initialised at 48Khz on startup, and there is no way to change it. But
the ALC650 disable SPDIF out if SPDIF clock is not the same as the clock
used on the corresponding ac-link channel (I don't know if it's a
standard AC97 behaviour ?)
The patch included tracks clock change on the main DAC channel, and
updates the SPDIF clock accordingly : it allows SPDIF out to output the
main PCM channel, when the sample rate is 32K, 44.1K or 48K.
If there is a better solution, let me know !
TODO:
* Test for the codec used (if other codecs don't need this ?)
* Check the channel/slot on AC97-SPSA to track the corresponding clock.
On a side note, how can I send PCM to the other channels (rear,
lfe/front and spdif) ? And is there already an API to get/set the SPDIF
clock ?
Thanks for any feedback / suggestions !
--
Antonin ENFRUN <ae.tech@noos.fr>
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1471 bytes --]
--- alsa-driver-0.9.0rc6/alsa-kernel/pci/ac97/ac97_codec.c 2002-10-30 15:20:08.000000000 +0100
+++ alsa-driver-0.9.0rc6-ae/alsa-kernel/pci/ac97/ac97_codec.c 2002-11-26 10:21:13.000000000 +0100
@@ -1946,6 +1946,51 @@
* PCM support
*/
+
+// AE: Updating SPDIF Clock
+static void ae_set_spdif(ac97_t *ac97, unsigned short rate)
+{
+ unsigned short old, new;
+
+ // Get new SPDIF Rate
+ switch(rate) {
+ case 48000:
+ rate = AC97_SC_SPSR_48K;
+ break;
+
+ case 44100:
+ rate = AC97_SC_SPSR_44K;
+ break;
+
+ case 32000:
+ rate = AC97_SC_SPSR_32K;
+ break;
+
+ default:
+ rate = AC97_SC_SPSR_48K;
+ break;
+ }
+
+
+ // Do we need to change SR ?
+ old = ac97->regs[AC97_SPDIF];
+ new = (old & ~ AC97_SC_SPSR_MASK) | rate;
+ if (old != new) {
+
+ // Disable SPDIF
+ snd_ac97_update_bits(ac97, AC97_EXTENDED_STATUS, AC97_EA_SPDIF, 0);
+
+
+ // Set SPDIF out RATE
+ snd_ac97_update_bits(ac97, AC97_SPDIF, AC97_SC_SPSR_MASK, rate);
+
+
+ // Re-Enable SPDIF
+ snd_ac97_update_bits(ac97, AC97_EXTENDED_STATUS, AC97_EA_SPDIF, AC97_EA_SPDIF);
+ }
+}
+
+
int snd_ac97_set_rate(ac97_t *ac97, int reg, unsigned short rate)
{
unsigned short mask;
@@ -1978,7 +2023,13 @@
if (tmp > 65535)
return -EINVAL;
snd_ac97_update(ac97, reg, tmp & 0xffff);
- snd_ac97_read(ac97, reg);
+ rate = snd_ac97_read(ac97, reg);
+
+ // AE: Set SPDIF out RATE
+ if (reg == AC97_PCM_FRONT_DAC_RATE) {
+ ae_set_spdif(ac97, rate);
+ }
+
return 0;
}
next reply other threads:[~2002-11-26 11:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-26 11:42 Antonin ENFRUN [this message]
2002-11-28 15:32 ` PATCH] SPDIF out clock sync for via8235 / ALC650 Takashi Iwai
2002-12-30 21:30 ` jgotts
2003-02-02 12:03 ` jgotts
2003-02-03 9:45 ` Takashi Iwai
[not found] ` <3E3E462E.B2EDC7D8@lysator.liu.se>
2003-02-03 10:45 ` Takashi Iwai
[not found] ` <3E3E4D63.8BFEC97F@lysator.liu.se>
2003-02-03 11:26 ` 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=1038310932.5903.34.camel@petulant \
--to=ae.tech@noos.fr \
--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 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.