On Mon Jun 16 20:57:21 2025 +0200, Niklas Söderlund wrote: > Depending on if the capture session deals with fields or whole frames > interrupts can be generated at an end of field, or end of frame event. > The interrupt mask is setup to generate an interrupt on one of the two > events depending on what is needed when the VIN is started. The end of > field bit is set in both cases so controlling the mask that generates an > interrupt have been enough to control the two use-cases. > > Before extending the interrupt handler to deal with other types of > interrupt events it is needs to extended to "capture complete" check for > correct the use-case in operation. Without this the simplification in > the handler can result in corrupted frames when the mask on what type of > events can generate an interrupt generated can no longer be assumed to > only be an "capture complete" event. > > Which bit is checked matches which bit is enabled at configuration time > as which event can generate an interrupt for "capture complete". There > is no functional change. > > While at it switch to use the BIT() macro to describe the bit positions > for the interrupt functions. > > Signed-off-by: Niklas Söderlund <niklas.soderlund+rene...@ragnatech.se> > Reviewed-by: Laurent Pinchart <laurent.pinchart+rene...@ideasonboard.com> > Link: > https://lore.kernel.org/r/20250616185722.980722-3-niklas.soderlund+rene...@ragnatech.se > Signed-off-by: Laurent Pinchart <laurent.pinch...@ideasonboard.com> > Signed-off-by: Hans Verkuil <hverk...@xs4all.nl>
Patch committed. Thanks, Hans Verkuil drivers/media/platform/renesas/rcar-vin/rcar-dma.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) --- diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c index e1dae46b06d4..19ff190f0fb2 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c @@ -114,11 +114,12 @@ #define VNFC_S_FRAME (1 << 0) /* Video n Interrupt Enable Register bits */ -#define VNIE_FIE (1 << 4) -#define VNIE_EFE (1 << 1) +#define VNIE_FIE BIT(4) +#define VNIE_EFE BIT(1) /* Video n Interrupt Status Register bits */ -#define VNINTS_FIS (1 << 4) +#define VNINTS_FIS BIT(4) +#define VNINTS_EFS BIT(1) /* Video n Data Mode Register bits */ #define VNDMR_A8BIT(n) (((n) & 0xff) << 24) @@ -1025,7 +1026,7 @@ static void rvin_capture_stop(struct rvin_dev *vin) static irqreturn_t rvin_irq(int irq, void *data) { struct rvin_dev *vin = data; - u32 status, vnms; + u32 capture, status, vnms; int slot; unsigned int handled = 0; unsigned long flags; @@ -1040,7 +1041,10 @@ static irqreturn_t rvin_irq(int irq, void *data) handled = 1; /* Nothing to do if nothing was captured. */ - if (!(status & VNINTS_FIS)) + capture = vin->format.field == V4L2_FIELD_NONE || + vin->format.field == V4L2_FIELD_ALTERNATE ? + VNINTS_FIS : VNINTS_EFS; + if (!(status & capture)) goto done; /* Nothing to do if not running. */