]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
media: rzg2l-cru: Add image_conv offset to OF data
authorLad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Fri, 11 Apr 2025 17:05:41 +0000 (19:05 +0200)
committerHans Verkuil <hverkuil@xs4all.nl>
Wed, 23 Apr 2025 08:55:53 +0000 (10:55 +0200)
Add `image_conv` field to the `rzg2l_cru_info` structure to store the
register offset for image conversion control. RZ/G2L uses `ICnMC`, while
RZ/G3E and RZ/V2H(P) use `ICnIPMC_C0`.

Update `rzg2l_cru_initialize_image_conv()` and `rzg2l_cru_csi2_setup()`
to use this `image_conv` offset from the OF data, facilitating future
support for RZ/G3E and RZ/V2H(P) SoCs.

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Link: https://lore.kernel.org/r/20250411170624.472257-14-tommaso.merciai.xr@bp.renesas.com
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c
drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h
drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c

index e179f8d29038f09e0ae11ad7f1386bd526996c1e..e7fef7f3f8223cf8063579ba5312b321f5093b68 100644 (file)
@@ -354,6 +354,7 @@ static const u16 rzg2l_cru_regs[] = {
 static const struct rzg2l_cru_info rzgl2_cru_info = {
        .max_width = 2800,
        .max_height = 4095,
+       .image_conv = ICnMC,
        .regs = rzg2l_cru_regs,
 };
 
index 6a621073948aa84eaa1e2dc4fdd199e9345dc0f8..ca156772b949b0eb544e5919e4965a0b5409fb7b 100644 (file)
@@ -81,6 +81,7 @@ struct rzg2l_cru_ip_format {
 struct rzg2l_cru_info {
        unsigned int max_width;
        unsigned int max_height;
+       u16 image_conv;
        const u16 *regs;
 };
 
index 395c4d3d0f0faaf79563098b6c4e6a03bff9b9fe..95cce250b3272021cb3f4f9504f6a60eeae145fd 100644 (file)
@@ -246,20 +246,22 @@ static void rzg2l_cru_csi2_setup(struct rzg2l_cru_dev *cru,
                                 const struct rzg2l_cru_ip_format *ip_fmt,
                                 u8 csi_vc)
 {
+       const struct rzg2l_cru_info *info = cru->info;
        u32 icnmc = ICnMC_INF(ip_fmt->datatype);
 
-       icnmc |= (rzg2l_cru_read(cru, ICnMC) & ~ICnMC_INF_MASK);
+       icnmc |= rzg2l_cru_read(cru, info->image_conv) & ~ICnMC_INF_MASK;
 
        /* Set virtual channel CSI2 */
        icnmc |= ICnMC_VCSEL(csi_vc);
 
-       rzg2l_cru_write(cru, ICnMC, icnmc);
+       rzg2l_cru_write(cru, info->image_conv, icnmc);
 }
 
 static int rzg2l_cru_initialize_image_conv(struct rzg2l_cru_dev *cru,
                                           struct v4l2_mbus_framefmt *ip_sd_fmt,
                                           u8 csi_vc)
 {
+       const struct rzg2l_cru_info *info = cru->info;
        const struct rzg2l_cru_ip_format *cru_video_fmt;
        const struct rzg2l_cru_ip_format *cru_ip_fmt;
 
@@ -276,11 +278,11 @@ static int rzg2l_cru_initialize_image_conv(struct rzg2l_cru_dev *cru,
 
        /* If input and output use same colorspace, do bypass mode */
        if (cru_ip_fmt->yuv == cru_video_fmt->yuv)
-               rzg2l_cru_write(cru, ICnMC,
-                               rzg2l_cru_read(cru, ICnMC) | ICnMC_CSCTHR);
+               rzg2l_cru_write(cru, info->image_conv,
+                               rzg2l_cru_read(cru, info->image_conv) | ICnMC_CSCTHR);
        else
-               rzg2l_cru_write(cru, ICnMC,
-                               rzg2l_cru_read(cru, ICnMC) & (~ICnMC_CSCTHR));
+               rzg2l_cru_write(cru, info->image_conv,
+                               rzg2l_cru_read(cru, info->image_conv) & ~ICnMC_CSCTHR);
 
        /* Set output data format */
        rzg2l_cru_write(cru, ICnDMR, cru_video_fmt->icndmr);