aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Estevam <fabio.estevam@freescale.com>2014-11-27 10:02:01 -0500
committerMark Brown <broonie@kernel.org>2014-11-27 12:42:01 -0500
commit2a4cfd10229dc93507aa5ddbc1ba0162140f4951 (patch)
tree774faef86de3f8000c8de79ccfb3acf96485264b
parentd819ce965d451aac08e46c9f8e2119fe3a845786 (diff)
ASoC: sgtl5000: Allow 8kHz playback in codec slave mode
When trying to play a 8kHz file with codec in slave mode we get the following error on a mx28evk: $ aplay -Dhw:0,0 stereo_8k.wav Playing WAVE 'stereo_8k.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Stereo [ 21.218647] sgtl5000 0-000a: PLL not supported in slave mode [ 21.224559] sgtl5000 0-000a: 128 ratio is not supported. SYS_MCLK needs to be 256, 384 or 512 * fs [ 21.233687] sgtl5000 0-000a: ASoC: can't set sgtl5000 hw params: -22 aplay: set_params:1123: Unable to install hw params: This error happens because we are using 'sys_fs' instead of 'frame_rate' in the valid ratio check. Use the real'frame_rate' so that the ratio is correctly calculated and the playback can run. sgtl5000 codec manual states that in 'Synchronous SYS_MCLK input' mode that the following SYS_CLK frequencies are allowed: 256*fs, 384*fs, 512*fs. , where fs is the sampling frequency, which can be in the range of: 8, 11.025, 16, 22.5, 32, 44.1, 48, 96 kHz. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/codecs/sgtl5000.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index 473579106539..47d6ca068897 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -618,7 +618,7 @@ static int sgtl5000_set_clock(struct snd_soc_codec *codec, int frame_rate)
618 * factor of freq = 96 kHz can only be 256, since mclk is in the range 618 * factor of freq = 96 kHz can only be 256, since mclk is in the range
619 * of 8 MHz - 27 MHz 619 * of 8 MHz - 27 MHz
620 */ 620 */
621 switch (sgtl5000->sysclk / sys_fs) { 621 switch (sgtl5000->sysclk / frame_rate) {
622 case 256: 622 case 256:
623 clk_ctl |= SGTL5000_MCLK_FREQ_256FS << 623 clk_ctl |= SGTL5000_MCLK_FREQ_256FS <<
624 SGTL5000_MCLK_FREQ_SHIFT; 624 SGTL5000_MCLK_FREQ_SHIFT;
@@ -641,7 +641,7 @@ static int sgtl5000_set_clock(struct snd_soc_codec *codec, int frame_rate)
641 "PLL not supported in slave mode\n"); 641 "PLL not supported in slave mode\n");
642 dev_err(codec->dev, "%d ratio is not supported. " 642 dev_err(codec->dev, "%d ratio is not supported. "
643 "SYS_MCLK needs to be 256, 384 or 512 * fs\n", 643 "SYS_MCLK needs to be 256, 384 or 512 * fs\n",
644 sgtl5000->sysclk / sys_fs); 644 sgtl5000->sysclk / frame_rate);
645 return -EINVAL; 645 return -EINVAL;
646 } 646 }
647 } 647 }