[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YrwwPbm0sL1RGwjO@sirena.org.uk>
Date: Wed, 29 Jun 2022 11:58:05 +0100
From: Mark Brown <broonie@...nel.org>
To: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Cc: alsa-devel@...a-project.org, lgirdwood@...il.com, perex@...ex.cz,
tiwai@...e.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/4] ASoC: codecs: wsa883x: add control, dapm widgets and
map
On Wed, Jun 29, 2022 at 10:06:43AM +0100, Srinivas Kandagatla wrote:
> +static int wsa_dev_mode_put(struct snd_kcontrol *kcontrol,
> + struct snd_ctl_elem_value *ucontrol)
> +{
> + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
> + struct wsa883x_priv *wsa883x = snd_soc_component_get_drvdata(component);
> +
> + if (wsa883x->dev_mode == ucontrol->value.enumerated.item[0])
> + return 0;
> +
> + wsa883x->dev_mode = ucontrol->value.enumerated.item[0];
> +
> + return 0;
> +}
This isn't returning 1 when the value changes so will miss generating
events, please test the driver with mixer-test.
> + switch (event) {
> + case SND_SOC_DAPM_POST_PMU:
> + if (wsa883x->dev_mode == RECEIVER) {
> + snd_soc_component_write_field(component, WSA883X_CDC_PATH_MODE,
> + WSA883X_RXD_MODE_MASK,
> + WSA883X_RXD_MODE_HIFI);
> + snd_soc_component_write_field(component, WSA883X_SPKR_PWM_CLK_CTL,
> + WSA883X_SPKR_PWM_FREQ_SEL_MASK,
> + WSA883X_SPKR_PWM_FREQ_F600KHZ);
> + snd_soc_component_write_field(component, WSA883X_DRE_CTL_0,
> + WSA883X_DRE_PROG_DELAY_MASK, 0x0);
> + } else if (wsa883x->dev_mode == SPEAKER) {
This looks like it'd be better written as a switch statement.
> +static const struct snd_kcontrol_new wsa883x_snd_controls[] = {
> + SOC_SINGLE_RANGE_TLV("PA Gain", WSA883X_DRE_CTL_1, 1,
> + 0x0, 0x1f, 1, pa_gain),
Volume controls should end in Volume, mixer-test should also have caught
this.
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists