Re: h5100 h5400 h5500 8KHz audio

From: Jim Kaba <jkaba_at_sarnoff.com>
Date: Fri, 25 Feb 2005 17:32:48 -0500

Hi,
  Here are the patches that remove the 8KHz audio work arounds I mentioned
in the previous posting.

The fix_8Khz_pxa-i2s.patch sets fs = 256; & clk_div =
SADIV_BITCLK_512_00_KHZ; when 8KHz sampling rate is chosen. I've verified
and reverified that these parameters work fine (on an h5400).

2) fix_8Khz_h5400-audio.patch removes the code that artificially turns sets
the sampling rate to 16KHz when 8KHz is chosen. I also moved the
statements that set the value for audio_state.double_samples. It wasn't
obvious where this could be initialized to 0 once at startup/attach --
maybe someone who knows the overall audio code better could do that. So I
moved it down to the area where the number of input channels is selected.
I plan to add "mono" support to the driver, and I'll reuse most of the
"double_samples" code that is already in pxa-audio.c

Both patches must be applied together. Applying just one or the other
would be, well, interesting...

Jim

Jim Kaba wrote:
>
> Hi,
> This message is kind of a continuation of a thread called "VoIP Sample
> Rate" and "audio sample rate" from Jan19-25, 2005.
>
> I've been tinkering with the h5400 audio (OSS drivers and familiar 0.8
> distribution) for the last week or so. I've been experimenting and
> "peeling the onion" removing all the patches/fixes in pxa-i2s.c,
> pxa-audio.c and h5400-audio.c that compensate for the problem with the 8KHz
> sampling rate and, as near as I can tell, there is no problem at all with
> the 8KHz sampling rate.
>
> I've been trying out all the combinations of settings and software fixes,
> and I have to agree with Manu Sharma's Jan 25 posting -- there just seems
> to be no fundamental problem! Both the ak4535 and PXA255 work in 256fs
> mode. It is true that the spec claims 4dB more noise operating in this
> mode; but like Sharma said, it is 84dB SNR in this mode versus 88dB in the
> other modes -- not enough to make a major difference.
>
> For me the noise level was only a problem when I had the MIC gain set too
> high. When the gain is turned down so that the input isn't distorted, the
> MIC input sound beautiful and the background noise is not noticeable. The
> 8KHz output side is beautiful, too.
>
> Quality with voice input is just fine. I also tested this out with some
> audio test gear generating pure sinewave tones as input and looking at the
> outputs on a spectrum analyzer. There are only hints of distortion when
> MIC/Speaker gains are set too high, which is to be expected. There are
> only problems with 8KHz audio when the hardware is set to something other
> than 256fs and SADIV_BITCLK_512_00_KHZ.
>
> Unless there is some ongoing discussion or evidence to why this isn't the
> case, I'll post a patch removing all of the 8KHz work-arounds tomorrow.
>
> Jim
>
> --
> ----------------------------------------------------------------------
> James T. Kaba
> Sarnoff Corporation There are 10 kinds of people in the world:
> jkaba_at_sarnoff.com those who understand binary, and those who don't.
> 609-734-2246
> _______________________________________________
> H5400-port mailing list
> H5400-port_at_handhelds.org
> https://www.handhelds.org/mailman/listinfo/h5400-port

-- 
----------------------------------------------------------------------
James T. Kaba                   
Sarnoff Corporation   There are 10 kinds of people in the world:
jkaba_at_sarnoff.com     those who understand binary, and those who don't.
609-734-2246

--- linux/kernel/drivers/sound/pxa-i2s.c 2003-12-13 06:37:05.000000000 -0500
+++ linux_jtk/kernel/drivers/sound/pxa-i2s.c 2005-02-25 17:36:23.000000000 -0500
@@ -79,13 +79,8 @@
         /* Select the clock divisor */
         switch (val) {
         case 8000:
-#if 0
                 fs = 256;
                 clk_div = SADIV_BITCLK_512_00_KHZ;
-#else
- fs = 512;
- clk_div = SADIV_BITCLK_1_024_MHZ;
-#endif
                 break;
         case 16000:
                 fs = 256;

--- linux/kernel/drivers/sound/h5400-audio.c 2004-01-15 16:58:28.000000000 -0500
+++ linux_jtk/kernel/drivers/sound/h5400-audio.c 2005-02-25 17:39:20.000000000 -0500
@@ -181,12 +181,6 @@
 
         audio_samplerate = val;
 
- if (val == 8000) {
- audio_state.double_samples = 1;
- val = 16000;
- } else
- audio_state.double_samples = 0;
-
         cfg.fs = pxa_i2s_set_samplerate (val);
         cfg.format = FMT_I2S;
         i2c_command(ak4535, I2C_AK4535_CONFIGURE, &cfg);
@@ -249,11 +243,13 @@
                         return ret;
                 /* the AK4535 is stereo only */
                 ret = (val == 0) ? -EINVAL : 1;
+ audio_state.double_samples = 0;
                 return put_user(ret, (int *) arg);
 
         case SNDCTL_DSP_CHANNELS:
         case SOUND_PCM_READ_CHANNELS:
                 /* the AK4535 is stereo only */
+ audio_state.double_samples = 0;
                 return put_user(2, (long *) arg);
 
         case SNDCTL_DSP_SPEED:
Received on Fri Feb 25 2005 - 17:35:56 EST

This archive was generated by hypermail 2.2.0 : Mon Jul 25 2005 - 17:20:11 EDT