From patchwork Fri Sep 2 16:44:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 9311443 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2289760756 for ; Fri, 2 Sep 2016 16:47:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1521829817 for ; Fri, 2 Sep 2016 16:47:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 09EFC29819; Fri, 2 Sep 2016 16:47:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0A5629817 for ; Fri, 2 Sep 2016 16:47:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932983AbcIBQrL (ORCPT ); Fri, 2 Sep 2016 12:47:11 -0400 Received: from smtp-3.sys.kth.se ([130.237.48.192]:32890 "EHLO smtp-3.sys.kth.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932911AbcIBQqz (ORCPT ); Fri, 2 Sep 2016 12:46:55 -0400 Received: from smtp-3.sys.kth.se (localhost.localdomain [127.0.0.1]) by smtp-3.sys.kth.se (Postfix) with ESMTP id B72042BBA; Fri, 2 Sep 2016 18:46:53 +0200 (CEST) X-Virus-Scanned: by amavisd-new at kth.se Received: from smtp-3.sys.kth.se ([127.0.0.1]) by smtp-3.sys.kth.se (smtp-3.sys.kth.se [127.0.0.1]) (amavisd-new, port 10024) with LMTP id wLgQEcIgAfb5; Fri, 2 Sep 2016 18:46:52 +0200 (CEST) X-KTH-Auth: niso [89.233.230.99] X-KTH-mail-from: niklas.soderlund+renesas@ragnatech.se Received: from bismarck.berto.se (unknown [89.233.230.99]) by smtp-3.sys.kth.se (Postfix) with ESMTPSA id 9A5382BD5; Fri, 2 Sep 2016 18:46:52 +0200 (CEST) From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= To: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, sergei.shtylyov@cogentembedded.com, hans.verkuil@cisco.com Cc: slongerbeam@gmail.com, lars@metafoo.de, mchehab@kernel.org, =?UTF-8?q?Niklas=20S=C3=B6derlund?= Subject: [PATCHv3 2/6] media: rcar-vin: make V4L2_FIELD_INTERLACED standard dependent Date: Fri, 2 Sep 2016 18:44:57 +0200 Message-Id: <20160902164501.19535-3-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160902164501.19535-1-niklas.soderlund+renesas@ragnatech.se> References: <20160902164501.19535-1-niklas.soderlund+renesas@ragnatech.se> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The field V4L2_FIELD_INTERLACED is standard dependent and should not unconditionally be equivalent to V4L2_FIELD_INTERLACED_TB. This patch adds a check to see if the video standard can be obtained and if it's a 60 Hz format. If the condition is met V4L2_FIELD_INTERLACED is treated as V4L2_FIELD_INTERLACED_BT if not as V4L2_FIELD_INTERLACED_TB. Signed-off-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/rcar-dma.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c index 46abdb0..d57801b 100644 --- a/drivers/media/platform/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/rcar-vin/rcar-dma.c @@ -131,6 +131,7 @@ static u32 rvin_read(struct rvin_dev *vin, u32 offset) static int rvin_setup(struct rvin_dev *vin) { u32 vnmc, dmr, dmr2, interrupts; + v4l2_std_id std; bool progressive = false, output_is_yuv = false, input_is_yuv = false; switch (vin->format.field) { @@ -141,6 +142,14 @@ static int rvin_setup(struct rvin_dev *vin) vnmc = VNMC_IM_EVEN; break; case V4L2_FIELD_INTERLACED: + /* Default to TB */ + vnmc = VNMC_IM_FULL; + /* Use BT if video standard can be read and is 60 Hz format */ + if (!v4l2_subdev_call(vin_to_source(vin), video, g_std, &std)) { + if (std & V4L2_STD_525_60) + vnmc = VNMC_IM_FULL | VNMC_FOC; + } + break; case V4L2_FIELD_INTERLACED_TB: vnmc = VNMC_IM_FULL; break;