aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaster K <officiallazerl0rd@gmail.com>2018-06-26 21:26:18 +0100
committerShubh@m <shubhindia123@gmail.com>2019-02-28 22:27:12 +0530
commit84cd6c744915551800950f4d244c3e3aab78286f (patch)
tree11b8ec31527500e8237bc2e46d0d1fca97332120
parentebc0b33750dc26477a78276b8f5b115e5f87c1ae (diff)
sound: DTS-Eagle integration
Signed-off-by: joshuous <joshuous@gmail.com> Change-Id: Ic4e0b5cdcd6eb5dc890e404d83045e0154b04246 Signed-off-by: Laster K. (lazerl0rd) <officiallazerl0rd@gmail.com> Signed-off-by: Shubh@m <shubhindia123@gmail.com>
-rw-r--r--sound/soc/msm/qdsp6v2/msm-dts-eagle.c143
-rw-r--r--sound/soc/msm/qdsp6v2/q6adm.c46
-rwxr-xr-xsound/soc/msm/qdsp6v2/q6asm.c30
3 files changed, 206 insertions, 13 deletions
diff --git a/sound/soc/msm/qdsp6v2/msm-dts-eagle.c b/sound/soc/msm/qdsp6v2/msm-dts-eagle.c
index d6917122576..23713354375 100644
--- a/sound/soc/msm/qdsp6v2/msm-dts-eagle.c
+++ b/sound/soc/msm/qdsp6v2/msm-dts-eagle.c
@@ -1,4 +1,8 @@
+<<<<<<< HEAD
/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
+=======
+/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
+>>>>>>> cc7e98ef6b9... sound: DTS-Eagle integration
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -197,6 +201,10 @@ static struct param_outband _po_NT;
#define SEC_BLOB_MAX_CNT 10
#define SEC_BLOB_MAX_SIZE 0x4004 /*extra 4 for size*/
static char *_sec_blob[SEC_BLOB_MAX_CNT];
+<<<<<<< HEAD
+=======
+struct mutex _sec_lock;
+>>>>>>> cc7e98ef6b9... sound: DTS-Eagle integration
/* multi-copp support */
static int _cidx[AFE_MAX_PORTS] = {-1};
@@ -409,6 +417,11 @@ static void _reg_ion_mem_NT(void)
if (rc < 0) {
eagle_drv_err("%s: memory map failed", __func__);
msm_audio_ion_free(_ion_client_NT, _ion_handle_NT);
+<<<<<<< HEAD
+=======
+ _ion_client_NT = NULL;
+ _ion_handle_NT = NULL;
+>>>>>>> cc7e98ef6b9... sound: DTS-Eagle integration
}
}
@@ -421,6 +434,12 @@ static void _unreg_ion_mem_NT(void)
rc = msm_audio_ion_free(_ion_client_NT, _ion_handle_NT);
if (rc < 0)
eagle_drv_err("%s: mem free failed", __func__);
+<<<<<<< HEAD
+=======
+
+ _ion_client_NT = NULL;
+ _ion_handle_NT = NULL;
+>>>>>>> cc7e98ef6b9... sound: DTS-Eagle integration
}
static struct audio_client *_getNTDeviceAC(void)
@@ -459,18 +478,34 @@ static int _sendcache_pre(struct audio_client *ac)
err = -EINVAL;
if ((_depc_size == 0) || !_depc || (size == 0) ||
cmd == 0 || ((offset + size) > _depc_size) || (err != 0)) {
+<<<<<<< HEAD
eagle_precache_err("%s: primary device %i cache index %i general error - cache size = %u, cache ptr = %p, offset = %u, size = %u, cmd = %i",
+=======
+ eagle_precache_err("%s: primary device %i cache index %i general error - cache size = %u, cache ptr = %pK, offset = %u, size = %u, cmd = %i",
+>>>>>>> cc7e98ef6b9... sound: DTS-Eagle integration
__func__, _device_primary, cidx, _depc_size, _depc,
offset, size, cmd);
return -EINVAL;
}
+<<<<<<< HEAD
eagle_precache_dbg("%s: first 6 integers %i %i %i %i %i %i (30th %i)",
__func__,
*((int *)&_depc[offset]), *((int *)&_depc[offset+4]),
*((int *)&_depc[offset+8]), *((int *)&_depc[offset+12]),
*((int *)&_depc[offset+16]), *((int *)&_depc[offset+20]),
*((int *)&_depc[offset+120]));
+=======
+ if ((offset < (UINT_MAX - 124)) && ((offset + 124) < _depc_size))
+ eagle_precache_dbg("%s: first 6 integers %i %i %i %i %i %i (30th %i)",
+ __func__, *((int *)&_depc[offset]),
+ *((int *)&_depc[offset+4]),
+ *((int *)&_depc[offset+8]),
+ *((int *)&_depc[offset+12]),
+ *((int *)&_depc[offset+16]),
+ *((int *)&_depc[offset+20]),
+ *((int *)&_depc[offset+120]));
+>>>>>>> cc7e98ef6b9... sound: DTS-Eagle integration
eagle_precache_dbg("%s: sending full data block to port, with cache index = %d device mask 0x%X, param = 0x%X, offset = %u, and size = %u",
__func__, cidx, _c_bl[cidx][CBD_DEV_MASK], cmd, offset, size);
@@ -500,12 +535,22 @@ static int _sendcache_post(int port_id, int copp_idx, int topology)
}
index = adm_validate_and_get_port_index(port_id);
+<<<<<<< HEAD
if (index < 0)
eagle_postcache_err("%s: Invalid port idx %d port_id %#x",
__func__, index, port_id);
else
eagle_postcache_dbg("%s: valid port idx %d for port_id %#x set to %i",
__func__, index, port_id, copp_idx);
+=======
+ if (index < 0) {
+ eagle_postcache_err("%s: Invalid port idx %d port_id %#x",
+ __func__, index, port_id);
+ return -EINVAL;
+ }
+ eagle_postcache_dbg("%s: valid port idx %d for port_id %#x set to %i",
+ __func__, index, port_id, copp_idx);
+>>>>>>> cc7e98ef6b9... sound: DTS-Eagle integration
_cidx[index] = copp_idx;
mask = _get_dev_mask_for_pid(port_id);
@@ -539,16 +584,31 @@ NT_MODE_GOTO:
err = -EINVAL;
if ((_depc_size == 0) || !_depc || (err != 0) || (size == 0) ||
(cmd == 0) || (offset + size) > _depc_size) {
+<<<<<<< HEAD
eagle_postcache_err("%s: primary device %i cache index %i port_id 0x%X general error - cache size = %u, cache ptr = %p, offset = %u, size = %u, cmd = %i",
+=======
+ eagle_postcache_err("%s: primary device %i cache index %i port_id 0x%X general error - cache size = %u, cache ptr = %pK, offset = %u, size = %u, cmd = %i",
+>>>>>>> cc7e98ef6b9... sound: DTS-Eagle integration
__func__, _device_primary, cidx, port_id,
_depc_size, _depc, offset, size, cmd);
return -EINVAL;
}
+<<<<<<< HEAD
eagle_postcache_dbg("%s: first 6 integers %i %i %i %i %i %i", __func__,
*((int *)&_depc[offset]), *((int *)&_depc[offset+4]),
*((int *)&_depc[offset+8]), *((int *)&_depc[offset+12]),
*((int *)&_depc[offset+16]), *((int *)&_depc[offset+20]));
+=======
+ if ((offset < (UINT_MAX - 24)) && ((offset + 24) < _depc_size))
+ eagle_postcache_dbg("%s: first 6 integers %i %i %i %i %i %i",
+ __func__, *((int *)&_depc[offset]),
+ *((int *)&_depc[offset+4]),
+ *((int *)&_depc[offset+8]),
+ *((int *)&_depc[offset+12]),
+ *((int *)&_depc[offset+16]),
+ *((int *)&_depc[offset+20]));
+>>>>>>> cc7e98ef6b9... sound: DTS-Eagle integration
eagle_postcache_dbg("%s: sending full data block to port, with cache index = %d device mask 0x%X, port_id = 0x%X, param = 0x%X, offset = %u, and size = %u",
__func__, cidx, _c_bl[cidx][CBD_DEV_MASK], port_id, cmd,
offset, size);
@@ -1227,15 +1287,27 @@ int msm_dts_eagle_ioctl(unsigned int cmd, unsigned long arg)
__func__, target, SEC_BLOB_MAX_CNT);
return -EINVAL;
}
+<<<<<<< HEAD
+ if (_sec_blob[target] == NULL) {
+ eagle_ioctl_err("%s: license index %u never initialized",
+ __func__, target);
+=======
+ mutex_lock(&_sec_lock);
if (_sec_blob[target] == NULL) {
eagle_ioctl_err("%s: license index %u never initialized",
__func__, target);
+ mutex_unlock(&_sec_lock);
+>>>>>>> cc7e98ef6b9... sound: DTS-Eagle integration
return -EINVAL;
}
size = ((u32 *)_sec_blob[target])[0];
if ((size == 0) || (size > SEC_BLOB_MAX_SIZE)) {
eagle_ioctl_err("%s: license size %u for index %u invalid (min size is 1, max size is %u)",
__func__, size, target, SEC_BLOB_MAX_SIZE);
+<<<<<<< HEAD
+=======
+ mutex_unlock(&_sec_lock);
+>>>>>>> cc7e98ef6b9... sound: DTS-Eagle integration
return -EINVAL;
}
if (size_only) {
@@ -1245,16 +1317,28 @@ int msm_dts_eagle_ioctl(unsigned int cmd, unsigned long arg)
(void *)&size, sizeof(size))) {
eagle_ioctl_err("%s: error copying license size",
__func__);
+<<<<<<< HEAD
+=======
+ mutex_unlock(&_sec_lock);
+>>>>>>> cc7e98ef6b9... sound: DTS-Eagle integration
return -EFAULT;
}
} else if (copy_to_user((void *)(((char *)arg)+sizeof(target)),
(void *)&(((s32 *)_sec_blob[target])[1]), size)) {
eagle_ioctl_err("%s: error copying license data",
__func__);
+<<<<<<< HEAD
+=======
+ mutex_unlock(&_sec_lock);
+>>>>>>> cc7e98ef6b9... sound: DTS-Eagle integration
return -EFAULT;
} else
eagle_ioctl_info("%s: license file %u bytes long from license index %u returned to user",
__func__, size, target);
+<<<<<<< HEAD
+=======
+ mutex_unlock(&_sec_lock);
+>>>>>>> cc7e98ef6b9... sound: DTS-Eagle integration
break;
}
case DTS_EAGLE_IOCTL_SET_LICENSE: {
@@ -1272,17 +1356,26 @@ int msm_dts_eagle_ioctl(unsigned int cmd, unsigned long arg)
__func__, target[0], SEC_BLOB_MAX_CNT-1);
return -EINVAL;
}
+<<<<<<< HEAD
+=======
+ mutex_lock(&_sec_lock);
+>>>>>>> cc7e98ef6b9... sound: DTS-Eagle integration
if (target[1] == 0) {
eagle_ioctl_dbg("%s: request to free license index %u",
__func__, target[0]);
kfree(_sec_blob[target[0]]);
_sec_blob[target[0]] = NULL;
+<<<<<<< HEAD
+=======
+ mutex_unlock(&_sec_lock);
+>>>>>>> cc7e98ef6b9... sound: DTS-Eagle integration
break;
}
if ((target[1] == 0) || (target[1] >= SEC_BLOB_MAX_SIZE)) {
eagle_ioctl_err("%s: license size %u for index %u invalid (min size is 1, max size is %u)",
__func__, target[1], target[0],
SEC_BLOB_MAX_SIZE);
+<<<<<<< HEAD
return -EINVAL;
}
if (_sec_blob[target[0]] != NULL) {
@@ -1292,6 +1385,16 @@ int msm_dts_eagle_ioctl(unsigned int cmd, unsigned long arg)
kfree(_sec_blob[target[0]]);
_sec_blob[target[0]] = NULL;
}
+=======
+ mutex_unlock(&_sec_lock);
+ return -EINVAL;
+ }
+ if (_sec_blob[target[0]] != NULL) {
+ eagle_ioctl_dbg("%s: reallocate already allocated license index %i",
+ __func__, target[0]);
+ kfree(_sec_blob[target[0]]);
+ _sec_blob[target[0]] = NULL;
+>>>>>>> cc7e98ef6b9... sound: DTS-Eagle integration
}
eagle_ioctl_dbg("%s: allocating %u bytes for license index %u",
__func__, target[1], target[0]);
@@ -1299,6 +1402,10 @@ int msm_dts_eagle_ioctl(unsigned int cmd, unsigned long arg)
if (!_sec_blob[target[0]]) {
eagle_ioctl_err("%s: error allocating license index %u (kzalloc failed on %u bytes)",
__func__, target[0], target[1]);
+<<<<<<< HEAD
+=======
+ mutex_unlock(&_sec_lock);
+>>>>>>> cc7e98ef6b9... sound: DTS-Eagle integration
return -ENOMEM;
}
((u32 *)_sec_blob[target[0]])[0] = target[1];
@@ -1311,10 +1418,18 @@ int msm_dts_eagle_ioctl(unsigned int cmd, unsigned long arg)
((char *)arg)+sizeof(target),
&(((u32 *)_sec_blob[target[0]])[1]),
target[1]);
+<<<<<<< HEAD
+=======
+ mutex_unlock(&_sec_lock);
+>>>>>>> cc7e98ef6b9... sound: DTS-Eagle integration
return -EFAULT;
} else
eagle_ioctl_info("%s: license file %u bytes long copied to index license index %u",
__func__, target[1], target[0]);
+<<<<<<< HEAD
+=======
+ mutex_unlock(&_sec_lock);
+>>>>>>> cc7e98ef6b9... sound: DTS-Eagle integration
break;
}
case DTS_EAGLE_IOCTL_SEND_LICENSE: {
@@ -1332,10 +1447,18 @@ int msm_dts_eagle_ioctl(unsigned int cmd, unsigned long arg)
__func__, target, SEC_BLOB_MAX_CNT-1);
return -EINVAL;
}
+<<<<<<< HEAD
+=======
+ mutex_lock(&_sec_lock);
+>>>>>>> cc7e98ef6b9... sound: DTS-Eagle integration
if (!_sec_blob[target] ||
((u32 *)_sec_blob[target])[0] == 0) {
eagle_ioctl_err("%s: license index %u is invalid",
__func__, target);
+<<<<<<< HEAD
+=======
+ mutex_unlock(&_sec_lock);
+>>>>>>> cc7e98ef6b9... sound: DTS-Eagle integration
return -EINVAL;
}
if (core_dts_eagle_set(((s32 *)_sec_blob[target])[0],
@@ -1345,6 +1468,10 @@ int msm_dts_eagle_ioctl(unsigned int cmd, unsigned long arg)
else
eagle_ioctl_info("%s: core_dts_eagle_set succeeded with id = %u",
__func__, target);
+<<<<<<< HEAD
+=======
+ mutex_unlock(&_sec_lock);
+>>>>>>> cc7e98ef6b9... sound: DTS-Eagle integration
break;
}
case DTS_EAGLE_IOCTL_SET_VOLUME_COMMANDS: {
@@ -1435,6 +1562,10 @@ int msm_dts_eagle_ioctl(unsigned int cmd, unsigned long arg)
*
* Return: Return failure if any.
*/
+<<<<<<< HEAD
+=======
+#ifdef CONFIG_COMPAT
+>>>>>>> cc7e98ef6b9... sound: DTS-Eagle integration
int msm_dts_eagle_compat_ioctl(unsigned int cmd, unsigned long arg)
{
switch (cmd) {
@@ -1473,7 +1604,11 @@ int msm_dts_eagle_compat_ioctl(unsigned int cmd, unsigned long arg)
}
return msm_dts_eagle_ioctl(cmd, arg);
}
+<<<<<<< HEAD
+=======
+#endif
+>>>>>>> cc7e98ef6b9... sound: DTS-Eagle integration
/**
* msm_dts_eagle_init_pre() - Initialize DTS premix module
* @ac: Initialize premix module in the ASM session.
@@ -1589,6 +1724,10 @@ int msm_dts_eagle_pcm_new(struct snd_soc_pcm_runtime *runtime)
_init_cb_descs();
_reg_ion_mem();
}
+<<<<<<< HEAD
+=======
+ mutex_init(&_sec_lock);
+>>>>>>> cc7e98ef6b9... sound: DTS-Eagle integration
return 0;
}
@@ -1605,6 +1744,10 @@ void msm_dts_eagle_pcm_free(struct snd_pcm *pcm)
if (!--_ref_cnt)
_unreg_ion_mem();
vfree(_depc);
+<<<<<<< HEAD
+=======
+ mutex_destroy(&_sec_lock);
+>>>>>>> cc7e98ef6b9... sound: DTS-Eagle integration
}
MODULE_DESCRIPTION("DTS EAGLE platform driver");
diff --git a/sound/soc/msm/qdsp6v2/q6adm.c b/sound/soc/msm/qdsp6v2/q6adm.c
index bc25305cc6d..2c6ffc9f666 100644
--- a/sound/soc/msm/qdsp6v2/q6adm.c
+++ b/sound/soc/msm/qdsp6v2/q6adm.c
@@ -26,6 +26,8 @@
#include <sound/msm-dts-eagle.h>
#include "msm-dts-srs-tm-config.h"
#include <sound/sounddebug.h>
+#include <sound/adsp_err.h>
+
#define TIMEOUT_MS 1000
#define RESET_COPP_ID 99
@@ -288,7 +290,7 @@ int adm_dts_eagle_set(int port_id, int copp_idx, int param_id,
admp.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD,
APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER);
- admp.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(admp));
+ admp.hdr.pkt_size = sizeof(admp);
admp.hdr.src_svc = APR_SVC_ADM;
admp.hdr.src_domain = APR_DOMAIN_APPS;
admp.hdr.src_port = port_id;
@@ -307,7 +309,8 @@ int adm_dts_eagle_set(int port_id, int copp_idx, int param_id,
__func__, admp.hdr.dest_port,
admp.payload_size, AUDPROC_MODULE_ID_DTS_HPX_POSTMIX,
param_id);
- atomic_set(&this_adm.copp.stat[p_idx][copp_idx], 0);
+
+ atomic_set(&this_adm.copp.stat[p_idx][copp_idx], -1);
ret = apr_send_pkt(this_adm.apr, (uint32_t *)&admp);
if (ret < 0) {
pr_err("DTS_EAGLE_ADM: %s - ADM enable for port %d failed\n",
@@ -316,12 +319,23 @@ int adm_dts_eagle_set(int port_id, int copp_idx, int param_id,
goto fail_cmd;
}
ret = wait_event_timeout(this_adm.copp.wait[p_idx][copp_idx],
- atomic_read(&this_adm.copp.stat[p_idx][copp_idx]),
+
+ atomic_read(&this_adm.copp.stat
+ [p_idx][copp_idx]) >= 0,
msecs_to_jiffies(TIMEOUT_MS));
if (!ret) {
pr_err("DTS_EAGLE_ADM: %s - set params timed out port = %d\n",
__func__, port_id);
ret = -EINVAL;
+ } else if (atomic_read(&this_adm.copp.stat
+ [p_idx][copp_idx]) > 0) {
+ pr_err("%s: DSP returned error[%s]\n",
+ __func__, adsp_err_get_err_str(
+ atomic_read(&this_adm.copp.stat
+ [p_idx][copp_idx])));
+ ret = adsp_err_get_lnx_err_code(
+ atomic_read(&this_adm.copp.stat
+ [p_idx][copp_idx]));
} else {
ret = 0;
}
@@ -385,7 +399,7 @@ int adm_dts_eagle_get(int port_id, int copp_idx, int param_id,
admp.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD,
APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER);
- admp.hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, sizeof(admp));
+ admp.hdr.pkt_size = sizeof(admp);
admp.hdr.src_svc = APR_SVC_ADM;
admp.hdr.src_domain = APR_DOMAIN_APPS;
admp.hdr.src_port = port_id;
@@ -405,8 +419,7 @@ int adm_dts_eagle_get(int port_id, int copp_idx, int param_id,
admp.param_max_size = size + sizeof(struct adm_param_data_v5);
admp.reserved = 0;
- atomic_set(&this_adm.copp.stat[p_idx][copp_idx], 0);
-
+ atomic_set(&this_adm.copp.stat[p_idx][copp_idx], -1);
ret = apr_send_pkt(this_adm.apr, (uint32_t *)&admp);
if (ret < 0) {
pr_err("DTS_EAGLE_ADM: %s - Failed to get EAGLE Params on port %d\n",
@@ -415,13 +428,25 @@ int adm_dts_eagle_get(int port_id, int copp_idx, int param_id,
goto fail_cmd;
}
ret = wait_event_timeout(this_adm.copp.wait[p_idx][copp_idx],
- atomic_read(&this_adm.copp.stat[p_idx][copp_idx]),
+
+ atomic_read(&this_adm.copp.stat
+ [p_idx][copp_idx]) >= 0,
msecs_to_jiffies(TIMEOUT_MS));
if (!ret) {
pr_err("DTS_EAGLE_ADM: %s - EAGLE get params timed out port = %d\n",
__func__, port_id);
ret = -EINVAL;
goto fail_cmd;
+ } else if (atomic_read(&this_adm.copp.stat
+ [p_idx][copp_idx]) > 0) {
+ pr_err("%s: DSP returned error[%s]\n",
+ __func__, adsp_err_get_err_str(
+ atomic_read(&this_adm.copp.stat
+ [p_idx][copp_idx])));
+ ret = adsp_err_get_lnx_err_code(
+ atomic_read(&this_adm.copp.stat
+ [p_idx][copp_idx]));
+ goto fail_cmd;
}
memcpy(data, ob_params, orig_size);
@@ -2227,6 +2252,13 @@ int adm_open(int port_id, int path, int rate, int channel_mode, int topology,
__func__, port_id, path, rate, channel_mode, perf_mode,
topology);
+ /* For DTS EAGLE only, force 24 bit */
+ if ((topology == ADM_CMD_COPP_OPEN_TOPOLOGY_ID_DTS_HPX) &&
+ (perf_mode == LEGACY_PCM_MODE)) {
+ bit_width = 24;
+ pr_debug("%s: Force open adm in 24-bit for DTS HPX topology 0x%x\n",
+ __func__, topology);
+ }
port_id = q6audio_convert_virtual_to_portid(port_id);
port_idx = adm_validate_and_get_port_index(port_id);
if (port_idx < 0) {
diff --git a/sound/soc/msm/qdsp6v2/q6asm.c b/sound/soc/msm/qdsp6v2/q6asm.c
index c093cedb15e..7c38ded5103 100755
--- a/sound/soc/msm/qdsp6v2/q6asm.c
+++ b/sound/soc/msm/qdsp6v2/q6asm.c
@@ -5208,7 +5208,7 @@ int q6asm_dts_eagle_set(struct audio_client *ac, int param_id, uint32_t size,
ad->data.param_id = param_id;
ad->data.param_size = size;
ad->data.reserved = 0;
- atomic_set(&ac->cmd_state, 1);
+ atomic_set(&ac->cmd_state, -1);
if (po) {
struct list_head *ptr, *next;
@@ -5258,11 +5258,20 @@ int q6asm_dts_eagle_set(struct audio_client *ac, int param_id, uint32_t size,
}
rc = wait_event_timeout(ac->cmd_wait,
- (atomic_read(&ac->cmd_state) <= 0), 1*HZ);
+ (atomic_read(&ac->cmd_state) >= 0), 1*HZ);
if (!rc) {
pr_err("DTS_EAGLE_ASM - %s: timeout, set-params paramid[0x%x]\n",
__func__, ad->data.param_id);
- rc = -EINVAL;
+ rc = -ETIMEDOUT;
+ goto fail_cmd;
+ }
+
+ if (atomic_read(&ac->cmd_state) > 0) {
+ pr_err("%s: DSP returned error[%s]\n",
+ __func__, adsp_err_get_err_str(
+ atomic_read(&ac->cmd_state)));
+ rc = adsp_err_get_lnx_err_code(
+ atomic_read(&ac->cmd_state));
goto fail_cmd;
}
rc = 0;
@@ -5301,7 +5310,7 @@ int q6asm_dts_eagle_get(struct audio_client *ac, int param_id, uint32_t size,
ad->param.param_id = param_id;
ad->param.param_max_size = size + APR_CMD_GET_HDR_SZ;
ad->param.reserved = 0;
- atomic_set(&ac->cmd_state, 1);
+ atomic_set(&ac->cmd_state, -1);
generic_get_data = kzalloc(size + sizeof(struct generic_get_data_),
GFP_KERNEL);
@@ -5359,11 +5368,20 @@ int q6asm_dts_eagle_get(struct audio_client *ac, int param_id, uint32_t size,
}
rc = wait_event_timeout(ac->cmd_wait,
- (atomic_read(&ac->cmd_state) <= 0), 1*HZ);
+ (atomic_read(&ac->cmd_state) >= 0), 1*HZ);
if (!rc) {
pr_err("DTS_EAGLE_ASM - %s: timeout in get\n",
__func__);
- rc = -EINVAL;
+ rc = -ETIMEDOUT;
+ goto fail_cmd;
+ }
+
+ if (atomic_read(&ac->cmd_state) > 0) {
+ pr_err("%s: DSP returned error[%s]\n",
+ __func__, adsp_err_get_err_str(
+ atomic_read(&ac->cmd_state)));
+ rc = adsp_err_get_lnx_err_code(
+ atomic_read(&ac->cmd_state));
goto fail_cmd;
}