On Thu, 24 Jan 2002, Kai Vehmanen wrote: > On the other hand with '-r 44100', full-duplex seems to work relatively > well. Even though nominally running at different speeds > (44100.952-44099.814=1.138frames/sec), they won't drift much apart.
Ok, here's a patch that adds mathematical rounding to setting dac1 and dac2 rates. The same is done in 2.4.16 kernel's ens1371 drivers. After applying this, I stopped getting "Unexpected hw_pointer" and "Lost interrupt: hw_ptr = %d expected %d" errors from pcm_lib.c. Without the patch, I get these errors with all parameters I've tried (even 48kHz!) if both stream directions are active. Playback- or capture-only operation won't cause these errors. Let me know how this works for you... --cut-- RCS file: /cvsroot/alsa/alsa-kernel/pci/ens1370.c,v retrieving revision 1.7 diff -u -r1.7 ens1370.c --- ens1370.c 2002/01/21 08:55:18 1.7 +++ ens1370.c 2002/01/24 13:45:48 @@ -656,6 +656,12 @@ truncm = (21 * n - 1) | 1; freq = ((48000UL << 15) / rate) * n; result = (48000UL << 15) / (freq / n); + +#ifdef CONFIG_SND_DEBUG + snd_printk("ens1371: setting adc-rate to freq=%lu ((%lu/%lu)*%lu) request for +%lu.\n", + freq, 48000UL << 15, rate, n, rate); +#endif + if (rate >= 24000) { if (truncm > 239) truncm = 239; @@ -678,8 +684,13 @@ static void snd_es1371_dac1_rate(ensoniq_t * ensoniq, unsigned int rate) { unsigned int freq, r; + + freq = ((rate << 15) + 1500) / 3000; - freq = (rate << 15) / 3000; +#ifdef CONFIG_SND_DEBUG + snd_printk("ens1371: setting dac1-rate to freq=%lu (%lu/3000) request for +%lu.\n", freq, (rate << 15) + 1500, rate); +#endif + r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE | ES_1371_DIS_P2 | ES_1371_DIS_R1)) | ES_1371_DIS_P1; outl(r, ES_REG(ensoniq, 1371_SMPRATE)); snd_es1371_src_write(ensoniq, ES_SMPREG_DAC1 + ES_SMPREG_INT_REGS, @@ -693,8 +704,13 @@ static void snd_es1371_dac2_rate(ensoniq_t * ensoniq, unsigned int rate) { unsigned int freq, r; + + freq = ((rate << 15) + 1500) / 3000; + +#ifdef CONFIG_SND_DEBUG + printk("ens1371: setting dac2-rate to freq=%lu (%lu/3000) request for %lu.\n", +freq, (rate << 15) + 1500, rate); +#endif - freq = (rate << 15) / 3000; r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE | ES_1371_DIS_P1 | ES_1371_DIS_R1)) | ES_1371_DIS_P2; outl(r, ES_REG(ensoniq, 1371_SMPRATE)); snd_es1371_src_write(ensoniq, ES_SMPREG_DAC2 + ES_SMPREG_INT_REGS, --cut-- -- http://www.eca.cx Audio software for Linux! _______________________________________________ Alsa-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/alsa-devel