Skip to content

Commit 2b21207

Browse files
TE-N-ShengjiuWangbroonie
authored andcommitted
ASoC: fsl-asoc-card: use integer type for fll_id and pll_id
As the pll_id and pll_id can be zero (WM8960_SYSCLK_AUTO) with the commit 2bbc2df ("ASoC: wm8960: Make automatic the default clocking mode") Then the machine driver will skip to call set_sysclk() and set_pll() for codec, when the sysclk rate is different with what wm8960 read at probe, the output sound frequency is wrong. So change the fll_id and pll_id initial value, still keep machine driver's behavior same as before. Signed-off-by: Shengjiu Wang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 197c53c commit 2b21207

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

sound/soc/fsl/fsl-asoc-card.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ struct codec_priv {
5252
unsigned long mclk_freq;
5353
unsigned long free_freq;
5454
u32 mclk_id;
55-
u32 fll_id;
56-
u32 pll_id;
55+
int fll_id;
56+
int pll_id;
5757
};
5858

5959
/**
@@ -206,7 +206,7 @@ static int fsl_asoc_card_hw_params(struct snd_pcm_substream *substream,
206206
}
207207

208208
/* Specific configuration for PLL */
209-
if (codec_priv->pll_id && codec_priv->fll_id) {
209+
if (codec_priv->pll_id >= 0 && codec_priv->fll_id >= 0) {
210210
if (priv->sample_format == SNDRV_PCM_FORMAT_S24_LE)
211211
pll_out = priv->sample_rate * 384;
212212
else
@@ -248,7 +248,7 @@ static int fsl_asoc_card_hw_free(struct snd_pcm_substream *substream)
248248

249249
priv->streams &= ~BIT(substream->stream);
250250

251-
if (!priv->streams && codec_priv->pll_id && codec_priv->fll_id) {
251+
if (!priv->streams && codec_priv->pll_id >= 0 && codec_priv->fll_id >= 0) {
252252
/* Force freq to be free_freq to avoid error message in codec */
253253
ret = snd_soc_dai_set_sysclk(asoc_rtd_to_codec(rtd, 0),
254254
codec_priv->mclk_id,
@@ -621,6 +621,10 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
621621
priv->card.dapm_routes = audio_map;
622622
priv->card.num_dapm_routes = ARRAY_SIZE(audio_map);
623623
priv->card.driver_name = DRIVER_NAME;
624+
625+
priv->codec_priv.fll_id = -1;
626+
priv->codec_priv.pll_id = -1;
627+
624628
/* Diversify the card configurations */
625629
if (of_device_is_compatible(np, "fsl,imx-audio-cs42888")) {
626630
codec_dai_name = "cs42888";

0 commit comments

Comments
 (0)