diff options
| author | Liam Girdwood <lrg@ti.com> | 2011-07-24 15:59:33 -0400 |
|---|---|---|
| committer | Paolo Pisati <paolo.pisati@canonical.com> | 2012-08-17 04:18:19 -0400 |
| commit | 0d09d165cbcd2de57df52ceea46b3151f1d9ebbb (patch) | |
| tree | 4f3ab3571de0bebce413bdf126077f1465273729 | |
| parent | 2e6c3d203e9bae344834bdb7609ccf37c1a97089 (diff) | |
Subject: [PATCH 036/104] ASoC: core - platform widget IO
Allow platform driver widgets to perform any IO required via DAPM.
Signed-off-by: Liam Girdwood <lrg@ti.com>
| -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 | 3 | ||||
| -rw-r--r-- | sound/soc/soc-dapm.c | 13 |
4 files changed, 18 insertions, 2 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 602024d4c45..e09505c5a49 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 c421501532d..6ce8dc32a3d 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 3c1a8965721..52888b5e91d 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
| @@ -995,6 +995,7 @@ static int soc_probe_platform(struct snd_soc_card *card, | |||
| 995 | const struct snd_soc_platform_driver *driver = platform->driver; | 995 | const struct snd_soc_platform_driver *driver = platform->driver; |
| 996 | 996 | ||
| 997 | platform->card = card; | 997 | platform->card = card; |
| 998 | platform->dapm.card = card; | ||
| 998 | 999 | ||
| 999 | if (!try_module_get(platform->dev->driver->owner)) | 1000 | if (!try_module_get(platform->dev->driver->owner)) |
| 1000 | return -ENODEV; | 1001 | return -ENODEV; |
| @@ -3138,6 +3139,8 @@ int snd_soc_register_platform(struct device *dev, | |||
| 3138 | 3139 | ||
| 3139 | platform->dev = dev; | 3140 | platform->dev = dev; |
| 3140 | platform->driver = platform_drv; | 3141 | platform->driver = platform_drv; |
| 3142 | platform->dapm.dev = dev; | ||
| 3143 | platform->dapm.platform = platform; | ||
| 3141 | 3144 | ||
| 3142 | mutex_lock(&client_mutex); | 3145 | mutex_lock(&client_mutex); |
| 3143 | list_add(&platform->list, &platform_list); | 3146 | list_add(&platform->list, &platform_list); |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 79fdcd7cfd8..13f4bdea936 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
| @@ -130,14 +130,22 @@ static int soc_widget_read(struct snd_soc_dapm_widget *w, int reg) | |||
| 130 | { | 130 | { |
| 131 | if (w->codec) | 131 | if (w->codec) |
| 132 | return snd_soc_read(w->codec, reg); | 132 | return snd_soc_read(w->codec, reg); |
| 133 | return 0; | 133 | else if (w->platform) |
| 134 | return snd_soc_platform_read(w->platform, reg); | ||
| 135 | |||
| 136 | dev_err(w->dapm->dev, "no valid widget read method\n"); | ||
| 137 | return -1; | ||
| 134 | } | 138 | } |
| 135 | 139 | ||
| 136 | static int soc_widget_write(struct snd_soc_dapm_widget *w, int reg, int val) | 140 | static int soc_widget_write(struct snd_soc_dapm_widget *w, int reg, int val) |
| 137 | { | 141 | { |
| 138 | if (w->codec) | 142 | if (w->codec) |
| 139 | return snd_soc_write(w->codec, reg, val); | 143 | return snd_soc_write(w->codec, reg, val); |
| 140 | return 0; | 144 | else if (w->platform) |
| 145 | return snd_soc_platform_write(w->platform, reg, val); | ||
| 146 | |||
| 147 | dev_err(w->dapm->dev, "no valid widget write method\n"); | ||
| 148 | return -1; | ||
| 141 | } | 149 | } |
| 142 | 150 | ||
| 143 | static int soc_widget_update_bits(struct snd_soc_dapm_widget *w, | 151 | static int soc_widget_update_bits(struct snd_soc_dapm_widget *w, |
| @@ -2497,6 +2505,7 @@ int snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm, | |||
| 2497 | dapm->n_widgets++; | 2505 | dapm->n_widgets++; |
| 2498 | w->dapm = dapm; | 2506 | w->dapm = dapm; |
| 2499 | w->codec = dapm->codec; | 2507 | w->codec = dapm->codec; |
| 2508 | w->platform = dapm->platform; | ||
| 2500 | INIT_LIST_HEAD(&w->sources); | 2509 | INIT_LIST_HEAD(&w->sources); |
| 2501 | INIT_LIST_HEAD(&w->sinks); | 2510 | INIT_LIST_HEAD(&w->sinks); |
| 2502 | INIT_LIST_HEAD(&w->list); | 2511 | INIT_LIST_HEAD(&w->list); |
