]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
ASoC: Fix dapm_is_shared_kcontrol so everything isn't shared
authorStephen Warren <swarren@nvidia.com>
Thu, 26 May 2011 15:57:33 +0000 (09:57 -0600)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 27 May 2011 13:49:36 +0000 (21:49 +0800)
commit1007da0604b1d2f064bfecece0f131d57237b03f
tree83881e32850d6488425dcf1bd377a80d083e247b
parentea77b94774b3cc67162d74894b49af7eb17071f0
ASoC: Fix dapm_is_shared_kcontrol so everything isn't shared

Commit af46800 ("ASoC: Implement mux control sharing") introduced
function dapm_is_shared_kcontrol.

When this function returns true, the naming of DAPM controls is derived
from the kcontrol_new. Otherwise, the name comes from the widget (and
possibly a widget's naming prefix).

A bug in the implementation of dapm_is_shared_kcontrol made it return 1
in all cases. Hence, that commit caused a change in control naming for
all controls instead of just shared controls.

Specifically, a control is always considered shared because it is always
compared against itself. Solve this by never comparing against the widget
containing the control being created.

Equally, controls should never be shared between DAPM contexts; when the
same codec is instantiated multiple times, the same kcontrol_new will be
used. However, the control should no be shared between the multiple
instances.

I tested that with the Tegra WM8903 driver:
* Shared is now mostly 0 as expected, and sometimes 1.
* The expected controls are still generated after this change.

However, I don't have any systems that have a widget/control naming
prefix, so I can't test that aspect.

Thanks for Jarkko Nikula for pointing out how to fix this.

Reported-by: Liam Girdwood <lrg@ti.com>
Tested-by: Jarkko Nikula <jhnikula@gmail.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/soc-dapm.c