@@ -36,6 +36,9 @@ struct snd_compress_ops {
int (*get_params)(struct snd_soc_component *component,
struct snd_compr_stream *stream,
struct snd_codec *params);
+ int (*set_codec_params)(struct snd_soc_component *component,
+ struct snd_compr_stream *stream,
+ struct snd_codec *params);
int (*set_metadata)(struct snd_soc_component *component,
struct snd_compr_stream *stream,
struct snd_compr_metadata *metadata);
@@ -192,6 +192,9 @@ int snd_soc_dai_compr_trigger(struct snd_soc_dai *dai,
int snd_soc_dai_compr_set_params(struct snd_soc_dai *dai,
struct snd_compr_stream *cstream,
struct snd_compr_params *params);
+int snd_soc_dai_compr_set_codec_params(struct snd_soc_dai *dai,
+ struct snd_compr_stream *cstream,
+ struct snd_codec *codec);
int snd_soc_dai_compr_get_params(struct snd_soc_dai *dai,
struct snd_compr_stream *cstream,
struct snd_codec *params);
@@ -292,6 +295,8 @@ struct snd_soc_cdai_ops {
struct snd_soc_dai *);
int (*set_params)(struct snd_compr_stream *,
struct snd_compr_params *, struct snd_soc_dai *);
+ int (*set_codec_params)(struct snd_compr_stream *,
+ struct snd_codec *, struct snd_soc_dai *);
int (*get_params)(struct snd_compr_stream *,
struct snd_codec *, struct snd_soc_dai *);
int (*set_metadata)(struct snd_compr_stream *,
@@ -518,6 +518,34 @@ static int soc_compr_set_params_fe(struct snd_compr_stream *cstream,
return ret;
}
+static int soc_compr_set_codec_params(struct snd_compr_stream *cstream,
+ struct snd_codec *codec)
+{
+ struct snd_soc_pcm_runtime *rtd = cstream->private_data;
+ struct snd_soc_component *component;
+ struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
+ int i, ret;
+
+ mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
+
+ ret = snd_soc_dai_compr_set_codec_params(cpu_dai, cstream, codec);
+ if (ret < 0)
+ goto err;
+
+ for_each_rtd_components(rtd, i, component) {
+ if (!component->driver->compress_ops ||
+ !component->driver->compress_ops->set_codec_params)
+ continue;
+
+ ret = component->driver->compress_ops->set_codec_params(component, cstream,
+ codec);
+ break;
+ }
+err:
+ mutex_unlock(&rtd->card->pcm_mutex);
+ return ret;
+}
+
static int soc_compr_get_params(struct snd_compr_stream *cstream,
struct snd_codec *params)
{
@@ -728,6 +756,7 @@ static struct snd_compr_ops soc_compr_ops = {
.open = soc_compr_open,
.free = soc_compr_free,
.set_params = soc_compr_set_params,
+ .set_codec_params = soc_compr_set_codec_params,
.set_metadata = soc_compr_set_metadata,
.get_metadata = soc_compr_get_metadata,
.get_params = soc_compr_get_params,
@@ -744,6 +773,7 @@ static struct snd_compr_ops soc_compr_dyn_ops = {
.free = soc_compr_free_fe,
.set_params = soc_compr_set_params_fe,
.get_params = soc_compr_get_params,
+ .set_codec_params = soc_compr_set_codec_params,
.set_metadata = soc_compr_set_metadata,
.get_metadata = soc_compr_get_metadata,
.trigger = soc_compr_trigger_fe,
@@ -594,6 +594,20 @@ int snd_soc_dai_compr_get_params(struct snd_soc_dai *dai,
}
EXPORT_SYMBOL_GPL(snd_soc_dai_compr_get_params);
+int snd_soc_dai_compr_set_codec_params(struct snd_soc_dai *dai,
+ struct snd_compr_stream *cstream,
+ struct snd_codec *codec)
+{ int ret = 0;
+
+ if (dai->driver->cops &&
+ dai->driver->cops->set_codec_params)
+ ret = dai->driver->cops->set_codec_params(cstream, codec, dai);
+
+ return soc_dai_ret(dai, ret);
+
+}
+EXPORT_SYMBOL_GPL(snd_soc_dai_compr_set_codec_params);
+
int snd_soc_dai_compr_ack(struct snd_soc_dai *dai,
struct snd_compr_stream *cstream,
size_t bytes)
Add corresponding ASoC changes to support gapless playback of tracks which have different codec profile with or without same decoder. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> --- include/sound/soc-component.h | 3 +++ include/sound/soc-dai.h | 5 +++++ sound/soc/soc-compress.c | 30 ++++++++++++++++++++++++++++++ sound/soc/soc-dai.c | 14 ++++++++++++++ 4 files changed, 52 insertions(+)