aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/samsung/tvout/s5p_tvout_v4l2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/samsung/tvout/s5p_tvout_v4l2.c')
-rw-r--r--drivers/media/video/samsung/tvout/s5p_tvout_v4l2.c115
1 files changed, 71 insertions, 44 deletions
diff --git a/drivers/media/video/samsung/tvout/s5p_tvout_v4l2.c b/drivers/media/video/samsung/tvout/s5p_tvout_v4l2.c
index 68508e7..3fa6e55 100644
--- a/drivers/media/video/samsung/tvout/s5p_tvout_v4l2.c
+++ b/drivers/media/video/samsung/tvout/s5p_tvout_v4l2.c
@@ -369,7 +369,7 @@ static int s5p_tvout_tvif_s_std(
int i;
v4l2_std_id std_id = *norm;
-#ifdef CONFIG_HAS_EARLYSUSPEND
+#if defined(CONFIG_HAS_EARLYSUSPEND) && defined(CLOCK_GATING_ON_EARLY_SUSPEND)
s5p_tvout_mutex_lock();
#endif
for (i = 0; i < S5P_TVOUT_TVIF_NO_OF_STANDARD; i++) {
@@ -379,7 +379,8 @@ static int s5p_tvout_tvif_s_std(
if (i == S5P_TVOUT_TVIF_NO_OF_STANDARD) {
tvout_err("There is no TV standard(0x%08Lx)\n", std_id);
-#ifdef CONFIG_HAS_EARLYSUSPEND
+
+#if defined(CONFIG_HAS_EARLYSUSPEND) && defined(CLOCK_GATING_ON_EARLY_SUSPEND)
s5p_tvout_mutex_unlock();
#endif
return -EINVAL;
@@ -390,7 +391,7 @@ static int s5p_tvout_tvif_s_std(
tvout_dbg("standard id=0x%X, name=\"%s\"\n",
(u32) std_id, s5p_tvout_tvif_standard[i].name);
-#ifdef CONFIG_HAS_EARLYSUSPEND
+#if defined(CONFIG_HAS_EARLYSUSPEND) && defined(CLOCK_GATING_ON_EARLY_SUSPEND)
s5p_tvout_mutex_unlock();
#endif
@@ -437,7 +438,7 @@ static int s5p_tvout_tvif_s_output(
return -EINVAL;
}
-#ifdef CONFIG_HAS_EARLYSUSPEND
+#if defined(CONFIG_HAS_EARLYSUSPEND)
s5p_tvout_mutex_lock();
#endif
on_start_process = true;
@@ -582,12 +583,12 @@ static int s5p_tvout_tvif_s_output(
s5p_tvif_ctrl_start(tv_std, tv_if);
-#ifdef CONFIG_HAS_EARLYSUSPEND
+#if defined(CONFIG_HAS_EARLYSUSPEND)
s5p_tvout_mutex_unlock();
#endif
return 0;
error_on_tvif_s_output:
-#ifdef CONFIG_HAS_EARLYSUSPEND
+#if defined(CONFIG_HAS_EARLYSUSPEND)
s5p_tvout_mutex_unlock();
#endif
return -1;
@@ -749,7 +750,7 @@ long s5p_tvout_tvif_ioctl(
void *argp = (void *) arg;
int i = 0;
-#ifdef CONFIG_HAS_EARLYSUSPEND
+#if defined(CONFIG_HAS_EARLYSUSPEND) && defined(CLOCK_GATING_ON_EARLY_SUSPEND)
s5p_tvout_mutex_lock();
#endif
@@ -916,13 +917,13 @@ long s5p_tvout_tvif_ioctl(
break;
}
-#ifdef CONFIG_HAS_EARLYSUSPEND
+#if defined(CONFIG_HAS_EARLYSUSPEND) && defined(CLOCK_GATING_ON_EARLY_SUSPEND)
s5p_tvout_mutex_unlock();
#endif
return video_ioctl2(file, cmd, arg);
end_tvif_ioctl:
-#ifdef CONFIG_HAS_EARLYSUSPEND
+#if defined(CONFIG_HAS_EARLYSUSPEND) && defined(CLOCK_GATING_ON_EARLY_SUSPEND)
s5p_tvout_mutex_unlock();
#endif
return ret;
@@ -1035,7 +1036,7 @@ static int s5p_tvout_vo_s_fmt_type_private(
(u32) vparam.base_y, (u32) vparam.base_c,
pix_fmt->field);
-#ifdef CONFIG_HAS_EARLYSUSPEND
+#if defined(CONFIG_HAS_EARLYSUSPEND) && defined(CLOCK_GATING_ON_EARLY_SUSPEND)
s5p_tvout_mutex_lock();
#endif
/* check progressive or not */
@@ -1133,52 +1134,72 @@ static int s5p_tvout_vo_s_fmt_type_private(
pix_fmt->height, color, field);
#else
if (pix_fmt->priv) {
- copy_buff_idx = s5ptv_vp_buff.copy_buff_idxs[s5ptv_vp_buff.curr_copy_idx];
-
- if ((void *)s5ptv_vp_buff.vp_buffs[copy_buff_idx].vir_base == NULL) {
- s5p_vp_ctrl_set_src_plane((u32) vparam.base_y, (u32) vparam.base_c,
- pix_fmt->width, pix_fmt->height, color, field);
+ copy_buff_idx =
+ s5ptv_vp_buff.
+ copy_buff_idxs[s5ptv_vp_buff.curr_copy_idx];
+
+ if ((void *)s5ptv_vp_buff.vp_buffs[copy_buff_idx].vir_base
+ == NULL) {
+ s5p_vp_ctrl_set_src_plane(
+ (u32) vparam.base_y, (u32) vparam.base_c,
+ pix_fmt->width, pix_fmt->height, color, field);
} else {
- if (pix_fmt->pixelformat == V4L2_PIX_FMT_NV12T
- || pix_fmt->pixelformat == V4L2_PIX_FMT_NV21T) {
- y_size = ALIGN(ALIGN(pix_fmt->width, 128) * ALIGN(pix_fmt->height, 32), SZ_8K);
- cbcr_size = ALIGN(ALIGN(pix_fmt->width, 128) * ALIGN(pix_fmt->height >> 1, 32), SZ_8K);
+ if (pix_fmt->pixelformat ==
+ V4L2_PIX_FMT_NV12T
+ || pix_fmt->pixelformat == V4L2_PIX_FMT_NV21T) {
+ y_size = ALIGN(ALIGN(pix_fmt->width, 128) *
+ ALIGN(pix_fmt->height, 32), SZ_8K);
+ cbcr_size = ALIGN(ALIGN(pix_fmt->width, 128) *
+ ALIGN(pix_fmt->height >> 1, 32), SZ_8K);
} else {
y_size = pix_fmt->width * pix_fmt->height;
- cbcr_size = pix_fmt->width * (pix_fmt->height >> 1);
+ cbcr_size =
+ pix_fmt->width * (pix_fmt->height >> 1);
}
- src_vir_y_addr = (unsigned int)phys_to_virt((unsigned long)vparam.base_y);
- src_vir_cb_addr = (unsigned int)phys_to_virt((unsigned long)vparam.base_c);
+ src_vir_y_addr = (unsigned int)phys_to_virt(
+ (unsigned long)vparam.base_y);
+ src_vir_cb_addr = (unsigned int)phys_to_virt(
+ (unsigned long)vparam.base_c);
- memcpy((void *)s5ptv_vp_buff.vp_buffs[copy_buff_idx].vir_base,
- (void *)src_vir_y_addr, y_size);
- memcpy((void *)s5ptv_vp_buff.vp_buffs[copy_buff_idx].vir_base + y_size,
- (void *)src_vir_cb_addr, cbcr_size);
+ memcpy(
+ (void *)
+ s5ptv_vp_buff.vp_buffs[copy_buff_idx].vir_base,
+ (void *)src_vir_y_addr, y_size);
+ memcpy(
+ (void *)s5ptv_vp_buff.vp_buffs[copy_buff_idx].
+ vir_base + y_size,
+ (void *)src_vir_cb_addr, cbcr_size);
flush_all_cpu_caches();
outer_flush_all();
- s5p_vp_ctrl_set_src_plane((u32) s5ptv_vp_buff.vp_buffs[copy_buff_idx].phy_base,
- (u32) s5ptv_vp_buff.vp_buffs[copy_buff_idx].phy_base + y_size,
- pix_fmt->width, pix_fmt->height, color, field);
+ s5p_vp_ctrl_set_src_plane(
+ (u32) s5ptv_vp_buff.
+ vp_buffs[copy_buff_idx].phy_base,
+ (u32) s5ptv_vp_buff.
+ vp_buffs[copy_buff_idx].phy_base
+ + y_size,
+ pix_fmt->width, pix_fmt->height, color, field);
s5ptv_vp_buff.curr_copy_idx++;
- if (s5ptv_vp_buff.curr_copy_idx >= S5PTV_VP_BUFF_CNT - 1)
+ if (s5ptv_vp_buff.curr_copy_idx >=
+ S5PTV_VP_BUFF_CNT - 1)
s5ptv_vp_buff.curr_copy_idx = 0;
}
} else {
- s5p_vp_ctrl_set_src_plane((u32) vparam.base_y, (u32) vparam.base_c,
- pix_fmt->width, pix_fmt->height, color, field);
+ s5p_vp_ctrl_set_src_plane(
+ (u32) vparam.base_y, (u32) vparam.base_c,
+ pix_fmt->width, pix_fmt->height, color, field);
}
#endif
-#ifdef CONFIG_HAS_EARLYSUSPEND
+#if defined(CONFIG_HAS_EARLYSUSPEND) && defined(CLOCK_GATING_ON_EARLY_SUSPEND)
s5p_tvout_mutex_unlock();
#endif
return 0;
error_on_s_fmt_type_private:
-#ifdef CONFIG_HAS_EARLYSUSPEND
+#if defined(CONFIG_HAS_EARLYSUSPEND) && defined(CLOCK_GATING_ON_EARLY_SUSPEND)
s5p_tvout_mutex_unlock();
#endif
return -1;
@@ -1201,7 +1222,7 @@ static int s5p_tvout_vo_s_fmt_vid_overlay(
rect->left, rect->top, rect->width, rect->height,
a->fmt.win.global_alpha);
-#ifdef CONFIG_HAS_EARLYSUSPEND
+#if defined(CONFIG_HAS_EARLYSUSPEND) && defined(CLOCK_GATING_ON_EARLY_SUSPEND)
s5p_tvout_mutex_lock();
#endif
s5p_tvout_v4l2_private.vo_dst_fmt = a->fmt.win;
@@ -1211,7 +1232,7 @@ static int s5p_tvout_vo_s_fmt_vid_overlay(
rect->left, rect->top,
rect->width, rect->height);
-#ifdef CONFIG_HAS_EARLYSUSPEND
+#if defined(CONFIG_HAS_EARLYSUSPEND) && defined(CLOCK_GATING_ON_EARLY_SUSPEND)
s5p_tvout_mutex_unlock();
#endif
return 0;
@@ -1237,7 +1258,7 @@ static int s5p_tvout_vo_s_crop(
struct file *file, void *fh, struct v4l2_crop *a)
{
tvout_dbg("\n");
-#ifdef CONFIG_HAS_EARLYSUSPEND
+#if defined(CONFIG_HAS_EARLYSUSPEND) && defined(CLOCK_GATING_ON_EARLY_SUSPEND)
s5p_tvout_mutex_lock();
#endif
switch (a->type) {
@@ -1260,7 +1281,7 @@ static int s5p_tvout_vo_s_crop(
tvout_err("Invalid buf type(0x%08x)\n", a->type);
break;
}
-#ifdef CONFIG_HAS_EARLYSUSPEND
+#if defined(CONFIG_HAS_EARLYSUSPEND) && defined(CLOCK_GATING_ON_EARLY_SUSPEND)
s5p_tvout_mutex_unlock();
#endif
return 0;
@@ -1285,7 +1306,7 @@ static int s5p_tvout_vo_s_fbuf(
(a->flags & V4L2_FBUF_FLAG_GLOBAL_ALPHA) ? 1 : 0,
a->fmt.priv);
-#ifdef CONFIG_HAS_EARLYSUSPEND
+#if defined(CONFIG_HAS_EARLYSUSPEND) && defined(CLOCK_GATING_ON_EARLY_SUSPEND)
s5p_tvout_mutex_lock();
#endif
@@ -1294,7 +1315,7 @@ static int s5p_tvout_vo_s_fbuf(
s5p_vp_ctrl_set_dest_win_priority(a->fmt.priv);
-#ifdef CONFIG_HAS_EARLYSUSPEND
+#if defined(CONFIG_HAS_EARLYSUSPEND) && defined(CLOCK_GATING_ON_EARLY_SUSPEND)
s5p_tvout_mutex_unlock();
#endif
return 0;
@@ -1305,15 +1326,21 @@ static int s5p_tvout_vo_overlay(
{
tvout_dbg("%s\n", (i) ? "start" : "stop");
-#ifdef CONFIG_HAS_EARLYSUSPEND
+#if defined(CONFIG_HAS_EARLYSUSPEND) && defined(CLOCK_GATING_ON_EARLY_SUSPEND)
s5p_tvout_mutex_lock();
#endif
- if (i)
+ if (i) {
s5p_vp_ctrl_start();
- else
+ /* restore vsync interrupt setting */
+ s5p_mixer_set_vsync_interrupt(
+ s5p_mixer_ctrl_get_vsync_interrupt());
+ } else {
+ /* disable vsync interrupt when VP is disabled */
+ s5p_mixer_ctrl_disable_vsync_interrupt();
s5p_vp_ctrl_stop();
+ }
-#ifdef CONFIG_HAS_EARLYSUSPEND
+#if defined(CONFIG_HAS_EARLYSUSPEND) && defined(CLOCK_GATING_ON_EARLY_SUSPEND)
s5p_tvout_mutex_unlock();
#endif
return 0;