[alsa-devel] [PATCH 2/2] ASoC: codecs: Add initial PCM1862/63/64/65 universal ADC driver

Mark Brown broonie at kernel.org
Fri Nov 10 22:21:50 CET 2017


On Fri, Nov 10, 2017 at 01:57:11PM -0600, Andrew F. Davis wrote:

This looks mostly good, a few small issues though:

> +	dev_info(&i2c->dev, "%s() i2c->addr=%d\n", __func__, i2c->addr);

No need for this as standard, we already have I2C level logging
facilities if they're really needed.  It's OK to do things like log chip
revisions read back from hardware but this is pure software.

> +static const struct snd_kcontrol_new pcm1863_snd_controls[] = {
> +	SOC_DOUBLE_R_S_TLV("Analog Gain", PCM186X_PGA_VAL_CH1_L,

Volume controls should end in Volume to tell userspace how to handle
them, see ControlNames.txt.

> +	ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(priv->supplies),
> +				      priv->supplies);
> +	if (ret != 0) {
> +		dev_err(dev, "failed to request supplies: %d\n", ret);
> +		return ret;
> +	}
> +
> +	/* Reset device registers for a consistent power-on like state */
> +	ret = regmap_write(regmap, PCM186X_PAGE, PCM186X_RESET);
> +	if (ret != 0) {
> +		dev_err(dev, "failed to write device: %d\n", ret);
> +		return ret;
> +	}

We didn't enable the supplies for the device before we reset it, if the
device was powered off then the write will hopefully not work and we'll
get a spurious error here.  The driver should bounce the supplies on at
least long enough to do the reset, it's not ideal but it's robust.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20171110/75712994/attachment.sig>


More information about the Alsa-devel mailing list