ASoC: stm32: sai: fix oversampling mode
Set OSR bit if mclk/fs ratio is 512. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
26f98e82dd
commit
71d9537fad
|
@ -913,7 +913,7 @@ static int stm32_sai_configure_clock(struct snd_soc_dai *cpu_dai,
|
||||||
struct snd_pcm_hw_params *params)
|
struct snd_pcm_hw_params *params)
|
||||||
{
|
{
|
||||||
struct stm32_sai_sub_data *sai = snd_soc_dai_get_drvdata(cpu_dai);
|
struct stm32_sai_sub_data *sai = snd_soc_dai_get_drvdata(cpu_dai);
|
||||||
int div = 0;
|
int div = 0, cr1 = 0;
|
||||||
int sai_clk_rate, mclk_ratio, den;
|
int sai_clk_rate, mclk_ratio, den;
|
||||||
unsigned int rate = params_rate(params);
|
unsigned int rate = params_rate(params);
|
||||||
|
|
||||||
|
@ -958,13 +958,19 @@ static int stm32_sai_configure_clock(struct snd_soc_dai *cpu_dai,
|
||||||
} else {
|
} else {
|
||||||
if (sai->mclk_rate) {
|
if (sai->mclk_rate) {
|
||||||
mclk_ratio = sai->mclk_rate / rate;
|
mclk_ratio = sai->mclk_rate / rate;
|
||||||
if ((mclk_ratio != 512) &&
|
if (mclk_ratio == 512) {
|
||||||
(mclk_ratio != 256)) {
|
cr1 = SAI_XCR1_OSR;
|
||||||
|
} else if (mclk_ratio != 256) {
|
||||||
dev_err(cpu_dai->dev,
|
dev_err(cpu_dai->dev,
|
||||||
"Wrong mclk ratio %d\n",
|
"Wrong mclk ratio %d\n",
|
||||||
mclk_ratio);
|
mclk_ratio);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
regmap_update_bits(sai->regmap,
|
||||||
|
STM_SAI_CR1_REGX,
|
||||||
|
SAI_XCR1_OSR, cr1);
|
||||||
|
|
||||||
div = stm32_sai_get_clk_div(sai, sai_clk_rate,
|
div = stm32_sai_get_clk_div(sai, sai_clk_rate,
|
||||||
sai->mclk_rate);
|
sai->mclk_rate);
|
||||||
if (div < 0)
|
if (div < 0)
|
||||||
|
|
Loading…
Reference in a new issue