Skip to content

Commit

Permalink
ASoC: Provide per widget type callback when executing DAPM sequences
Browse files Browse the repository at this point in the history
Many modern devices have features such as DC servos which take time to start.
Currently these are handled by per-widget events but this makes it difficult
to paralleise operations on multiple widgets, meaning delays can end up
being needlessly serialised. By providing a callback to drivers when all
widgets of a given type have been handled during a DAPM sequence the core
allows drivers to start operations separately and wait for them to complete
much more simply.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
  • Loading branch information
Mark Brown committed Jan 19, 2011
1 parent 20e4859 commit 474b62d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
3 changes: 3 additions & 0 deletions include/sound/soc-dapm.h
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,9 @@ struct snd_soc_dapm_context {

struct snd_soc_dapm_update *update;

void (*seq_notifier)(struct snd_soc_dapm_context *,
enum snd_soc_dapm_type);

struct device *dev; /* from parent - for debug */
struct snd_soc_codec *codec; /* parent codec */
struct snd_soc_card *card; /* parent card */
Expand Down
3 changes: 3 additions & 0 deletions include/sound/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,9 @@ struct snd_soc_codec_driver {
/* codec bias level */
int (*set_bias_level)(struct snd_soc_codec *,
enum snd_soc_bias_level level);

void (*seq_notifier)(struct snd_soc_dapm_context *,
enum snd_soc_dapm_type);
};

/* SoC platform interface */
Expand Down
1 change: 1 addition & 0 deletions sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3496,6 +3496,7 @@ int snd_soc_register_codec(struct device *dev,
codec->dapm.bias_level = SND_SOC_BIAS_OFF;
codec->dapm.dev = dev;
codec->dapm.codec = codec;
codec->dapm.seq_notifier = codec_drv->seq_notifier;
codec->dev = dev;
codec->driver = codec_drv;
codec->num_dai = num_dai;
Expand Down
16 changes: 15 additions & 1 deletion sound/soc/soc-dapm.c
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ static void dapm_seq_run(struct snd_soc_dapm_context *dapm,
int cur_subseq = -1;
int cur_reg = SND_SOC_NOPM;
struct snd_soc_dapm_context *cur_dapm = NULL;
int ret;
int ret, i;
int *sort;

if (power_up)
Expand All @@ -895,6 +895,13 @@ static void dapm_seq_run(struct snd_soc_dapm_context *dapm,
if (!list_empty(&pending))
dapm_seq_run_coalesced(cur_dapm, &pending);

if (cur_dapm && cur_dapm->seq_notifier) {
for (i = 0; i < ARRAY_SIZE(dapm_up_seq); i++)
if (sort[i] == cur_sort)
cur_dapm->seq_notifier(cur_dapm,
i);
}

INIT_LIST_HEAD(&pending);
cur_sort = -1;
cur_subseq = -1;
Expand Down Expand Up @@ -956,6 +963,13 @@ static void dapm_seq_run(struct snd_soc_dapm_context *dapm,

if (!list_empty(&pending))
dapm_seq_run_coalesced(dapm, &pending);

if (cur_dapm && cur_dapm->seq_notifier) {
for (i = 0; i < ARRAY_SIZE(dapm_up_seq); i++)
if (sort[i] == cur_sort)
cur_dapm->seq_notifier(cur_dapm,
i);
}
}

static void dapm_widget_update(struct snd_soc_dapm_context *dapm)
Expand Down

0 comments on commit 474b62d

Please sign in to comment.