[1/3] ASoC: adau1372: fix mclk

Message ID 20221028152626.109603-2-maarten.zanders@mind.be
State New
Headers
Series ASoC: adau1372: fixes after debugging custom board |

Commit Message

Maarten Zanders Oct. 28, 2022, 3:26 p.m. UTC
  "mclk" is retrieved from the configuration and assigned to adau1372->clk.
However adau1372->mclk (==NULL) is used for clk_prepare_enable() and
clk_disable_unprepare() which don't have any effect.

Remove .clk from struct adau1372 and use .mclk throughout.
This change ensures that the input clock is switched on/off when the
bias level is changed.

Signed-off-by: Maarten Zanders <maarten.zanders@mind.be>
---
 sound/soc/codecs/adau1372.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
  

Comments

Sa, Nuno Oct. 31, 2022, 11:20 a.m. UTC | #1
> -----Original Message-----
> From: Maarten Zanders <maarten.zanders@mind.be>
> Sent: Friday, October 28, 2022 5:26 PM
> To: Lars-Peter Clausen <lars@metafoo.de>; Sa, Nuno
> <Nuno.Sa@analog.com>; Liam Girdwood <lgirdwood@gmail.com>; Mark
> Brown <broonie@kernel.org>; Jaroslav Kysela <perex@perex.cz>; Takashi
> Iwai <tiwai@suse.com>
> Cc: Maarten Zanders <maarten.zanders@mind.be>; alsa-devel@alsa-
> project.org; linux-kernel@vger.kernel.org
> Subject: [PATCH 1/3] ASoC: adau1372: fix mclk
> 
> [External]
> 
> "mclk" is retrieved from the configuration and assigned to adau1372->clk.
> However adau1372->mclk (==NULL) is used for clk_prepare_enable() and
> clk_disable_unprepare() which don't have any effect.
> 
> Remove .clk from struct adau1372 and use .mclk throughout.
> This change ensures that the input clock is switched on/off when the
> bias level is changed.
> 
> Signed-off-by: Maarten Zanders <maarten.zanders@mind.be>
> ---

I guess this needs a Fixes: tag?

- Nuno Sá
  
Maarten Zanders Nov. 2, 2022, 8:07 a.m. UTC | #2
Hi,

On 10/31/22 12:20, Sa, Nuno wrote:
>
> I guess this needs a Fixes: tag?

Yes, you're right. I figured it'd be less relevant since we're fixing 
the initial commit, but that was wrong.

Did you get a chance to look at the fix itself?

Thanks!
  
Sa, Nuno Nov. 2, 2022, 8:59 a.m. UTC | #3
> -----Original Message-----
> From: Maarten Zanders <maarten.zanders@mind.be>
> Sent: Wednesday, November 2, 2022 9:08 AM
> To: Sa, Nuno <Nuno.Sa@analog.com>; Lars-Peter Clausen
> <lars@metafoo.de>; Liam Girdwood <lgirdwood@gmail.com>; Mark Brown
> <broonie@kernel.org>; Jaroslav Kysela <perex@perex.cz>; Takashi Iwai
> <tiwai@suse.com>
> Cc: alsa-devel@alsa-project.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH 1/3] ASoC: adau1372: fix mclk
> 
> [External]
> 
> Hi,
> 
> On 10/31/22 12:20, Sa, Nuno wrote:
> >
> > I guess this needs a Fixes: tag?
> 
> Yes, you're right. I figured it'd be less relevant since we're fixing
> the initial commit, but that was wrong.
> 
> Did you get a chance to look at the fix itself?
> 

Yeah, the fix looks valid to me...

- Nuno Sá
  

Patch

diff --git a/sound/soc/codecs/adau1372.c b/sound/soc/codecs/adau1372.c
index a9f89e8565ec..00d0825e193b 100644
--- a/sound/soc/codecs/adau1372.c
+++ b/sound/soc/codecs/adau1372.c
@@ -25,7 +25,6 @@ 
 #include "adau-utils.h"
 
 struct adau1372 {
-	struct clk *clk;
 	struct regmap *regmap;
 	void (*switch_mode)(struct device *dev);
 	bool use_pll;
@@ -925,9 +924,9 @@  int adau1372_probe(struct device *dev, struct regmap *regmap,
 	if (!adau1372)
 		return -ENOMEM;
 
-	adau1372->clk = devm_clk_get(dev, "mclk");
-	if (IS_ERR(adau1372->clk))
-		return PTR_ERR(adau1372->clk);
+	adau1372->mclk = devm_clk_get(dev, "mclk");
+	if (IS_ERR(adau1372->mclk))
+		return PTR_ERR(adau1372->mclk);
 
 	adau1372->pd_gpio = devm_gpiod_get_optional(dev, "powerdown", GPIOD_OUT_HIGH);
 	if (IS_ERR(adau1372->pd_gpio))
@@ -947,7 +946,7 @@  int adau1372_probe(struct device *dev, struct regmap *regmap,
 	 * 12.288MHz. Automatically choose a valid configuration from the
 	 * external clock.
 	 */
-	rate = clk_get_rate(adau1372->clk);
+	rate = clk_get_rate(adau1372->mclk);
 
 	switch (rate) {
 	case 12288000: