dsp: update MSM Audio ION wrappers to align with upstream

Between Linux-4.9 and Linux-4.14, upstream has updated the
ION APIs significantly to make ION ready to bring out of
staging folder. This has changed the way ION and dma_buf
APIs used to work together for allocating, mapping and
deallocating ION buffers.
Update MSM Audio ION wrapper functions used by audio drivers
to reflect these ION API changes as per upstream ION.

Change-Id: I63097e147a397aa3a538f69ac88b6fb10871c3dc
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
This commit is contained in:
Banajit Goswami
2017-11-03 22:48:23 -07:00
parent b05cd67f29
commit 08bb73698a
22 changed files with 592 additions and 918 deletions

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
*
* 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
@@ -41,13 +41,13 @@
struct rtac_cal_block_data rtac_cal[MAX_RTAC_BLOCKS] = {
/* ADM_RTAC_CAL */
{{RTAC_BUF_SIZE, 0, 0, 0}, {0, 0, 0} },
{{RTAC_BUF_SIZE, 0, 0}, {0, 0, 0} },
/* ASM_RTAC_CAL */
{{RTAC_BUF_SIZE, 0, 0, 0}, {0, 0, 0} },
{{RTAC_BUF_SIZE, 0, 0}, {0, 0, 0} },
/* VOICE_RTAC_CAL */
{{RTAC_BUF_SIZE, 0, 0, 0}, {0, 0, 0} },
{{RTAC_BUF_SIZE, 0, 0}, {0, 0, 0} },
/* AFE_RTAC_CAL */
{{RTAC_BUF_SIZE, 0, 0, 0}, {0, 0, 0} }
{{RTAC_BUF_SIZE, 0, 0}, {0, 0, 0} }
};
struct rtac_common_data {
@@ -164,9 +164,7 @@ int rtac_allocate_cal_buffer(uint32_t cal_type)
goto done;
}
result = msm_audio_ion_alloc("rtac_client",
&rtac_cal[cal_type].map_data.ion_client,
&rtac_cal[cal_type].map_data.ion_handle,
result = msm_audio_ion_alloc(&rtac_cal[cal_type].map_data.dma_buf,
rtac_cal[cal_type].map_data.map_size,
&rtac_cal[cal_type].cal_data.paddr,
&len,
@@ -199,14 +197,13 @@ int rtac_free_cal_buffer(uint32_t cal_type)
goto done;
}
if (rtac_cal[cal_type].map_data.ion_client == NULL) {
if (rtac_cal[cal_type].map_data.dma_buf == NULL) {
pr_debug("%s: cal_type %d not allocated!\n",
__func__, cal_type);
goto done;
}
result = msm_audio_ion_free(rtac_cal[cal_type].map_data.ion_client,
rtac_cal[cal_type].map_data.ion_handle);
result = msm_audio_ion_free(rtac_cal[cal_type].map_data.dma_buf);
if (result < 0) {
pr_err("%s: ION free for RTAC failed! cal_type %d, paddr 0x%pK\n",
__func__, cal_type, &rtac_cal[cal_type].cal_data.paddr);
@@ -214,8 +211,7 @@ int rtac_free_cal_buffer(uint32_t cal_type)
}
rtac_cal[cal_type].map_data.map_handle = 0;
rtac_cal[cal_type].map_data.ion_client = NULL;
rtac_cal[cal_type].map_data.ion_handle = NULL;
rtac_cal[cal_type].map_data.dma_buf = NULL;
rtac_cal[cal_type].cal_data.size = 0;
rtac_cal[cal_type].cal_data.kvaddr = 0;
rtac_cal[cal_type].cal_data.paddr = 0;
@@ -754,7 +750,7 @@ int send_adm_apr(void *buf, u32 opcode)
pr_debug("%s\n", __func__);
if (rtac_cal[ADM_RTAC_CAL].map_data.ion_handle == NULL) {
if (rtac_cal[ADM_RTAC_CAL].map_data.dma_buf == NULL) {
result = rtac_allocate_cal_buffer(ADM_RTAC_CAL);
if (result < 0) {
pr_err("%s: allocate buffer failed!",
@@ -983,7 +979,7 @@ int send_rtac_asm_apr(void *buf, u32 opcode)
pr_debug("%s\n", __func__);
if (rtac_cal[ASM_RTAC_CAL].map_data.ion_handle == NULL) {
if (rtac_cal[ASM_RTAC_CAL].map_data.dma_buf == NULL) {
result = rtac_allocate_cal_buffer(ASM_RTAC_CAL);
if (result < 0) {
pr_err("%s: allocate buffer failed!",
@@ -1232,7 +1228,7 @@ static int send_rtac_afe_apr(void *buf, uint32_t opcode)
pr_debug("%s\n", __func__);
if (rtac_cal[AFE_RTAC_CAL].map_data.ion_handle == NULL) {
if (rtac_cal[AFE_RTAC_CAL].map_data.dma_buf == NULL) {
result = rtac_allocate_cal_buffer(AFE_RTAC_CAL);
if (result < 0) {
pr_err("%s: allocate buffer failed! ret = %d\n",
@@ -1482,7 +1478,7 @@ int send_voice_apr(u32 mode, void *buf, u32 opcode)
pr_debug("%s\n", __func__);
if (rtac_cal[VOICE_RTAC_CAL].map_data.ion_handle == NULL) {
if (rtac_cal[VOICE_RTAC_CAL].map_data.dma_buf == NULL) {
result = rtac_allocate_cal_buffer(VOICE_RTAC_CAL);
if (result < 0) {
pr_err("%s: allocate buffer failed!",