ASoC: imx-card: Fix mclk calculation issue for akcodec
Transfer the refined slots and slot_width to akcodec_get_mclk_rate() for mclk calculation, otherwise the mclk frequency does not match with the slots and slot_width for S16_LE format, because the default slot_width is 32. Fixes: aa736700f42f ("ASoC: imx-card: Add imx-card machine driver") Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Link: https://lore.kernel.org/r/1641292835-19085-3-git-send-email-shengjiu.wang@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
3349b3d0c6
commit
f331ae5fa5
@ -247,13 +247,14 @@ static bool codec_is_akcodec(unsigned int type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static unsigned long akcodec_get_mclk_rate(struct snd_pcm_substream *substream,
|
static unsigned long akcodec_get_mclk_rate(struct snd_pcm_substream *substream,
|
||||||
struct snd_pcm_hw_params *params)
|
struct snd_pcm_hw_params *params,
|
||||||
|
int slots, int slot_width)
|
||||||
{
|
{
|
||||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||||
struct imx_card_data *data = snd_soc_card_get_drvdata(rtd->card);
|
struct imx_card_data *data = snd_soc_card_get_drvdata(rtd->card);
|
||||||
const struct imx_card_plat_data *plat_data = data->plat_data;
|
const struct imx_card_plat_data *plat_data = data->plat_data;
|
||||||
struct dai_link_data *link_data = &data->link_data[rtd->num];
|
struct dai_link_data *link_data = &data->link_data[rtd->num];
|
||||||
unsigned int width = link_data->slots * link_data->slot_width;
|
unsigned int width = slots * slot_width;
|
||||||
unsigned int rate = params_rate(params);
|
unsigned int rate = params_rate(params);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -349,7 +350,7 @@ static int imx_aif_hw_params(struct snd_pcm_substream *substream,
|
|||||||
|
|
||||||
/* Set MCLK freq */
|
/* Set MCLK freq */
|
||||||
if (codec_is_akcodec(plat_data->type))
|
if (codec_is_akcodec(plat_data->type))
|
||||||
mclk_freq = akcodec_get_mclk_rate(substream, params);
|
mclk_freq = akcodec_get_mclk_rate(substream, params, slots, slot_width);
|
||||||
else
|
else
|
||||||
mclk_freq = params_rate(params) * slots * slot_width;
|
mclk_freq = params_rate(params) * slots * slot_width;
|
||||||
/* Use the maximum freq from DSD512 (512*44100 = 22579200) */
|
/* Use the maximum freq from DSD512 (512*44100 = 22579200) */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user