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

Commit aa5c585c authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: qdsp6v2: fallback to system heap only if smmu enabled"

parents b06d837b a81ff5e7
Loading
Loading
Loading
Loading
+18 −14
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ int msm_audio_ion_alloc(const char *name, struct ion_client **client,
			struct ion_handle **handle, size_t bufsz,
			ion_phys_addr_t *paddr, size_t *pa_len, void **vaddr)
{
	int rc = 0;
	int rc = -EINVAL;

	if ((msm_audio_ion_data.smmu_enabled == true) &&
	    (msm_audio_ion_data.group == NULL)) {
@@ -67,21 +67,25 @@ int msm_audio_ion_alloc(const char *name, struct ion_client **client,
	*handle = ion_alloc(*client, bufsz, SZ_4K,
			ION_HEAP(ION_AUDIO_HEAP_ID), 0);
	if (IS_ERR_OR_NULL((void *) (*handle))) {
		if (msm_audio_ion_data.smmu_enabled == true) {
			pr_debug("system heap is used");
			msm_audio_ion_data.audioheap_enabled = 0;
			*handle = ion_alloc(*client, bufsz, SZ_4K,
					ION_HEAP(ION_SYSTEM_HEAP_ID), 0);

	} else {
		pr_debug("audio heap is used");
		msm_audio_ion_data.audioheap_enabled = 1;
		}

		if (IS_ERR_OR_NULL((void *) (*handle))) {
		pr_err("%s: ION memory allocation for AUDIO failed rc=%d, smmu_enabled=%d\n",
			if ((void *)(*handle) != NULL)
				rc = *(int *)(*handle);
			else
				rc = -ENOMEM;
			pr_err("%s:ION mem alloc fail rc=%d, smmu_enabled=%d\n",
				__func__, rc, msm_audio_ion_data.smmu_enabled);
			goto err_ion_client;
		}
	} else {
		pr_debug("audio heap is used");
		msm_audio_ion_data.audioheap_enabled = 1;
	}

	rc = msm_audio_ion_get_phys(*client, *handle, paddr, pa_len);
	if (rc) {
@@ -103,7 +107,7 @@ int msm_audio_ion_alloc(const char *name, struct ion_client **client,
		memset((void *)*vaddr, 0, bufsz);
	}

	return 0;
	return rc;

err_ion_handle:
	ion_free(*client, *handle);
@@ -112,7 +116,7 @@ err_ion_client:
	*handle = NULL;
	*client = NULL;
err:
	return -EINVAL;
	return rc;
}

int msm_audio_ion_import(const char *name, struct ion_client **client,