Skip to content
This repository has been archived by the owner on Sep 18, 2022. It is now read-only.

Commit

Permalink
msm: mdss: synchronize wfd driver iommu mmap/munmap with mdss
Browse files Browse the repository at this point in the history
Add clocks reference during wfd driver iommu mdp_mmap/mdp_munmap
to ensure iommu is in proper state while wfd driver map/un-map
any buffers.

Change-Id: Id1a24285b81d5047e5e9f002ade9694ea49be59d
Signed-off-by: Pawan Kumar <[email protected]>
  • Loading branch information
Pawan Kumar authored and Giulio Cervera committed Mar 11, 2014
1 parent a8b23dc commit b85103d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
9 changes: 7 additions & 2 deletions drivers/media/platform/msm/wfd/mdp-5-subdev.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* 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
Expand Down Expand Up @@ -208,6 +208,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);
Expand All @@ -231,12 +232,15 @@ static int mdp_mmap(struct v4l2_subdev *sd, void *arg)
!inst->secure ? "non" : "", rc);
goto iommu_fail;
}
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;
}

Expand All @@ -251,10 +255,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);
Expand All @@ -264,6 +268,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;
}
Expand Down
19 changes: 19 additions & 0 deletions drivers/video/msm/mdss/mdss_mdp_wb.c
Original file line number Diff line number Diff line change
Expand Up @@ -845,3 +845,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);
3 changes: 2 additions & 1 deletion include/linux/msm_mdp.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* 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
Expand Down Expand Up @@ -997,6 +997,7 @@ 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

#endif /*_MSM_MDP_H_*/

0 comments on commit b85103d

Please sign in to comment.