[alsa-devel] Low sample rates for SGTL5000 on i.MX28

Craig McQueen craig.mcqueen at beamcommunications.com
Thu Nov 13 07:34:13 CET 2014


I'm testing the 3.18 kernel for i.MX28 EVK, which has an SGTL5000 CODEC. 
I notice that audio cannot be output at 8 kHz or 11.025 kHz, although 
the SGTL5000 data sheet table 8 indicates this should be possible.

If I try to play or record at 8 kHz or 11.025 kHz, I get an error message:

     # aplay test_8k.wav
     [ 6168.910201] mxs_evk_startup: Skipped programming wolfson codec
     Playing WAVE 'test_8k.wav' : Signed 16 bit Little Endian, Rate 8000 
Hz, Mono
     [ 6168.941211] sgtl5000 0-000a: Invalid mclk frequency: 4.096MHz
     [ 6168.947047] mxs-sgtl5000 sound.11: ASoC: machine hw_params 
failed: -22
     aplay: set_params:1145: Unable to install hw params:
     ...

For an 8 kHz sample rate, I get

     Invalid mclk frequency: 4.096MHz

For 11.025 kHz sample rate, I get

     Invalid mclk frequency: 5.644MHz

Looking in the code (/sound/soc/mxs/mxs-sgtl5000c), I see:

          /* Sgtl5000 sysclk should be >= 8MHz and <= 27M */
          if (mclk < 8000000 || mclk > 27000000) {
               dev_err(codec_dai->dev, "Invalid mclk frequency: 
%u.%03uMHz\n",
                    mclk / 1000000, mclk / 1000 % 1000);
               return -EINVAL;
          }

But a sysclk constraint of 8 to 27 MHz only applies if the supplied 
clock is asynchronous to the frame clock, and the internal clock is 
being generated by PLL (which it's not in this case). So I tried 
removing this constraint. But I found that from codecs/sgtl5000.c, I 
would get the error "PLL not supported in slave mode". I tried changing 
the switch (sgtl5000->sysclk / sys_fs) to switch (sgtl5000->sysclk / 
frame_rate), on the basis of the SGTL5000 data sheet table 8. But the 
resulting audio sounds funny (frequency shifted).

Looking in the SGTL5000 data sheet table 18, it seems unclear whether 
the MCLK_FREQ field is a multiple of the sample rate (Fs) or the 
internal system sample rate SYS_FS. It seems that there is some 
inconsistency in the interpretation of this in codecs/sgtl5000.c 
compared to mxs/mxs-sgtl5000.c.

What is the correct interpretation of the SGTL5000 data sheet MCLK_FREQ 
field, and can the mxs-sgtl5000 driver be fixed to support 8 kHz and 
11.025 kHz sample rates?

-- 
Craig McQueen



More information about the Alsa-devel mailing list