mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] media: rcar-vin: Generate FRAME_SYNC events
Date: Sun, 15 Jun 2025 00:36:29 +0300	[thread overview]
Message-ID: <20250614213629.GN10542@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20250614141545.2860860-4-niklas.soderlund+renesas@ragnatech.se>

Hi Niklas,

Thank you for the patch.

On Sat, Jun 14, 2025 at 04:15:45PM +0200, Niklas Söderlund wrote:
> Enable the VSYNC Rising Edge Detection interrupt and generate a
> FRAME_SYNC event form it. The interrupt is available on all supported
> models of the VIN (Gen2, Gen3 and Gen4).
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

> ---
>  .../media/platform/renesas/rcar-vin/rcar-dma.c  | 17 +++++++++++++++++
>  .../media/platform/renesas/rcar-vin/rcar-v4l2.c |  2 ++
>  2 files changed, 19 insertions(+)
> 
> diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c
> index 85e44a00e0fc..a1ae9c9bccc7 100644
> --- a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c
> +++ b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c
> @@ -14,6 +14,7 @@
>  #include <linux/interrupt.h>
>  #include <linux/pm_runtime.h>
>  
> +#include <media/v4l2-event.h>
>  #include <media/videobuf2-dma-contig.h>
>  
>  #include "rcar-vin.h"
> @@ -115,10 +116,14 @@
>  #define VNFC_S_FRAME		(1 << 0)
>  
>  /* Video n Interrupt Enable Register bits */
> +#define VNIE_VFE		BIT(17)
> +#define VNIE_VRE		BIT(16)
>  #define VNIE_FIE		BIT(4)
>  #define VNIE_EFE		BIT(1)
>  
>  /* Video n Interrupt Status Register bits */
> +#define VNINTS_VFS		BIT(17)
> +#define VNINTS_VRS		BIT(16)
>  #define VNINTS_FIS		BIT(4)
>  #define VNINTS_EFS		BIT(1)
>  
> @@ -898,6 +903,8 @@ static int rvin_setup(struct rvin_dev *vin)
>  
>  	/* Progressive or interlaced mode */
>  	interrupts = progressive ? VNIE_FIE : VNIE_EFE;
> +	/* Enable VSYNC Rising Edge Detection. */
> +	interrupts |= VNIE_VRE;
>  
>  	/* Ack interrupts */
>  	rvin_write(vin, interrupts, VNINTS_REG);
> @@ -1049,6 +1056,16 @@ static irqreturn_t rvin_irq(int irq, void *data)
>  	rvin_write(vin, status, VNINTS_REG);
>  	handled = 1;
>  
> +	/* Signal Start of Frame. */
> +	if (status & VNINTS_VRS) {
> +		struct v4l2_event event = {
> +			.type = V4L2_EVENT_FRAME_SYNC,
> +			.u.frame_sync.frame_sequence = vin->sequence,
> +		};
> +
> +		v4l2_event_queue(&vin->vdev, &event);
> +	}
> +
>  	/* Nothing to do if nothing was captured. */
>  	capture = vin->format.field == V4L2_FIELD_NONE ||
>  		vin->format.field == V4L2_FIELD_ALTERNATE ?
> diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-v4l2.c b/drivers/media/platform/renesas/rcar-vin/rcar-v4l2.c
> index db091af57c19..6339de54b02b 100644
> --- a/drivers/media/platform/renesas/rcar-vin/rcar-v4l2.c
> +++ b/drivers/media/platform/renesas/rcar-vin/rcar-v4l2.c
> @@ -734,6 +734,8 @@ static int rvin_subscribe_event(struct v4l2_fh *fh,
>  				const struct v4l2_event_subscription *sub)
>  {
>  	switch (sub->type) {
> +	case V4L2_EVENT_FRAME_SYNC:
> +		return v4l2_event_subscribe(fh, sub, 2, NULL);
>  	case V4L2_EVENT_SOURCE_CHANGE:
>  		return v4l2_event_subscribe(fh, sub, 4, NULL);
>  	}

-- 
Regards,

Laurent Pinchart

      reply	other threads:[~2025-06-14 21:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-14 14:15 [PATCH 0/3] " Niklas Söderlund
2025-06-14 14:15 ` [PATCH 1/3] media: rcar-vin: Fold interrupt helpers into only callers Niklas Söderlund
2025-06-14 21:23   ` Laurent Pinchart
2025-06-15 12:48     ` Niklas Söderlund
2025-06-16 18:28       ` Laurent Pinchart
2025-06-16  7:02   ` Geert Uytterhoeven
2025-06-14 14:15 ` [PATCH 2/3] media: rcar-vin: Check for correct capture interrupt event Niklas Söderlund
2025-06-14 21:32   ` Laurent Pinchart
2025-06-15 12:47     ` Niklas Söderlund
2025-06-16 18:25       ` Laurent Pinchart
2025-06-14 14:15 ` [PATCH 3/3] media: rcar-vin: Generate FRAME_SYNC events Niklas Söderlund
2025-06-14 21:36   ` Laurent Pinchart [this message]

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=20250614213629.GN10542@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=geert+renesas@glider.be \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    --cc=sakari.ailus@linux.intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®