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

Commit d2274296 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "dsp: support ION memory allocation from audio heap"

parents da5ff7c3 8c623f54
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))) {