[PATCH] ASoC: ti: osk5912: Make it CCF clk API compatible

Janusz Krzysztofik jmkrzyszt at gmail.com
Thu Apr 7 00:18:45 CEST 2022


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 at 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);
> >  }
> 
> 






More information about the Alsa-devel mailing list