diff mbox series

[07/11] ASoC: q6asm: add support to gapless flag in asm open

Message ID 20200707163641.17113-8-srinivas.kandagatla@linaro.org (mailing list archive)
State New, archived
Headers show
Series ASoC: qdsp6: add gapless compressed audio support | expand

Commit Message

Srinivas Kandagatla July 7, 2020, 4:36 p.m. UTC
This patch adds support to gapless flag to q6asm_open_write().

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/qcom/qdsp6/q6asm-dai.c | 4 ++--
 sound/soc/qcom/qdsp6/q6asm.c     | 4 +++-
 sound/soc/qcom/qdsp6/q6asm.h     | 2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

Comments

Pierre-Louis Bossart July 7, 2020, 4:57 p.m. UTC | #1
> diff --git a/sound/soc/qcom/qdsp6/q6asm-dai.c b/sound/soc/qcom/qdsp6/q6asm-dai.c
> index c3558288242a..8c214436a2c2 100644
> --- a/sound/soc/qcom/qdsp6/q6asm-dai.c
> +++ b/sound/soc/qcom/qdsp6/q6asm-dai.c
> @@ -258,7 +258,7 @@ static int q6asm_dai_prepare(struct snd_soc_component *component,
>   	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
>   		ret = q6asm_open_write(prtd->audio_client, prtd->stream_id,
>   				       FORMAT_LINEAR_PCM,
> -				       0, prtd->bits_per_sample);
> +				       0, prtd->bits_per_sample, false);

nit-pick: it's a bit ironic that is_gapless is false for PCM, when there 
is no gap in the first place..

>   	} else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
>   		ret = q6asm_open_read(prtd->audio_client, prtd->stream_id,
>   				      FORMAT_LINEAR_PCM,
> @@ -685,7 +685,7 @@ static int q6asm_dai_compr_set_params(struct snd_soc_component *component,
>   	if (dir == SND_COMPRESS_PLAYBACK) {
>   		ret = q6asm_open_write(prtd->audio_client, prtd->stream_id,
>   				       params->codec.id, params->codec.profile,
> -				       prtd->bits_per_sample);
> +				       prtd->bits_per_sample, true);
Srinivas Kandagatla July 8, 2020, 9:44 a.m. UTC | #2
Thanks Pierre for review,

On 07/07/2020 17:57, Pierre-Louis Bossart wrote:
> 
>> diff --git a/sound/soc/qcom/qdsp6/q6asm-dai.c 
>> b/sound/soc/qcom/qdsp6/q6asm-dai.c
>> index c3558288242a..8c214436a2c2 100644
>> --- a/sound/soc/qcom/qdsp6/q6asm-dai.c
>> +++ b/sound/soc/qcom/qdsp6/q6asm-dai.c
>> @@ -258,7 +258,7 @@ static int q6asm_dai_prepare(struct 
>> snd_soc_component *component,
>>       if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
>>           ret = q6asm_open_write(prtd->audio_client, prtd->stream_id,
>>                          FORMAT_LINEAR_PCM,
>> -                       0, prtd->bits_per_sample);
>> +                       0, prtd->bits_per_sample, false);
> 
> nit-pick: it's a bit ironic that is_gapless is false for PCM, when there 
> is no gap in the first place..

I think this is to do with same apis reused for both compressed and pcm.

Probably we can live with it for now!

--srini
> 
>>       } else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
>>           ret = q6asm_open_read(prtd->audio_client, prtd->stream_id,
>>                         FORMAT_LINEAR_PCM,
>> @@ -685,7 +685,7 @@ static int q6asm_dai_compr_set_params(struct 
>> snd_soc_component *component,
>>       if (dir == SND_COMPRESS_PLAYBACK) {
>>           ret = q6asm_open_write(prtd->audio_client, prtd->stream_id,
>>                          params->codec.id, params->codec.profile,
>> -                       prtd->bits_per_sample);
>> +                       prtd->bits_per_sample, true);
diff mbox series

Patch

diff --git a/sound/soc/qcom/qdsp6/q6asm-dai.c b/sound/soc/qcom/qdsp6/q6asm-dai.c
index c3558288242a..8c214436a2c2 100644
--- a/sound/soc/qcom/qdsp6/q6asm-dai.c
+++ b/sound/soc/qcom/qdsp6/q6asm-dai.c
@@ -258,7 +258,7 @@  static int q6asm_dai_prepare(struct snd_soc_component *component,
 	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
 		ret = q6asm_open_write(prtd->audio_client, prtd->stream_id,
 				       FORMAT_LINEAR_PCM,
-				       0, prtd->bits_per_sample);
+				       0, prtd->bits_per_sample, false);
 	} else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
 		ret = q6asm_open_read(prtd->audio_client, prtd->stream_id,
 				      FORMAT_LINEAR_PCM,
@@ -685,7 +685,7 @@  static int q6asm_dai_compr_set_params(struct snd_soc_component *component,
 	if (dir == SND_COMPRESS_PLAYBACK) {
 		ret = q6asm_open_write(prtd->audio_client, prtd->stream_id,
 				       params->codec.id, params->codec.profile,
-				       prtd->bits_per_sample);
+				       prtd->bits_per_sample, true);
 
 		if (ret < 0) {
 			dev_err(dev, "q6asm_open_write failed\n");
diff --git a/sound/soc/qcom/qdsp6/q6asm.c b/sound/soc/qcom/qdsp6/q6asm.c
index 14ec7dad5b65..22ac99029e56 100644
--- a/sound/soc/qcom/qdsp6/q6asm.c
+++ b/sound/soc/qcom/qdsp6/q6asm.c
@@ -923,7 +923,7 @@  static int q6asm_ac_send_cmd_sync(struct audio_client *ac, struct apr_pkt *pkt)
  */
 int q6asm_open_write(struct audio_client *ac, uint32_t stream_id,
 		     uint32_t format, u32 codec_profile,
-		     uint16_t bits_per_sample)
+		     uint16_t bits_per_sample, bool is_gapless)
 {
 	struct asm_stream_cmd_open_write_v3 *open;
 	struct apr_pkt *pkt;
@@ -943,6 +943,8 @@  int q6asm_open_write(struct audio_client *ac, uint32_t stream_id,
 	pkt->hdr.opcode = ASM_STREAM_CMD_OPEN_WRITE_V3;
 	open->mode_flags = 0x00;
 	open->mode_flags |= ASM_LEGACY_STREAM_SESSION;
+	if (is_gapless)
+		open->mode_flags |= BIT(ASM_SHIFT_GAPLESS_MODE_FLAG);
 
 	/* source endpoint : matrix */
 	open->sink_endpointype = ASM_END_POINT_DEVICE_MATRIX;
diff --git a/sound/soc/qcom/qdsp6/q6asm.h b/sound/soc/qcom/qdsp6/q6asm.h
index e315f7ff5e54..69513ac1fa55 100644
--- a/sound/soc/qcom/qdsp6/q6asm.h
+++ b/sound/soc/qcom/qdsp6/q6asm.h
@@ -100,7 +100,7 @@  int q6asm_write_async(struct audio_client *ac, uint32_t stream_id, uint32_t len,
 		      uint32_t msw_ts, uint32_t lsw_ts, uint32_t flags);
 int q6asm_open_write(struct audio_client *ac, uint32_t stream_id,
 		     uint32_t format, u32 codec_profile,
-		     uint16_t bits_per_sample);
+		     uint16_t bits_per_sample, bool is_gapless);
 
 int q6asm_open_read(struct audio_client *ac, uint32_t stream_id,
 		    uint32_t format, uint16_t bits_per_sample);