ASoC: fsl-asoc-card: Drop mclk management for nau8822

commit 93f12a7568 ("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 1075df4bde ("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 <chancel.liu@nxp.com>
Link: https://patch.msgid.link/20260810093834.1511749-2-chancel.liu@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Chancel Liu 2026-08-10 18:35:29 +09:00 committed by Mark Brown
parent db2ddb8714
commit 4c51a83a4f
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -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;