summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sound/soc/codecs/sgtl5000.c19
-rw-r--r--sound/soc/tegra/apalis-tk1.c16
2 files changed, 4 insertions, 31 deletions
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index 3cdbb2c80461..eeff807c129f 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -692,24 +692,7 @@ static int sgtl5000_set_clock(struct snd_soc_codec *codec, int frame_rate)
int clk_ctl = 0;
int sys_fs; /* sample freq */
- /*
- * sample freq should be divided by frame clock,
- * if frame clock lower than 44.1khz, sample feq should set to
- * 32khz or 44.1khz.
- */
- switch (frame_rate) {
- case 8000:
- case 16000:
- sys_fs = 32000;
- break;
- case 11025:
- case 22050:
- sys_fs = 44100;
- break;
- default:
- sys_fs = frame_rate;
- break;
- }
+ sys_fs = sgtl5000_srate_to_sys_fs(frame_rate);
/* set divided factor of frame clock */
switch (sys_fs / frame_rate) {
diff --git a/sound/soc/tegra/apalis-tk1.c b/sound/soc/tegra/apalis-tk1.c
index 4f08b1d32980..6ca99a1ca67e 100644
--- a/sound/soc/tegra/apalis-tk1.c
+++ b/sound/soc/tegra/apalis-tk1.c
@@ -69,20 +69,10 @@ static int apalis_tk1_sgtl5000_hw_params(struct snd_pcm_substream *substream,
int err;
int rate;
- /* sgtl5000 does not support 512*rate when in 96000 fs */
srate = params_rate(params);
- switch (srate) {
- case 96000:
- mclk = 256 * srate;
- break;
- default:
- mclk = 512 * srate;
- break;
- }
-
- /* Sgtl5000 sysclk should be >= 8MHz and <= 27M */
- if (mclk < 8000000 || mclk > 27000000)
- return -EINVAL;
+ mclk = sgtl5000_srate_to_mclk(srate);
+ if (IS_ERR_VALUE(mclk))
+ return mclk;
if (pdata->i2s_param[HIFI_CODEC].is_i2s_master)
i2s_daifmt = SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS;