aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-04-05 22:38:14 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-04-08 22:25:20 -0400
commit0d86733cce776ca0262b850ee8eb46bc52dc8244 (patch)
treee0bac583719dd5f37e7c1199cae81b077aeb6a59 /sound/soc/soc-dapm.c
parent52ba67bf85889828b3766207fa43ce7159c84c78 (diff)
ASoC: Allow DAPM pin operations to match any context
The DAPM pin operations currently require that the specific DAPM context that the pin being operated in is contained in be specified. With multi component and especially with the addition of a per-card DAPM context this isn't ideal as it means that things like disabling unused pins on CODECs require looking up the CODEC DAPM context. Fix this by falling back to matching a widget in any context if there isn't a match in the current context. The code isn't ideal currently but will do the job. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 68879209b315..2ee738c08ca4 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1477,6 +1477,19 @@ static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm,
1477 } 1477 }
1478 } 1478 }
1479 1479
1480 /* Try again in other contexts */
1481 list_for_each_entry(w, &dapm->card->widgets, list) {
1482 if (!strcmp(w->name, pin)) {
1483 dev_dbg(w->dapm->dev, "dapm: pin %s = %d\n",
1484 pin, status);
1485 w->connected = status;
1486 /* Allow disabling of forced pins */
1487 if (status == 0)
1488 w->force = 0;
1489 return 0;
1490 }
1491 }
1492
1480 dev_err(dapm->dev, "dapm: unknown pin %s\n", pin); 1493 dev_err(dapm->dev, "dapm: unknown pin %s\n", pin);
1481 return -EINVAL; 1494 return -EINVAL;
1482} 1495}
@@ -2317,6 +2330,17 @@ int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm,
2317 } 2330 }
2318 } 2331 }
2319 2332
2333 /* Try again with other contexts */
2334 list_for_each_entry(w, &dapm->card->widgets, list) {
2335 if (!strcmp(w->name, pin)) {
2336 dev_dbg(w->dapm->dev,
2337 "dapm: force enable pin %s\n", pin);
2338 w->connected = 1;
2339 w->force = 1;
2340 return 0;
2341 }
2342 }
2343
2320 dev_err(dapm->dev, "dapm: unknown pin %s\n", pin); 2344 dev_err(dapm->dev, "dapm: unknown pin %s\n", pin);
2321 return -EINVAL; 2345 return -EINVAL;
2322} 2346}