dsp: return ENETRESET error if apr is down

In SSR/PDR, return ENETRESET errno to
propagate this failure to userspace. After
audio HAL receives ENETRESET, it stops retry
for pcm_open continuously. Rate limit the logs
when apr send packet fails during PDR/SSR
usecases to avoid watchdog timeouts.

Change-Id: I03a80aef6ffedb4f15f953fff5213d6a3c9efc4b
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
This commit is contained in:
Laxminath Kasam 2018-04-04 10:59:57 +05:30 • committed by Meng Wang
commit c910c02395
3 changed files with 13 additions and 13 deletions

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
*/
#include <linux/slab.h>
#include <linux/debugfs.h>
@ -866,7 +866,7 @@ int afe_q6_interface_prepare(void)
0xFFFFFFFF, &this_afe);
if (this_afe.apr == NULL) {
pr_err("%s: Unable to register AFE\n", __func__);
ret = -ENODEV;
ret = -ENETRESET;
}
rtac_set_afe_handle(this_afe.apr);
}

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
*/
#include <linux/kernel.h>
@ -432,7 +432,7 @@ void ocm_core_open(void)
aprv2_core_fn_q, 0xFFFFFFFF, NULL);
pr_debug("%s: Open_q %pK\n", __func__, q6core_lcl.core_handle_q);
if (q6core_lcl.core_handle_q == NULL)
pr_err("%s: Unable to register CORE\n", __func__);
pr_err_ratelimited("%s: Unable to register CORE\n", __func__);
}
struct cal_block_data *cal_utils_get_cal_block_by_key(
@ -926,7 +926,7 @@ bool q6core_is_adsp_ready(void)
q6core_lcl.bus_bw_resp_received = 0;
rc = apr_send_pkt(q6core_lcl.core_handle_q, (uint32_t *)&hdr);
if (rc < 0) {
pr_err("%s: Get ADSP state APR packet send event %d\n",
pr_err_ratelimited("%s: Get ADSP state APR packet send event %d\n",
__func__, rc);
goto bail;
}

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2010-2014, 2016-2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2010-2014, 2016-2019 The Linux Foundation. All rights reserved.
*/
#include <linux/kernel.h>
@ -368,13 +368,13 @@ int apr_send_pkt(void *handle, uint32_t *buf)
return -EINVAL;
}
if (svc->need_reset) {
pr_err("apr: send_pkt service need reset\n");
pr_err_ratelimited("apr: send_pkt service need reset\n");
return -ENETRESET;
}
if ((svc->dest_id == APR_DEST_QDSP6) &&
(apr_get_q6_state() != APR_SUBSYS_LOADED)) {
pr_err("%s: Still dsp is not Up\n", __func__);
pr_err_ratelimited("%s: Still dsp is not Up\n", __func__);
return -ENETRESET;
} else if ((svc->dest_id == APR_DEST_MODEM) &&
(apr_get_modem_state() == APR_SUBSYS_DOWN)) {
@ -388,7 +388,7 @@ int apr_send_pkt(void *handle, uint32_t *buf)
clnt = &client[dest_id][client_id];
if (!client[dest_id][client_id].handle) {
pr_err("APR: Still service is not yet opened\n");
pr_err_ratelimited("APR: Still service is not yet opened\n");
spin_unlock_irqrestore(&svc->w_lock, flags);
return -EINVAL;
}
@ -501,7 +501,7 @@ struct apr_svc *apr_register(char *dest, char *svc_name, apr_fn svc_fn,
if (dest_id == APR_DEST_QDSP6) {
if (apr_get_q6_state() != APR_SUBSYS_LOADED) {
pr_err("%s: adsp not up\n", __func__);
pr_err_ratelimited("%s: adsp not up\n", __func__);
return NULL;
}
pr_debug("%s: adsp Up\n", __func__);
@ -525,7 +525,7 @@ struct apr_svc *apr_register(char *dest, char *svc_name, apr_fn svc_fn,
}
if (apr_get_svc(svc_name, domain_id, &client_id, &svc_idx, &svc_id)) {
pr_err("%s: apr_get_svc failed\n", __func__);
pr_err_ratelimited("%s: apr_get_svc failed\n", __func__);
goto done;
}
@ -536,7 +536,7 @@ struct apr_svc *apr_register(char *dest, char *svc_name, apr_fn svc_fn,
APR_DL_SMD, apr_cb_func, NULL);
if (!clnt->handle) {
svc = NULL;
pr_err("APR: Unable to open handle\n");
pr_err_ratelimited("APR: Unable to open handle\n");
mutex_unlock(&clnt->m_lock);
goto done;
}
@ -547,7 +547,7 @@ struct apr_svc *apr_register(char *dest, char *svc_name, apr_fn svc_fn,
clnt->id = client_id;
if (svc->need_reset) {
mutex_unlock(&svc->m_lock);
pr_err("APR: Service needs reset\n");
pr_err_ratelimited("APR: Service needs reset\n");
svc = NULL;
goto done;
}