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

Mark Brown broonie at kernel.org
Wed Jun 12 13:29:34 PDT 2024


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-mediatek/attachments/20240612/c86e59f6/attachment-0001.sig>


More information about the Linux-mediatek mailing list