[alsa-devel] [PATCH v7] ASoC: add RT286 CODEC driver

Mark Brown broonie at kernel.org
Fri Jul 4 19:50:35 CEST 2014


On Fri, Jun 20, 2014 at 02:41:13PM +0800, bardliao at realtek.com wrote:
> From: Bard Liao <bardliao at realtek.com>
> 
> This patch adds Realtek ALC286 codec driver.

I've applied this but there are small number of remaining issues which
should be fixed - please send followup patches for them.

> +static int rt286_probe(struct snd_soc_codec *codec)
> +{
> +	struct rt286_priv *rt286 = snd_soc_codec_get_drvdata(codec);
> +	int i, ret;
> +
> +	ret = snd_soc_read(codec,
> +		RT286_GET_PARAM(AC_NODE_ROOT, AC_PAR_VENDOR_ID));
> +	if (ret != RT286_VENDOR_ID) {
> +		dev_err(codec->dev,
> +			"Device with ID register %x is not rt286\n", ret);
> +		return -ENODEV;
> +	}

Most of this probe function doesn't depend on ASoC at all and so should
be done at the I2C level probe not here - that way errors are detected
earlier and the device is initialised even if the sound card as a whole
isn't ready yet.

> +	if (!rt286->pdata.cbj_en) {
> +		snd_soc_write(codec, RT286_CBJ_CTRL2, 0x0000);
> +		snd_soc_write(codec, RT286_MIC1_DET_CTRL, 0x0816);
> +		snd_soc_write(codec, RT286_MISC_CTRL1, 0x0000);
> +		snd_soc_update_bits(codec,
> +					RT286_CBJ_CTRL1, 0xf000, 0xb000);
> +	} else {
> +		snd_soc_update_bits(codec,
> +					RT286_CBJ_CTRL1, 0xf000, 0x5000);
> +	}
> +
> +	mdelay(10);

I notice that the resume doesn't have these delays in it - is that not a
problem if the device lost power over suspend?

> +	rt286->i2c->irq = 0;
> +	if (rt286->i2c->irq) {

The assignment looks like some test code which was left in by mistake.

> +		ret = request_threaded_irq(rt286->i2c->irq, NULL, rt286_irq,
> +			IRQF_TRIGGER_HIGH | IRQF_ONESHOT, "rt286", rt286);
> +		if (ret != 0) {

This is only released in the I2C level remove() (the the fix should be
to move the request to the I2C level probe()).
-------------- 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/20140704/04bc7cfc/attachment.sig>


More information about the Alsa-devel mailing list