Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 257571
b: refs/heads/master
c: b795064
h: refs/heads/master
i:
  257569: b1c1585
  257567: a5fbfea
v: v3
  • Loading branch information
Liam Girdwood authored and Mark Brown committed Jul 5, 2011
1 parent 9432df4 commit 9ab3864
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 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: a491a5c84f34febfebd4cb0b8c9add97977efa97
refs/heads/master: b7950641374ddb41e9a03ff61b43f9ab3fcf763d
2 changes: 2 additions & 0 deletions trunk/include/sound/soc-dapm.h
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ struct snd_soc_dapm_widget {
char *name; /* widget name */
char *sname; /* stream name */
struct snd_soc_codec *codec;
struct snd_soc_platform *platform;
struct list_head list;
struct snd_soc_dapm_context *dapm;

Expand Down Expand Up @@ -510,6 +511,7 @@ struct snd_soc_dapm_context {

struct device *dev; /* from parent - for debug */
struct snd_soc_codec *codec; /* parent codec */
struct snd_soc_platform *platform; /* parent platform */
struct snd_soc_card *card; /* parent card */

/* used during DAPM updates */
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/sound/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,8 @@ struct snd_soc_platform {
struct snd_soc_card *card;
struct list_head list;
struct list_head card_list;

struct snd_soc_dapm_context dapm;
};

struct snd_soc_dai_link {
Expand Down
4 changes: 4 additions & 0 deletions trunk/sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,7 @@ static int soc_probe_platform(struct snd_soc_card *card,
const struct snd_soc_platform_driver *driver = platform->driver;

platform->card = card;
platform->dapm.card = card;

if (!try_module_get(platform->dev->driver->owner))
return -ENODEV;
Expand All @@ -1010,6 +1011,7 @@ static int soc_probe_platform(struct snd_soc_card *card,
/* mark platform as probed and add to card platform list */
platform->probed = 1;
list_add(&platform->card_list, &card->platform_dev_list);
list_add(&platform->dapm.list, &card->dapm_list);

return 0;

Expand Down Expand Up @@ -3122,6 +3124,8 @@ int snd_soc_register_platform(struct device *dev,

platform->dev = dev;
platform->driver = platform_drv;
platform->dapm.dev = dev;
platform->dapm.platform = platform;

mutex_lock(&client_mutex);
list_add(&platform->list, &platform_list);
Expand Down
13 changes: 11 additions & 2 deletions trunk/sound/soc/soc-dapm.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,22 @@ static int soc_widget_read(struct snd_soc_dapm_widget *w, int reg)
{
if (w->codec)
return snd_soc_read(w->codec, reg);
return 0;
else if (w->platform)
return snd_soc_platform_read(w->platform, reg);

dev_err(w->dapm->dev, "no valid widget read method\n");
return -1;
}

static int soc_widget_write(struct snd_soc_dapm_widget *w, int reg, int val)
{
if (w->codec)
return snd_soc_write(w->codec, reg, val);
return 0;
else if (w->platform)
return snd_soc_platform_write(w->platform, reg, val);

dev_err(w->dapm->dev, "no valid widget write method\n");
return -1;
}

static int soc_widget_update_bits(struct snd_soc_dapm_widget *w,
Expand Down Expand Up @@ -2495,6 +2503,7 @@ int snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
dapm->n_widgets++;
w->dapm = dapm;
w->codec = dapm->codec;
w->platform = dapm->platform;
INIT_LIST_HEAD(&w->sources);
INIT_LIST_HEAD(&w->sinks);
INIT_LIST_HEAD(&w->list);
Expand Down

0 comments on commit 9ab3864

Please sign in to comment.