linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: broonie@kernel.org
Cc: vkoul@kernel.org, perex@perex.cz, tiwai@suse.com,
	lgirdwood@gmail.com, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org, ckeepax@opensource.cirrus.com,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Subject: [PATCH 08/11] ASoC: q6asm-dai: add next track metadata support
Date: Tue,  7 Jul 2020 17:36:38 +0100	[thread overview]
Message-ID: <20200707163641.17113-9-srinivas.kandagatla@linaro.org> (raw)
In-Reply-To: <20200707163641.17113-1-srinivas.kandagatla@linaro.org>

This patch adds support to metadata required to do a gapless playback.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/qcom/qdsp6/q6asm-dai.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/sound/soc/qcom/qdsp6/q6asm-dai.c b/sound/soc/qcom/qdsp6/q6asm-dai.c
index 8c214436a2c2..c0e1e84267bf 100644
--- a/sound/soc/qcom/qdsp6/q6asm-dai.c
+++ b/sound/soc/qcom/qdsp6/q6asm-dai.c
@@ -71,6 +71,8 @@ struct q6asm_dai_rtd {
 	uint32_t stream_id;
 	uint16_t session_id;
 	enum stream_state state;
+	uint32_t initial_samples_drop;
+	uint32_t trailing_samples_drop;
 };
 
 struct q6asm_dai_data {
@@ -868,6 +870,28 @@ static int q6asm_dai_compr_set_params(struct snd_soc_component *component,
 	return 0;
 }
 
+static int q6asm_dai_compr_set_metadata(struct snd_compr_stream *stream,
+					struct snd_compr_metadata *metadata)
+{
+	struct snd_compr_runtime *runtime = stream->runtime;
+	struct q6asm_dai_rtd *prtd = runtime->private_data;
+	int ret = 0;
+
+	switch (metadata->key) {
+	case SNDRV_COMPRESS_ENCODER_PADDING:
+		prtd->trailing_samples_drop = metadata->value[0];
+		break;
+	case SNDRV_COMPRESS_ENCODER_DELAY:
+		prtd->initial_samples_drop = metadata->value[0];
+		break;
+	default:
+		ret = -EINVAL;
+		break;
+	}
+
+	return ret;
+}
+
 static int q6asm_dai_compr_trigger(struct snd_soc_component *component,
 				   struct snd_compr_stream *stream, int cmd)
 {
@@ -984,6 +1008,7 @@ static struct snd_compress_ops q6asm_dai_compress_ops = {
 	.open		= q6asm_dai_compr_open,
 	.free		= q6asm_dai_compr_free,
 	.set_params	= q6asm_dai_compr_set_params,
+	.set_metadata	= q6asm_dai_compr_set_metadata,
 	.pointer	= q6asm_dai_compr_pointer,
 	.trigger	= q6asm_dai_compr_trigger,
 	.get_caps	= q6asm_dai_compr_get_caps,
-- 
2.21.0


  parent reply	other threads:[~2020-07-07 16:37 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-07 16:36 [PATCH 00/11] ASoC: qdsp6: add gapless compressed audio support Srinivas Kandagatla
2020-07-07 16:36 ` [PATCH 01/11] ASoC: q6asm: add command opcode to timeout error report Srinivas Kandagatla
2020-07-07 16:36 ` [PATCH 02/11] ASoC: q6asm: rename misleading session id variable Srinivas Kandagatla
2020-07-07 16:36 ` [PATCH 03/11] ASoC: q6asm: make commands specific to streams Srinivas Kandagatla
2020-07-07 16:52   ` Pierre-Louis Bossart
2020-07-08  9:44     ` Srinivas Kandagatla
2020-07-08 13:13       ` Mark Brown
2020-07-08 15:26         ` Srinivas Kandagatla
2020-07-07 16:36 ` [PATCH 04/11] ASoC: q6asm: use flags directly from asm-dai Srinivas Kandagatla
2020-07-07 16:36 ` [PATCH 05/11] ASoC: q6asm: add length to write command token Srinivas Kandagatla
2020-07-07 16:36 ` [PATCH 06/11] ASoC: q6asm: add support to remove intial and trailing silence Srinivas Kandagatla
2020-07-07 16:55   ` Pierre-Louis Bossart
2020-07-08  9:44     ` Srinivas Kandagatla
2020-07-07 16:36 ` [PATCH 07/11] ASoC: q6asm: add support to gapless flag in asm open Srinivas Kandagatla
2020-07-07 16:57   ` Pierre-Louis Bossart
2020-07-08  9:44     ` Srinivas Kandagatla
2020-07-07 16:36 ` Srinivas Kandagatla [this message]
2020-07-07 16:36 ` [PATCH 09/11] ASoC: qdsp6: use dev_err instead of pr_err Srinivas Kandagatla
2020-07-07 16:36 ` [PATCH 10/11] ASoC: qdsp6-dai: add gapless support Srinivas Kandagatla
2020-07-07 17:07   ` Pierre-Louis Bossart
2020-07-08  9:44     ` Srinivas Kandagatla
2020-07-08 13:32       ` Pierre-Louis Bossart
2020-07-08 13:42         ` Mark Brown
2020-07-08 15:23         ` Srinivas Kandagatla
2020-07-08 16:58           ` Pierre-Louis Bossart
2020-07-07 16:36 ` [PATCH 11/11] ASoC: q6asm-dai: add support to copy callback Srinivas Kandagatla
2020-07-08 13:32 ` [PATCH 00/11] ASoC: qdsp6: add gapless compressed audio support Mark Brown
2020-07-08 15:24   ` Srinivas Kandagatla
2020-07-08 16:59 ` Mark Brown

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=20200707163641.17113-9-srinivas.kandagatla@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --cc=vkoul@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).