[PATCH 1/3] ASoC: fsl-asoc-card: Drop mclk management for nau8822
Chancel Liu <[email protected]>
| Newsgroups | gmane.linux.ports.ppc.embedded |
|---|---|
| Message-ID | <20260810093834.1511749-2-chancel.liu__48312.1519720712$1786354770$gmane$org@oss.nxp.com> |
From: Chancel Liu <[email protected]> commit 93f12a7568269 ("ASoC: nau8822: add MCLK support") added MCLK handling directly in the nau8822 codec driver. The machine driver no longer needs to acquire and enable the codec MCLK on its behalf. Remove MCLK management in this machine driver that was introduced by commit 1075df4bdeb32 ("ASoC: fsl-asoc-card: add nau8822 support"). This avoids a potential double-enable and removes clock resource management from the machine driver where it does not belong. Additionally, the sound card may be unbound and rebound multiple times during its lifetime. Managing a codec clock resource in the machine driver would require careful cleanup in the card remove path to avoid reference count leaks. Leaving clock management to the codec driver, which has the same lifetime as the codec device, is the correct ownership model. The nau8822 compatible entry, DAI name, and PLL/FLL clock ID configuration are kept unchanged. Assisted-by: VeroCoder:claude-sonnet-4-6 Signed-off-by: Chancel Liu <[email protected]> --- sound/soc/fsl/fsl-asoc-card.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index 709543308fe9..4c245aaf2847 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -69,7 +69,6 @@ static const struct snd_pcm_hw_constraint_list cs42888_channel_constraints = { /** * struct codec_priv - CODEC private data - * @mclk: Main clock of the CODEC * @mclk_freq: Clock rate of MCLK * @free_freq: Clock rate of MCLK for hw_free() * @mclk_id: MCLK (or main clock) id for set_sysclk() @@ -80,7 +79,6 @@ static const struct snd_pcm_hw_constraint_list cs42888_channel_constraints = { * to stay within PLL frequency limits */ struct codec_priv { - struct clk *mclk; unsigned long mclk_freq; unsigned long free_freq; u32 mclk_id; @@ -680,9 +678,6 @@ static int fsl_asoc_card_late_probe(struct snd_soc_card *card) dev_err(dev, "failed to set sysclk in %s\n", __func__); return ret; } - - if (!IS_ERR_OR_NULL(codec_priv->mclk)) - clk_prepare_enable(codec_priv->mclk); } return 0; @@ -933,8 +928,6 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) priv->codec_priv[0].fll_id = NAU8822_CLK_PLL; priv->codec_priv[0].pll_id = NAU8822_CLK_PLL; priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP; - if (codec_dev[0]) - priv->codec_priv[0].mclk = devm_clk_get(codec_dev[0], NULL); } else if (of_device_is_compatible(np, "fsl,imx-audio-wm8904")) { codec_dai_name[0] = "wm8904-hifi"; priv->codec_priv[0].mclk_id = WM8904_FLL_MCLK; -- 2.50.1