Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: alsa-devel@alsa-project.org, Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>
Subject: Re: [PATCH 2/2] ASoC: tlv320aic3x: Fix Left/Rigth PGA mixer widgets/kcontrols
Date: Tue, 27 May 2014 15:19:14 +0300	[thread overview]
Message-ID: <538482C2.1090607@ti.com> (raw)
In-Reply-To: <53847CE7.4080105@metafoo.de>

On 05/27/2014 02:54 PM, Lars-Peter Clausen wrote:
> On 05/27/2014 01:41 PM, Peter Ujfalusi wrote:
>> On 05/27/2014 02:18 PM, Lars-Peter Clausen wrote:
>>> On 05/27/2014 12:53 PM, Peter Ujfalusi wrote:
>>>> Commit "cf7c1de20c576 ASoC: dapm: Move 'value' field from widget to
>>>> control" changed the way how the 'value' has been stored for a widget.
>>>> Since the driver is not updated following the mentioned commit it is mostly
>>>> broken when we try to change mixers for Left/Right PGA since the value is
>>>> not going to be updated correctly.
>>>
>>> I don't think the mentioned commit is the cause. The driver didn't set
>>> widget->value either, so there is no change in behavior here. The commit only
>>> changed where the value is stored not how it is handled.
>>
>> Yes, exactly. The driver has not been updated after the place where the value
>> is stored, so it is not going to store it at all, which causes issues along
>> the way.
> 
> Before the patch the value was stored in widget->value, after the patch the
> value is stored in the kcontrol. The tlv320aic3x driver did not store anything
> in widget->value before the patch and neither does it store anything in the
> kcontrol after the patch.

Sure it is not doing itself. When this custom function has been added it was
essentially a copy of the snd_soc_dapm_put_volsw() - stripped down a bit copy.
But it has not been updated for a long time to follow what is happening the
the core underneath.
I believe not many people uses these paths with the codec and this is why it
has gone unnoticed.
I might attempt to bisect this, but not really sure from which point this is
broken (3.14, 3.12?).

>>> This driver uses a custom put handler and the generic get handler.
>>> dapm_kcontrol_get_value() is used in the generic get handler, but only if reg
>>> equal to SND_SOC_NOPM. Which is not the case for this driver.
>>
>> The relevant code is this:
>>     if (dapm_kcontrol_is_powered(kcontrol) && reg != SND_SOC_NOPM)
>>         val = (snd_soc_read(codec, reg) >> shift) & mask;
>>     else
>>         val = dapm_kcontrol_get_value(kcontrol);
>>
>> and when the widget is not powered the code will try to get the value from the
>> dapm_kcontrol_data, which is not even touched by the custom code in the driver.
> 
> dapm_kcontrol_is_powered() always returns true if the control is not a
> auto-muted control. And there are no auto-muted controls in the tlv320aix3c
> driver.

dapm_kcontrol_is_powered() returns the data->widget->power, which is not the
automute state. Widgets do turn off when they are not in use, like in my system:

# cat tlv320aic3x-codec.0-001b/dapm/Left\ PGA\ Mixer
Left PGA Mixer: Off  in 0 out 0
 out "static" "Left ADC"

So the widget's power is off.

> 
> There are two cases where dapm_kcontrol_get_value() can be called
> a) The control is a virtual control
> b) The control is a auto-muted control
> 
> Neither is the case here, which is why I expect that the real issue is
> something else and it is just shadowed by this patch.
> 
> - Lars


-- 
Péter

  parent reply	other threads:[~2014-05-27 12:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-27 10:53 [PATCH 0/2] ASoC: tlv320aic3x: Fix snd_soc_dapm_put_volsw_aic3x callback Peter Ujfalusi
2014-05-27 10:53 ` [PATCH 1/2] ASoC: dapm: Export dapm_kcontrol_set_value() so it can be used by drivers Peter Ujfalusi
2014-05-27 10:53 ` [PATCH 2/2] ASoC: tlv320aic3x: Fix Left/Rigth PGA mixer widgets/kcontrols Peter Ujfalusi
2014-05-27 11:18   ` Lars-Peter Clausen
2014-05-27 11:41     ` Peter Ujfalusi
2014-05-27 11:54       ` Lars-Peter Clausen
2014-05-27 12:09         ` Lars-Peter Clausen
2014-05-27 12:19         ` Peter Ujfalusi [this message]
2014-05-27 12:24           ` Lars-Peter Clausen
2014-05-27 11:02 ` [PATCH 0/2] ASoC: tlv320aic3x: Fix snd_soc_dapm_put_volsw_aic3x callback Mark Brown
2014-05-27 13:04   ` Peter Ujfalusi
2014-05-28  7:27     ` Lars-Peter Clausen
2014-05-28 13:12       ` Peter Ujfalusi

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=538482C2.1090607@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