]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
media: rzg2l-cru: Add function pointer to configure CSI
authorLad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Fri, 11 Apr 2025 17:05:44 +0000 (19:05 +0200)
committerHans Verkuil <hverkuil@xs4all.nl>
Wed, 23 Apr 2025 08:55:54 +0000 (10:55 +0200)
Add a `csi_setup` function pointer to the `rzg2l_cru_info` structure and
pass it as part of the OF data. On RZ/G3E and RZ/V2H(P) SoCs, additional
register configurations are required compared to the RZ/G2L SoC.

Modify `rzg2l_cru_csi2_setup()` to be referenced through this function
pointer and update the code to use it accordingly.

This change is in preparation for adding 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-17-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 3b5de845331924cf2398e5efe428518312dfe22e..e0f04f7e19dfb354541d9f9111dd78bb33b3b875 100644 (file)
@@ -360,6 +360,7 @@ static const struct rzg2l_cru_info rzgl2_cru_info = {
        .enable_interrupts = rzg2l_cru_enable_interrupts,
        .disable_interrupts = rzg2l_cru_disable_interrupts,
        .fifo_empty = rzg2l_fifo_empty,
+       .csi_setup = rzg2l_cru_csi2_setup,
 };
 
 static const struct of_device_id rzg2l_cru_of_id_table[] = {
index 2e17bfef43ce6f3186a2dd7f88df8d129ff46b29..ccaba5220f1c8aac7348ddb4ffb2d23613b982dd 100644 (file)
@@ -89,6 +89,9 @@ struct rzg2l_cru_info {
        void (*enable_interrupts)(struct rzg2l_cru_dev *cru);
        void (*disable_interrupts)(struct rzg2l_cru_dev *cru);
        bool (*fifo_empty)(struct rzg2l_cru_dev *cru);
+       void (*csi_setup)(struct rzg2l_cru_dev *cru,
+                         const struct rzg2l_cru_ip_format *ip_fmt,
+                         u8 csi_vc);
 };
 
 /**
@@ -187,5 +190,8 @@ void rzg2l_cru_enable_interrupts(struct rzg2l_cru_dev *cru);
 void rzg2l_cru_disable_interrupts(struct rzg2l_cru_dev *cru);
 
 bool rzg2l_fifo_empty(struct rzg2l_cru_dev *cru);
+void rzg2l_cru_csi2_setup(struct rzg2l_cru_dev *cru,
+                         const struct rzg2l_cru_ip_format *ip_fmt,
+                         u8 csi_vc);
 
 #endif
index d35e9b2074937c05b4a3e175bfd83788fd1ce158..809c43d686e264817ced75f3a5a475aa7ebbbf2c 100644 (file)
@@ -242,9 +242,9 @@ static void rzg2l_cru_initialize_axi(struct rzg2l_cru_dev *cru)
        rzg2l_cru_write(cru, AMnAXIATTR, amnaxiattr);
 }
 
-static void rzg2l_cru_csi2_setup(struct rzg2l_cru_dev *cru,
-                                const struct rzg2l_cru_ip_format *ip_fmt,
-                                u8 csi_vc)
+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);
@@ -266,7 +266,7 @@ static int rzg2l_cru_initialize_image_conv(struct rzg2l_cru_dev *cru,
        const struct rzg2l_cru_ip_format *cru_ip_fmt;
 
        cru_ip_fmt = rzg2l_cru_ip_code_to_fmt(ip_sd_fmt->code);
-       rzg2l_cru_csi2_setup(cru, cru_ip_fmt, csi_vc);
+       info->csi_setup(cru, cru_ip_fmt, csi_vc);
 
        /* Output format */
        cru_video_fmt = rzg2l_cru_ip_format_to_fmt(cru->format.pixelformat);