All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cezary Rojewski <cezary.rojewski@intel.com>
To: Chancel Liu <chancel.liu@oss.nxp.com>
Cc: Support Opensource <support.opensource@diasemi.com>,
	<linux-sound@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<patches@opensource.cirrus.com>, Mark Brown <broonie@kernel.org>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>, "Takashi Iwai" <tiwai@suse.com>,
	Charles Keepax <ckeepax@opensource.cirrus.com>,
	"Oder Chiou" <oder_chiou@realtek.com>
Subject: Re: [PATCH 09/21] ASoC: rt5640: Move mclk acquisition to the i2c probe
Date: Mon, 21 Sep 2026 20:28:16 +0200	[thread overview]
Message-ID: <e0825225-9616-4c3e-82de-346da017d600@intel.com> (raw)
In-Reply-To: <20260921104640.1941554-10-chancel.liu@oss.nxp.com>

On 9/21/2026 12:46 PM, Chancel Liu wrote:
> From: Chancel Liu <chancel.liu@nxp.com>
> 
> component->dev is the underlying i2c device whose devres is only
> released on physical device removal, not on ASoC card unbind. Getting
> the codec clock with devm_clk_get_optional(component->dev, ...) in the
> component probe therefore leaks a clk reference on every card
> bind/unbind cycle.
> 
> Move the devm_clk_get_optional() to rt5640_i2c_probe() so the clk
> reference is tied to the physical device lifetime.
> 
> Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
> ---
>  sound/soc/codecs/rt5640.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c
> index 03d0ac3359f5..1a45346cf6b9 100644
> --- a/sound/soc/codecs/rt5640.c
> +++ b/sound/soc/codecs/rt5640.c
> @@ -2667,11 +2667,6 @@ static int rt5640_probe(struct snd_soc_component *component)
>  	bool dmic_en = false;
>  	u32 val;
>  
> -	/* Check if MCLK provided */
> -	rt5640->mclk = devm_clk_get_optional(component->dev, "mclk");
> -	if (IS_ERR(rt5640->mclk))
> -		return PTR_ERR(rt5640->mclk);
> -
>  	rt5640->component = component;
>  
>  	snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_OFF);
> @@ -3053,6 +3048,11 @@ static int rt5640_i2c_probe(struct i2c_client *i2c)
>  	regmap_update_bits(rt5640->regmap, RT5640_GCTL1,
>  				RT5640_MCLK_DET, RT5640_MCLK_DET);
>  
> +	/* Check if MCLK provided */
> +	rt5640->mclk = devm_clk_get_optional(&i2c->dev, "mclk");
> +	if (IS_ERR(rt5640->mclk))
> +		return PTR_ERR(rt5640->mclk);
> +
>  	rt5640->hp_mute = true;
>  	rt5640->irq = i2c->irq;
>  	INIT_DELAYED_WORK(&rt5640->bp_work, rt5640_button_press_work);


nitpick: update the title tags so it starts with:
	ASoC: codecs: rt5640:

Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>

  reply	other threads:[~2026-09-21 18:28 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21 10:46 [PATCH 00/21] ASoC: codecs: Fix resource leaks across card bind/unbind Chancel Liu
2026-09-21 10:46 ` [PATCH 01/21] ASoC: cpcap: Fix devm " Chancel Liu
2026-09-21 10:46 ` [PATCH 02/21] ASoC: da7218: " Chancel Liu
2026-09-21 10:46 ` [PATCH 03/21] ASoC: tlv320aic32x4: Fix clock leak from runtime callbacks Chancel Liu
2026-09-21 10:46 ` [PATCH 04/21] ASoC: twl4030: Acquire board params and hs_extmute GPIO in the platform probe Chancel Liu
2026-09-21 10:46 ` [PATCH 05/21] ASoC: es8316: Move mclk acquisition to the i2c probe Chancel Liu
2026-09-21 10:46 ` [PATCH 06/21] ASoC: es8323: " Chancel Liu
2026-09-21 13:17   ` Mark Brown
2026-09-21 13:18     ` Mark Brown
2026-09-22  2:18       ` Chancel Liu
2026-09-21 10:46 ` [PATCH 07/21] ASoC: es8311: " Chancel Liu
2026-09-21 10:46 ` [PATCH 08/21] ASoC: es8328: Move clk acquisition to the bus probe Chancel Liu
2026-09-21 10:46 ` [PATCH 09/21] ASoC: rt5640: Move mclk acquisition to the i2c probe Chancel Liu
2026-09-21 18:28   ` Cezary Rojewski [this message]
2026-09-21 10:46 ` [PATCH 10/21] ASoC: rt5616: " Chancel Liu
2026-09-21 10:46 ` [PATCH 11/21] ASoC: rt5514: Move clk " Chancel Liu
2026-09-21 10:46 ` [PATCH 12/21] ASoC: rt5682s: Move mclk " Chancel Liu
2026-09-21 18:44   ` Cezary Rojewski
2026-09-22  2:34     ` Chancel Liu
2026-09-21 10:46 ` [PATCH 13/21] ASoC: max98090: " Chancel Liu
2026-09-21 10:46 ` [PATCH 14/21] ASoC: max98095: " Chancel Liu
2026-09-21 10:46 ` [PATCH 15/21] ASoC: wm8985: Move regulator acquisition to the bus probe Chancel Liu
2026-09-21 11:52   ` Charles Keepax
2026-09-22  2:01     ` Chancel Liu
2026-09-21 10:46 ` [PATCH 16/21] ASoC: wm8955: Move regulator acquisition to the i2c probe Chancel Liu
2026-09-21 10:58   ` Charles Keepax
2026-09-21 10:46 ` [PATCH 17/21] ASoC: es8389: Move regulator and mclk " Chancel Liu
2026-09-21 10:46 ` [PATCH 18/21] ASoC: rt5677-spi: Free the DSP context on component remove Chancel Liu
2026-09-21 10:46 ` [PATCH 19/21] ASoC: rt1011: Free the bq/drc coefficient arrays " Chancel Liu
2026-09-21 10:46 ` [PATCH 20/21] ASoC: rt5645: Free the hardware EQ parameters " Chancel Liu
2026-09-21 10:46 ` [PATCH 21/21] ASoC: rt5514-spi: Free the DSP context " Chancel Liu
2026-09-21 13:23   ` Mark Brown
2026-09-22  2:31     ` Chancel Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e0825225-9616-4c3e-82de-346da017d600@intel.com \
    --to=cezary.rojewski@intel.com \
    --cc=broonie@kernel.org \
    --cc=chancel.liu@oss.nxp.com \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=oder_chiou@realtek.com \
    --cc=patches@opensource.cirrus.com \
    --cc=perex@perex.cz \
    --cc=support.opensource@diasemi.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.