Allow platform driver widgets to perform any IO required for DAPM.
Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
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;
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 */
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 {
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;
/* 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;
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);
{
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,
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);