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
vanhempi b05cd67f29
commit 08bb73698a
22 muutettua tiedostoa jossa 592 lisäystä ja 918 poistoa

Näytä tiedosto

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2014, 2016-2017, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2014, 2016-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
@@ -25,8 +25,7 @@
static int srs_port_id[AFE_MAX_PORTS] = {-1};
static int srs_copp_idx[AFE_MAX_PORTS] = {-1};
static union srs_trumedia_params_u msm_srs_trumedia_params;
static struct ion_client *ion_client;
static struct ion_handle *ion_handle;
struct dma_buf *dma_buf;
static struct param_outband po;
static atomic_t ref_cnt;
#define ION_MEM_SIZE (8 * 1024)
@@ -299,13 +298,13 @@ static int reg_ion_mem(void)
{
int rc;
rc = msm_audio_ion_alloc("SRS_TRUMEDIA", &ion_client, &ion_handle,
ION_MEM_SIZE, &po.paddr, (size_t *)&po.size,
rc = msm_audio_ion_alloc(&dma_buf, ION_MEM_SIZE,
&po.paddr, (size_t *)&po.size,
&po.kvaddr);
if (rc != 0)
pr_err("%s: failed to allocate memory.\n", __func__);
pr_debug("%s: exited ion_client = %pK, ion_handle = %pK, phys_addr = %lu, length = %d, vaddr = %pK, rc = 0x%x\n",
__func__, ion_client, ion_handle, (long)po.paddr,
pr_debug("%s: exited dma_buf = %pK, phys_addr = %lu, length = %d, vaddr = %pK, rc = 0x%x\n",
__func__, dma_buf, (long)po.paddr,
(unsigned int)po.size, po.kvaddr, rc);
return rc;
}
@@ -323,7 +322,8 @@ void msm_dts_srs_tm_ion_memmap(struct param_outband *po_)
static void unreg_ion_mem(void)
{
msm_audio_ion_free(ion_client, ion_handle);
msm_audio_ion_free(dma_buf);
dma_buf = NULL;
po.kvaddr = NULL;
po.paddr = 0;
po.size = 0;