Commit 96a5d3f0 authored by Mark Brown's avatar Mark Brown

Merge branch 'topic/dpcm' of...

Merge branch 'topic/dpcm' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-rcar
parents 5626ad08 b073ed4e
...@@ -949,6 +949,24 @@ struct snd_soc_dai_link { ...@@ -949,6 +949,24 @@ struct snd_soc_dai_link {
enum snd_soc_dpcm_trigger trigger[2]; /* trigger type for DPCM */ enum snd_soc_dpcm_trigger trigger[2]; /* trigger type for DPCM */
/* 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 */
const struct snd_soc_ops *ops;
const struct snd_soc_compr_ops *compr_ops;
/* For unidirectional dai links */
bool playback_only;
bool capture_only;
/* Mark this pcm with non atomic ops */
bool nonatomic;
/* Keep DAI active over suspend */ /* Keep DAI active over suspend */
unsigned int ignore_suspend:1; unsigned int ignore_suspend:1;
...@@ -957,9 +975,6 @@ struct snd_soc_dai_link { ...@@ -957,9 +975,6 @@ struct snd_soc_dai_link {
unsigned int symmetric_channels:1; unsigned int symmetric_channels:1;
unsigned int symmetric_samplebits:1; unsigned int symmetric_samplebits:1;
/* Mark this pcm with non atomic ops */
bool nonatomic;
/* Do not create a PCM for this DAI link (Backend link) */ /* Do not create a PCM for this DAI link (Backend link) */
unsigned int no_pcm:1; unsigned int no_pcm:1;
...@@ -970,23 +985,11 @@ struct snd_soc_dai_link { ...@@ -970,23 +985,11 @@ struct snd_soc_dai_link {
unsigned int dpcm_capture:1; unsigned int dpcm_capture:1;
unsigned int dpcm_playback:1; unsigned int dpcm_playback:1;
/* DPCM used FE & BE merged format */
unsigned int dpcm_merged_format:1;
/* pmdown_time is ignored at stop */ /* pmdown_time is ignored at stop */
unsigned int ignore_pmdown_time:1; 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 */
const struct snd_soc_ops *ops;
const struct snd_soc_compr_ops *compr_ops;
/* For unidirectional dai links */
bool playback_only;
bool capture_only;
}; };
struct snd_soc_codec_conf { struct snd_soc_codec_conf {
......
...@@ -1485,30 +1485,67 @@ int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream) ...@@ -1485,30 +1485,67 @@ int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream)
} }
static void dpcm_init_runtime_hw(struct snd_pcm_runtime *runtime, static void dpcm_init_runtime_hw(struct snd_pcm_runtime *runtime,
struct snd_soc_pcm_stream *stream) struct snd_soc_pcm_stream *stream,
u64 formats)
{ {
runtime->hw.rate_min = stream->rate_min; runtime->hw.rate_min = stream->rate_min;
runtime->hw.rate_max = stream->rate_max; runtime->hw.rate_max = stream->rate_max;
runtime->hw.channels_min = stream->channels_min; runtime->hw.channels_min = stream->channels_min;
runtime->hw.channels_max = stream->channels_max; runtime->hw.channels_max = stream->channels_max;
if (runtime->hw.formats) if (runtime->hw.formats)
runtime->hw.formats &= stream->formats; runtime->hw.formats &= formats & stream->formats;
else else
runtime->hw.formats = stream->formats; runtime->hw.formats = formats & stream->formats;
runtime->hw.rates = stream->rates; runtime->hw.rates = stream->rates;
} }
static u64 dpcm_runtime_base_format(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *fe = substream->private_data;
struct snd_soc_dpcm *dpcm;
u64 formats = ULLONG_MAX;
int stream = substream->stream;
if (!fe->dai_link->dpcm_merged_format)
return formats;
/*
* It returns merged BE codec format
* if FE want to use it (= dpcm_merged_format)
*/
list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) {
struct snd_soc_pcm_runtime *be = dpcm->be;
struct snd_soc_dai_driver *codec_dai_drv;
struct snd_soc_pcm_stream *codec_stream;
int i;
for (i = 0; i < be->num_codecs; i++) {
codec_dai_drv = be->codec_dais[i]->driver;
if (stream == SNDRV_PCM_STREAM_PLAYBACK)
codec_stream = &codec_dai_drv->playback;
else
codec_stream = &codec_dai_drv->capture;
formats &= codec_stream->formats;
}
}
return formats;
}
static void dpcm_set_fe_runtime(struct snd_pcm_substream *substream) static void dpcm_set_fe_runtime(struct snd_pcm_substream *substream)
{ {
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct snd_soc_dai_driver *cpu_dai_drv = cpu_dai->driver; struct snd_soc_dai_driver *cpu_dai_drv = cpu_dai->driver;
u64 format = dpcm_runtime_base_format(substream);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
dpcm_init_runtime_hw(runtime, &cpu_dai_drv->playback); dpcm_init_runtime_hw(runtime, &cpu_dai_drv->playback, format);
else else
dpcm_init_runtime_hw(runtime, &cpu_dai_drv->capture); dpcm_init_runtime_hw(runtime, &cpu_dai_drv->capture, format);
} }
static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd); static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment