Message ID | 20250324-rcar-fix-raw-v1-0-ae56c1c7a2f6@ideasonboard.com |
---|---|
Headers | show |
Series | media: rcar: Fix RAW formats | expand |
Hi Tomi, Thanks for your work. On 2025-03-24 13:48:52 +0200, Tomi Valkeinen wrote: > Currently Gen4 VINs are marked as RCAN_GEN3 models. Add a new enum > value, RCAR_GEN4, and use it for Gen4 VINs. No functional changes in > this patch. > > Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Tested-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> > --- > drivers/media/platform/renesas/rcar-vin/rcar-core.c | 2 +- > drivers/media/platform/renesas/rcar-vin/rcar-dma.c | 8 ++++---- > drivers/media/platform/renesas/rcar-vin/rcar-vin.h | 1 + > 3 files changed, 6 insertions(+), 5 deletions(-) > > diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-core.c b/drivers/media/platform/renesas/rcar-vin/rcar-core.c > index ddfb18e6e7a4..88989c5fe636 100644 > --- a/drivers/media/platform/renesas/rcar-vin/rcar-core.c > +++ b/drivers/media/platform/renesas/rcar-vin/rcar-core.c > @@ -1275,7 +1275,7 @@ static const struct rvin_info rcar_info_r8a77995 = { > }; > > static const struct rvin_info rcar_info_gen4 = { > - .model = RCAR_GEN3, > + .model = RCAR_GEN4, > .use_mc = true, > .use_isp = true, > .nv12 = true, > diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c > index 8de871240440..972ae2cb3314 100644 > --- a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c > +++ b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c > @@ -803,7 +803,7 @@ static int rvin_setup(struct rvin_dev *vin) > } > > /* Make sure input interface and input format is valid. */ > - if (vin->info->model == RCAR_GEN3) { > + if (vin->info->model == RCAR_GEN3 || vin->info->model == RCAR_GEN4) { > switch (vnmc & VNMC_INF_MASK) { > case VNMC_INF_YUV8_BT656: > case VNMC_INF_YUV10_BT656: > @@ -826,7 +826,7 @@ static int rvin_setup(struct rvin_dev *vin) > } > > /* Enable VSYNC Field Toggle mode after one VSYNC input */ > - if (vin->info->model == RCAR_GEN3) > + if (vin->info->model == RCAR_GEN3 || vin->info->model == RCAR_GEN4) > dmr2 = VNDMR2_FTEV; > else > dmr2 = VNDMR2_FTEV | VNDMR2_VLV(1); > @@ -926,7 +926,7 @@ static int rvin_setup(struct rvin_dev *vin) > if (input_is_yuv == output_is_yuv) > vnmc |= VNMC_BPS; > > - if (vin->info->model == RCAR_GEN3) { > + if (vin->info->model == RCAR_GEN3 || vin->info->model == RCAR_GEN4) { > /* Select between CSI-2 and parallel input */ > if (vin->is_csi) > vnmc &= ~VNMC_DPINE; > @@ -1351,7 +1351,7 @@ static int rvin_mc_validate_format(struct rvin_dev *vin, struct v4l2_subdev *sd, > > if (rvin_scaler_needed(vin)) { > /* Gen3 can't scale NV12 */ > - if (vin->info->model == RCAR_GEN3 && > + if ((vin->info->model == RCAR_GEN3 || vin->info->model == RCAR_GEN4) && > vin->format.pixelformat == V4L2_PIX_FMT_NV12) > return -EPIPE; > > diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-vin.h b/drivers/media/platform/renesas/rcar-vin/rcar-vin.h > index f87d4bc9e53e..34bbd1343bf6 100644 > --- a/drivers/media/platform/renesas/rcar-vin/rcar-vin.h > +++ b/drivers/media/platform/renesas/rcar-vin/rcar-vin.h > @@ -39,6 +39,7 @@ enum model_id { > RCAR_M1, > RCAR_GEN2, > RCAR_GEN3, > + RCAR_GEN4, > }; > > enum rvin_csi_id { > > -- > 2.43.0 >
Hi Tomi, Thanks for your patch. On 2025-03-24 13:48:53 +0200, Tomi Valkeinen wrote: > On Gen4 we need to set VNMC's EXINF to a different value (1) than in > Gen3 (0). Add a define for this, and set the bit for Gen4. > > Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com> > --- > drivers/media/platform/renesas/rcar-vin/rcar-dma.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c > index 972ae2cb3314..53046614f7a1 100644 > --- a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c > +++ b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c > @@ -94,6 +94,7 @@ > #define VNMC_INF_YUV16 (5 << 16) > #define VNMC_INF_RGB888 (6 << 16) > #define VNMC_INF_RGB666 (7 << 16) > +#define VNMC_EXINF_RAW8 (1 << 12) /* Gen4 specific */ > #define VNMC_VUP (1 << 10) > #define VNMC_IM_ODD (0 << 3) > #define VNMC_IM_ODD_EVEN (1 << 3) > @@ -791,6 +792,8 @@ static int rvin_setup(struct rvin_dev *vin) > case MEDIA_BUS_FMT_SRGGB8_1X8: > case MEDIA_BUS_FMT_Y8_1X8: > vnmc |= VNMC_INF_RAW8; > + if (vin->info->model == RCAR_GEN4) > + vnmc |= VNMC_EXINF_RAW8; This is a partial fix for RAW8, but more was needed to capture it correctly. But that issue covers more then just RAW8, I will send a proper patch to fix that. For this patch, Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Tested-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> > break; > case MEDIA_BUS_FMT_SBGGR10_1X10: > case MEDIA_BUS_FMT_SGBRG10_1X10: > > -- > 2.43.0 >
Fix RAW8 and RAW10 formats. These are taken from the previously sent "[PATCH 00/18] media: rcar: Streams support" series. I can only test these with multi-stream setup, which requires a big pile of patches on top, so these are not really tested in upstream. Tomi Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com> --- Tomi Valkeinen (3): media: rcar-vin: Add RCAR_GEN4 model value media: rcar-vin: Fix RAW8 media: rcar-vin: Fix RAW10 drivers/media/platform/renesas/rcar-vin/rcar-core.c | 2 +- drivers/media/platform/renesas/rcar-vin/rcar-dma.c | 20 ++++++++++++++------ drivers/media/platform/renesas/rcar-vin/rcar-v4l2.c | 8 ++++---- drivers/media/platform/renesas/rcar-vin/rcar-vin.h | 1 + 4 files changed, 20 insertions(+), 11 deletions(-) --- base-commit: f2151613e040973c868d28c8b00885dfab69eb75 change-id: 20250324-rcar-fix-raw-c7967ff85d3e Best regards,