diff options
-rw-r--r-- | include/sound/soc-dapm.h | 2 | ||||
-rw-r--r-- | include/sound/soc.h | 2 | ||||
-rw-r--r-- | sound/soc/soc-core.c | 4 | ||||
-rw-r--r-- | sound/soc/soc-dapm.c | 13 |
4 files changed, 19 insertions, 2 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 602024d4c459..e09505c5a490 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h | |||
@@ -447,6 +447,7 @@ struct snd_soc_dapm_widget { | |||
447 | char *name; /* widget name */ | 447 | char *name; /* widget name */ |
448 | char *sname; /* stream name */ | 448 | char *sname; /* stream name */ |
449 | struct snd_soc_codec *codec; | 449 | struct snd_soc_codec *codec; |
450 | struct snd_soc_platform *platform; | ||
450 | struct list_head list; | 451 | struct list_head list; |
451 | struct snd_soc_dapm_context *dapm; | 452 | struct snd_soc_dapm_context *dapm; |
452 | 453 | ||
@@ -510,6 +511,7 @@ struct snd_soc_dapm_context { | |||
510 | 511 | ||
511 | struct device *dev; /* from parent - for debug */ | 512 | struct device *dev; /* from parent - for debug */ |
512 | struct snd_soc_codec *codec; /* parent codec */ | 513 | struct snd_soc_codec *codec; /* parent codec */ |
514 | struct snd_soc_platform *platform; /* parent platform */ | ||
513 | struct snd_soc_card *card; /* parent card */ | 515 | struct snd_soc_card *card; /* parent card */ |
514 | 516 | ||
515 | /* used during DAPM updates */ | 517 | /* used during DAPM updates */ |
diff --git a/include/sound/soc.h b/include/sound/soc.h index c421501532db..6ce8dc32a3db 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -682,6 +682,8 @@ struct snd_soc_platform { | |||
682 | struct snd_soc_card *card; | 682 | struct snd_soc_card *card; |
683 | struct list_head list; | 683 | struct list_head list; |
684 | struct list_head card_list; | 684 | struct list_head card_list; |
685 | |||
686 | struct snd_soc_dapm_context dapm; | ||
685 | }; | 687 | }; |
686 | 688 | ||
687 | struct snd_soc_dai_link { | 689 | struct snd_soc_dai_link { |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 16651814ecba..38f954af7bb5 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -993,6 +993,7 @@ static int soc_probe_platform(struct snd_soc_card *card, | |||
993 | const struct snd_soc_platform_driver *driver = platform->driver; | 993 | const struct snd_soc_platform_driver *driver = platform->driver; |
994 | 994 | ||
995 | platform->card = card; | 995 | platform->card = card; |
996 | platform->dapm.card = card; | ||
996 | 997 | ||
997 | if (!try_module_get(platform->dev->driver->owner)) | 998 | if (!try_module_get(platform->dev->driver->owner)) |
998 | return -ENODEV; | 999 | return -ENODEV; |
@@ -1010,6 +1011,7 @@ static int soc_probe_platform(struct snd_soc_card *card, | |||
1010 | /* mark platform as probed and add to card platform list */ | 1011 | /* mark platform as probed and add to card platform list */ |
1011 | platform->probed = 1; | 1012 | platform->probed = 1; |
1012 | list_add(&platform->card_list, &card->platform_dev_list); | 1013 | list_add(&platform->card_list, &card->platform_dev_list); |
1014 | list_add(&platform->dapm.list, &card->dapm_list); | ||
1013 | 1015 | ||
1014 | return 0; | 1016 | return 0; |
1015 | 1017 | ||
@@ -3122,6 +3124,8 @@ int snd_soc_register_platform(struct device *dev, | |||
3122 | 3124 | ||
3123 | platform->dev = dev; | 3125 | platform->dev = dev; |
3124 | platform->driver = platform_drv; | 3126 | platform->driver = platform_drv; |
3127 | platform->dapm.dev = dev; | ||
3128 | platform->dapm.platform = platform; | ||
3125 | 3129 | ||
3126 | mutex_lock(&client_mutex); | 3130 | mutex_lock(&client_mutex); |
3127 | list_add(&platform->list, &platform_list); | 3131 | list_add(&platform->list, &platform_list); |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index ceb2ba44fd3f..54fa2e5e3078 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -128,14 +128,22 @@ static int soc_widget_read(struct snd_soc_dapm_widget *w, int reg) | |||
128 | { | 128 | { |
129 | if (w->codec) | 129 | if (w->codec) |
130 | return snd_soc_read(w->codec, reg); | 130 | return snd_soc_read(w->codec, reg); |
131 | return 0; | 131 | else if (w->platform) |
132 | return snd_soc_platform_read(w->platform, reg); | ||
133 | |||
134 | dev_err(w->dapm->dev, "no valid widget read method\n"); | ||
135 | return -1; | ||
132 | } | 136 | } |
133 | 137 | ||
134 | static int soc_widget_write(struct snd_soc_dapm_widget *w, int reg, int val) | 138 | static int soc_widget_write(struct snd_soc_dapm_widget *w, int reg, int val) |
135 | { | 139 | { |
136 | if (w->codec) | 140 | if (w->codec) |
137 | return snd_soc_write(w->codec, reg, val); | 141 | return snd_soc_write(w->codec, reg, val); |
138 | return 0; | 142 | else if (w->platform) |
143 | return snd_soc_platform_write(w->platform, reg, val); | ||
144 | |||
145 | dev_err(w->dapm->dev, "no valid widget write method\n"); | ||
146 | return -1; | ||
139 | } | 147 | } |
140 | 148 | ||
141 | static int soc_widget_update_bits(struct snd_soc_dapm_widget *w, | 149 | static int soc_widget_update_bits(struct snd_soc_dapm_widget *w, |
@@ -2495,6 +2503,7 @@ int snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm, | |||
2495 | dapm->n_widgets++; | 2503 | dapm->n_widgets++; |
2496 | w->dapm = dapm; | 2504 | w->dapm = dapm; |
2497 | w->codec = dapm->codec; | 2505 | w->codec = dapm->codec; |
2506 | w->platform = dapm->platform; | ||
2498 | INIT_LIST_HEAD(&w->sources); | 2507 | INIT_LIST_HEAD(&w->sources); |
2499 | INIT_LIST_HEAD(&w->sinks); | 2508 | INIT_LIST_HEAD(&w->sinks); |
2500 | INIT_LIST_HEAD(&w->list); | 2509 | INIT_LIST_HEAD(&w->list); |