From: Sergey Vlasov <vsu@altlinux.ru>
To: alsa-devel@lists.sourceforge.net
Subject: [PATCH] snd-via82xx: Support all sample rate conversion capabilities of DXS channels
Date: Sun, 10 Apr 2005 19:53:20 +0400 [thread overview]
Message-ID: <20050410155320.GA2101@procyon.home> (raw)
[-- Attachment #1: Type: text/plain, Size: 8594 bytes --]
Hello!
The current snd-via82xx driver does not use all capabilities of the
DXS channels present in VIA VT8233/5/7 chips. In particular:
- The driver only accepts sample rates which are supported by the
AC'97 codec; however, the controller is able to perform sample rate
conversion itself, therefore the codec limits do not apply (and even
non-standard rates can be used).
- The driver forces sample rates for all 4 DXS subdevices to be the
same; however, the controller has separate sample rate converters
for each channel.
This patch adds support for these capabilities of the VT823x
controller to the snd-via82xx driver. I have tested it with the ASUS
A8V Deluxe board (VT8237 southbridge, Realtek ALC850 codec), with
simultaneous output with different sample rates (48000, 44100, 8000,
and some non-standard values like 44444, 12345, etc...). The SPDIF
output also seems to work (tested with the Sony MZ-N1 portable
minidisc recorder).
To avoid breaking support of some other hardware which may not like
this mode, the full DXS support is enabled only for known devices (the
patch adds an entry for ASUS A8V Deluxe), or when the dxs_support=5
option is used.
When using dxs_support=5, the AC'97 sample rate is locked at 48000 Hz,
and the controller performs sample rate conversion for each DXS
channel. Therefore output with any sample rate between 8000 and 48000
Hz is possible even if the codec supports only 48000 Hz (like ALC850,
which does not support VRA). SPDIF rate is also locked to 48000 Hz.
The patch was made for ALSA CVS version from yesterday.
Best regards,
Sergey Vlasov
=======================================================================
Add support for full sample rate conversion capabilities of DXS
channels present in VIA VT8233/5/7 controllers:
- any sample rate in the 8000 ... 48000 Hz range is supported even if
the AC'97 codec supports only 48000 Hz output;
- different DXS channels can use different sample rates at the same
time (the controller performs required sample rate conversion and
mixing in hardware).
Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
--- alsa-driver-1.0.9rc2-cvs/alsa-kernel/pci/via82xx.c.dxs-src 2005-04-10 17:10:56 +0400
+++ alsa-driver-1.0.9rc2-cvs/alsa-kernel/pci/via82xx.c 2005-04-10 17:35:28 +0400
@@ -101,7 +101,7 @@ MODULE_PARM_DESC(ac97_clock, "AC'97 code
module_param_array(ac97_quirk, charp, NULL, 0444);
MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware.");
module_param_array(dxs_support, int, NULL, 0444);
-MODULE_PARM_DESC(dxs_support, "Support for DXS channels (0 = auto, 1 = enable, 2 = disable, 3 = 48k only, 4 = no VRA)");
+MODULE_PARM_DESC(dxs_support, "Support for DXS channels (0 = auto, 1 = enable, 2 = disable, 3 = 48k only, 4 = no VRA, 5 = enable any sample rate)");
/* pci ids */
@@ -302,6 +302,7 @@ DEFINE_VIA_REGSET(CAPTURE_8233, 0x60);
#define VIA_DXS_DISABLE 2
#define VIA_DXS_48K 3
#define VIA_DXS_NO_VRA 4
+#define VIA_DXS_SRC 5
/*
@@ -380,6 +381,7 @@ struct _snd_via82xx {
struct via_rate_lock rates[2]; /* playback and capture */
unsigned int dxs_fixed: 1; /* DXS channel accepts only 48kHz */
unsigned int no_vra: 1; /* no need to set VRA on DXS channels */
+ unsigned int dxs_src: 1; /* use full SRC capabilities of DXS */
unsigned int spdif_on: 1; /* only spdif rates work to external DACs */
snd_pcm_t *pcms[2];
@@ -924,15 +926,16 @@ static int snd_via8233_playback_prepare(
via82xx_t *chip = snd_pcm_substream_chip(substream);
viadev_t *viadev = (viadev_t *)substream->runtime->private_data;
snd_pcm_runtime_t *runtime = substream->runtime;
+ int ac97_rate = chip->dxs_src ? 48000 : runtime->rate;
int rate_changed;
u32 rbits;
- if ((rate_changed = via_lock_rate(&chip->rates[0], runtime->rate)) < 0)
+ if ((rate_changed = via_lock_rate(&chip->rates[0], ac97_rate)) < 0)
return rate_changed;
if (rate_changed) {
snd_ac97_set_rate(chip->ac97, AC97_PCM_FRONT_DAC_RATE,
chip->no_vra ? 48000 : runtime->rate);
- snd_ac97_set_rate(chip->ac97, AC97_SPDIF, runtime->rate);
+ snd_ac97_set_rate(chip->ac97, AC97_SPDIF, ac97_rate);
}
if (runtime->rate == 48000)
rbits = 0xfffff;
@@ -1074,6 +1077,12 @@ static int snd_via82xx_pcm_open(via82xx_
/* fixed DXS playback rate */
runtime->hw.rates = SNDRV_PCM_RATE_48000;
runtime->hw.rate_min = runtime->hw.rate_max = 48000;
+ } else if (chip->dxs_src && viadev->reg_offset < 0x40) {
+ /* use full SRC capabilities of DXS */
+ runtime->hw.rates = (SNDRV_PCM_RATE_CONTINUOUS |
+ SNDRV_PCM_RATE_8000_48000);
+ runtime->hw.rate_min = 8000;
+ runtime->hw.rate_max = 48000;
} else if (! ratep->rate) {
int idx = viadev->direction ? AC97_RATES_ADC : AC97_RATES_FRONT_DAC;
runtime->hw.rates = chip->ac97->rates[idx];
@@ -2149,6 +2158,7 @@ static int __devinit check_dxs_list(stru
{ .vendor = 0x1043, .device = 0x8095, .action = VIA_DXS_NO_VRA }, /* ASUS A7V8X (FIXME: possibly VIA_DXS_ENABLE?)*/
{ .vendor = 0x1043, .device = 0x80a1, .action = VIA_DXS_NO_VRA }, /* ASUS A7V8-X */
{ .vendor = 0x1043, .device = 0x80b0, .action = VIA_DXS_NO_VRA }, /* ASUS A7V600 & K8V*/
+ { .vendor = 0x1043, .device = 0x812a, .action = VIA_DXS_SRC }, /* ASUS A8V Deluxe */
{ .vendor = 0x1071, .device = 0x8375, .action = VIA_DXS_NO_VRA }, /* Vobis/Yakumo/Mitac notebook */
{ .vendor = 0x10cf, .device = 0x118e, .action = VIA_DXS_ENABLE }, /* FSC laptop */
{ .vendor = 0x1106, .device = 0x4161, .action = VIA_DXS_NO_VRA }, /* ASRock K7VT2 */
@@ -2288,6 +2298,10 @@ static int __devinit snd_via82xx_probe(s
chip->dxs_fixed = 1;
else if (dxs_support[dev] == VIA_DXS_NO_VRA)
chip->no_vra = 1;
+ else if (dxs_support[dev] == VIA_DXS_SRC) {
+ chip->no_vra = 1;
+ chip->dxs_src = 1;
+ }
}
if ((err = snd_via8233_init_misc(chip, dev)) < 0)
goto __error;
--- alsa-driver-1.0.9rc2-cvs/alsa-kernel/Documentation/ALSA-Configuration.txt.dxs-src 2005-04-09 16:56:58 +0400
+++ alsa-driver-1.0.9rc2-cvs/alsa-kernel/Documentation/ALSA-Configuration.txt 2005-04-10 17:29:12 +0400
@@ -1211,16 +1211,18 @@ Prior to version 0.9.0rc4 options had a
------------------
Module for AC'97 motherboards based on VIA 82C686A/686B, 8233,
- 8233A, 8233C, 8235 (south) bridge.
+ 8233A, 8233C, 8235, 8237 (south) bridge.
mpu_port - 0x300,0x310,0x320,0x330, otherwise obtain BIOS setup
[VIA686A/686B only]
joystick - Enable joystick (default off) [VIA686A/686B only]
ac97_clock - AC'97 codec clock base (default 48000Hz)
dxs_support - support DXS channels,
- 0 = auto (defalut), 1 = enable, 2 = disable,
- 3 = 48k only, 4 = no VRA
- [VIA8233/C,8235 only]
+ 0 = auto (default), 1 = enable, 2 = disable,
+ 3 = 48k only, 4 = no VRA, 5 = enable any sample
+ rate and different sample rates on different
+ channels
+ [VIA8233/C, 8235, 8237 only]
ac97_quirk - AC'97 workaround for strange hardware
See the description of intel8x0 module for details.
@@ -1232,18 +1234,21 @@ Prior to version 0.9.0rc4 options had a
default value 1.4. Then the interrupt number will be
assigned under 15. You might also upgrade your BIOS.
- Note: VIA8233/5 (not VIA8233A) can support DXS (direct sound)
+ Note: VIA8233/5/7 (not VIA8233A) can support DXS (direct sound)
channels as the first PCM. On these channels, up to 4
- streams can be played at the same time.
+ streams can be played at the same time, and the controller
+ can perform sample rate conversion with separate rates for
+ each channel.
As default (dxs_support = 0), 48k fixed rate is chosen
except for the known devices since the output is often
noisy except for 48k on some mother boards due to the
bug of BIOS.
- Please try once dxs_support=1 and if it works on other
+ Please try once dxs_support=5 and if it works on other
sample rates (e.g. 44.1kHz of mp3 playback), please let us
know the PCI subsystem vendor/device id's (output of
"lspci -nv").
- If it doesn't work, try dxs_support=4. If it still doesn't
+ If dxs_support=5 does not work, try dxs_support=1; if it
+ doesn't work too, try dxs_support=4. If it still doesn't
work and the default setting is ok, dxs_support=3 is the
right choice. If the default setting doesn't work at all,
try dxs_support=2 to disable the DXS channels.
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next reply other threads:[~2005-04-10 15:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-10 15:53 Sergey Vlasov [this message]
2005-04-11 14:06 ` [PATCH] snd-via82xx: Support all sample rate conversion capabilities of DXS channels Takashi Iwai
2005-04-11 14:40 ` Sergey Vlasov
2005-04-11 14:44 ` 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=20050410155320.GA2101@procyon.home \
--to=vsu@altlinux.ru \
--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.