From 355f0c4d27bab3c11aee2dd0fe45973f327252f3 Mon Sep 17 00:00:00 2001 From: Satish Babu Patakokila Date: Thu, 5 Jan 2017 20:45:38 +0530 Subject: [PATCH] ASoc: msm: qdsp6v2: Fix audio noise issue during incall recording The timestamp API is called even when timestamp flag is not set. Correct the read API calls based on timestamp flag. CRs-fixed: 1107319 Change-Id: Ic40b166e9ddd42f20fecadcd4eafe187b3ff8785 Signed-off-by: Satish Babu Patakokila --- include/sound/q6asm-v2.h | 4 ++-- sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c | 11 ++++++++--- sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c | 4 ++-- sound/soc/msm/qdsp6v2/q6asm.c | 7 ++++--- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/include/sound/q6asm-v2.h b/include/sound/q6asm-v2.h index efa5af8e661c..56a8951faadc 100644 --- a/include/sound/q6asm-v2.h +++ b/include/sound/q6asm-v2.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -270,7 +270,7 @@ int q6asm_open_read_v3(struct audio_client *ac, uint32_t format, uint16_t bits_per_sample); int q6asm_open_read_v4(struct audio_client *ac, uint32_t format, - uint16_t bits_per_sample); + uint16_t bits_per_sample, bool ts_mode); int q6asm_open_write(struct audio_client *ac, uint32_t format /*, uint16_t bits_per_sample*/); diff --git a/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c b/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c index d3c0850d8de2..b4500860db70 100644 --- a/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c +++ b/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -1242,8 +1242,13 @@ static int msm_compr_configure_dsp_for_capture(struct snd_compr_stream *cstream) pr_debug("%s: stream_id %d bits_per_sample %d\n", __func__, ac->stream_id, bits_per_sample); - ret = q6asm_open_read_v4(prtd->audio_client, FORMAT_LINEAR_PCM, - bits_per_sample); + if (prtd->codec_param.codec.flags & COMPRESSED_TIMESTAMP_FLAG) { + ret = q6asm_open_read_v4(prtd->audio_client, FORMAT_LINEAR_PCM, + bits_per_sample, true); + } else { + ret = q6asm_open_read_v4(prtd->audio_client, FORMAT_LINEAR_PCM, + bits_per_sample, false); + } if (ret < 0) { pr_err("%s: q6asm_open_read failed:%d\n", __func__, ret); return ret; diff --git a/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c b/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c index 920e7324f14a..9b672d803d31 100644 --- a/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c +++ b/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -423,7 +423,7 @@ static int msm_pcm_capture_prepare(struct snd_pcm_substream *substream) prtd->audio_client->perf_mode); ret = q6asm_open_read_v4(prtd->audio_client, FORMAT_LINEAR_PCM, - bits_per_sample); + bits_per_sample, false); if (ret < 0) { pr_err("%s: q6asm_open_read failed\n", __func__); q6asm_audio_client_free(prtd->audio_client); diff --git a/sound/soc/msm/qdsp6v2/q6asm.c b/sound/soc/msm/qdsp6v2/q6asm.c index 19105ffd9d4a..dab58bdfadab 100644 --- a/sound/soc/msm/qdsp6v2/q6asm.c +++ b/sound/soc/msm/qdsp6v2/q6asm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016, The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. * Author: Brian Swetland * * This software is licensed under the terms of the GNU General Public @@ -2441,13 +2441,14 @@ EXPORT_SYMBOL(q6asm_open_read_v3); * @ac: Client session handle * @format: encoder format * @bits_per_sample: bit width of capture session + * @ts_mode: timestamp mode */ int q6asm_open_read_v4(struct audio_client *ac, uint32_t format, - uint16_t bits_per_sample) + uint16_t bits_per_sample, bool ts_mode) { return __q6asm_open_read(ac, format, bits_per_sample, PCM_MEDIA_FORMAT_V4 /*media fmt block ver*/, - true/*ts_mode*/); + ts_mode); } EXPORT_SYMBOL(q6asm_open_read_v4);