From: Lars-Peter Clausen <lars@metafoo.de>
To: Mark Brown <broonie@kernel.org>, Liam Girdwood <lgirdwood@gmail.com>
Cc: alsa-devel@alsa-project.org, Lars-Peter Clausen <lars@metafoo.de>
Subject: [PATCH 09/11] ASoC: Add component level stream_event() and seq_notifier() support
Date: Sun, 18 May 2014 14:24:16 +0200 [thread overview]
Message-ID: <1400415858-11025-10-git-send-email-lars@metafoo.de> (raw)
In-Reply-To: <1400415858-11025-1-git-send-email-lars@metafoo.de>
This patch adds stream_event() and seq_notifier() callbacks similar to those
found in the snd_soc_codec_driver and snd_soc_platform driver struct to the
snd_soc_component_driver struct. This is meant to unify the handling of these
callbacks across different types of components and will eventually allow their
removal from the CODEC and platfrom driver structs.
The new callbacks are slightly different from the old ones in that they take a
snd_soc_component as a parameter rather than a snd_soc_dapm_context. This was
done since otherwise casting from the DAPM context to the component would
typically be the first thing to do in the callback. And the interface becomes
slightly cleaner by passing a snd_soc_component to all callbacks in the
snd_soc_component_driver struct.
The patch also already removes the stream_event() callback from the
snd_soc_codec_driver and snd_soc_platform_driver structs as it is currently
unused.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
include/sound/soc.h | 9 +++------
sound/soc/soc-core.c | 23 ++++++++++++++++++++---
2 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/include/sound/soc.h b/include/sound/soc.h
index ddd51737..fc08d7e 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -659,6 +659,9 @@ struct snd_soc_component_driver {
int (*of_xlate_dai_name)(struct snd_soc_component *component,
struct of_phandle_args *args,
const char **dai_name);
+ void (*seq_notifier)(struct snd_soc_component *, enum snd_soc_dapm_type,
+ int subseq);
+ int (*stream_event)(struct snd_soc_component *, int event);
};
struct snd_soc_component {
@@ -774,9 +777,6 @@ 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);
-
bool ignore_pmdown_time; /* Doesn't benefit from pmdown delay */
/* probe ordering - for components with runtime dependencies */
@@ -818,9 +818,6 @@ struct snd_soc_platform_driver {
/* platform stream compress ops */
const struct snd_compr_ops *compr_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;
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index afb70cf..1ce443b 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3995,6 +3995,20 @@ err:
return ret;
}
+static void snd_soc_component_seq_notifier(struct snd_soc_dapm_context *dapm,
+ enum snd_soc_dapm_type type, int subseq)
+{
+ struct snd_soc_component *component = dapm->component;
+ component->driver->seq_notifier(component, type, subseq);
+}
+
+static int snd_soc_component_stream_event(struct snd_soc_dapm_context *dapm,
+ int event)
+{
+ struct snd_soc_component *component = dapm->component;
+ return component->driver->stream_event(component, event);
+}
+
static int snd_soc_component_initialize(struct snd_soc_component *component,
const struct snd_soc_component_driver *driver, struct device *dev)
{
@@ -4016,6 +4030,10 @@ static int snd_soc_component_initialize(struct snd_soc_component *component,
dapm->dev = dev;
dapm->component = component;
dapm->bias_level = SND_SOC_BIAS_OFF;
+ if (driver->seq_notifier)
+ dapm->seq_notifier = snd_soc_component_seq_notifier;
+ if (driver->stream_event)
+ dapm->stream_event = snd_soc_component_stream_event;
INIT_LIST_HEAD(&component->dai_list);
mutex_init(&component->io_mutex);
@@ -4150,7 +4168,6 @@ int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform,
platform->dev = dev;
platform->driver = platform_drv;
platform->component.dapm.platform = platform;
- platform->component.dapm.stream_event = platform_drv->stream_event;
if (platform_drv->write)
platform->component.write = snd_soc_platform_drv_write;
if (platform_drv->read)
@@ -4335,8 +4352,8 @@ int snd_soc_register_codec(struct device *dev,
codec->component.read = snd_soc_codec_drv_read;
codec->component.ignore_pmdown_time = codec_drv->ignore_pmdown_time;
codec->dapm.codec = codec;
- codec->dapm.seq_notifier = codec_drv->seq_notifier;
- codec->dapm.stream_event = codec_drv->stream_event;
+ if (codec_drv->seq_notifier)
+ codec->dapm.seq_notifier = codec_drv->seq_notifier;
if (codec_drv->set_bias_level)
codec->dapm.set_bias_level = snd_soc_codec_set_bias_level;
codec->dev = dev;
--
1.8.0
next prev parent reply other threads:[~2014-05-18 12:24 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-18 12:24 [PATCH 00/11] ASoC: Add support for DAPM at the component level Lars-Peter Clausen
2014-05-18 12:24 ` [PATCH 01/11] ASoC: Move name_prefix from CODEC to component Lars-Peter Clausen
2014-05-18 12:24 ` [PATCH 02/11] ASoC: Move name and id from CODEC/platform " Lars-Peter Clausen
2014-05-18 12:24 ` [PATCH 03/11] ASoC: Split component registration into two steps Lars-Peter Clausen
2014-05-18 12:24 ` [PATCH 04/11] ASoC: Auto disconnect pins from all DAPM contexts Lars-Peter Clausen
2014-05-18 12:24 ` [PATCH 05/11] ASoC: Add helper functions to cast from DAPM context to CODEC/platform Lars-Peter Clausen
2014-05-26 19:36 ` Lars-Peter Clausen
2014-06-01 18:18 ` Mark Brown
2014-06-06 5:47 ` Vinod Koul
2014-06-06 6:20 ` Lars-Peter Clausen
2014-05-18 12:24 ` [PATCH 06/11] ASoC: Add a set_bias_level() callback to the DAPM context struct Lars-Peter Clausen
2014-05-18 12:24 ` [PATCH 07/11] ASoC: Add DAPM support at the component level Lars-Peter Clausen
2014-05-18 12:24 ` [PATCH 08/11] ASoC: Use component DAPM context for platforms Lars-Peter Clausen
2014-05-18 12:24 ` Lars-Peter Clausen [this message]
2014-05-18 12:24 ` [PATCH 10/11] ASoC: Add component level set_bias_level() support Lars-Peter Clausen
2014-05-18 12:24 ` [PATCH 11/11] ASoC: dapm: Remove DAI DAPM context Lars-Peter Clausen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1400415858-11025-10-git-send-email-lars@metafoo.de \
--to=lars@metafoo.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox