All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vinod <vkoul@kernel.org>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: lee.jones@linaro.org, robh+dt@kernel.org, broonie@kernel.org,
	mark.rutland@arm.com, lgirdwood@gmail.com, tiwai@suse.com,
	bgoswami@codeaurora.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org
Subject: Re: [PATCH 08/12] ASoC: wcd9335: add basic controls
Date: Wed, 25 Jul 2018 17:34:07 +0530	[thread overview]
Message-ID: <20180725120407.GO3661@vkoul-mobl> (raw)
In-Reply-To: <20180723155410.9494-9-srinivas.kandagatla@linaro.org>

On 23-07-18, 16:54, Srinivas Kandagatla wrote:

> +static int wcd9335_set_compander(struct snd_kcontrol *kc,
> +				 struct snd_ctl_elem_value *ucontrol)
> +{
> +	struct snd_soc_component *component = snd_soc_kcontrol_component(kc);
> +	struct wcd9335_codec *wcd = dev_get_drvdata(component->dev);
> +	int comp = ((struct soc_mixer_control *) kc->private_value)->shift;
> +	int value = ucontrol->value.integer.value[0];
> +	int sel;
> +
> +	wcd->comp_enabled[comp] = value;
> +	sel = value ? WCD9335_HPH_GAIN_SRC_SEL_COMPANDER :
> +		WCD9335_HPH_GAIN_SRC_SEL_REGISTER;
> +
> +	/* Any specific register configuration for compander */
> +	switch (comp) {
> +	case COMPANDER_1:
> +		/* Set Gain Source Select based on compander enable/disable */
> +		snd_soc_component_update_bits(component, WCD9335_HPH_L_EN,
> +				      WCD9335_HPH_GAIN_SRC_SEL_MASK, sel);
> +		break;
> +	case COMPANDER_2:
> +		snd_soc_component_update_bits(component, WCD9335_HPH_R_EN,
> +				      WCD9335_HPH_GAIN_SRC_SEL_MASK, sel);
> +		break;
> +	case COMPANDER_3:
> +		break;
> +	case COMPANDER_4:
> +		break;
> +	case COMPANDER_5:
> +		snd_soc_component_update_bits(component, WCD9335_SE_LO_LO3_GAIN,
> +				      WCD9335_HPH_GAIN_SRC_SEL_MASK, sel);
> +		break;
> +	case COMPANDER_6:
> +		snd_soc_component_update_bits(component, WCD9335_SE_LO_LO4_GAIN,
> +				      WCD9335_HPH_GAIN_SRC_SEL_MASK, sel);
> +		break;
> +	case COMPANDER_7:
> +		break;
> +	case COMPANDER_8:
> +		break;

why not do:

        case COMPANDER_3:
        case COMPANDER_4:
        case COMPANDER_7:
        case COMPANDER_8:
                break;

thereby clubbing all the ones not handled together..

> +static int wcd9335_rx_hph_mode_get(struct snd_kcontrol *kc,
> +				 struct snd_ctl_elem_value *ucontrol)
> +{
> +	struct snd_soc_component *component = snd_soc_kcontrol_component(kc);
> +	struct wcd9335_codec *wcd = dev_get_drvdata(component->dev);
> +
> +	ucontrol->value.integer.value[0] = wcd->hph_mode;

i think this is an enum so shouldn't value.enumerated.item[0] be used?

> +
> +	return 0;
> +}
> +
> +static int wcd9335_rx_hph_mode_put(struct snd_kcontrol *kc,
> +				 struct snd_ctl_elem_value *ucontrol)
> +{
> +	struct snd_soc_component *component = snd_soc_kcontrol_component(kc);
> +	struct wcd9335_codec *wcd = dev_get_drvdata(component->dev);
> +	u32 mode_val;
> +
> +	mode_val = ucontrol->value.enumerated.item[0];

yaaay
-- 
~Vinod

  reply	other threads:[~2018-07-25 12:04 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-23 15:53 [PATCH 00/12] mfd: Add support to WCD9335 Audio Codec Srinivas Kandagatla
2018-07-23 15:53 ` [PATCH 01/12] mfd: dt-bindings: Add wcd9335 mfd bindings Srinivas Kandagatla
2018-07-23 15:53   ` Srinivas Kandagatla
2018-07-24  5:56   ` Vinod
2018-07-24  5:56     ` Vinod
2018-07-24 11:50     ` Srinivas Kandagatla
2018-07-23 15:54 ` [PATCH 02/12] mfd: wcd9335: add support to wcd9335 core Srinivas Kandagatla
2018-07-23 15:54   ` Srinivas Kandagatla
2018-07-23 15:54 ` [PATCH 03/12] mfd: wcd9335: add wcd irq support Srinivas Kandagatla
2018-07-23 15:54 ` [PATCH 04/12] ASoC: dt-bindings: add dt bindings for wcd9335 audio codec Srinivas Kandagatla
2018-07-23 15:54   ` Srinivas Kandagatla
2018-07-24 11:06   ` Mark Brown
2018-07-24 11:06     ` Mark Brown
2018-07-24 11:48     ` Srinivas Kandagatla
2018-07-24 11:48       ` Srinivas Kandagatla
2018-07-23 15:54 ` [PATCH 05/12] ASoC: core: add support to snd_soc_dai_get_channel_map() Srinivas Kandagatla
2018-07-24 11:50   ` Applied "ASoC: core: add support to snd_soc_dai_get_channel_map()" to the asoc tree Mark Brown
2018-07-24 11:50     ` Mark Brown
2018-07-23 15:54 ` [PATCH 06/12] ASoC: wcd9335: add support to wcd9335 codec Srinivas Kandagatla
2018-07-23 15:54 ` [PATCH 07/12] ASoC: wcd9335: add CLASS-H Controller support Srinivas Kandagatla
2018-07-24 11:59   ` Mark Brown
2018-07-24 11:59     ` Mark Brown
2018-07-24 12:05     ` Srinivas Kandagatla
2018-07-23 15:54 ` [PATCH 08/12] ASoC: wcd9335: add basic controls Srinivas Kandagatla
2018-07-25 12:04   ` Vinod [this message]
2018-07-27  9:55     ` Srinivas Kandagatla
2018-07-23 15:54 ` [PATCH 09/12] ASoC: wcd9335: add playback dapm widgets Srinivas Kandagatla
2018-07-23 15:54 ` [PATCH 10/12] ASoC: wcd9335: add capture " Srinivas Kandagatla
2018-07-23 15:54 ` [PATCH 11/12] ASoC: wcd9335: add audio routings Srinivas Kandagatla
2018-07-23 15:54 ` [PATCH 12/12] ASoC: apq8096: Add support to Analog audio via WCD9335 slim Srinivas Kandagatla
2018-07-25 16:24   ` Mark Brown
2018-07-25 16:24     ` Mark Brown
2018-07-24  5:53 ` [PATCH 00/12] mfd: Add support to WCD9335 Audio Codec Vinod

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=20180725120407.GO3661@vkoul-mobl \
    --to=vkoul@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=bgoswami@codeaurora.org \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --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.