Re: [PATCH] ASoC: mediatek: mt6358: Add "Dmic Mode Switch" kcontrol for switch DMIC mode.

From: Mark Brown
Date: Wed Jun 12 2024 - 16:29:45 EST


On Wed, Jun 12, 2024 at 05:41:55PM +0800, Jiaxin Yu wrote:

> +static int mt6358_dmic_mode_set(struct snd_kcontrol *kcontrol,
> + struct snd_ctl_elem_value *ucontrol)
> +{
> + struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol);
> + struct mt6358_priv *priv = snd_soc_component_get_drvdata(c);
> + int enabled = ucontrol->value.integer.value[0];
> +
> + if (priv->dmic_one_wire_mode != enabled) {
> + priv->dmic_one_wire_mode = enabled;

This will allow any value to be written rather than just 0 or 1,
mixer-test should report that this is a bug - there should either be
validation or clamping of the value so it stays as either 0 or 1. Both
options are valid.

Attachment: signature.asc
Description: PGP signature