diff options
author | Fancy Fang <chen.fang@freescale.com> | 2014-11-07 16:44:46 +0800 |
---|---|---|
committer | Fancy Fang <chen.fang@freescale.com> | 2014-11-25 10:51:51 +0800 |
commit | 4fea48c13ebf455f977905f076e978da8568a769 (patch) | |
tree | 29e53536e3e7a2081c08187e1d2e2696fe971d39 /drivers | |
parent | 68a1d763e08dba3076d539d77adbdd5b612c732b (diff) |
MLK-9741-01: ARM: IMX6SL-EVK: EPDC: add two ioctls to disable/enable EPDC hardware access
The two ioctls can be used to disable/enable EPDC hardware
access which are required by epdc user apps to do some
sync jobs.
Signed-off-by: Fancy Fang <chen.fang@freescale.com>
(cherry picked from commit 085c057661e7840bb5da4556a3c8844365af283a)
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/mxc/mxc_epdc_fb.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/video/mxc/mxc_epdc_fb.c b/drivers/video/mxc/mxc_epdc_fb.c index 0eb864ac9369..8f975368e7ce 100644 --- a/drivers/video/mxc/mxc_epdc_fb.c +++ b/drivers/video/mxc/mxc_epdc_fb.c @@ -90,6 +90,7 @@ #define MERGE_BLOCK 2 static unsigned long default_bpp = 16; +DEFINE_MUTEX(hard_lock); struct update_marker_data { struct list_head full_list; @@ -2820,13 +2821,18 @@ static int mxc_epdc_fb_send_single_update(struct mxcfb_update_data *upd_data, upd_data->waveform_mode); return -EINVAL; } + + mutex_lock(&fb_data->queue_mutex); if ((upd_data->update_region.left + upd_data->update_region.width > fb_data->epdc_fb_var.xres) || (upd_data->update_region.top + upd_data->update_region.height > fb_data->epdc_fb_var.yres)) { + mutex_unlock(&fb_data->queue_mutex); dev_err(fb_data->dev, "Update region is outside bounds of framebuffer." "Aborting update.\n"); return -EINVAL; } + mutex_unlock(&fb_data->queue_mutex); + if (upd_data->flags & EPDC_FLAG_USE_ALT_BUFFER) { if ((upd_data->update_region.width != upd_data->alt_buffer_data.alt_update_region.width) || @@ -3261,6 +3267,10 @@ static int mxc_epdc_fb_ioctl(struct fb_info *info, unsigned int cmd, case MXCFB_SEND_UPDATE: { struct mxcfb_update_data upd_data; + + if (mutex_lock_interruptible(&hard_lock) < 0) + return -ERESTARTSYS; + if (!copy_from_user(&upd_data, argp, sizeof(upd_data))) { ret = mxc_epdc_fb_send_update(&upd_data, info); @@ -3271,6 +3281,8 @@ static int mxc_epdc_fb_ioctl(struct fb_info *info, unsigned int cmd, ret = -EFAULT; } + mutex_unlock(&hard_lock); + break; } case MXCFB_WAIT_FOR_UPDATE_COMPLETE: @@ -3327,6 +3339,25 @@ static int mxc_epdc_fb_ioctl(struct fb_info *info, unsigned int cmd, break; } + case MXCFB_DISABLE_EPDC_ACCESS: + { + struct mxc_epdc_fb_data *fb_data = info ? + (struct mxc_epdc_fb_data *)info:g_fb_data; + mxc_epdc_fb_flush_updates(fb_data); + /* disable handling any user update request */ + mutex_lock(&hard_lock); + ret = 0; + break; + } + + case MXCFB_ENABLE_EPDC_ACCESS: + { + /* enable user update handling again */ + mutex_unlock(&hard_lock); + ret = 0; + break; + } + default: break; } |