diff options
author | Liam Girdwood <lrg@ti.com> | 2012-04-25 12:12:49 +0100 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-04-26 17:48:19 +0100 |
commit | 01d7584cd2e5a93a2b959c9dddaa0d93ec205404 (patch) | |
tree | 1ed8fe39b490723195812dd562536e362b8027b0 /include/sound/soc.h | |
parent | f20c2cb9995eb8c5cd7084e11af7b54522ef0ab9 (diff) | |
download | linux-01d7584cd2e5a93a2b959c9dddaa0d93ec205404.tar.bz2 |
ASoC: dpcm: Add Dynamic PCM core operations.
The Dynamic PCM core allows digital audio data to be dynamically
routed between different ALSA PCMs and DAI links on SoC CPUs with
on chip DSP devices. e.g. audio data could be played on pcm:0,0 and
routed to any (or all) SoC DAI links.
Dynamic PCM introduces the concept of Front End (FE) PCMs and Back
End (BE) PCMs. The FE PCMs are normal ALSA PCM devices except that
they can dynamically route digital audio data to any supported BE
PCM. A BE PCM has no ALSA device, but represents a DAI link and it's
substream and audio HW parameters.
e.g. pcm:0,0 routing digital data to 2 external codecs.
FE pcm:0,0 ----> BE (McBSP.0) ----> CODEC 0
+--> BE (McPDM.0) ----> CODEC 1
e.g. pcm:0,0 and pcm:0,1 routing digital data to 1 external codec.
FE pcm:0,0 ---
+--> BE (McBSP.0) ----> CODEC
FE pcm:0,1 ---
The digital audio routing is controlled by the usual ALSA method
of mixer kcontrols. Dynamic PCM uses a DAPM graph to work out the
routing based upon the mixer settings and configures the BE PCMs
based on routing and the FE HW params.
DPCM is designed so that most ASoC component drivers will need no
modification at all. It's intended that existing CODEC, DAI and
platform drivers can be used in DPCM based audio devices without
any changes. However, there will be some cases where minor changes
are required (e.g. for very tightly coupled HW) and there are
helpers to support this too.
Somethimes the HW params of a FE and BE do not match or are
incompatible, so in these cases the machine driver can reconfigure
any hw_params and make any DSP perform sample rate / format conversion.
This patch adds the core DPCM code and contains :-
o The FE and BE PCM operations.
o FE and BE DAI link support.
o FE and BE PCM creation.
o BE support API.
o BE and FE link management.
Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'include/sound/soc.h')
-rw-r--r-- | include/sound/soc.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h index 1f38aa1653c8..78aec854b6a1 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -287,6 +287,7 @@ struct snd_soc_jack_zone; struct snd_soc_jack_pin; struct snd_soc_cache_ops; #include <sound/soc-dapm.h> +#include <sound/soc-dpcm.h> #ifdef CONFIG_GPIOLIB struct snd_soc_jack_gpio; @@ -782,23 +783,36 @@ struct snd_soc_dai_link { const char *cpu_dai_name; const struct device_node *cpu_dai_of_node; const char *codec_dai_name; + int be_id; /* optional ID for machine driver BE identification */ const struct snd_soc_pcm_stream *params; unsigned int dai_fmt; /* format to set on init */ + enum snd_soc_dpcm_trigger trigger[2]; /* trigger type for DPCM */ + /* Keep DAI active over suspend */ unsigned int ignore_suspend:1; /* Symmetry requirements */ unsigned int symmetric_rates:1; + /* Do not create a PCM for this DAI link (Backend link) */ + unsigned int no_pcm:1; + + /* This DAI link can route to other DAI links at runtime (Frontend)*/ + unsigned int dynamic:1; + /* pmdown_time is ignored at stop */ unsigned int ignore_pmdown_time:1; /* codec/machine specific init - e.g. add machine controls */ int (*init)(struct snd_soc_pcm_runtime *rtd); + /* optional hw_params re-writing for BE and FE sync */ + int (*be_hw_params_fixup)(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_hw_params *params); + /* machine stream operations */ struct snd_soc_ops *ops; }; @@ -930,6 +944,9 @@ struct snd_soc_pcm_runtime { unsigned int dev_registered:1; + /* Dynamic PCM BE runtime data */ + struct snd_soc_dpcm_runtime dpcm[2]; + long pmdown_time; /* runtime devices */ |