mm-audio: aud_acdb_util: Fix ADM custom topology
When AANC was added an enum was changed that affected ADM
custom topology and TX audproc vol cal. If ADM custom
topology was used the memmap handle for TX audproc volume
would be overwritten. This fixes that logic.
Change-Id: I8c0a13d0a3c0359537508b7ca9a34faf8cd267b4
CRs-fixed: 515406
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
diff --git a/sound/soc/msm/qdsp6v2/audio_acdb.h b/sound/soc/msm/qdsp6v2/audio_acdb.h
index 1685894..d9c1210 100644
--- a/sound/soc/msm/qdsp6v2/audio_acdb.h
+++ b/sound/soc/msm/qdsp6v2/audio_acdb.h
@@ -19,7 +19,6 @@
enum {
RX_CAL,
TX_CAL,
- AANC_TX_CAL,
MAX_AUDPROC_TYPES
};
diff --git a/sound/soc/msm/qdsp6v2/q6adm.c b/sound/soc/msm/qdsp6v2/q6adm.c
index df0fa6a..b1f968d 100644
--- a/sound/soc/msm/qdsp6v2/q6adm.c
+++ b/sound/soc/msm/qdsp6v2/q6adm.c
@@ -35,6 +35,16 @@
#define INVALID_COPP_ID 0xFF
#define ADM_GET_PARAMETER_LENGTH 350
+
+enum {
+ ADM_RX_AUDPROC_CAL,
+ ADM_TX_AUDPROC_CAL,
+ ADM_RX_AUDVOL_CAL,
+ ADM_TX_AUDVOL_CAL,
+ ADM_CUSTOM_TOP_CAL,
+ ADM_MAX_CAL_TYPES
+};
+
struct adm_ctl {
void *apr;
atomic_t copp_id[AFE_MAX_PORTS];
@@ -48,10 +58,7 @@
struct acdb_cal_block mem_addr_audproc[MAX_AUDPROC_TYPES];
struct acdb_cal_block mem_addr_audvol[MAX_AUDPROC_TYPES];
-/* 0 - (MAX_AUDPROC_TYPES -1): audproc handles */
-/* (MAX_AUDPROC_TYPES -1) - (2 * MAX_AUDPROC_TYPES -1): audvol handles */
-/* + 1 for custom ADM topology */
- atomic_t mem_map_cal_handles[(2 * MAX_AUDPROC_TYPES) + 1];
+ atomic_t mem_map_cal_handles[ADM_MAX_CAL_TYPES];
atomic_t mem_map_cal_index;
int set_custom_topology;
@@ -626,7 +633,7 @@
if (this_adm.set_custom_topology) {
/* specific index 4 for adm topology memory */
- atomic_set(&this_adm.mem_map_cal_index, 4);
+ atomic_set(&this_adm.mem_map_cal_index, ADM_CUSTOM_TOP_CAL);
/* Only call this once */
this_adm.set_custom_topology = 0;
@@ -656,7 +663,8 @@
adm_top.hdr.opcode = ADM_CMD_ADD_TOPOLOGIES;
adm_top.payload_addr_lsw = cal_block.cal_paddr;
adm_top.payload_addr_msw = 0;
- adm_top.mem_map_handle = atomic_read(&this_adm.mem_map_cal_handles[4]);
+ adm_top.mem_map_handle =
+ atomic_read(&this_adm.mem_map_cal_handles[ADM_CUSTOM_TOP_CAL]);
adm_top.payload_size = cal_block.cal_size;
atomic_set(&this_adm.copp_stat[index], 0);
diff --git a/sound/soc/msm/qdsp6v2/q6afe.c b/sound/soc/msm/qdsp6v2/q6afe.c
index 1810770..6dfe5b3 100644
--- a/sound/soc/msm/qdsp6v2/q6afe.c
+++ b/sound/soc/msm/qdsp6v2/q6afe.c
@@ -25,6 +25,14 @@
#include "audio_acdb.h"
+enum {
+ AFE_RX_CAL,
+ AFE_TX_CAL,
+ AFE_AANC_TX_CAL,
+ MAX_AFE_CAL_TYPES
+};
+
+
struct afe_ctl {
void *apr;
atomic_t state;
@@ -39,8 +47,8 @@
void *rx_private_data;
uint32_t mmap_handle;
- struct acdb_cal_block afe_cal_addr[MAX_AUDPROC_TYPES];
- atomic_t mem_map_cal_handles[MAX_AUDPROC_TYPES];
+ struct acdb_cal_block afe_cal_addr[MAX_AFE_CAL_TYPES];
+ atomic_t mem_map_cal_handles[MAX_AFE_CAL_TYPES];
atomic_t mem_map_cal_index;
u16 dtmf_gen_rx_portid;
struct afe_spkr_prot_calib_get_resp calib_data;
@@ -94,7 +102,7 @@
pr_debug("q6afe: reset event = %d %d apr[%p]\n",
data->reset_event, data->reset_proc, this_afe.apr);
- for (i = 0; i < MAX_AUDPROC_TYPES; i++) {
+ for (i = 0; i < MAX_AFE_CAL_TYPES; i++) {
this_afe.afe_cal_addr[i].cal_paddr = 0;
this_afe.afe_cal_addr[i].cal_size = 0;
}
@@ -384,7 +392,7 @@
u32 handle;
pr_debug("%s: path %d\n", __func__, path);
- if (path == AANC_TX_CAL) {
+ if (path == AFE_AANC_TX_CAL) {
get_aanc_cal(&cal_block);
} else {
get_afe_cal(path, &cal_block);
@@ -600,10 +608,10 @@
if (afe_get_port_type(port_id) == MSM_AFE_PORT_TYPE_TX) {
afe_send_cal_spkr_prot_tx(port_id);
- afe_send_cal_block(TX_CAL, port_id);
+ afe_send_cal_block(AFE_TX_CAL, port_id);
} else if (afe_get_port_type(port_id) == MSM_AFE_PORT_TYPE_RX) {
afe_send_cal_spkr_prot_rx(port_id);
- afe_send_cal_block(RX_CAL, port_id);
+ afe_send_cal_block(AFE_RX_CAL, port_id);
}
}
@@ -1149,7 +1157,7 @@
__func__, ret);
goto fail_cmd;
}
- afe_send_cal_block(AANC_TX_CAL, tx_port_id);
+ afe_send_cal_block(AFE_AANC_TX_CAL, tx_port_id);
fail_cmd:
return ret;