Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@nokia.com>
To: alsa-devel@alsa-project.org
Cc: ext Mark Brown <broonie@opensource.wolfsonmicro.com>,
	patches@opensource.wolfsonmicro.com,
	Liam Girdwood <lrg@slimlogic.co.uk>
Subject: Re: [PATCH 2/2] ASoC: Do DAPM control updates in the middle of DAPM sequences
Date: Thu, 16 Dec 2010 15:03:09 +0200	[thread overview]
Message-ID: <201012161503.09095.peter.ujfalusi@nokia.com> (raw)
In-Reply-To: <1292349202-25538-2-git-send-email-broonie@opensource.wolfsonmicro.com>

On Tuesday 14 December 2010 19:53:22 ext Mark Brown wrote:
> @@ -1634,13 +1671,12 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol
> *kcontrol, (struct soc_mixer_control *)kcontrol->private_value; unsigned
> int reg = mc->reg;
>         unsigned int shift = mc->shift;
> -       unsigned int rshift = mc->rshift;
>         int max = mc->max;
>         unsigned int mask = (1 << fls(max)) - 1;
>         unsigned int invert = mc->invert;
> -       unsigned int val, val2, val_mask;
> -       int connect;
> -       int ret;
> +       unsigned int val, val_mask;
> +       int connect, change;

You do not need the change variable, since

> +       struct snd_soc_dapm_update update;
> 
>         val = (ucontrol->value.integer.value[0] & mask);
> 
> @@ -1648,18 +1684,12 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol
> *kcontrol, val = max - val;
>         val_mask = mask << shift;
>         val = val << shift;
> -       if (shift != rshift) {
> -               val2 = (ucontrol->value.integer.value[1] & mask);
> -               if (invert)
> -                       val2 = max - val2;
> -               val_mask |= mask << rshift;
> -               val |= val2 << rshift;
> -       }
> 
>         mutex_lock(&widget->codec->mutex);
>         widget->value = val;
> 
> -       if (snd_soc_test_bits(widget->codec, reg, val_mask, val)) {
> +       change = snd_soc_test_bits(widget->codec, reg, val_mask, val);
> +       if (change) {

it is used only here, so you could just keep the old if () way.

>                 if (val)
>                         /* new connection */
>                         connect = invert ? 0:1;
> @@ -1667,28 +1697,20 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol
> *kcontrol, /* old connection must be powered down */
>                         connect = invert ? 1:0;
> 
> +               update.kcontrol = kcontrol;
> +               update.widget = widget;
> +               update.reg = reg;
> +               update.mask = mask;
> +               update.val = val;
> +               widget->dapm->update = &update;
> +
>                 dapm_mixer_update_power(widget, kcontrol, connect);
> +
> +               widget->dapm->update = NULL;
>         }
> 
> -       if (widget->event) {
> -               if (widget->event_flags & SND_SOC_DAPM_PRE_REG) {
> -                       ret = widget->event(widget, kcontrol,
> -                                               SND_SOC_DAPM_PRE_REG);
> -                       if (ret < 0) {
> -                               ret = 1;
> -                               goto out;
> -                       }
> -               }
> -               ret = snd_soc_update_bits(widget->codec, reg, val_mask,
> val); -               if (widget->event_flags & SND_SOC_DAPM_POST_REG)
> -                       ret = widget->event(widget, kcontrol,
> -                                               SND_SOC_DAPM_POST_REG);
> -       } else
> -               ret = snd_soc_update_bits(widget->codec, reg, val_mask,
> val); -
> -out:
>         mutex_unlock(&widget->codec->mutex);
> -       return ret;
> +       return 0;
>  }
>  EXPORT_SYMBOL_GPL(snd_soc_dapm_put_volsw);

-- 
Péter

  parent reply	other threads:[~2010-12-16 13:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-14 17:53 [PATCH 1/2] ASoC: Remove unused DAPM_DOUBLE control types Mark Brown
2010-12-14 17:53 ` [PATCH 2/2] ASoC: Do DAPM control updates in the middle of DAPM sequences Mark Brown
2010-12-16  8:39   ` Peter Ujfalusi
2010-12-16 13:03   ` Peter Ujfalusi [this message]
2010-12-16 13:51   ` Peter Ujfalusi
2010-12-16 13:55     ` Mark Brown
2010-12-17  7:08       ` Peter Ujfalusi
2010-12-17 11:45         ` Mark Brown
2010-12-15 13:37 ` [PATCH 1/2] ASoC: Remove unused DAPM_DOUBLE control types Liam Girdwood
2010-12-15 18:10   ` 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=201012161503.09095.peter.ujfalusi@nokia.com \
    --to=peter.ujfalusi@nokia.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=lrg@slimlogic.co.uk \
    --cc=patches@opensource.wolfsonmicro.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