diff mbox series

ASoC: ti: osk5912: Make it CCF clk API compatible

Message ID 20220402120106.131118-1-jmkrzyszt@gmail.com
State New
Headers show
Series ASoC: ti: osk5912: Make it CCF clk API compatible | expand

Commit Message

Janusz Krzysztofik April 2, 2022, 12:01 p.m. UTC
The driver, OMAP1 specific, now omits clk_prepare/unprepare() steps, not
supported by OMAP1 custom implementation of clock API.  However, non-CCF
stubs of those functions exist for use on such platforms until converted
to CCF.

Update the driver to be compatible with CCF implementation of clock API.

Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
---
 sound/soc/ti/osk5912.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Péter Ujfalusi April 6, 2022, 7:57 p.m. UTC | #1
Hi Janusz,

On 02/04/2022 15:01, Janusz Krzysztofik wrote:
> The driver, OMAP1 specific, now omits clk_prepare/unprepare() steps, not
> supported by OMAP1 custom implementation of clock API.  However, non-CCF
> stubs of those functions exist for use on such platforms until converted
> to CCF.
> 
> Update the driver to be compatible with CCF implementation of clock API.
> 
> Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
> ---
>  sound/soc/ti/osk5912.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/ti/osk5912.c b/sound/soc/ti/osk5912.c
> index 40e29dda7e7a..22da3b335e81 100644
> --- a/sound/soc/ti/osk5912.c
> +++ b/sound/soc/ti/osk5912.c
> @@ -134,6 +134,10 @@ static int __init osk_soc_init(void)
>  		goto err2;
>  	}
>  
> +	err = clk_prepare(tlv320aic23_mclk);

would not make sense to change the clk_enable() to clk_prepare_enable()
in osk_startup() and the clk_disable() to clk_disable_unprepare() in
osk_shutdown() instead leaving the clock in prepared state as long as
the driver is loaded?

> +	if (err)
> +		goto err3;
> +
>  	/*
>  	 * Configure 12 MHz output on MCLK.
>  	 */
> @@ -142,7 +146,7 @@ static int __init osk_soc_init(void)
>  		if (clk_set_rate(tlv320aic23_mclk, CODEC_CLOCK)) {
>  			printk(KERN_ERR "Cannot set MCLK for AIC23 CODEC\n");
>  			err = -ECANCELED;
> -			goto err3;
> +			goto err4;
>  		}
>  	}
>  
> @@ -151,6 +155,8 @@ static int __init osk_soc_init(void)
>  
>  	return 0;
>  
> +err4:
> +	clk_unprepare(tlv320aic23_mclk);
>  err3:
>  	clk_put(tlv320aic23_mclk);
>  err2:
> @@ -164,6 +170,7 @@ static int __init osk_soc_init(void)
>  
>  static void __exit osk_soc_exit(void)
>  {
> +	clk_unprepare(tlv320aic23_mclk);
>  	clk_put(tlv320aic23_mclk);
>  	platform_device_unregister(osk_snd_device);
>  }
Janusz Krzysztofik April 6, 2022, 10:18 p.m. UTC | #2
Hi Peter,

On Wednesday, 6 April 2022 21:57:34 CEST Péter Ujfalusi wrote:
> Hi Janusz,
> 
> On 02/04/2022 15:01, Janusz Krzysztofik wrote:
> > The driver, OMAP1 specific, now omits clk_prepare/unprepare() steps, not
> > supported by OMAP1 custom implementation of clock API.  However, non-CCF
> > stubs of those functions exist for use on such platforms until converted
> > to CCF.
> > 
> > Update the driver to be compatible with CCF implementation of clock API.
> > 
> > Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
> > ---
> >  sound/soc/ti/osk5912.c | 9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> > 
> > diff --git a/sound/soc/ti/osk5912.c b/sound/soc/ti/osk5912.c
> > index 40e29dda7e7a..22da3b335e81 100644
> > --- a/sound/soc/ti/osk5912.c
> > +++ b/sound/soc/ti/osk5912.c
> > @@ -134,6 +134,10 @@ static int __init osk_soc_init(void)
> >  		goto err2;
> >  	}
> >  
> > +	err = clk_prepare(tlv320aic23_mclk);
> 
> would not make sense to change the clk_enable() to clk_prepare_enable()
> in osk_startup() and the clk_disable() to clk_disable_unprepare() in
> osk_shutdown() instead leaving the clock in prepared state as long as
> the driver is loaded?

OK, I can see the clk_prepare_enable() approach is more common than 
separate clk_prepare() across the kernel code, and I have no arguments 
against it in our case.  I'll submit v2 soon.

Thanks,
Janusz
  
> 
> > +	if (err)
> > +		goto err3;
> > +
> >  	/*
> >  	 * Configure 12 MHz output on MCLK.
> >  	 */
> > @@ -142,7 +146,7 @@ static int __init osk_soc_init(void)
> >  		if (clk_set_rate(tlv320aic23_mclk, CODEC_CLOCK)) {
> >  			printk(KERN_ERR "Cannot set MCLK for AIC23 CODEC\n");
> >  			err = -ECANCELED;
> > -			goto err3;
> > +			goto err4;
> >  		}
> >  	}
> >  
> > @@ -151,6 +155,8 @@ static int __init osk_soc_init(void)
> >  
> >  	return 0;
> >  
> > +err4:
> > +	clk_unprepare(tlv320aic23_mclk);
> >  err3:
> >  	clk_put(tlv320aic23_mclk);
> >  err2:
> > @@ -164,6 +170,7 @@ static int __init osk_soc_init(void)
> >  
> >  static void __exit osk_soc_exit(void)
> >  {
> > +	clk_unprepare(tlv320aic23_mclk);
> >  	clk_put(tlv320aic23_mclk);
> >  	platform_device_unregister(osk_snd_device);
> >  }
> 
>
Mark Brown April 12, 2022, 10:26 p.m. UTC | #3
On Sat, 2 Apr 2022 14:01:06 +0200, Janusz Krzysztofik wrote:
> The driver, OMAP1 specific, now omits clk_prepare/unprepare() steps, not
> supported by OMAP1 custom implementation of clock API.  However, non-CCF
> stubs of those functions exist for use on such platforms until converted
> to CCF.
> 
> Update the driver to be compatible with CCF implementation of clock API.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: ti: osk5912: Make it CCF clk API compatible
      commit: 90b76a3cb9bf208286851560cfc70830c91c1d3f

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/sound/soc/ti/osk5912.c b/sound/soc/ti/osk5912.c
index 40e29dda7e7a..22da3b335e81 100644
--- a/sound/soc/ti/osk5912.c
+++ b/sound/soc/ti/osk5912.c
@@ -134,6 +134,10 @@  static int __init osk_soc_init(void)
 		goto err2;
 	}
 
+	err = clk_prepare(tlv320aic23_mclk);
+	if (err)
+		goto err3;
+
 	/*
 	 * Configure 12 MHz output on MCLK.
 	 */
@@ -142,7 +146,7 @@  static int __init osk_soc_init(void)
 		if (clk_set_rate(tlv320aic23_mclk, CODEC_CLOCK)) {
 			printk(KERN_ERR "Cannot set MCLK for AIC23 CODEC\n");
 			err = -ECANCELED;
-			goto err3;
+			goto err4;
 		}
 	}
 
@@ -151,6 +155,8 @@  static int __init osk_soc_init(void)
 
 	return 0;
 
+err4:
+	clk_unprepare(tlv320aic23_mclk);
 err3:
 	clk_put(tlv320aic23_mclk);
 err2:
@@ -164,6 +170,7 @@  static int __init osk_soc_init(void)
 
 static void __exit osk_soc_exit(void)
 {
+	clk_unprepare(tlv320aic23_mclk);
 	clk_put(tlv320aic23_mclk);
 	platform_device_unregister(osk_snd_device);
 }