alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Lars-Peter Clausen <lars@metafoo.de>,
	Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH 3/3] ASoC: twl6040: Use virtual DAPM mixer controls
Date: Mon, 7 Oct 2013 12:07:38 +0300	[thread overview]
Message-ID: <525279DA.4070502@ti.com> (raw)
In-Reply-To: <1381059831-16074-3-git-send-email-lars@metafoo.de>

On 10/06/2013 02:43 PM, Lars-Peter Clausen wrote:
> By using the new virtual DAPM mixer controls it is possible to remove the
> twl6040 specific implementation of virtual controls.

Acked-by: Peter Ujfalusi <peter.ujflausi@ti.com>

> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> ---
>  sound/soc/codecs/twl6040.c | 22 +++++-----------------
>  1 file changed, 5 insertions(+), 17 deletions(-)
> 
> diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c
> index 35059a2..f2f4bcb 100644
> --- a/sound/soc/codecs/twl6040.c
> +++ b/sound/soc/codecs/twl6040.c
> @@ -54,12 +54,7 @@ enum twl6040_dai_id {
>  #define TWL6040_OUTHF_0dB 0x03
>  #define TWL6040_OUTHF_M52dB 0x1D
>  
> -/* Shadow register used by the driver */
> -#define TWL6040_REG_SW_SHADOW	0x2F
> -#define TWL6040_CACHEREGNUM	(TWL6040_REG_SW_SHADOW + 1)
> -
> -/* TWL6040_REG_SW_SHADOW (0x2F) fields */
> -#define TWL6040_EAR_PATH_ENABLE	0x01
> +#define TWL6040_CACHEREGNUM	(TWL6040_REG_STATUS + 1)
>  
>  struct twl6040_jack_data {
>  	struct snd_soc_jack *jack;
> @@ -135,8 +130,6 @@ static const u8 twl6040_reg[TWL6040_CACHEREGNUM] = {
>  	0x00, /* REG_HFOTRIM	0x2C	*/
>  	0x09, /* REG_ACCCTL	0x2D	*/
>  	0x00, /* REG_STATUS	0x2E (ro) */
> -
> -	0x00, /* REG_SW_SHADOW	0x2F - Shadow, non HW register */
>  };
>  
>  /* List of registers to be restored after power up */
> @@ -220,12 +213,8 @@ static int twl6040_read_reg_volatile(struct snd_soc_codec *codec,
>  	if (reg >= TWL6040_CACHEREGNUM)
>  		return -EIO;
>  
> -	if (likely(reg < TWL6040_REG_SW_SHADOW)) {
> -		value = twl6040_reg_read(twl6040, reg);
> -		twl6040_write_reg_cache(codec, reg, value);
> -	} else {
> -		value = twl6040_read_reg_cache(codec, reg);
> -	}
> +	value = twl6040_reg_read(twl6040, reg);
> +	twl6040_write_reg_cache(codec, reg, value);
>  
>  	return value;
>  }
> @@ -261,8 +250,7 @@ static int twl6040_write(struct snd_soc_codec *codec,
>  		return -EIO;
>  
>  	twl6040_write_reg_cache(codec, reg, value);
> -	if (likely(reg < TWL6040_REG_SW_SHADOW) &&
> -	    twl6040_is_path_unmuted(codec, reg))
> +	if (twl6040_is_path_unmuted(codec, reg))
>  		return twl6040_reg_write(twl6040, reg, value);
>  	else
>  		return 0;
> @@ -555,7 +543,7 @@ static const struct snd_kcontrol_new hfr_mux_controls =
>  	SOC_DAPM_ENUM("Route", twl6040_hf_enum[1]);
>  
>  static const struct snd_kcontrol_new ep_path_enable_control =
> -	SOC_DAPM_SINGLE("Switch", TWL6040_REG_SW_SHADOW, 0, 1, 0);
> +	SOC_DAPM_SINGLE_VIRT("Switch", 1);
>  
>  static const struct snd_kcontrol_new auxl_switch_control =
>  	SOC_DAPM_SINGLE("Switch", TWL6040_REG_HFLCTL, 6, 1, 0);
> 


-- 
Péter

  reply	other threads:[~2013-10-07  9:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-06 11:43 [PATCH 1/3] ASoC: dapm: Add support for virtual mixer controls Lars-Peter Clausen
2013-10-06 11:43 ` [PATCH 2/3] ASoC: twl4030: Use virtual DAPM " Lars-Peter Clausen
2013-10-07  9:07   ` Peter Ujfalusi
2013-10-07  9:09     ` Peter Ujfalusi
2013-10-07 10:50   ` Mark Brown
2013-10-06 11:43 ` [PATCH 3/3] ASoC: twl6040: " Lars-Peter Clausen
2013-10-07  9:07   ` Peter Ujfalusi [this message]
2013-10-07  9:11     ` Peter Ujfalusi
2013-10-07 10:49   ` Mark Brown
2013-10-07  9:10 ` [PATCH 1/3] ASoC: dapm: Add support for virtual " Peter Ujfalusi
2013-10-07 10:45 ` 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=525279DA.4070502@ti.com \
    --to=peter.ujfalusi@ti.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).