Skip to content

Commit

Permalink
ASoC: dapm - Add DAPM stream completion event.
Browse files Browse the repository at this point in the history
In preparation for Dynamic PCM (AKA DSP) support.

This adds a callback function to be called at the completion of a DAPM stream
event.

This can be used by DSP components to perform calculations based on DAPM graphs
after completion of stream events.

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Liam Girdwood authored and Mark Brown committed Jul 25, 2011
1 parent a0c27ab commit 64a648c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/sound/soc-dapm.h
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,8 @@ struct snd_soc_dapm_context {
enum snd_soc_bias_level target_bias_level;
struct list_head list;

int (*stream_event)(struct snd_soc_dapm_context *dapm, int event);

#ifdef CONFIG_DEBUG_FS
struct dentry *debugfs_dapm;
#endif
Expand Down
6 changes: 6 additions & 0 deletions include/sound/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,9 @@ struct snd_soc_codec_driver {
void (*seq_notifier)(struct snd_soc_dapm_context *,
enum snd_soc_dapm_type, int);

/* codec stream completion event */
int (*stream_event)(struct snd_soc_dapm_context *dapm, int event);

/* probe ordering - for components with runtime dependencies */
int probe_order;
int remove_order;
Expand Down Expand Up @@ -669,6 +672,9 @@ struct snd_soc_platform_driver {
/* platform stream ops */
struct snd_pcm_ops *ops;

/* platform stream completion event */
int (*stream_event)(struct snd_soc_dapm_context *dapm, int event);

/* probe ordering - for components with runtime dependencies */
int probe_order;
int remove_order;
Expand Down
2 changes: 2 additions & 0 deletions sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3141,6 +3141,7 @@ int snd_soc_register_platform(struct device *dev,
platform->driver = platform_drv;
platform->dapm.dev = dev;
platform->dapm.platform = platform;
platform->dapm.stream_event = platform_drv->stream_event;

mutex_lock(&client_mutex);
list_add(&platform->list, &platform_list);
Expand Down Expand Up @@ -3253,6 +3254,7 @@ int snd_soc_register_codec(struct device *dev,
codec->dapm.dev = dev;
codec->dapm.codec = codec;
codec->dapm.seq_notifier = codec_drv->seq_notifier;
codec->dapm.stream_event = codec_drv->stream_event;
codec->dev = dev;
codec->driver = codec_drv;
codec->num_dai = num_dai;
Expand Down
4 changes: 4 additions & 0 deletions sound/soc/soc-dapm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2604,6 +2604,10 @@ static void soc_dapm_stream_event(struct snd_soc_dapm_context *dapm,
}

dapm_power_widgets(dapm, event);

/* do we need to notify any clients that DAPM stream is complete */
if (dapm->stream_event)
dapm->stream_event(dapm, event);
}

/**
Expand Down

0 comments on commit 64a648c

Please sign in to comment.