summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLiam Girdwood <lrg@slimlogic.co.uk>2011-04-07 08:38:46 +0100
committerAndy Green <andy.green@linaro.org>2011-04-07 08:38:46 +0100
commitbe054eadeaf4e2de3139dc2d9859b2001be47e51 (patch)
tree4b7443cd1ffe275f856cbcc82aa7d76b3144ab11 /include
parentf6e4e17fc6f5684f961921dfe8255ea68ca1fad5 (diff)
ASoC: core: Add support for back end DAIs
Add support for backend DAIs. Change-Id: Id067678682ecb480c63af142b85b73a93ebc6c69 Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Axel Castaneda Gonzalez <x0055901@ti.com> Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com> Signed-off-by: Margarita Olaya Cabrera <magi.olaya@ti.com>
Diffstat (limited to 'include')
-rw-r--r--include/sound/soc-dai.h49
-rw-r--r--include/sound/soc.h26
2 files changed, 75 insertions, 0 deletions
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 1bafe95dcf4..af9a5519e33 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -277,4 +277,53 @@ static inline void *snd_soc_dai_get_drvdata(struct snd_soc_dai *dai)
return dev_get_drvdata(dai->dev);
}
+/* Backend DAI PCM ops */
+static inline int snd_soc_dai_startup(struct snd_pcm_substream *substream,
+ struct snd_soc_dai *dai)
+{
+ if (dai->driver->ops->startup)
+ return dai->driver->ops->startup(substream, dai);
+ return 0;
+}
+
+static inline void snd_soc_dai_shutdown(struct snd_pcm_substream *substream,
+ struct snd_soc_dai *dai)
+{
+ if (dai->driver->ops->shutdown)
+ dai->driver->ops->shutdown(substream, dai);
+}
+
+static inline int snd_soc_dai_hw_params(struct snd_pcm_substream * substream,
+ struct snd_pcm_hw_params *hw_params, struct snd_soc_dai *dai)
+{
+ if (dai->driver->ops->hw_params)
+ return dai->driver->ops->hw_params(substream, hw_params, dai);
+ return 0;
+}
+
+static inline int snd_soc_dai_hw_free(struct snd_pcm_substream *substream,
+ struct snd_soc_dai *dai)
+{
+ if (dai->driver->ops->hw_free)
+ return dai->driver->ops->hw_free(substream, dai);
+ return 0;
+}
+
+static inline int snd_soc_dai_prepare(struct snd_pcm_substream *substream,
+ struct snd_soc_dai *dai)
+{
+ if (dai->driver->ops->prepare)
+ return dai->driver->ops->prepare(substream, dai);
+ return 0;
+}
+
+static inline int snd_soc_dai_trigger(struct snd_pcm_substream *substream,
+ int cmd, struct snd_soc_dai *dai)
+{
+ if (dai->driver->ops->trigger)
+ return dai->driver->ops->trigger(substream, cmd, dai);
+ return 0;
+}
+
+
#endif
diff --git a/include/sound/soc.h b/include/sound/soc.h
index d787268e533..a89e611d490 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -278,6 +278,24 @@ int snd_soc_cache_write(struct snd_soc_codec *codec,
int snd_soc_cache_read(struct snd_soc_codec *codec,
unsigned int reg, unsigned int *value);
+/* pcm <-> DAI connect */
+void snd_soc_free_pcms(struct snd_soc_codec *codec);
+int snd_soc_new_pcms(struct snd_soc_codec *codec, int idx, const char *xid);
+
+/* DAI operations - for backend DAIs */
+int snd_soc_pcm_open(struct snd_pcm_substream *substream);
+int snd_soc_pcm_close(struct snd_pcm_substream *substream);
+int snd_soc_pcm_prepare(struct snd_pcm_substream *substream);
+int snd_soc_pcm_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *params);
+int snd_soc_pcm_hw_free(struct snd_pcm_substream *substream);
+int snd_soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd);
+snd_pcm_uframes_t snd_soc_pcm_pointer(struct snd_pcm_substream *substream);
+struct snd_pcm_substream *snd_soc_get_dai_substream(struct snd_soc_card *card,
+ const char *dai_link, int stream);
+struct snd_soc_pcm_runtime *snd_soc_get_pcm_runtime(struct snd_soc_card *card,
+ const char *dai_link);
+
/* Utility functions to get clock rates from various things */
int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots);
int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params);
@@ -584,6 +602,12 @@ struct snd_soc_dai_link {
/* Symmetry requirements */
unsigned int symmetric_rates:1;
+ /* No PCM created for this DAI link */
+ unsigned int no_pcm:1;
+ /* This DAI link can change CODEC and platform at runtime*/
+ unsigned int dynamic:1;
+ /* This DAI link has no codec side driver*/
+ unsigned int no_codec:1;
/* codec/machine specific init - e.g. add machine controls */
int (*init)(struct snd_soc_pcm_runtime *rtd);
@@ -688,6 +712,7 @@ struct snd_soc_pcm_runtime {
struct device dev;
struct snd_soc_card *card;
struct snd_soc_dai_link *dai_link;
+ struct mutex pcm_mutex;
unsigned int complete:1;
unsigned int dev_registered:1;
@@ -702,6 +727,7 @@ struct snd_soc_pcm_runtime {
struct snd_soc_platform *platform;
struct snd_soc_dai *codec_dai;
struct snd_soc_dai *cpu_dai;
+ int current_fe;
struct delayed_work delayed_work;
};