aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Vlasov <vsu@altlinux.ru>2005-04-11 09:04:33 -0400
committerJaroslav Kysela <perex@suse.cz>2005-05-29 04:00:24 -0400
commit2d7eb7cb2bab1fbe8cfb610277b19ad40a9f7c75 (patch)
tree02ed97111c92b32d4aa4944b97de6d7bb88703de
parent26be865923ce9edefe8ddc007ddb1c098c29c449 (diff)
[ALSA] Support all sample rate conversion capabilities of DXS channels
Documentation,VIA82xx driver 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> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--Documentation/sound/alsa/ALSA-Configuration.txt21
-rw-r--r--sound/pci/via82xx.c20
2 files changed, 30 insertions, 11 deletions
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt
index 71ef0498d5e0..c69581ca2a34 100644
--- a/Documentation/sound/alsa/ALSA-Configuration.txt
+++ b/Documentation/sound/alsa/ALSA-Configuration.txt
@@ -1211,16 +1211,18 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1211 ------------------ 1211 ------------------
1212 1212
1213 Module for AC'97 motherboards based on VIA 82C686A/686B, 8233, 1213 Module for AC'97 motherboards based on VIA 82C686A/686B, 8233,
1214 8233A, 8233C, 8235 (south) bridge. 1214 8233A, 8233C, 8235, 8237 (south) bridge.
1215 1215
1216 mpu_port - 0x300,0x310,0x320,0x330, otherwise obtain BIOS setup 1216 mpu_port - 0x300,0x310,0x320,0x330, otherwise obtain BIOS setup
1217 [VIA686A/686B only] 1217 [VIA686A/686B only]
1218 joystick - Enable joystick (default off) [VIA686A/686B only] 1218 joystick - Enable joystick (default off) [VIA686A/686B only]
1219 ac97_clock - AC'97 codec clock base (default 48000Hz) 1219 ac97_clock - AC'97 codec clock base (default 48000Hz)
1220 dxs_support - support DXS channels, 1220 dxs_support - support DXS channels,
1221 0 = auto (defalut), 1 = enable, 2 = disable, 1221 0 = auto (default), 1 = enable, 2 = disable,
1222 3 = 48k only, 4 = no VRA 1222 3 = 48k only, 4 = no VRA, 5 = enable any sample
1223 [VIA8233/C,8235 only] 1223 rate and different sample rates on different
1224 channels
1225 [VIA8233/C, 8235, 8237 only]
1224 ac97_quirk - AC'97 workaround for strange hardware 1226 ac97_quirk - AC'97 workaround for strange hardware
1225 See the description of intel8x0 module for details. 1227 See the description of intel8x0 module for details.
1226 1228
@@ -1232,18 +1234,21 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1232 default value 1.4. Then the interrupt number will be 1234 default value 1.4. Then the interrupt number will be
1233 assigned under 15. You might also upgrade your BIOS. 1235 assigned under 15. You might also upgrade your BIOS.
1234 1236
1235 Note: VIA8233/5 (not VIA8233A) can support DXS (direct sound) 1237 Note: VIA8233/5/7 (not VIA8233A) can support DXS (direct sound)
1236 channels as the first PCM. On these channels, up to 4 1238 channels as the first PCM. On these channels, up to 4
1237 streams can be played at the same time. 1239 streams can be played at the same time, and the controller
1240 can perform sample rate conversion with separate rates for
1241 each channel.
1238 As default (dxs_support = 0), 48k fixed rate is chosen 1242 As default (dxs_support = 0), 48k fixed rate is chosen
1239 except for the known devices since the output is often 1243 except for the known devices since the output is often
1240 noisy except for 48k on some mother boards due to the 1244 noisy except for 48k on some mother boards due to the
1241 bug of BIOS. 1245 bug of BIOS.
1242 Please try once dxs_support=1 and if it works on other 1246 Please try once dxs_support=5 and if it works on other
1243 sample rates (e.g. 44.1kHz of mp3 playback), please let us 1247 sample rates (e.g. 44.1kHz of mp3 playback), please let us
1244 know the PCI subsystem vendor/device id's (output of 1248 know the PCI subsystem vendor/device id's (output of
1245 "lspci -nv"). 1249 "lspci -nv").
1246 If it doesn't work, try dxs_support=4. If it still doesn't 1250 If dxs_support=5 does not work, try dxs_support=1; if it
1251 doesn't work too, try dxs_support=4. If it still doesn't
1247 work and the default setting is ok, dxs_support=3 is the 1252 work and the default setting is ok, dxs_support=3 is the
1248 right choice. If the default setting doesn't work at all, 1253 right choice. If the default setting doesn't work at all,
1249 try dxs_support=2 to disable the DXS channels. 1254 try dxs_support=2 to disable the DXS channels.
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index 9b4d74d49f98..2f1e6ebd56a7 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -101,7 +101,7 @@ MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (default 48000Hz).");
101module_param_array(ac97_quirk, charp, NULL, 0444); 101module_param_array(ac97_quirk, charp, NULL, 0444);
102MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware."); 102MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware.");
103module_param_array(dxs_support, int, NULL, 0444); 103module_param_array(dxs_support, int, NULL, 0444);
104MODULE_PARM_DESC(dxs_support, "Support for DXS channels (0 = auto, 1 = enable, 2 = disable, 3 = 48k only, 4 = no VRA)"); 104MODULE_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)");
105 105
106 106
107/* pci ids */ 107/* pci ids */
@@ -302,6 +302,7 @@ DEFINE_VIA_REGSET(CAPTURE_8233, 0x60);
302#define VIA_DXS_DISABLE 2 302#define VIA_DXS_DISABLE 2
303#define VIA_DXS_48K 3 303#define VIA_DXS_48K 3
304#define VIA_DXS_NO_VRA 4 304#define VIA_DXS_NO_VRA 4
305#define VIA_DXS_SRC 5
305 306
306 307
307/* 308/*
@@ -380,6 +381,7 @@ struct _snd_via82xx {
380 struct via_rate_lock rates[2]; /* playback and capture */ 381 struct via_rate_lock rates[2]; /* playback and capture */
381 unsigned int dxs_fixed: 1; /* DXS channel accepts only 48kHz */ 382 unsigned int dxs_fixed: 1; /* DXS channel accepts only 48kHz */
382 unsigned int no_vra: 1; /* no need to set VRA on DXS channels */ 383 unsigned int no_vra: 1; /* no need to set VRA on DXS channels */
384 unsigned int dxs_src: 1; /* use full SRC capabilities of DXS */
383 unsigned int spdif_on: 1; /* only spdif rates work to external DACs */ 385 unsigned int spdif_on: 1; /* only spdif rates work to external DACs */
384 386
385 snd_pcm_t *pcms[2]; 387 snd_pcm_t *pcms[2];
@@ -924,15 +926,16 @@ static int snd_via8233_playback_prepare(snd_pcm_substream_t *substream)
924 via82xx_t *chip = snd_pcm_substream_chip(substream); 926 via82xx_t *chip = snd_pcm_substream_chip(substream);
925 viadev_t *viadev = (viadev_t *)substream->runtime->private_data; 927 viadev_t *viadev = (viadev_t *)substream->runtime->private_data;
926 snd_pcm_runtime_t *runtime = substream->runtime; 928 snd_pcm_runtime_t *runtime = substream->runtime;
929 int ac97_rate = chip->dxs_src ? 48000 : runtime->rate;
927 int rate_changed; 930 int rate_changed;
928 u32 rbits; 931 u32 rbits;
929 932
930 if ((rate_changed = via_lock_rate(&chip->rates[0], runtime->rate)) < 0) 933 if ((rate_changed = via_lock_rate(&chip->rates[0], ac97_rate)) < 0)
931 return rate_changed; 934 return rate_changed;
932 if (rate_changed) { 935 if (rate_changed) {
933 snd_ac97_set_rate(chip->ac97, AC97_PCM_FRONT_DAC_RATE, 936 snd_ac97_set_rate(chip->ac97, AC97_PCM_FRONT_DAC_RATE,
934 chip->no_vra ? 48000 : runtime->rate); 937 chip->no_vra ? 48000 : runtime->rate);
935 snd_ac97_set_rate(chip->ac97, AC97_SPDIF, runtime->rate); 938 snd_ac97_set_rate(chip->ac97, AC97_SPDIF, ac97_rate);
936 } 939 }
937 if (runtime->rate == 48000) 940 if (runtime->rate == 48000)
938 rbits = 0xfffff; 941 rbits = 0xfffff;
@@ -1074,6 +1077,12 @@ static int snd_via82xx_pcm_open(via82xx_t *chip, viadev_t *viadev, snd_pcm_subst
1074 /* fixed DXS playback rate */ 1077 /* fixed DXS playback rate */
1075 runtime->hw.rates = SNDRV_PCM_RATE_48000; 1078 runtime->hw.rates = SNDRV_PCM_RATE_48000;
1076 runtime->hw.rate_min = runtime->hw.rate_max = 48000; 1079 runtime->hw.rate_min = runtime->hw.rate_max = 48000;
1080 } else if (chip->dxs_src && viadev->reg_offset < 0x40) {
1081 /* use full SRC capabilities of DXS */
1082 runtime->hw.rates = (SNDRV_PCM_RATE_CONTINUOUS |
1083 SNDRV_PCM_RATE_8000_48000);
1084 runtime->hw.rate_min = 8000;
1085 runtime->hw.rate_max = 48000;
1077 } else if (! ratep->rate) { 1086 } else if (! ratep->rate) {
1078 int idx = viadev->direction ? AC97_RATES_ADC : AC97_RATES_FRONT_DAC; 1087 int idx = viadev->direction ? AC97_RATES_ADC : AC97_RATES_FRONT_DAC;
1079 runtime->hw.rates = chip->ac97->rates[idx]; 1088 runtime->hw.rates = chip->ac97->rates[idx];
@@ -2149,6 +2158,7 @@ static int __devinit check_dxs_list(struct pci_dev *pci)
2149 { .vendor = 0x1043, .device = 0x8095, .action = VIA_DXS_NO_VRA }, /* ASUS A7V8X (FIXME: possibly VIA_DXS_ENABLE?)*/ 2158 { .vendor = 0x1043, .device = 0x8095, .action = VIA_DXS_NO_VRA }, /* ASUS A7V8X (FIXME: possibly VIA_DXS_ENABLE?)*/
2150 { .vendor = 0x1043, .device = 0x80a1, .action = VIA_DXS_NO_VRA }, /* ASUS A7V8-X */ 2159 { .vendor = 0x1043, .device = 0x80a1, .action = VIA_DXS_NO_VRA }, /* ASUS A7V8-X */
2151 { .vendor = 0x1043, .device = 0x80b0, .action = VIA_DXS_NO_VRA }, /* ASUS A7V600 & K8V*/ 2160 { .vendor = 0x1043, .device = 0x80b0, .action = VIA_DXS_NO_VRA }, /* ASUS A7V600 & K8V*/
2161 { .vendor = 0x1043, .device = 0x812a, .action = VIA_DXS_SRC }, /* ASUS A8V Deluxe */
2152 { .vendor = 0x1071, .device = 0x8375, .action = VIA_DXS_NO_VRA }, /* Vobis/Yakumo/Mitac notebook */ 2162 { .vendor = 0x1071, .device = 0x8375, .action = VIA_DXS_NO_VRA }, /* Vobis/Yakumo/Mitac notebook */
2153 { .vendor = 0x10cf, .device = 0x118e, .action = VIA_DXS_ENABLE }, /* FSC laptop */ 2163 { .vendor = 0x10cf, .device = 0x118e, .action = VIA_DXS_ENABLE }, /* FSC laptop */
2154 { .vendor = 0x1106, .device = 0x4161, .action = VIA_DXS_NO_VRA }, /* ASRock K7VT2 */ 2164 { .vendor = 0x1106, .device = 0x4161, .action = VIA_DXS_NO_VRA }, /* ASRock K7VT2 */
@@ -2288,6 +2298,10 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
2288 chip->dxs_fixed = 1; 2298 chip->dxs_fixed = 1;
2289 else if (dxs_support[dev] == VIA_DXS_NO_VRA) 2299 else if (dxs_support[dev] == VIA_DXS_NO_VRA)
2290 chip->no_vra = 1; 2300 chip->no_vra = 1;
2301 else if (dxs_support[dev] == VIA_DXS_SRC) {
2302 chip->no_vra = 1;
2303 chip->dxs_src = 1;
2304 }
2291 } 2305 }
2292 if ((err = snd_via8233_init_misc(chip, dev)) < 0) 2306 if ((err = snd_via8233_init_misc(chip, dev)) < 0)
2293 goto __error; 2307 goto __error;