From patchwork Fri Mar 20 20:32:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Nordell X-Patchwork-Id: 28916 X-Patchwork-Delegate: laurent.pinchart@ideasonboard.com Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1YZ3bE-0000xT-Mt; Fri, 20 Mar 2015 21:32:56 +0100 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.76/mailfrontend-7) with esmtp id 1YZ3bB-0000AE-3B; Fri, 20 Mar 2015 21:32:56 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751642AbbCTUcv (ORCPT + 1 other); Fri, 20 Mar 2015 16:32:51 -0400 Received: from smtp.logicpd.com ([174.46.170.145]:38051 "HELO smtp.logicpd.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751641AbbCTUcv (ORCPT ); Fri, 20 Mar 2015 16:32:51 -0400 X-ASG-Debug-ID: 1426883569-083a4f2516140a40001-rVgMWv Received: from EDPR-MAIL01.logicpd.com (edpr-mail01.logicpd.com [10.1.18.127]) by smtp.logicpd.com with ESMTP id 0aK6nRcjWYbruJhQ (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 20 Mar 2015 15:32:49 -0500 (CDT) X-Barracuda-Envelope-From: tim.nordell@logicpd.com Received: from mplswks572_linux.logicpd.com (10.0.5.78) by EDPR-MAIL01.logicpd.com (10.1.18.127) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Fri, 20 Mar 2015 15:32:48 -0500 From: Tim Nordell To: CC: , , Tim Nordell Subject: [PATCH] OMAP3 ISP: Support top and bottom fields Date: Fri, 20 Mar 2015 15:32:20 -0500 X-ASG-Orig-Subj: [PATCH] OMAP3 ISP: Support top and bottom fields Message-ID: <1426883540-19936-1-git-send-email-tim.nordell@logicpd.com> X-Mailer: git-send-email 2.0.4 MIME-Version: 1.0 X-Originating-IP: [10.0.5.78] X-ClientProxiedBy: EDPR-MAIL01.logicpd.com (10.1.18.127) To EDPR-MAIL01.logicpd.com (10.1.18.127) X-Barracuda-Connect: edpr-mail01.logicpd.com[10.1.18.127] X-Barracuda-Start-Time: 1426883569 X-Barracuda-Encrypted: ECDHE-RSA-AES256-SHA X-Barracuda-URL: https://edpr-cuda.logicpd.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at logicpd.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests=BSF_SC0_MISMATCH_TO X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.16951 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.00 BSF_SC0_MISMATCH_TO Envelope rcpt doesn't match header Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2015.3.20.202423 X-PMX-Spam: Gauge=IIIIIIIII, Probability=9%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, MSGID_ADDED_BY_MTA 0.05, BODY_SIZE_3000_3999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DATE_TZ_NA 0, URI_ENDS_IN_HTML 0, WEBMAIL_SOURCE 0, WEBMAIL_XOIP 0, WEBMAIL_X_IP_HDR 0, __ANY_URI 0, __CP_MEDIA_BODY 0, __CP_URI_IN_BODY 0, __CT 0, __CT_TEXT_PLAIN 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_XOIP 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MULTIPLE_RCPTS_CC_X2 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' 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 --- 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: