summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Baluta <daniel.baluta@nxp.com>2017-06-22 10:18:29 +0300
committerDaniel Baluta <daniel.baluta@nxp.com>2017-06-22 14:10:50 +0300
commitbbc9f7eb02f76cae92390cf83a6faaf0e5a2d43e (patch)
treed16c209c081c435fcb7a8edcdbd2ede8c2a5393a
parentab761d65acf4cbf4f212b99fdf1fc57fe24564dc (diff)
MLK-15028: ASoC: codecs: wm8960: Remove bitclk relax condition
Using a higher bitclk then expected doesn't always work. Here is an example: aplay -Dhw:0,0 -d 5 -r 48000 -f S24_LE -c 2 audio48k24b2c.wav In this case, the required bitclk is 48000 * 24 * 2 = 2304000 but the closest bitclk that can be derived is 3072000. Now, for format S24_LE, SAI will use slot_width = 24, but since the clock is faster than expected, it will start to send bytes from the next channel so the sound will be corrupted. Thus, remove bitclk relaxation condition which was added mostly for supporting S20_3LE format which was removed from SAI in commit 739e6d654b5c0a ("MLK-14870: ASoC: fsl_sai: Remove support for S20_3LE"). Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
-rw-r--r--sound/soc/codecs/wm8960.c26
1 files changed, 2 insertions, 24 deletions
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index dcfcc68b4539..956c5d0f923a 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -611,10 +611,6 @@ static const int bclk_divs[] = {
* - lrclk = sysclk / dac_divs
* - 10 * bclk = sysclk / bclk_divs
*
- * If we cannot find an exact match for (sysclk, lrclk, bclk)
- * triplet, we relax the bclk such that bclk is chosen as the
- * closest available frequency greater than expected bclk.
- *
* @wm8960_priv: wm8960 codec private data
* @mclk: MCLK used to derive sysclk
* @sysclk_idx: sysclk_divs index for found sysclk
@@ -632,7 +628,7 @@ int wm8960_configure_sysclk(struct wm8960_priv *wm8960, int mclk,
{
int sysclk, bclk, lrclk;
int i, j, k;
- int diff, closest = mclk;
+ int diff;
/* marker for no match */
*bclk_idx = -1;
@@ -656,12 +652,6 @@ int wm8960_configure_sysclk(struct wm8960_priv *wm8960, int mclk,
*bclk_idx = k;
break;
}
- if (diff > 0 && closest > diff) {
- *sysclk_idx = i;
- *dac_idx = j;
- *bclk_idx = k;
- closest = diff;
- }
}
if (k != ARRAY_SIZE(bclk_divs))
break;
@@ -679,10 +669,6 @@ int wm8960_configure_sysclk(struct wm8960_priv *wm8960, int mclk,
* - freq_out = sysclk * sysclk_divs
* - 10 * sysclk = bclk * bclk_divs
*
- * If we cannot find an exact match for (sysclk, lrclk, bclk)
- * triplet, we relax the bclk such that bclk is chosen as the
- * closest available frequency greater than expected bclk.
- *
* @codec: codec structure
* @freq_in: input frequency used to derive freq out via PLL
* @sysclk_idx: sysclk_divs index for found sysclk
@@ -700,12 +686,11 @@ int wm8960_configure_pll(struct snd_soc_codec *codec, int freq_in,
{
struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec);
int sysclk, bclk, lrclk, freq_out;
- int diff, closest, best_freq_out = 0;
+ int diff, best_freq_out = 0;
int i, j, k;
bclk = wm8960->bclk;
lrclk = wm8960->lrclk;
- closest = freq_in;
*bclk_idx = *dac_idx = *sysclk_idx = -1;
@@ -728,13 +713,6 @@ int wm8960_configure_pll(struct snd_soc_codec *codec, int freq_in,
best_freq_out = freq_out;
break;
}
- if (diff > 0 && closest > diff) {
- *sysclk_idx = i;
- *dac_idx = j;
- *bclk_idx = k;
- closest = diff;
- best_freq_out = freq_out;
- }
}
if (k != ARRAY_SIZE(bclk_divs))
break;