[alsa-devel] [PATCH V2] ASoC: fsl: add imx-wm8962 machine driver

Nicolin Chen b42378 at freescale.com
Thu Jun 6 14:49:53 CEST 2013


On Wed, Jun 05, 2013 at 12:55:44PM +0100, Mark Brown wrote:
> > +		/* assuming clock enabled by default */
> > +		data->codec_clk = NULL;
> > +		ret = of_property_read_u32(codec_np, "clock-frequency",
> > +					&data->clk_frequency);
> > +		if (ret) {
> > +			dev_err(&codec_dev->dev,
> > +				"clock-frequency missing or invalid\n");
> > +			goto fail;
> > +		}
> 
> Since it's easy to define a fixed rate clock (there's a generic driver
> for that) I'd just require the user to provide a clock API clock and fix
> the rate using that.  This is going to be less error prone and makes the
> code simpler.

I tried to use fixed rate clock as below:

	data->codec_clk = devm_clk_get(&codec_dev->dev, NULL);
	if (IS_ERR(data->codec_clk)) {
		of_fixed_clk_setup(codec_np);
		data->codec_clk = clk_get(NULL, codec_np->name);
		if (IS_ERR(data->codec_clk)) {
			dev_err(&pdev->dev, "failed to create fixed clk\n");
			ret = IS_ERR(data->codec_clk);
			goto fail;
		}
	}

	data->clk_frequency = clk_get_rate(data->codec_clk);
	clk_prepare_enable(data->codec_clk);

But I always got "failed to create fixed clk" error during system booting.
So I think it's pretty different to get a fixed clock with normal since
it's on the root_list of clock tree.
How can I get the clock here, or more specifically, any way to get the 
rate of the fixed-rate-clk?

Thanks.




More information about the Alsa-devel mailing list