I'm testing the 3.14.19 kernel on imx28evk, with a Yocto build that uses the linux-fslc kernel provider.
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. I assume the PLL isn't being used. So can this constraint be relaxed?
Craig,
You are right that the 8-27MHz constraint does not apply when the sgtl5000 codec is slave.
I will prepare some patches to fix it, then will post at alsa-devel with you on Cc.
Thanks for reporting.
Just tested playback of a 8k wav file and it works fine on 3.18-rc4:
root@freescale /home$ aplay mono_8k.wav
Playing WAVE 'mono_8k.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono
I've just tried it myself on a 3.18-rc4 kernel, but didn't get the same results as you. I got the same error as I previously got with the 3.14 kernel.
Maybe your device is using an ALSA asoundrc that is using plug or rate plugins to convert to a different sampling rate. Try using -D hw:0,0 option. First of all, I wouldn't expect a mono file to work, since the hardware needs 2 channels. E.g. I get:
# aplay -D hw:0,0 mono_8k.wav
Playing WAVE 'mono_8k.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono
aplay: set_params:1239: Channels count non available
But if you try a stereo file, then I expect you would get the invalid mclk frequency error:
# aplay -D hw:0,0 stereo_8k.wav
Playing WAVE 'stereo_8k.wav' : S[ 3718.857813] sgtl5000 0-000a: Invalid mclk frequency: 4.096MHz
igned 16 bit Little Endi[ 3718.865460] mxs-sgtl5000 sound: ASoC: machine hw_params failed: -22
an, Rate 8000 Hz, Stereo
aplay: set_params:1297: Unable to install hw params:
ACCESS: RW_INTERLEAVED
FORMAT: S16_LE
SUBFORMAT: STD
SAMPLE_BITS: 16
FRAME_BITS: 32
CHANNELS: 2
RATE: 8000
...
Craig,
Please share your two wav files, so that I can test them here.