All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacopo Mondi <jacopo+renesas@jmondi.org>
To: niklas.soderlund@ragnatech.se, laurent.pinchart@ideasonboard.com
Cc: Jacopo Mondi <jacopo+renesas@jmondi.org>,
	linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: [PATCH 5/5] media: rcar-vin: Use FTEV for digital input
Date: Fri, 11 May 2018 11:59:41 +0200	[thread overview]
Message-ID: <1526032781-14319-6-git-send-email-jacopo+renesas@jmondi.org> (raw)
In-Reply-To: <1526032781-14319-1-git-send-email-jacopo+renesas@jmondi.org>

Since commit (015060cb "media: rcar-vin: enable field toggle after a set
number of lines for Gen3) the VIN generates an internal field signal
toggle after a fixed number of received lines, and uses the internal
field signal to drive capture operations. When capturing from digital
input, using FTEH driven field signal toggling messes up the received
image sizes. Fall back to use FTEV driven signal toggling when capturing
from digital input.

As explained in the comment, this disables buffer overflow protection
for digital input capture, for which the FOE overflow might be used in
future.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
 drivers/media/platform/rcar-vin/rcar-dma.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c
index ea7a120..8dc3455 100644
--- a/drivers/media/platform/rcar-vin/rcar-dma.c
+++ b/drivers/media/platform/rcar-vin/rcar-dma.c
@@ -685,11 +685,27 @@ static int rvin_setup(struct rvin_dev *vin)
 		break;
 	}
 
-	if (vin->info->model == RCAR_GEN3) {
+	if (vin->info->model == RCAR_GEN3 &&
+	    vin->mbus_cfg.type == V4L2_MBUS_CSI2) {
 		/* Enable HSYNC Field Toggle mode after height HSYNC inputs. */
 		lines = vin->format.height / (halfsize ? 2 : 1);
 		dmr2 = VNDMR2_FTEH | VNDMR2_HLV(lines);
 		vin_dbg(vin, "Field Toogle after %u lines\n", lines);
+	} else if (vin->info->model == RCAR_GEN3 &&
+		   vin->mbus_cfg.type == V4L2_MBUS_PARALLEL) {
+		/*
+		 * FIXME
+		 * Section 26.3.17 specifies that for digital input there's no
+		 * need to program FTEH or FTEV to generate internal
+		 * field toggle signal to driver capture. Although when
+		 * running on GEN3 with digital input no EFE interrupt is ever
+		 * generated, and we need to rely on FTEV driven field signal
+		 * toggling, as using FTEH as in the CSI-2 case, messes up
+		 * the output image size. This implies no protection
+		 * against buffer overflow is in place for Gen3 digital input
+		 * capture.
+		 */
+		dmr2 = VNDMR2_FTEV;
 	} else {
 		/* Enable VSYNC Field Toogle mode after one VSYNC input. */
 		dmr2 = VNDMR2_FTEV | VNDMR2_VLV(1);
-- 
2.7.4

  parent reply	other threads:[~2018-05-11  9:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-11  9:59 [PATCH 0/5] rcar-vin: Add support for digital input on Gen3 Jacopo Mondi
2018-05-11  9:59 ` [PATCH 1/5] media: rcar-vin: Add support for R-Car R8A77995 SoC Jacopo Mondi
2018-05-11 10:44   ` Niklas Söderlund
2018-05-11 10:44     ` Niklas Söderlund
2018-05-14  2:46   ` Laurent Pinchart
2018-05-11  9:59 ` [PATCH 2/5] media: rcar-vin: Add digital input subdevice parsing Jacopo Mondi
2018-05-11 11:01   ` Niklas Söderlund
2018-05-11 11:01     ` Niklas Söderlund
2018-05-14  8:06     ` jacopo mondi
2018-05-11  9:59 ` [PATCH 3/5] media: rcar-vin: [un]bind and link digital subdevice Jacopo Mondi
2018-05-11  9:59 ` [PATCH 4/5] media: rcar-vin: Do not use crop if not configured Jacopo Mondi
2018-05-11 11:10   ` Niklas Söderlund
2018-05-11 11:10     ` Niklas Söderlund
2018-05-11 11:34     ` Niklas Söderlund
2018-05-11 11:34       ` Niklas Söderlund
2018-05-11  9:59 ` Jacopo Mondi [this message]
2018-05-11 10:28   ` [PATCH 5/5] media: rcar-vin: Use FTEV for digital input Hans Verkuil
2018-05-11 14:53     ` jacopo mondi
2018-05-12  9:32   ` Sergei Shtylyov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1526032781-14319-6-git-send-email-jacopo+renesas@jmondi.org \
    --to=jacopo+renesas@jmondi.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=niklas.soderlund@ragnatech.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.