Skip to content

Commit f331ae5

Browse files
TE-N-ShengjiuWangbroonie
authored andcommitted
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: aa73670 ("ASoC: imx-card: Add imx-card machine driver") Signed-off-by: Shengjiu Wang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 3349b3d commit f331ae5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sound/soc/fsl/imx-card.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,13 +247,14 @@ static bool codec_is_akcodec(unsigned int type)
247247
}
248248

249249
static unsigned long akcodec_get_mclk_rate(struct snd_pcm_substream *substream,
250-
struct snd_pcm_hw_params *params)
250+
struct snd_pcm_hw_params *params,
251+
int slots, int slot_width)
251252
{
252253
struct snd_soc_pcm_runtime *rtd = substream->private_data;
253254
struct imx_card_data *data = snd_soc_card_get_drvdata(rtd->card);
254255
const struct imx_card_plat_data *plat_data = data->plat_data;
255256
struct dai_link_data *link_data = &data->link_data[rtd->num];
256-
unsigned int width = link_data->slots * link_data->slot_width;
257+
unsigned int width = slots * slot_width;
257258
unsigned int rate = params_rate(params);
258259
int i;
259260

@@ -349,7 +350,7 @@ static int imx_aif_hw_params(struct snd_pcm_substream *substream,
349350

350351
/* Set MCLK freq */
351352
if (codec_is_akcodec(plat_data->type))
352-
mclk_freq = akcodec_get_mclk_rate(substream, params);
353+
mclk_freq = akcodec_get_mclk_rate(substream, params, slots, slot_width);
353354
else
354355
mclk_freq = params_rate(params) * slots * slot_width;
355356
/* Use the maximum freq from DSD512 (512*44100 = 22579200) */

0 commit comments

Comments
 (0)