Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8c623f54 authored by Viraja Kommaraju's avatar Viraja Kommaraju
Browse files

dsp: support ION memory allocation from audio heap



* Add support to allocate memory from the ION audio heap
  once smmu enabled.

Change-Id: Ic1686c7a3225b723811cbbd35f08d0ac123d1f78
Signed-off-by: default avatarViraja Kommaraju <virajak@codeaurora.org>
parent 3944bb8d
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -562,12 +562,18 @@ int msm_audio_ion_alloc(struct dma_buf **dma_buf, size_t bufsz,
		pr_err("%s: Invalid params\n", __func__);
		return -EINVAL;
	}

	pr_debug("%s: audio heap is used\n", __func__);
	if (msm_audio_ion_data.smmu_enabled == true) {
		pr_debug("%s: system heap is used\n", __func__);
		*dma_buf = ion_alloc(bufsz, ION_HEAP(ION_AUDIO_HEAP_ID), 0);
		if (IS_ERR_OR_NULL((void *)(*dma_buf))) {
			if (IS_ERR((void *)(*dma_buf)))
				err_ion_ptr = PTR_ERR((int *)(*dma_buf));
			pr_debug("%s: ION alloc failed for audio heap err ptr=%ld, smmu_enabled=%d,"
					"trying system heap..\n",
					__func__, err_ion_ptr, msm_audio_ion_data.smmu_enabled);
			*dma_buf = ion_alloc(bufsz, ION_HEAP(ION_SYSTEM_HEAP_ID), 0);
		}
	} else {
		pr_debug("%s: audio heap is used\n", __func__);
		*dma_buf = ion_alloc(bufsz, ION_HEAP(ION_AUDIO_HEAP_ID), 0);
	}
	if (IS_ERR_OR_NULL((void *)(*dma_buf))) {