[PATCH V1] ASoC: fsl_ssi: refine ipg clock usage in this module

Markus Pargmann mpa at pengutronix.de
Wed Sep 10 20:53:59 EST 2014


Hi,

On Wed, Sep 10, 2014 at 06:30:06PM +0800, Shengjiu Wang wrote:
> On Wed, Sep 10, 2014 at 08:21:18AM +0200, Markus Pargmann wrote:
> > On Tue, Sep 09, 2014 at 11:38:05AM -0700, Nicolin Chen wrote:
> > > On Tue, Sep 09, 2014 at 05:18:07PM +0800, Shengjiu Wang wrote:
> > > > @@ -1321,7 +1333,11 @@ static int fsl_ssi_probe(struct platform_device *pdev)
> > > >  		return -ENOMEM;
> > > >  	}
> > > >  
> > > > -	ssi_private->regs = devm_regmap_init_mmio(&pdev->dev, iomem,
> > > > +	if (ssi_private->soc->imx)
> > > > +		ssi_private->regs = devm_regmap_init_mmio_clk(&pdev->dev,
> > > > +			"ipg", iomem, &fsl_ssi_regconfig);
> > > > +	else
> > > > +		ssi_private->regs = devm_regmap_init_mmio(&pdev->dev, iomem,
> > > 
> > > As Markus mentioned, the key point here is to be compatible with those
> > > non-clock-name platforms.
> > > 
> > > I think it would be safer to keep the current code while adding an extra
> > > clk_disable_unprepare() at the end of probe() as a common routine. And
> > > meantime, make sure to have the call for imx only because it seems that
> > > the other platforms do not depend on the clock. //a bit guessing here :)
> > > 
> > > Then we can get a patch like:
> > > open() {
> > > +	clk_prepare_enable();
> > > 	....
> > > }
> > > 
> > > close() {
> > > 	....
> > > +	clk_disable_unprepare()
> > > }
> > > 
> > > probe() {
> > > 	clk_get();
> > > 	clk_prepare_enable();
> > > 	....
> > > 	if (xxx)
> > > -		goto err_xx;
> > > +		return ret;
> > > 	....
> > > +	clk_disable_unprepare();
> > > 	return 0;
> > > -err_xx:
> > > -	clk_disable_unprepare()
> > > }
> > > 
> > > remove() {
> > > 	....
> > > -	clk_disable_unprepare()
> > > }
> > 
> > If I remember correctly, there may be AC97 communication with the codec
> > before any substream is created. That's why we enable the SSI unit right
> > at the beginning for AC97 in fsl_ssi_setup_reg_vals(). So we need to
> > check for AC97 before disabling clocks.
> > 
> > Best regards,
> > 
> > Markus
> 
> hi Markus
> 
> I think if clk_prepare_enable() in startup(), and clk_disable_unprepare()
> in shutdown can meet this requirement, right?

Yes that could work.

> 
> done:
>         if (ssi_private->dai_fmt)
>                 _fsl_ssi_set_dai_fmt(ssi_private, ssi_private->dai_fmt);
> 
> I find that in end of probe, there is setting of dai_fmt. Can we remove this?
> because this setting need to enable ipg clock, and if ac97, ipg clock can't be
> disabled.

No you can't remove it. It is necessary for the DT property "fsl,mode".
Most dts do not have this property anymore because the sound cards are
setting the dai-fmt. But there are still some powerpc dts files that
contain that property.

Best regards,

Markus

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20140910/378ee40b/attachment.sig>


More information about the Linuxppc-dev mailing list