[alsa-devel] [PATCH v4 3/3] ASoC: fsl: add imx-es8328 machine driver

Mark Brown broonie at kernel.org
Wed Jun 18 12:02:33 CEST 2014


On Wed, Jun 18, 2014 at 11:47:21AM +0800, Sean Cross wrote:

> +config SND_SOC_IMX_ES8328
> +	tristate "SoC Audio support for i.MX boards with the ES8328 codec"
> +	depends on OF && (I2C || SPI)
> +	select SND_SOC_ES8328_I2C if I2C
> +	select SND_SOC_ES8328_SPI if SPI_MASTER

I expect this is going to break configurations where I2C is modular and
SPI is enabled since it'll try to build in the I2C bus interface.

> +static int imx_set_frequency(struct imx_es8328_data *data, int freq)
> +{
> +	int ret;
> +
> +	ret = clk_set_parent(data->output_clk, data->codec_clk);
> +	if (ret) {
> +		dev_err(data->dev, "unable to set clk output");
> +		return ret;
> +	}
> +
> +	ret = clk_set_parent(data->codec_clk_sel, data->codec_clk_post_div);
> +	if (ret) {
> +		dev_err(data->dev, "unable to set clk parent");
> +		return ret;
> +	}

This should be handled by the clock bindings not open coded in the
driver - leaving this here most likely won't play nicely when the clock
API can configure the defaults for the tree.  There is supposed to be
support for setting default clock trees going in (or perhaps already in)
the clock bindings.

> +	data->codec_regulator = devm_regulator_get(dev, "codec");
> +	if (IS_ERR(data->codec_regulator)) {
> +		dev_err(dev, "No codec regulator\n");
> +		data->codec_regulator = NULL;
> +	} else {
> +		ret = regulator_enable(data->codec_regulator);
> +		if (ret)
> +			dev_err(dev,
> +				"Unable to enable codec regulator: %d\n", ret);
> +	}

No, this is broken.  The CODEC should request its own supplies which
need to correspond to the supplies the physical device has and failing
to get the supplies should be a fatal error unless the device works
without power (in which case why bother enablin them at all?).

> +	ret = snd_soc_register_card(&data->card);
> +	if (ret)
> +		goto fail;

devm_snd_soc_register_card().
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20140618/cf106e2f/attachment.sig>


More information about the Alsa-devel mailing list