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

Commit 11f041e2 authored by Yiduo Wang's avatar Yiduo Wang Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera_v2: Delete SMMU detach operation.



Delete SMMU detach in camera in order to be compatible with
new IOMMU APIs of doing unmap

Change-Id: Id9cd9c9a8a4ca4fd0ef4ca32d95117846facb025
Signed-off-by: default avatarYiduo Wang <yiduow@codeaurora.org>
parent e49eb111
Loading
Loading
Loading
Loading
+3 −48
Original line number Diff line number Diff line
@@ -334,13 +334,6 @@ static int cam_smmu_attach_device(int idx)
	return rc;
}

static void cam_smmu_detach_device(int idx)
{
	struct cam_context_bank_info *cb = &iommu_cb_set.cb_info[idx];
	arm_iommu_detach_device(cb->dev);
	return;
}

static int cam_smmu_create_add_handle_in_table(char *name,
					int *hdl)
{
@@ -443,9 +436,7 @@ static int cam_smmu_attach(int idx)

	mutex_lock(&iommu_cb_set.cb_info[idx].lock);
	if (iommu_cb_set.cb_info[idx].state == CAM_SMMU_ATTACH) {
		pr_err("Error: index %d got attached before\n",
			idx);
		ret = -EINVAL;
		ret = 0;
	} else if (iommu_cb_set.cb_info[idx].state == CAM_SMMU_DETACH) {
		ret = cam_smmu_attach_device(idx);
		if (ret < 0) {
@@ -463,28 +454,6 @@ static int cam_smmu_attach(int idx)
	return ret;
}

static int cam_smmu_detach(int idx)
{
	int ret;

	mutex_lock(&iommu_cb_set.cb_info[idx].lock);
	if (iommu_cb_set.cb_info[idx].state == CAM_SMMU_DETACH) {
		pr_err("Error: Index %d got detached before\n", idx);
		ret = -EINVAL;
	} else if (iommu_cb_set.cb_info[idx].state == CAM_SMMU_ATTACH) {
		iommu_cb_set.cb_info[idx].state = CAM_SMMU_DETACH;
		mutex_unlock(&iommu_cb_set.cb_info[idx].lock);
		cam_smmu_clean_buffer_list(idx);
		cam_smmu_detach_device(idx);
		return 0;
	} else {
		pr_err("Error: Not detach/attach\n");
		ret = -EINVAL;
	}
	mutex_unlock(&iommu_cb_set.cb_info[idx].lock);
	return ret;
}

static int cam_smmu_map_buffer_and_add_to_list(int idx, int ion_fd,
		 enum dma_data_direction dma_dir, dma_addr_t *paddr_ptr,
		 size_t *len_ptr)
@@ -680,7 +649,7 @@ int cam_smmu_ops(int handle, enum cam_smmu_ops_param ops)
		break;
	}
	case CAM_SMMU_DETACH: {
		ret = cam_smmu_detach(idx);
		ret = 0;
		break;
	}
	case CAM_SMMU_VOTE:
@@ -788,7 +757,7 @@ EXPORT_SYMBOL(cam_smmu_put_phy_addr);

int cam_smmu_destroy_handle(int handle)
{
	int idx, ret;
	int idx;
	idx = cam_smmu_find_index_by_handle(handle);
	if (idx < 0 || idx >= iommu_cb_set.cb_num) {
		pr_err("Error: index is not valid, index = %d\n", idx);
@@ -805,20 +774,6 @@ int cam_smmu_destroy_handle(int handle)
		cam_smmu_print_list(idx);
	}

	mutex_lock(&iommu_cb_set.cb_info[idx].lock);
	if (iommu_cb_set.cb_info[idx].state == CAM_SMMU_ATTACH) {
		CDBG("It should get detached before.\n");
		mutex_unlock(&iommu_cb_set.cb_info[idx].lock);
		ret = cam_smmu_detach(idx);
		if (ret < 0) {
			pr_err("Error: Detach idx %d fail\n", idx);
			mutex_unlock(&iommu_table_lock);
			return -EINVAL;
		}
	} else {
		mutex_unlock(&iommu_cb_set.cb_info[idx].lock);
	}

	mutex_destroy(&iommu_cb_set.cb_info[idx].lock);
	mutex_unlock(&iommu_table_lock);
	return 0;