aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2009-09-08 13:59:05 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-09-08 14:24:56 -0400
commit215edda3adf502ccdf3a358ab35b616e7abd25ff (patch)
treeb0423de56c23f0410608fdb31e6adb49aec503dc /sound/soc/soc-dapm.c
parent341c9b84bc01040bd5c75140303e32f6b10098f3 (diff)
ASoC: Allow per-route connectedness checks for supplies
Some chips with complex internal supply (particularly clocking) arragements may have multiple options for some of the supply connections. Since these don't affect user-visible audio routing the expectation would be that they would be managed automatically by one of the drivers. Support these users by allowing routes to have a connected function which is queried before the connectedness of the path is checked as normal. Currently this is only done for supplies, other widgets could be supported but are not currently since the expectation for them is that audio routing will be under the control of userspace. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 0d8b08ef8731..37f7adeae323 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -718,6 +718,10 @@ static int dapm_supply_check_power(struct snd_soc_dapm_widget *w)
718 718
719 /* Check if one of our outputs is connected */ 719 /* Check if one of our outputs is connected */
720 list_for_each_entry(path, &w->sinks, list_source) { 720 list_for_each_entry(path, &w->sinks, list_source) {
721 if (path->connected &&
722 !path->connected(path->source, path->sink))
723 continue;
724
721 if (path->sink && path->sink->power_check && 725 if (path->sink && path->sink->power_check &&
722 path->sink->power_check(path->sink)) { 726 path->sink->power_check(path->sink)) {
723 power = 1; 727 power = 1;
@@ -1136,6 +1140,9 @@ static ssize_t dapm_widget_power_read_file(struct file *file,
1136 w->sname); 1140 w->sname);
1137 1141
1138 list_for_each_entry(p, &w->sources, list_sink) { 1142 list_for_each_entry(p, &w->sources, list_sink) {
1143 if (p->connected && !p->connected(w, p->sink))
1144 continue;
1145
1139 if (p->connect) 1146 if (p->connect)
1140 ret += snprintf(buf + ret, PAGE_SIZE - ret, 1147 ret += snprintf(buf + ret, PAGE_SIZE - ret,
1141 " in %s %s\n", 1148 " in %s %s\n",
@@ -1143,6 +1150,9 @@ static ssize_t dapm_widget_power_read_file(struct file *file,
1143 p->source->name); 1150 p->source->name);
1144 } 1151 }
1145 list_for_each_entry(p, &w->sinks, list_source) { 1152 list_for_each_entry(p, &w->sinks, list_source) {
1153 if (p->connected && !p->connected(w, p->sink))
1154 continue;
1155
1146 if (p->connect) 1156 if (p->connect)
1147 ret += snprintf(buf + ret, PAGE_SIZE - ret, 1157 ret += snprintf(buf + ret, PAGE_SIZE - ret,
1148 " out %s %s\n", 1158 " out %s %s\n",
@@ -1385,10 +1395,13 @@ int snd_soc_dapm_sync(struct snd_soc_codec *codec)
1385EXPORT_SYMBOL_GPL(snd_soc_dapm_sync); 1395EXPORT_SYMBOL_GPL(snd_soc_dapm_sync);
1386 1396
1387static int snd_soc_dapm_add_route(struct snd_soc_codec *codec, 1397static int snd_soc_dapm_add_route(struct snd_soc_codec *codec,
1388 const char *sink, const char *control, const char *source) 1398 const struct snd_soc_dapm_route *route)
1389{ 1399{
1390 struct snd_soc_dapm_path *path; 1400 struct snd_soc_dapm_path *path;
1391 struct snd_soc_dapm_widget *wsource = NULL, *wsink = NULL, *w; 1401 struct snd_soc_dapm_widget *wsource = NULL, *wsink = NULL, *w;
1402 const char *sink = route->sink;
1403 const char *control = route->control;
1404 const char *source = route->source;
1392 int ret = 0; 1405 int ret = 0;
1393 1406
1394 /* find src and dest widgets */ 1407 /* find src and dest widgets */
@@ -1412,6 +1425,7 @@ static int snd_soc_dapm_add_route(struct snd_soc_codec *codec,
1412 1425
1413 path->source = wsource; 1426 path->source = wsource;
1414 path->sink = wsink; 1427 path->sink = wsink;
1428 path->connected = route->connected;
1415 INIT_LIST_HEAD(&path->list); 1429 INIT_LIST_HEAD(&path->list);
1416 INIT_LIST_HEAD(&path->list_source); 1430 INIT_LIST_HEAD(&path->list_source);
1417 INIT_LIST_HEAD(&path->list_sink); 1431 INIT_LIST_HEAD(&path->list_sink);
@@ -1512,8 +1526,7 @@ int snd_soc_dapm_add_routes(struct snd_soc_codec *codec,
1512 int i, ret; 1526 int i, ret;
1513 1527
1514 for (i = 0; i < num; i++) { 1528 for (i = 0; i < num; i++) {
1515 ret = snd_soc_dapm_add_route(codec, route->sink, 1529 ret = snd_soc_dapm_add_route(codec, route);
1516 route->control, route->source);
1517 if (ret < 0) { 1530 if (ret < 0) {
1518 printk(KERN_ERR "Failed to add route %s->%s\n", 1531 printk(KERN_ERR "Failed to add route %s->%s\n",
1519 route->source, 1532 route->source,