Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 170128
b: refs/heads/master
c: 215edda
h: refs/heads/master
v: v3
  • Loading branch information
Mark Brown committed Sep 8, 2009
1 parent 566db03 commit 05a811f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 341c9b84bc01040bd5c75140303e32f6b10098f3
refs/heads/master: 215edda3adf502ccdf3a358ab35b616e7abd25ff
7 changes: 7 additions & 0 deletions trunk/include/sound/soc-dapm.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,10 @@ struct snd_soc_dapm_route {
const char *sink;
const char *control;
const char *source;

/* Note: currently only supported for links where source is a supply */
int (*connected)(struct snd_soc_dapm_widget *source,
struct snd_soc_dapm_widget *sink);
};

/* dapm audio path between two widgets */
Expand All @@ -349,6 +353,9 @@ struct snd_soc_dapm_path {
u32 connect:1; /* source and sink widgets are connected */
u32 walked:1; /* path has been walked */

int (*connected)(struct snd_soc_dapm_widget *source,
struct snd_soc_dapm_widget *sink);

struct list_head list_source;
struct list_head list_sink;
struct list_head list;
Expand Down
19 changes: 16 additions & 3 deletions trunk/sound/soc/soc-dapm.c
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,10 @@ static int dapm_supply_check_power(struct snd_soc_dapm_widget *w)

/* Check if one of our outputs is connected */
list_for_each_entry(path, &w->sinks, list_source) {
if (path->connected &&
!path->connected(path->source, path->sink))
continue;

if (path->sink && path->sink->power_check &&
path->sink->power_check(path->sink)) {
power = 1;
Expand Down Expand Up @@ -1136,13 +1140,19 @@ static ssize_t dapm_widget_power_read_file(struct file *file,
w->sname);

list_for_each_entry(p, &w->sources, list_sink) {
if (p->connected && !p->connected(w, p->sink))
continue;

if (p->connect)
ret += snprintf(buf + ret, PAGE_SIZE - ret,
" in %s %s\n",
p->name ? p->name : "static",
p->source->name);
}
list_for_each_entry(p, &w->sinks, list_source) {
if (p->connected && !p->connected(w, p->sink))
continue;

if (p->connect)
ret += snprintf(buf + ret, PAGE_SIZE - ret,
" out %s %s\n",
Expand Down Expand Up @@ -1385,10 +1395,13 @@ int snd_soc_dapm_sync(struct snd_soc_codec *codec)
EXPORT_SYMBOL_GPL(snd_soc_dapm_sync);

static int snd_soc_dapm_add_route(struct snd_soc_codec *codec,
const char *sink, const char *control, const char *source)
const struct snd_soc_dapm_route *route)
{
struct snd_soc_dapm_path *path;
struct snd_soc_dapm_widget *wsource = NULL, *wsink = NULL, *w;
const char *sink = route->sink;
const char *control = route->control;
const char *source = route->source;
int ret = 0;

/* find src and dest widgets */
Expand All @@ -1412,6 +1425,7 @@ static int snd_soc_dapm_add_route(struct snd_soc_codec *codec,

path->source = wsource;
path->sink = wsink;
path->connected = route->connected;
INIT_LIST_HEAD(&path->list);
INIT_LIST_HEAD(&path->list_source);
INIT_LIST_HEAD(&path->list_sink);
Expand Down Expand Up @@ -1512,8 +1526,7 @@ int snd_soc_dapm_add_routes(struct snd_soc_codec *codec,
int i, ret;

for (i = 0; i < num; i++) {
ret = snd_soc_dapm_add_route(codec, route->sink,
route->control, route->source);
ret = snd_soc_dapm_add_route(codec, route);
if (ret < 0) {
printk(KERN_ERR "Failed to add route %s->%s\n",
route->source,
Expand Down

0 comments on commit 05a811f

Please sign in to comment.