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

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

Merge "msm: mdss: synchronize wfd driver iommu mmap/munmap with mdss"

parents ebe31ae5 3c7c553c
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -209,6 +209,7 @@ static int mdp_mmap(struct v4l2_subdev *sd, void *arg)
		return -EINVAL;
	}

	msm_fb_writeback_iommu_ref(inst->mdp, true);
	if (inst->secure) {
		rc = msm_ion_secure_buffer(mmap->ion_client,
			mregion->ion_handle, VIDEO_PIXEL, 0);
@@ -232,12 +233,15 @@ static int mdp_mmap(struct v4l2_subdev *sd, void *arg)
		goto iommu_fail;
	}
	mregion->paddr = dma_addr_to_void_ptr(paddr);
	msm_fb_writeback_iommu_ref(inst->mdp, false);

	return 0;
iommu_fail:
	if (inst->secure)
		msm_ion_unsecure_buffer(mmap->ion_client, mregion->ion_handle);
secure_fail:
	msm_fb_writeback_iommu_ref(inst->mdp, false);

	return rc;
}

@@ -252,10 +256,10 @@ static int mdp_munmap(struct v4l2_subdev *sd, void *arg)
		WFD_MSG_ERR("Invalid argument\n");
		return -EINVAL;
	}

	inst = mmap->cookie;
	mregion = mmap->mregion;

	msm_fb_writeback_iommu_ref(inst->mdp, true);
	domain = msm_fb_get_iommu_domain(inst->mdp,
			inst->secure ? MDP_IOMMU_DOMAIN_CP :
					MDP_IOMMU_DOMAIN_NS);
@@ -265,6 +269,7 @@ static int mdp_munmap(struct v4l2_subdev *sd, void *arg)

	if (inst->secure)
		msm_ion_unsecure_buffer(mmap->ion_client, mregion->ion_handle);
	msm_fb_writeback_iommu_ref(inst->mdp, false);

	return 0;
}
+19 −0
Original line number Diff line number Diff line
@@ -860,3 +860,22 @@ int msm_fb_writeback_set_secure(struct fb_info *info, int enable)
	return mdss_mdp_wb_set_secure(mfd, enable);
}
EXPORT_SYMBOL(msm_fb_writeback_set_secure);

/**
 * msm_fb_writeback_iommu_ref() - Power ON/OFF mdp clock
 * @enable - true/false to Power ON/OFF mdp clock
 *
 * Call to enable mdp clock at start of mdp_mmap/mdp_munmap API and
 * to disable mdp clock at end of these API's to ensure iommu is in
 * proper state while driver map/un-map any buffers.
 */
int msm_fb_writeback_iommu_ref(struct fb_info *info, int enable)
{
	if (enable)
		mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_ON, false);
	else
		mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_OFF, false);

	return 0;
}
EXPORT_SYMBOL(msm_fb_writeback_iommu_ref);
+2 −1
Original line number Diff line number Diff line
/* include/linux/msm_mdp.h
 *
 * Copyright (C) 2007 Google Incorporated
 * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
 * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
@@ -31,5 +31,6 @@ int msm_fb_writeback_dequeue_buffer(struct fb_info *info,
int msm_fb_writeback_stop(struct fb_info *info);
int msm_fb_writeback_terminate(struct fb_info *info);
int msm_fb_writeback_set_secure(struct fb_info *info, int enable);
int msm_fb_writeback_iommu_ref(struct fb_info *info, int enable);

#endif /*_MSM_MDP_H_*/