From c7d538c0c4eb708d55c37b80d832fd1d8552707a Mon Sep 17 00:00:00 2001 From: Harshal Ahire Date: Tue, 19 Jan 2021 15:35:43 +0530 Subject: [PATCH] dsp: Unload the BT modules when APR handle is NULL As a part of SSR/PDR, afe_close() is called. If APR handle is NULL, BT modules were not unloaded. Unload the modules to recover post SSR/PDR. Change-Id: I69bdb3ab1d55ad9a0a8ed3eed069c97af9143722 Signed-off-by: Harshal Ahire --- dsp/q6afe.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/dsp/q6afe.c b/dsp/q6afe.c index ccfc7d5ff847..aeda849ec414 100644 --- a/dsp/q6afe.c +++ b/dsp/q6afe.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-only -/* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved. */ #include #include @@ -975,6 +975,20 @@ static int32_t afe_callback(struct apr_client_data *data, void *priv) mutex_lock(&this_afe.afe_cmd_lock); for (i = 0; i < AFE_LPASS_CORE_HW_VOTE_MAX; i++) this_afe.lpass_hw_core_client_hdl[i] = 0; + + /* + * Free the port mapping structures used for AVCS module + * load/unload. + */ + for (i = 0; i < MAX_ALLOWED_USE_CASES; i++) { + if (pm[i]) { + kfree(pm[i]->payload); + pm[i]->payload = NULL; + kfree(pm[i]); + pm[i] = NULL; + } + } + mutex_unlock(&this_afe.afe_cmd_lock); /*