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

Commit 81a54a22 authored by Aditya Bavanari's avatar Aditya Bavanari Committed by Gerrit - the friendly Code Review server
Browse files

dsp: Reset core hw vote client handle in SSR



Reset core hw vote client handle in SSR use cases
and do not unvote when the client handle is 0.
This is to clean up the client ids in SSR in
order to avoid unusual client deregistrations.

Change-Id: Id0cee50f7ca27e29db6134b7a70ae75334e0d765
Signed-off-by: default avatarAditya Bavanari <abavanar@codeaurora.org>
parent 97815137
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -596,6 +596,11 @@ static int32_t afe_callback(struct apr_client_data *data, void *priv)
			rtac_set_afe_handle(this_afe.apr);
		}

		/* Reset the core client handle in SSR/PDR use cases */
		mutex_lock(&this_afe.afe_cmd_lock);
		this_afe.lpass_hw_core_client_hdl = 0;
		mutex_unlock(&this_afe.afe_cmd_lock);

		/*
		 * Pass reset events to proxy driver, if cb is registered
		 */
@@ -9058,6 +9063,7 @@ int __init afe_init(void)
	this_afe.mmap_handle = 0;
	this_afe.vi_tx_port = -1;
	this_afe.vi_rx_port = -1;
	this_afe.lpass_hw_core_client_hdl = 0;
	this_afe.prot_cfg.mode = MSM_SPKR_PROT_DISABLED;
	this_afe.th_ftm_cfg.mode = MSM_SPKR_PROT_DISABLED;
	this_afe.ex_ftm_cfg.mode = MSM_SPKR_PROT_DISABLED;
@@ -9262,6 +9268,11 @@ int afe_unvote_lpass_core_hw(uint32_t hw_block_id, uint32_t client_handle)

	mutex_lock(&this_afe.afe_cmd_lock);

	if (!this_afe.lpass_hw_core_client_hdl) {
		pr_debug("%s: SSR in progress, return\n", __func__);
		goto done;
	}

	memset(cmd_ptr, 0, sizeof(hw_vote_cfg));

	cmd_ptr->hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD,
@@ -9278,6 +9289,12 @@ int afe_unvote_lpass_core_hw(uint32_t hw_block_id, uint32_t client_handle)
	pr_debug("%s: lpass core hw unvote opcode[0x%x] hw id[0x%x]\n",
		__func__, cmd_ptr->hdr.opcode, cmd_ptr->hw_block_id);

	if (cmd_ptr->client_handle <= 0) {
		pr_err("%s: invalid client handle\n", __func__);
		ret = -EINVAL;
		goto done;
	}

	atomic_set(&this_afe.status, 0);
	atomic_set(&this_afe.state, 1);
	ret = apr_send_pkt(this_afe.apr, (uint32_t *) cmd_ptr);