From 29a4c3c9d0af96891846c1b294f36ed11fbd1e4b Mon Sep 17 00:00:00 2001 From: Jhansi Konathala Date: Wed, 25 Sep 2019 16:21:16 +0530 Subject: [PATCH] ASoc: Fix for dtmf tone play issue Fix the data corruption happening because of misaligned datatypes so that DTMF can be played for more than 32767 seconds. Change-Id: I199d6d10e9f184665d8f03a2265d0bcd8ae16590 Signed-off-by: Jhansi Konathala --- asoc/msm-pcm-dtmf-v2.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/asoc/msm-pcm-dtmf-v2.c b/asoc/msm-pcm-dtmf-v2.c index 7f79471bf086..3dc7a26a54c8 100644 --- a/asoc/msm-pcm-dtmf-v2.c +++ b/asoc/msm-pcm-dtmf-v2.c @@ -20,6 +20,8 @@ #define DRV_NAME "msm-pcm-dtmf-v2" +#define DTMF_MAX_DURATION 65535 + enum { DTMF_IN_RX, DTMF_IN_TX, @@ -94,8 +96,12 @@ static int msm_dtmf_rx_generate_put(struct snd_kcontrol *kcontrol, int64_t duration = ucontrol->value.integer.value[2]; uint16_t gain = ucontrol->value.integer.value[3]; - pr_debug("%s: low_freq=%d high_freq=%d duration=%d gain=%d\n", + pr_debug("%s: low_freq=%d high_freq=%d duration=%lld gain=%d\n", __func__, low_freq, high_freq, (int)duration, gain); + + if (duration == DTMF_MAX_DURATION) + duration = -1; + afe_dtmf_generate_rx(duration, high_freq, low_freq, gain); return 0; }