alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Mark Brown <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org, Liam Girdwood <lgirdwood@gmail.com>
Subject: Re: [PATCH 10/10] ASoC: dapm: Implement mixer input auto-disable
Date: Thu, 01 Aug 2013 21:24:11 +0200	[thread overview]
Message-ID: <51FAB5DB.20607@metafoo.de> (raw)
In-Reply-To: <20130801104800.GO9858@sirena.org.uk>

On 08/01/2013 12:48 PM, Mark Brown wrote:
> On Mon, Jul 29, 2013 at 05:14:04PM +0200, Lars-Peter Clausen wrote:
>
>> -	ucontrol->value.integer.value[0] =
>> -		(snd_soc_read(codec, reg) >> shift) & mask;
>> +	mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
>> +	if (dapm_kcontrol_is_powered(kcontrol))
>> +		val = (snd_soc_read(codec, reg) >> shift) & mask;
>> +	else
>> +		val = dapm_kcontrol_get_value(kcontrol);
>> +	mutex_unlock(&card->dapm_mutex);
>> +
>
> My first thought looking at this is that I would expect this to be
> encapsulated in kcntrol_get_value(), though at the minute it's actually
> only returning the virtual value which makes sense for the existing use.
>
> Equally well I'd expect the value to always be a functioning cache of
> the real value so I think what I'm really saying here is that I don't
> think we should really be checking if the control is powered at all.  We
> do need the I/O path but the power isn't the reason for it, the fact
> that we have the value stashed locally is.
>

There might be some corner cases where the driver directly modifies the 
register value outside of put_volsw() which would break. But otherwise I agree.

> Another thing that's bothering me here is that this only works for mono
> controls but many of the uses are stereo mutes and/or volumes.  We'd
> need to add back the support for those.

But that's a general limitation for DAPM controls. Right now 
snd_soc_dapm_put_volsw() only supports mono controls. If we have a left and a 
right mixer we usually have one mono control for each side. But I of course it 
would be nice to have support for stereo controls here. I guess with the shared 
control infrastructure we actually have most of what we need in place. The only 
thing missing is a way to express which channel of the control controls which 
path. E.g. an extra field per path or per mixer widget selecting the index.

- Lars

  reply	other threads:[~2013-08-01 19:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-29 15:13 [PATCH 01/10] ASoC: dapm: Move snd_soc_dapm_update from dapm context to card Lars-Peter Clausen
2013-07-29 15:13 ` [PATCH 02/10] ASoC: dapm: Pass card instead of dapm context to dapm_power_widgets() Lars-Peter Clausen
2013-07-29 15:13 ` [PATCH 03/10] ASoC: dapm: Add a helper to get the CODEC for DAPM kcontrol Lars-Peter Clausen
2013-07-29 15:13 ` [PATCH 04/10] ASoC: dapm: Wrap kcontrol widget list access Lars-Peter Clausen
2013-07-29 15:13 ` [PATCH 05/10] ASoC: dapm: Move 'value' field from widget to control Lars-Peter Clausen
2013-07-29 15:14 ` [PATCH 06/10] ASoC: dapm: Keep a list of paths per kcontrol Lars-Peter Clausen
2013-07-29 15:14 ` [PATCH 07/10] ASoC: dapm: Make widget power register settings more flexible Lars-Peter Clausen
2013-07-29 15:14 ` [PATCH 08/10] ASoC: dapm: Add snd_soc_dapm_add_path() helper function Lars-Peter Clausen
2013-07-29 17:45   ` Mark Brown
2013-07-30 11:35     ` Lars-Peter Clausen
2013-07-29 15:14 ` [PATCH 09/10] ASoC: dapm: Delay w->power update until the changes are written Lars-Peter Clausen
2013-07-29 15:14 ` [PATCH 10/10] ASoC: dapm: Implement mixer input auto-disable Lars-Peter Clausen
2013-08-01 10:48   ` Mark Brown
2013-08-01 19:24     ` Lars-Peter Clausen [this message]
2013-08-02  9:53       ` Mark Brown
2013-08-02 10:22   ` 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=51FAB5DB.20607@metafoo.de \
    --to=lars@metafoo.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --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).