[PATCH] ASoC: max9867: shutdown codec when changing filter type

Mark Brown broonie at kernel.org
Wed Aug 26 15:46:58 CEST 2020


On Wed, Aug 26, 2020 at 01:39:04PM +0200, Pavel Dobias wrote:
> Changing filter type without disabling codec results in filter
> malfunction. Disable codec when changing filter type.

> +static int max9867_filter_set(struct snd_kcontrol *kcontrol,
> +			      struct snd_ctl_elem_value *ucontrol)
> +{
> +	struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
> +	struct max9867_priv *max9867 = snd_soc_component_get_drvdata(component);
> +	unsigned int mode = ucontrol->value.enumerated.item[0];
> +
> +	if (mode > 1)
> +		return -EINVAL;
> +
> +	/* shutdown codec before switching filter mode */
> +	regmap_update_bits(max9867->regmap, MAX9867_PWRMAN,
> +		MAX9867_PWRMAN_SHDN, 0);

This probably needs to return -EBUSY if the audio path is up - obviously
shutting the CODEC down is going to glitch the audio pretty badly.  It
should probably also check to see if the value is actually being changed
so we avoid a fairly expensive operation for noop changes.
-------------- 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/20200826/9093e069/attachment.sig>


More information about the Alsa-devel mailing list