aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/davinci/vpif.h30
-rw-r--r--drivers/media/video/davinci/vpif_display.c10
-rw-r--r--include/media/davinci/vpif_types.h2
3 files changed, 42 insertions, 0 deletions
diff --git a/drivers/media/video/davinci/vpif.h b/drivers/media/video/davinci/vpif.h
index a4d2141d1ef3..c2ce4d97c279 100644
--- a/drivers/media/video/davinci/vpif.h
+++ b/drivers/media/video/davinci/vpif.h
@@ -211,6 +211,12 @@ static inline void vpif_clr_bit(u32 reg, u32 bit)
211#define VPIF_CH3_INT_CTRL_SHIFT (6) 211#define VPIF_CH3_INT_CTRL_SHIFT (6)
212#define VPIF_CH_INT_CTRL_SHIFT (6) 212#define VPIF_CH_INT_CTRL_SHIFT (6)
213 213
214#define VPIF_CH2_CLIP_ANC_EN 14
215#define VPIF_CH2_CLIP_ACTIVE_EN 13
216
217#define VPIF_CH3_CLIP_ANC_EN 14
218#define VPIF_CH3_CLIP_ACTIVE_EN 13
219
214/* enabled interrupt on both the fields on vpid_ch0_ctrl register */ 220/* enabled interrupt on both the fields on vpid_ch0_ctrl register */
215#define channel0_intr_assert() (regw((regr(VPIF_CH0_CTRL)|\ 221#define channel0_intr_assert() (regw((regr(VPIF_CH0_CTRL)|\
216 (VPIF_INT_BOTH << VPIF_CH0_INT_CTRL_SHIFT)), VPIF_CH0_CTRL)) 222 (VPIF_INT_BOTH << VPIF_CH0_INT_CTRL_SHIFT)), VPIF_CH0_CTRL))
@@ -515,6 +521,30 @@ static inline void channel3_raw_enable(int enable, u8 index)
515 vpif_clr_bit(VPIF_CH3_CTRL, mask); 521 vpif_clr_bit(VPIF_CH3_CTRL, mask);
516} 522}
517 523
524/* function to enable clipping (for both active and blanking regions) on ch 2 */
525static inline void channel2_clipping_enable(int enable)
526{
527 if (enable) {
528 vpif_set_bit(VPIF_CH2_CTRL, VPIF_CH2_CLIP_ANC_EN);
529 vpif_set_bit(VPIF_CH2_CTRL, VPIF_CH2_CLIP_ACTIVE_EN);
530 } else {
531 vpif_clr_bit(VPIF_CH2_CTRL, VPIF_CH2_CLIP_ANC_EN);
532 vpif_clr_bit(VPIF_CH2_CTRL, VPIF_CH2_CLIP_ACTIVE_EN);
533 }
534}
535
536/* function to enable clipping (for both active and blanking regions) on ch 2 */
537static inline void channel3_clipping_enable(int enable)
538{
539 if (enable) {
540 vpif_set_bit(VPIF_CH3_CTRL, VPIF_CH3_CLIP_ANC_EN);
541 vpif_set_bit(VPIF_CH3_CTRL, VPIF_CH3_CLIP_ACTIVE_EN);
542 } else {
543 vpif_clr_bit(VPIF_CH3_CTRL, VPIF_CH3_CLIP_ANC_EN);
544 vpif_clr_bit(VPIF_CH3_CTRL, VPIF_CH3_CLIP_ACTIVE_EN);
545 }
546}
547
518/* inline function to set buffer addresses in case of Y/C non mux mode */ 548/* inline function to set buffer addresses in case of Y/C non mux mode */
519static inline void ch2_set_videobuf_addr_yc_nmux(unsigned long top_strt_luma, 549static inline void ch2_set_videobuf_addr_yc_nmux(unsigned long top_strt_luma,
520 unsigned long btm_strt_luma, 550 unsigned long btm_strt_luma,
diff --git a/drivers/media/video/davinci/vpif_display.c b/drivers/media/video/davinci/vpif_display.c
index 787245923a20..c3e2c193dda1 100644
--- a/drivers/media/video/davinci/vpif_display.c
+++ b/drivers/media/video/davinci/vpif_display.c
@@ -306,6 +306,8 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
306 channel2_intr_assert(); 306 channel2_intr_assert();
307 channel2_intr_enable(1); 307 channel2_intr_enable(1);
308 enable_channel2(1); 308 enable_channel2(1);
309 if (vpif_config_data->ch2_clip_en)
310 channel2_clipping_enable(1);
309 } 311 }
310 312
311 if ((VPIF_CHANNEL3_VIDEO == ch->channel_id) 313 if ((VPIF_CHANNEL3_VIDEO == ch->channel_id)
@@ -313,6 +315,8 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
313 channel3_intr_assert(); 315 channel3_intr_assert();
314 channel3_intr_enable(1); 316 channel3_intr_enable(1);
315 enable_channel3(1); 317 enable_channel3(1);
318 if (vpif_config_data->ch3_clip_en)
319 channel3_clipping_enable(1);
316 } 320 }
317 channel_first_int[VPIF_VIDEO_INDEX][ch->channel_id] = 1; 321 channel_first_int[VPIF_VIDEO_INDEX][ch->channel_id] = 1;
318 322
@@ -1140,6 +1144,8 @@ static int vpif_streamoff(struct file *file, void *priv,
1140 struct vpif_fh *fh = priv; 1144 struct vpif_fh *fh = priv;
1141 struct channel_obj *ch = fh->channel; 1145 struct channel_obj *ch = fh->channel;
1142 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; 1146 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
1147 struct vpif_display_config *vpif_config_data =
1148 vpif_dev->platform_data;
1143 1149
1144 if (buftype != V4L2_BUF_TYPE_VIDEO_OUTPUT) { 1150 if (buftype != V4L2_BUF_TYPE_VIDEO_OUTPUT) {
1145 vpif_err("buffer type not supported\n"); 1151 vpif_err("buffer type not supported\n");
@@ -1159,11 +1165,15 @@ static int vpif_streamoff(struct file *file, void *priv,
1159 if (buftype == V4L2_BUF_TYPE_VIDEO_OUTPUT) { 1165 if (buftype == V4L2_BUF_TYPE_VIDEO_OUTPUT) {
1160 /* disable channel */ 1166 /* disable channel */
1161 if (VPIF_CHANNEL2_VIDEO == ch->channel_id) { 1167 if (VPIF_CHANNEL2_VIDEO == ch->channel_id) {
1168 if (vpif_config_data->ch2_clip_en)
1169 channel2_clipping_enable(0);
1162 enable_channel2(0); 1170 enable_channel2(0);
1163 channel2_intr_enable(0); 1171 channel2_intr_enable(0);
1164 } 1172 }
1165 if ((VPIF_CHANNEL3_VIDEO == ch->channel_id) || 1173 if ((VPIF_CHANNEL3_VIDEO == ch->channel_id) ||
1166 (2 == common->started)) { 1174 (2 == common->started)) {
1175 if (vpif_config_data->ch3_clip_en)
1176 channel3_clipping_enable(0);
1167 enable_channel3(0); 1177 enable_channel3(0);
1168 channel3_intr_enable(0); 1178 channel3_intr_enable(0);
1169 } 1179 }
diff --git a/include/media/davinci/vpif_types.h b/include/media/davinci/vpif_types.h
index bd8217c2577c..d8f6ab1943e4 100644
--- a/include/media/davinci/vpif_types.h
+++ b/include/media/davinci/vpif_types.h
@@ -50,6 +50,8 @@ struct vpif_display_config {
50 const char **output; 50 const char **output;
51 int output_count; 51 int output_count;
52 const char *card_name; 52 const char *card_name;
53 bool ch2_clip_en;
54 bool ch3_clip_en;
53}; 55};
54 56
55struct vpif_input { 57struct vpif_input {