All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com, perex@perex.cz,
	tiwai@suse.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] ASoC: codecs: wsa883x: add control, dapm widgets and map
Date: Wed, 29 Jun 2022 11:58:05 +0100	[thread overview]
Message-ID: <YrwwPbm0sL1RGwjO@sirena.org.uk> (raw)
In-Reply-To: <20220629090644.67982-4-srinivas.kandagatla@linaro.org>

[-- Attachment #1: Type: text/plain, Size: 1510 bytes --]

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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Mark Brown <broonie@kernel.org>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org,
	tiwai@suse.com, lgirdwood@gmail.com
Subject: Re: [PATCH 3/4] ASoC: codecs: wsa883x: add control, dapm widgets and map
Date: Wed, 29 Jun 2022 11:58:05 +0100	[thread overview]
Message-ID: <YrwwPbm0sL1RGwjO@sirena.org.uk> (raw)
In-Reply-To: <20220629090644.67982-4-srinivas.kandagatla@linaro.org>

[-- Attachment #1: Type: text/plain, Size: 1510 bytes --]

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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2022-06-29 10:58 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-29  9:06 [PATCH 0/4] ASoC: codecs: add WSA883x support Srinivas Kandagatla
2022-06-29  9:06 ` Srinivas Kandagatla
2022-06-29  9:06 ` [PATCH 1/4] ASoC: dt-bindings: Add WSA883x bindings Srinivas Kandagatla
2022-06-29  9:06   ` Srinivas Kandagatla
2022-06-29  9:06 ` [PATCH 2/4] ASoC: codecs: add wsa883x amplifier support Srinivas Kandagatla
2022-06-29  9:06   ` Srinivas Kandagatla
2022-06-29 15:03   ` Pierre-Louis Bossart
2022-06-29 15:03     ` Pierre-Louis Bossart
2022-06-29 16:09     ` Srinivas Kandagatla
2022-06-29 16:09       ` Srinivas Kandagatla
2022-06-29 16:42       ` Pierre-Louis Bossart
2022-06-29 16:42         ` Pierre-Louis Bossart
2022-06-29  9:06 ` [PATCH 3/4] ASoC: codecs: wsa883x: add control, dapm widgets and map Srinivas Kandagatla
2022-06-29  9:06   ` Srinivas Kandagatla
2022-06-29 10:58   ` Mark Brown [this message]
2022-06-29 10:58     ` Mark Brown
2022-06-29 11:00     ` Srinivas Kandagatla
2022-06-29 11:00       ` Srinivas Kandagatla
2022-06-29  9:06 ` [PATCH 4/4] MAINTAINERS: add ASoC Qualcomm codecs Srinivas Kandagatla
2022-06-29  9:06   ` Srinivas Kandagatla
2022-06-29 14:44 ` (subset) [PATCH 0/4] ASoC: codecs: add WSA883x support Mark Brown
2022-06-29 14:44   ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YrwwPbm0sL1RGwjO@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.