[alsa-devel] [PATCH] ASoC: imx-sgtl5000: Use devm_clk_get()

Shawn Guo shawn.guo at linaro.org
Tue Jun 11 04:50:40 CEST 2013


On Mon, Jun 10, 2013 at 11:04:29PM -0300, Fabio Estevam wrote:
> On Mon, Jun 10, 2013 at 9:44 PM, Shawn Guo <shawn.guo at linaro.org> wrote:
>
> > I do not think the change is correct.  It only works if the struct *dev
> > is what imx_sgtl5000 platform_device points to, that is pdev->dev here.
> > However what you pass here is codec's.  So when imx_sgtl5000_probe()
> > fails or imx_sgtl5000 module is removed, clk_put() will not be called.
> > And if I remember correctly, that's the reason why devm_clk_get() wasn't
> > used here in the first place.
>
> Ok, as you suggested I think we should handle the clocks at the codec
> driver only and pass the codec frequency to the machine driver.

Why do you need to pass it at all?  It seems to me that the machine
driver only needs the frequency to set up sgtl5000 sysclk.  So it ends
up with something below.

 - sgtl5000 driver calls clk_get_rate() to get the frequency
 - sgtl5000 driver passes the frequency to imx-sgtl500 driver
 - imx-sgtl500 driver sets the frequency back to sgtl5000 via
   .set_sysclk callback

I need some help to understand why sgtl5000 driver can not just set up
its sysclk but having to do the above.

Shawn


More information about the Alsa-devel mailing list