Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e66ba137 authored by Vatsal Bucha's avatar Vatsal Bucha
Browse files

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: default avatarVatsal Bucha <vbucha@codeaurora.org>
parent 9c87b94c
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -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);