Re: [Alsa-devel] Re: problems with intel8x0 and 1.0.0pre3 (was: Re: [ANN] ALSA 1.0.0pre1 is released)

2003-11-28 Thread Kai Vehmanen
Hi,

On Thu, 27 Nov 2003, Takashi Iwai wrote:
   /proc/asound/card0/pcm0p/sub0/hw_params and
 .. the rate is locked to 48000 with 1.0.0pre3.
 do you mean both for playback and capture, or only on capture side?
 if the playback rate isn't set correctly (i.e. aplay -Dhw with 44.1kHz
 doesn't work), it's a serious problem.

that seems to be the case. I get this error:

--cut--
[EMAIL PROTECTED] ad]$ aplay -Dhw:0 ~/mp3/foo2.wav 
Playing WAVE '/home/kaiv/mp3/foo2.wav' : Signed 16 bit Little Endian, Rate 
44100 Hz, Stereo
Warning: rate is not accurate (requested = 44100Hz, got = 48000Hz)
 please, try the plug plugin (-Dplug:hw:0)
--cut--

With an app that opens playback and capture with 8000kHz, the hw_params 
output looks like this:

--cut--
[EMAIL PROTECTED] pub]# cat /proc/asound/card0/pcm0p/sub0/hw_params 
access: MMAP_INTERLEAVED
format: S16_LE
subformat: STD
channels: 2
rate: 48000 (48000/1)
period_size: 960
buffer_size: 1920
tick_time: 1
[EMAIL PROTECTED] pub]# cat /proc/asound/card0/pcm0c/sub0/hw_params 
access: MMAP_INTERLEAVED
format: S16_LE
subformat: STD
channels: 2
rate: 8000 (8000/1)
period_size: 160
buffer_size: 320
tick_time: 1
--cut--

 but, if it's a capture side, right now i found and fixed a bug.
 could you try and check whether it works for you?

The above results are with your patch applied. The ADC rate seems to be
correct.

-- 
 http://www.eca.cx
 Audio software for Linux!



---
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
___
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel


Re: [Alsa-devel] Re: problems with intel8x0 and 1.0.0pre3 (was: Re: [ANN] ALSA 1.0.0pre1 is released)

2003-11-27 Thread Takashi Iwai
At Thu, 27 Nov 2003 17:23:43 +0100,
I wrote:
 
 At Thu, 27 Nov 2003 18:16:05 +0200 (EET),
 Kai Vehmanen wrote:
  
  On Wed, 26 Nov 2003, Takashi Iwai wrote:
  
   On the same machine, alsa-driver-0.9.8 works fine, but not with 1.0.0pre1 
   and 1.0.0pre3.
   what do you mean exactly don't work in the above?
   the operation is blocked, or returns an error?
   if it's blocked, check /proc/asound/card0/pcm0*/sub0/* files.
  
  I think I found the problem. In 1.0.0preX, the supported sampling rate 
  is limited to 48000Hz and this causes all kinds of problems if running 
  with lower rates (I've mostly tested running at 8000Hz) - i.e. when
  using alsa-lib for sr-conversion.
  
  With 1.0.0pre3, for example arecord -r 8000 - |aplay -r 8000 - produces 
  constant xruns. A similar app that relies on poll()/select(), fails even 
  more severely. When looking at... 
  
/proc/asound/card0/pcm0p/sub0/hw_params and
/proc/asound/card0/pcm0c/sub0/hw_params 
  
  .. the rate is locked to 48000 with 1.0.0pre3.

do you mean both for playback and capture, or only on capture side?
if the playback rate isn't set correctly (i.e. aplay -Dhw with 44.1kHz
doesn't work), it's a serious problem.
but, if it's a capture side, right now i found and fixed a bug.
could you try and check whether it works for you?


Takashi
Index: alsa-kernel/pci/ac97/ac97_pcm.c
===
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/ac97/ac97_pcm.c,v
retrieving revision 1.4
diff -u -r1.4 ac97_pcm.c
--- alsa-kernel/pci/ac97/ac97_pcm.c 24 Nov 2003 11:12:24 -  1.4
+++ alsa-kernel/pci/ac97/ac97_pcm.c 27 Nov 2003 18:04:19 -
@@ -145,6 +145,19 @@
   }
 }};
 
+/* FIXME: more various mappings for ADC? */
+static unsigned char rate_cregs[9] = {
+   AC97_PCM_LR_ADC_RATE,   /* 3 */
+   AC97_PCM_LR_ADC_RATE,   /* 4 */
+   0xff,   /* 5 */
+   AC97_PCM_MIC_ADC_RATE,  /* 6 */
+   0xff,   /* 7 */
+   0xff,   /* 8 */
+   0xff,   /* 9 */
+   0xff,   /* 10 */
+   0xff,   /* 11 */
+};
+
 static unsigned char get_slot_reg(struct ac97_pcm *pcm, unsigned short cidx,
  unsigned short slot, int dbl)
 {
@@ -152,7 +165,10 @@
return 0xff;
if (slot  11)
return 0xff;
-   return rate_reg_tables[dbl][pcm-r[dbl].rate_table[cidx]][slot - 3];
+   if (pcm-stream == SNDRV_PCM_STREAM_PLAYBACK)
+   return rate_preg_tables[dbl][pcm-r[dbl].rate_table[cidx]][slot - 3];
+   else
+   return rate_cregs[slot - 3];
 }
 
 static int set_spdif_rate(ac97_t *ac97, unsigned short rate)
@@ -380,7 +396,6 @@
const struct ac97_pcm *pcm;
struct ac97_pcm *rpcms, *rpcm;
unsigned short avail_slots[2][4];
-   unsigned short all_slots[2][4];
unsigned char rate_table[2][4];
unsigned short tmp, slots;
unsigned int rates;
@@ -390,7 +405,7 @@
if (rpcms == NULL)
return -ENOMEM;
memset(avail_slots, 0, sizeof(avail_slots));
-   memset(all_slots, 0, sizeof(all_slots));
+   memset(rate_table, 0, sizeof(rate_table));
for (i = 0; i  4; i++) {
codec = bus-codec[i];
if (! codec)
@@ -401,8 +416,6 @@
for (j = 0; j  i; j++)
avail_slots[1][i] = ~avail_slots[1][j];
}
-   all_slots[0][i] = avail_slots[0][i];
-   all_slots[1][i] = avail_slots[1][i];
}
/* FIXME: add double rate allocation */
/* first step - exclusive devices */
@@ -430,7 +443,7 @@
if (tmp) {
rpcm-r[0].rslots[j] = tmp;
rpcm-r[0].codec[j] = bus-codec[j];
-   rpcm-r[0].rate_table[j] = rate_table[0][j];
+   rpcm-r[0].rate_table[j] = 
rate_table[pcm-stream][j];
rates = get_rates(rpcm, j, tmp, 0);
avail_slots[pcm-stream][j] = ~tmp;
}