Re: [PATCH v3 2/2] ASoC: add support for TAS6424 digital amplifier

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Tue, Jul 18, 2017 at 02:20:04PM -0500, Michael Stecklein wrote:

> +	if (!tx_mask) {
> +		dev_err(codec->dev, "tdm mask must not be 0\n");
> +		return -EINVAL;
> +	}

Setting the mask to 0 is used when turning off TDM.

> +	if ((reg & TAS6424_WARN_VDD_UV) && !(tas6424->last_warn & TAS6424_WARN_VDD_UV))
> +		dev_warn(dev, "experienced a VDD under voltage condition\n");
> +
> +	if ((reg & TAS6424_WARN_VDD_POR) && !(tas6424->last_warn & TAS6424_WARN_VDD_POR))
> +		dev_warn(dev, "experienced a VDD POR condition\n");

These look like they are errors rather than warnings and should be
critical prints like the other errors.

> +	/* Store current warn value so we can detect any changes next time */
> +	tas6424->last_warn = reg;

It would be better to clear these at some point, perhaps after a delay.
Especially with thermal issues they could come and go over device
operation.

> +static int tas6424_codec_probe(struct snd_soc_codec *codec)
> +{
> +	struct tas6424_data *tas6424 = snd_soc_codec_get_drvdata(codec);
> +	int ret;
> +
> +	tas6424->codec = codec;
> +
> +	ret = regulator_bulk_enable(ARRAY_SIZE(tas6424->supplies),
> +				    tas6424->supplies);
> +	if (ret != 0) {
> +		dev_err(codec->dev, "failed to enable supplies: %d\n", ret);
> +		return ret;
> +	}

This init stuff should be in either the main I2C probe, DAPM or bias
level management.  The CODEC probe should be very minimal.

> +	if (event & SND_SOC_DAPM_POST_PMU) {

> +	} else if (event & SND_SOC_DAPM_PRE_PMD) {

You're trying to write a switch statement here.

> +	switch (level) {
> +	case SND_SOC_BIAS_ON:
> +	case SND_SOC_BIAS_PREPARE:
> +		msleep(500);
> +		break;

You need a 500ms sleep in all these cases?  That's a lot of sleeping.

> +	case SND_SOC_BIAS_STANDBY:
> +		ret = snd_soc_update_bits(codec, TAS6424_CH_STATE_CTRL_REG,
> +					  0xff, TAS6424_CH1_STATE_MUTE | TAS6424_CH2_STATE_MUTE |
> +					  TAS6424_CH3_STATE_MUTE | TAS6424_CH4_STATE_MUTE);
> +
> +		if (ret < 0) {
> +			dev_err(codec->dev, "error resuming device: %d\n", ret);
> +			return ret;
> +		}
> +		break;
> +	case SND_SOC_BIAS_OFF:
> +		ret = snd_soc_update_bits(codec, TAS6424_CH_STATE_CTRL_REG,
> +					  0xff, TAS6424_CH1_STATE_HIZ | TAS6424_CH2_STATE_HIZ |
> +					  TAS6424_CH3_STATE_HIZ | TAS6424_CH4_STATE_HIZ);
> +
> +		if (ret < 0) {
> +			dev_err(codec->dev, "error suspending device: %d\n", ret);
> +			return ret;
> +		}

These mutes seem very random disassociated from anything else?

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux