public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] OMAP3 ISP: Support top and bottom fields
@ 2015-03-20 20:32 Tim Nordell
  2015-04-13 20:39 ` Laurent Pinchart
  0 siblings, 1 reply; 3+ messages in thread
From: Tim Nordell @ 2015-03-20 20:32 UTC (permalink / raw)
  To: linux-media; +Cc: laurent.pinchart, sakari.ailus, Tim Nordell

The OMAP3ISP can selectively stream either the top or bottom
field by setting the start line vertical field to a high value
for the field that one doesn't want to stream.  The driver
can switch between these utilizing the vertical start feature
of the CCDC.

Additionally, we need to ensure that the FLDMODE bit is set
when we're doing this as we need to differentiate between
the two frames.

Signed-off-by: Tim Nordell <tim.nordell@logicpd.com>
---
 drivers/media/platform/omap3isp/ispccdc.c  | 29 +++++++++++++++++++++++++++--
 drivers/media/platform/omap3isp/ispvideo.c |  4 ++--
 2 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/omap3isp/ispccdc.c b/drivers/media/platform/omap3isp/ispccdc.c
index 882ebde..beb8d96 100644
--- a/drivers/media/platform/omap3isp/ispccdc.c
+++ b/drivers/media/platform/omap3isp/ispccdc.c
@@ -1131,6 +1131,7 @@ static void ccdc_configure(struct isp_ccdc_device *ccdc)
 	unsigned int sph;
 	u32 syn_mode;
 	u32 ccdc_pattern;
+	int slv0, slv1;
 
 	ccdc->bt656 = false;
 	ccdc->fields = 0;
@@ -1237,11 +1238,27 @@ static void ccdc_configure(struct isp_ccdc_device *ccdc)
 		nph = crop->width - 1;
 	}
 
+	/* Default the start vertical line offset to the crop point */
+	slv0 = slv1 = crop->top;
+
+	/* When streaming just the top or bottom field, enable processing
+	 * of the field input signal so that SLV1 is processed.
+	 */
+	if (ccdc->formats[CCDC_PAD_SINK].field == V4L2_FIELD_ALTERNATE) {
+		if (format->field == V4L2_FIELD_TOP) {
+			slv1 = 0x7FFF;
+			syn_mode |= ISPCCDC_SYN_MODE_FLDMODE;
+		} else if (format->field == V4L2_FIELD_BOTTOM) {
+			slv0 = 0x7FFF;
+			syn_mode |= ISPCCDC_SYN_MODE_FLDMODE;
+		}
+	}
+
 	isp_reg_writel(isp, (sph << ISPCCDC_HORZ_INFO_SPH_SHIFT) |
 		       (nph << ISPCCDC_HORZ_INFO_NPH_SHIFT),
 		       OMAP3_ISP_IOMEM_CCDC, ISPCCDC_HORZ_INFO);
-	isp_reg_writel(isp, (crop->top << ISPCCDC_VERT_START_SLV0_SHIFT) |
-		       (crop->top << ISPCCDC_VERT_START_SLV1_SHIFT),
+	isp_reg_writel(isp, (slv0 << ISPCCDC_VERT_START_SLV0_SHIFT) |
+		       (slv1 << ISPCCDC_VERT_START_SLV1_SHIFT),
 		       OMAP3_ISP_IOMEM_CCDC, ISPCCDC_VERT_START);
 	isp_reg_writel(isp, (crop->height - 1)
 			<< ISPCCDC_VERT_LINES_NLV_SHIFT,
@@ -2064,6 +2081,14 @@ ccdc_try_format(struct isp_ccdc_device *ccdc, struct v4l2_subdev_fh *fh,
 			fmt->height *= 2;
 		}
 
+		/* When input format is interlaced with alternating fields the
+		 * CCDC can pick out just the top or bottom field.
+		 */
+		 if (fmt->field == V4L2_FIELD_ALTERNATE &&
+		   (field == V4L2_FIELD_TOP ||
+		    field == V4L2_FIELD_BOTTOM))
+			fmt->field = field;
+
 		break;
 
 	case CCDC_PAD_SOURCE_VP:
diff --git a/drivers/media/platform/omap3isp/ispvideo.c b/drivers/media/platform/omap3isp/ispvideo.c
index bbbe55d..e636168 100644
--- a/drivers/media/platform/omap3isp/ispvideo.c
+++ b/drivers/media/platform/omap3isp/ispvideo.c
@@ -797,12 +797,12 @@ isp_video_set_format(struct file *file, void *fh, struct v4l2_format *format)
 		/* Fall-through */
 	case V4L2_FIELD_INTERLACED_TB:
 	case V4L2_FIELD_INTERLACED_BT:
+	case V4L2_FIELD_TOP:
+	case V4L2_FIELD_BOTTOM:
 		/* Interlaced orders are only supported at the CCDC output. */
 		if (video != &video->isp->isp_ccdc.video_out)
 			format->fmt.pix.field = V4L2_FIELD_NONE;
 		break;
-	case V4L2_FIELD_TOP:
-	case V4L2_FIELD_BOTTOM:
 	case V4L2_FIELD_SEQ_TB:
 	case V4L2_FIELD_SEQ_BT:
 	default:
-- 
2.0.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-14 10:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-20 20:32 [PATCH] OMAP3 ISP: Support top and bottom fields Tim Nordell
2015-04-13 20:39 ` Laurent Pinchart
2015-06-14 10:38   ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox