From e66ba1377362125f6d4b95a5d6f07091dc6ab80d Mon Sep 17 00:00:00 2001 From: Vatsal Bucha Date: Thu, 2 Sep 2021 15:02:20 +0530 Subject: [PATCH] dsp: q6adm: Resolve pop noise heard during playback when screen rotated Pop noise is heard during speaker swap when screen is rotated. This is because path is not muted before swap. Mute path before applying swap and unmute afterwards to resolve issue. Change-Id: I235a75f92c451b95dae89671681628e500e3029a Signed-off-by: Vatsal Bucha --- dsp/q6adm.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/dsp/q6adm.c b/dsp/q6adm.c index 5fd053abfc06..5492cf501c22 100755 --- a/dsp/q6adm.c +++ b/dsp/q6adm.c @@ -43,6 +43,7 @@ #endif #define SESSION_TYPE_RX 0 +#define COPP_VOL_DEFAULT 0x2000 /* ENUM for adm_status */ enum adm_cal_status { @@ -111,6 +112,7 @@ struct adm_ctl { int tx_port_id; bool hyp_assigned; int fnn_app_type; + bool is_channel_swapped; }; static struct adm_ctl this_adm; @@ -5476,6 +5478,13 @@ int adm_swap_speaker_channels(int port_id, int copp_idx, (uint16_t) PCM_CHANNEL_FR; } + if(spk_swap || this_adm.is_channel_swapped) { + /* Before applying swap channel, mute the device to avoid pop */ + ret = adm_set_volume(port_id, copp_idx, 0); + /* Add delay after mute as per hw requirement */ + msleep(50); + } + ret = adm_pack_and_set_one_pp_param(port_id, copp_idx, param_hdr, (u8 *) &mfc_cfg); if (ret < 0) { @@ -5484,6 +5493,12 @@ int adm_swap_speaker_channels(int port_id, int copp_idx, return ret; } + if(spk_swap || this_adm.is_channel_swapped) { + /* After applying swap channel, reset to default */ + ret = adm_set_volume(port_id, copp_idx, COPP_VOL_DEFAULT); + } + this_adm.is_channel_swapped = spk_swap; + pr_debug("%s: mfc_cfg Set params returned success", __func__); return 0; } @@ -5865,6 +5880,7 @@ int __init adm_init(void) this_adm.tx_port_id = -1; this_adm.hyp_assigned = false; this_adm.fnn_app_type = -1; + this_adm.is_channel_swapped = false; init_waitqueue_head(&this_adm.matrix_map_wait); init_waitqueue_head(&this_adm.adm_wait); mutex_init(&this_adm.adm_apr_lock);