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

Commit 679e6076 authored by Shaohua Deng's avatar Shaohua Deng Committed by Ning Feng
Browse files

[ALPS05475847] DISP: fix ion_phys fail



use get_iova to get mva instead of ion_phys

MTK-Commit-Id: fab63816b24c89df32378e1800d2af2cf6217b2c

Change-Id: I617148521c1d1e5f3266d30d0984b48b08bced75
Signed-off-by: default avatarShaohua Deng <shaohua.deng@mediatek.com>
CR-Id: ALPS05475847
Feature: [Module]Display Driver
parent 535ce985
Loading
Loading
Loading
Loading
+35 −12
Original line number Diff line number Diff line
@@ -5,6 +5,8 @@

#include "disp_drv_log.h"
#include "ion_drv.h"
#include "mtk_ion.h"
#include <ion_priv.h>
#include <linux/slab.h>
#include <linux/wait.h>
#include <linux/sched.h>
@@ -384,19 +386,40 @@ static size_t mtkfb_ion_phys_mmu_addr(struct ion_client *client,
	if (!handle)
		return 0;

	memset((void *)&mm_data, 0, sizeof(struct ion_mm_data));
	mm_data.config_buffer_param.module_id = 0;
	if (handle->buffer && handle->buffer->heap) {
		memset((void *)&mm_data, 0, sizeof(mm_data));
		if (handle->buffer->heap->type == ION_HEAP_TYPE_MULTIMEDIA) {
			mm_data.mm_cmd = ION_MM_GET_IOVA;
			mm_data.config_buffer_param.kernel_handle = handle;
			mm_data.config_buffer_param.module_id = 0;
			if (ion_kernel_ioctl(ion_client, ION_CMD_MULTIMEDIA,
				(unsigned long)&mm_data)) {
				pr_info("[DISP][ION] ERR: get iova of mm heap failed!\n");
				return 0;
			}
			*mva = (unsigned int)mm_data.get_phys_param.phy_addr;
			size = (size_t)mm_data.get_phys_param.len;
		} else {
			ion_phys_addr_t phy_addr = 0;

			mm_data.mm_cmd = ION_MM_CONFIG_BUFFER;
			mm_data.config_buffer_param.kernel_handle = handle;
			mm_data.config_buffer_param.module_id = 0;
			mm_data.config_buffer_param.security = 0;
			mm_data.config_buffer_param.coherent = 0;
			if (ion_kernel_ioctl(ion_client, ION_CMD_MULTIMEDIA,
		(unsigned long)&mm_data) < 0) {
		DISPERR("disp_ion_get_mva: config buffer failed.%p -%p\n",
		ion_client, handle);
		ion_free(ion_client, handle);
		return -1;
				(unsigned long)&mm_data)) {
				pr_info("[DISP][ION] ERR: get iova of fb heap failed!\n");
				return 0;
			}
			ion_phys(client, handle, &phy_addr, &size);
			*mva = (unsigned int)phy_addr;
		}
	} else {
		pr_info("[DISP][ION] ERR: ion handle is not valid\n", __func__);
		return 0;
	}

	MTKFB_FENCE_LOG("alloc mmu addr hnd=0x%p,mva=0x%08x\n",
		handle, (unsigned int)*mva);
	return size;