* [PATCH] media: rzg2l-cru: Drop function pointer to configure CSI
@ 2025-08-01 5:34 Biju
2025-08-01 8:00 ` Tommaso Merciai
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Biju @ 2025-08-01 5:34 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Biju Das, Laurent Pinchart, Hans Verkuil, Lad Prabhakar,
Tommaso Merciai, Uwe Kleine-König, Daniel Scally,
linux-media, linux-kernel, Geert Uytterhoeven, Biju Das,
linux-renesas-soc
From: Biju Das <biju.das.jz@bp.renesas.com>
Drop function pointer to configure CSI to avoid code duplication
by checking the presence of vc select register in rzg2l_cru_info.
After this change, limit the scope of the rzg2l_cru_csi2_setup()
to static.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
.../platform/renesas/rzg2l-cru/rzg2l-core.c | 2 --
.../platform/renesas/rzg2l-cru/rzg2l-cru.h | 9 ------
.../platform/renesas/rzg2l-cru/rzg2l-video.c | 30 ++++++-------------
3 files changed, 9 insertions(+), 32 deletions(-)
diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c
index 806acc8f9728..3c5fbd857371 100644
--- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c
+++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c
@@ -367,7 +367,6 @@ static const struct rzg2l_cru_info rzg3e_cru_info = {
.enable_interrupts = rzg3e_cru_enable_interrupts,
.disable_interrupts = rzg3e_cru_disable_interrupts,
.fifo_empty = rzg3e_fifo_empty,
- .csi_setup = rzg3e_cru_csi2_setup,
};
static const u16 rzg2l_cru_regs[] = {
@@ -412,7 +411,6 @@ static const struct rzg2l_cru_info rzg2l_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[] = {
diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h
index be95b41c37df..3a200db15730 100644
--- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h
+++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h
@@ -92,9 +92,6 @@ 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);
};
/**
@@ -204,11 +201,5 @@ void rzg3e_cru_disable_interrupts(struct rzg2l_cru_dev *cru);
bool rzg2l_fifo_empty(struct rzg2l_cru_dev *cru);
bool rzg3e_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);
-void rzg3e_cru_csi2_setup(struct rzg2l_cru_dev *cru,
- const struct rzg2l_cru_ip_format *ip_fmt,
- u8 csi_vc);
#endif
diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
index a8817a7066b2..d75cd5fa9f7c 100644
--- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
+++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
@@ -257,30 +257,18 @@ static void rzg2l_cru_initialize_axi(struct rzg2l_cru_dev *cru)
rzg2l_cru_write(cru, AMnAXIATTR, amnaxiattr);
}
-void rzg3e_cru_csi2_setup(struct rzg2l_cru_dev *cru,
- const struct rzg2l_cru_ip_format *ip_fmt,
- u8 csi_vc)
+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, info->image_conv) & ~ICnMC_INF_MASK;
-
- /* Set virtual channel CSI2 */
- icnmc |= ICnMC_VCSEL(csi_vc);
-
- rzg2l_cru_write(cru, ICnSVCNUM, csi_vc);
- rzg2l_cru_write(cru, ICnSVC, ICnSVC_SVC0(0) | ICnSVC_SVC1(1) |
- ICnSVC_SVC2(2) | ICnSVC_SVC3(3));
- rzg2l_cru_write(cru, info->image_conv, icnmc);
-}
-
-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);
+ if (cru->info->regs[ICnSVC]) {
+ rzg2l_cru_write(cru, ICnSVCNUM, csi_vc);
+ rzg2l_cru_write(cru, ICnSVC, ICnSVC_SVC0(0) | ICnSVC_SVC1(1) |
+ ICnSVC_SVC2(2) | ICnSVC_SVC3(3));
+ }
icnmc |= rzg2l_cru_read(cru, info->image_conv) & ~ICnMC_INF_MASK;
@@ -299,7 +287,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);
- info->csi_setup(cru, cru_ip_fmt, csi_vc);
+ rzg2l_cru_csi2_setup(cru, cru_ip_fmt, csi_vc);
/* Output format */
cru_video_fmt = rzg2l_cru_ip_format_to_fmt(cru->format.pixelformat);
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] media: rzg2l-cru: Drop function pointer to configure CSI
2025-08-01 5:34 [PATCH] media: rzg2l-cru: Drop function pointer to configure CSI Biju
@ 2025-08-01 8:00 ` Tommaso Merciai
2025-08-04 9:48 ` Lad, Prabhakar
2025-08-04 21:43 ` Laurent Pinchart
2 siblings, 0 replies; 4+ messages in thread
From: Tommaso Merciai @ 2025-08-01 8:00 UTC (permalink / raw)
To: Biju
Cc: Mauro Carvalho Chehab, Biju Das, Laurent Pinchart, Hans Verkuil,
Lad Prabhakar, Uwe Kleine-König, Daniel Scally, linux-media,
linux-kernel, Geert Uytterhoeven, linux-renesas-soc
Hi Biju,
Thanks for your patch.
Tested on RZ/G3E using ov5645 image sensor.
On Fri, Aug 01, 2025 at 06:34:22AM +0100, Biju wrote:
> From: Biju Das <biju.das.jz@bp.renesas.com>
>
> Drop function pointer to configure CSI to avoid code duplication
> by checking the presence of vc select register in rzg2l_cru_info.
> After this change, limit the scope of the rzg2l_cru_csi2_setup()
> to static.
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Tested-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Reviewed-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
> ---
> .../platform/renesas/rzg2l-cru/rzg2l-core.c | 2 --
> .../platform/renesas/rzg2l-cru/rzg2l-cru.h | 9 ------
> .../platform/renesas/rzg2l-cru/rzg2l-video.c | 30 ++++++-------------
> 3 files changed, 9 insertions(+), 32 deletions(-)
>
> diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c
> index 806acc8f9728..3c5fbd857371 100644
> --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c
> +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c
> @@ -367,7 +367,6 @@ static const struct rzg2l_cru_info rzg3e_cru_info = {
> .enable_interrupts = rzg3e_cru_enable_interrupts,
> .disable_interrupts = rzg3e_cru_disable_interrupts,
> .fifo_empty = rzg3e_fifo_empty,
> - .csi_setup = rzg3e_cru_csi2_setup,
> };
>
> static const u16 rzg2l_cru_regs[] = {
> @@ -412,7 +411,6 @@ static const struct rzg2l_cru_info rzg2l_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[] = {
> diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h
> index be95b41c37df..3a200db15730 100644
> --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h
> +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h
> @@ -92,9 +92,6 @@ 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);
> };
>
> /**
> @@ -204,11 +201,5 @@ void rzg3e_cru_disable_interrupts(struct rzg2l_cru_dev *cru);
>
> bool rzg2l_fifo_empty(struct rzg2l_cru_dev *cru);
> bool rzg3e_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);
> -void rzg3e_cru_csi2_setup(struct rzg2l_cru_dev *cru,
> - const struct rzg2l_cru_ip_format *ip_fmt,
> - u8 csi_vc);
>
> #endif
> diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> index a8817a7066b2..d75cd5fa9f7c 100644
> --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> @@ -257,30 +257,18 @@ static void rzg2l_cru_initialize_axi(struct rzg2l_cru_dev *cru)
> rzg2l_cru_write(cru, AMnAXIATTR, amnaxiattr);
> }
>
> -void rzg3e_cru_csi2_setup(struct rzg2l_cru_dev *cru,
> - const struct rzg2l_cru_ip_format *ip_fmt,
> - u8 csi_vc)
> +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, info->image_conv) & ~ICnMC_INF_MASK;
> -
> - /* Set virtual channel CSI2 */
> - icnmc |= ICnMC_VCSEL(csi_vc);
> -
> - rzg2l_cru_write(cru, ICnSVCNUM, csi_vc);
> - rzg2l_cru_write(cru, ICnSVC, ICnSVC_SVC0(0) | ICnSVC_SVC1(1) |
> - ICnSVC_SVC2(2) | ICnSVC_SVC3(3));
> - rzg2l_cru_write(cru, info->image_conv, icnmc);
> -}
> -
> -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);
> + if (cru->info->regs[ICnSVC]) {
> + rzg2l_cru_write(cru, ICnSVCNUM, csi_vc);
> + rzg2l_cru_write(cru, ICnSVC, ICnSVC_SVC0(0) | ICnSVC_SVC1(1) |
> + ICnSVC_SVC2(2) | ICnSVC_SVC3(3));
> + }
>
> icnmc |= rzg2l_cru_read(cru, info->image_conv) & ~ICnMC_INF_MASK;
>
> @@ -299,7 +287,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);
> - info->csi_setup(cru, cru_ip_fmt, csi_vc);
> + rzg2l_cru_csi2_setup(cru, cru_ip_fmt, csi_vc);
>
> /* Output format */
> cru_video_fmt = rzg2l_cru_ip_format_to_fmt(cru->format.pixelformat);
> --
> 2.43.0
>
>
Thanks & Regards,
Tommaso
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] media: rzg2l-cru: Drop function pointer to configure CSI
2025-08-01 5:34 [PATCH] media: rzg2l-cru: Drop function pointer to configure CSI Biju
2025-08-01 8:00 ` Tommaso Merciai
@ 2025-08-04 9:48 ` Lad, Prabhakar
2025-08-04 21:43 ` Laurent Pinchart
2 siblings, 0 replies; 4+ messages in thread
From: Lad, Prabhakar @ 2025-08-04 9:48 UTC (permalink / raw)
To: Biju
Cc: Mauro Carvalho Chehab, Biju Das, Laurent Pinchart, Hans Verkuil,
Lad Prabhakar, Tommaso Merciai, Uwe Kleine-König,
Daniel Scally, linux-media, linux-kernel, Geert Uytterhoeven,
linux-renesas-soc
On Fri, Aug 1, 2025 at 6:34 AM Biju <biju.das.au@gmail.com> wrote:
>
> From: Biju Das <biju.das.jz@bp.renesas.com>
>
> Drop function pointer to configure CSI to avoid code duplication
> by checking the presence of vc select register in rzg2l_cru_info.
> After this change, limit the scope of the rzg2l_cru_csi2_setup()
> to static.
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> .../platform/renesas/rzg2l-cru/rzg2l-core.c | 2 --
> .../platform/renesas/rzg2l-cru/rzg2l-cru.h | 9 ------
> .../platform/renesas/rzg2l-cru/rzg2l-video.c | 30 ++++++-------------
> 3 files changed, 9 insertions(+), 32 deletions(-)
>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Cheers,
Prabhakar
> diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c
> index 806acc8f9728..3c5fbd857371 100644
> --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c
> +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c
> @@ -367,7 +367,6 @@ static const struct rzg2l_cru_info rzg3e_cru_info = {
> .enable_interrupts = rzg3e_cru_enable_interrupts,
> .disable_interrupts = rzg3e_cru_disable_interrupts,
> .fifo_empty = rzg3e_fifo_empty,
> - .csi_setup = rzg3e_cru_csi2_setup,
> };
>
> static const u16 rzg2l_cru_regs[] = {
> @@ -412,7 +411,6 @@ static const struct rzg2l_cru_info rzg2l_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[] = {
> diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h
> index be95b41c37df..3a200db15730 100644
> --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h
> +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h
> @@ -92,9 +92,6 @@ 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);
> };
>
> /**
> @@ -204,11 +201,5 @@ void rzg3e_cru_disable_interrupts(struct rzg2l_cru_dev *cru);
>
> bool rzg2l_fifo_empty(struct rzg2l_cru_dev *cru);
> bool rzg3e_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);
> -void rzg3e_cru_csi2_setup(struct rzg2l_cru_dev *cru,
> - const struct rzg2l_cru_ip_format *ip_fmt,
> - u8 csi_vc);
>
> #endif
> diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> index a8817a7066b2..d75cd5fa9f7c 100644
> --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> @@ -257,30 +257,18 @@ static void rzg2l_cru_initialize_axi(struct rzg2l_cru_dev *cru)
> rzg2l_cru_write(cru, AMnAXIATTR, amnaxiattr);
> }
>
> -void rzg3e_cru_csi2_setup(struct rzg2l_cru_dev *cru,
> - const struct rzg2l_cru_ip_format *ip_fmt,
> - u8 csi_vc)
> +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, info->image_conv) & ~ICnMC_INF_MASK;
> -
> - /* Set virtual channel CSI2 */
> - icnmc |= ICnMC_VCSEL(csi_vc);
> -
> - rzg2l_cru_write(cru, ICnSVCNUM, csi_vc);
> - rzg2l_cru_write(cru, ICnSVC, ICnSVC_SVC0(0) | ICnSVC_SVC1(1) |
> - ICnSVC_SVC2(2) | ICnSVC_SVC3(3));
> - rzg2l_cru_write(cru, info->image_conv, icnmc);
> -}
> -
> -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);
> + if (cru->info->regs[ICnSVC]) {
> + rzg2l_cru_write(cru, ICnSVCNUM, csi_vc);
> + rzg2l_cru_write(cru, ICnSVC, ICnSVC_SVC0(0) | ICnSVC_SVC1(1) |
> + ICnSVC_SVC2(2) | ICnSVC_SVC3(3));
> + }
>
> icnmc |= rzg2l_cru_read(cru, info->image_conv) & ~ICnMC_INF_MASK;
>
> @@ -299,7 +287,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);
> - info->csi_setup(cru, cru_ip_fmt, csi_vc);
> + rzg2l_cru_csi2_setup(cru, cru_ip_fmt, csi_vc);
>
> /* Output format */
> cru_video_fmt = rzg2l_cru_ip_format_to_fmt(cru->format.pixelformat);
> --
> 2.43.0
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] media: rzg2l-cru: Drop function pointer to configure CSI
2025-08-01 5:34 [PATCH] media: rzg2l-cru: Drop function pointer to configure CSI Biju
2025-08-01 8:00 ` Tommaso Merciai
2025-08-04 9:48 ` Lad, Prabhakar
@ 2025-08-04 21:43 ` Laurent Pinchart
2 siblings, 0 replies; 4+ messages in thread
From: Laurent Pinchart @ 2025-08-04 21:43 UTC (permalink / raw)
To: Biju
Cc: Mauro Carvalho Chehab, Biju Das, Hans Verkuil, Lad Prabhakar,
Tommaso Merciai, Uwe Kleine-König, Daniel Scally,
linux-media, linux-kernel, Geert Uytterhoeven, linux-renesas-soc
On Fri, Aug 01, 2025 at 06:34:22AM +0100, Biju wrote:
> From: Biju Das <biju.das.jz@bp.renesas.com>
>
> Drop function pointer to configure CSI to avoid code duplication
> by checking the presence of vc select register in rzg2l_cru_info.
> After this change, limit the scope of the rzg2l_cru_csi2_setup()
> to static.
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
> .../platform/renesas/rzg2l-cru/rzg2l-core.c | 2 --
> .../platform/renesas/rzg2l-cru/rzg2l-cru.h | 9 ------
> .../platform/renesas/rzg2l-cru/rzg2l-video.c | 30 ++++++-------------
> 3 files changed, 9 insertions(+), 32 deletions(-)
>
> diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c
> index 806acc8f9728..3c5fbd857371 100644
> --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c
> +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c
> @@ -367,7 +367,6 @@ static const struct rzg2l_cru_info rzg3e_cru_info = {
> .enable_interrupts = rzg3e_cru_enable_interrupts,
> .disable_interrupts = rzg3e_cru_disable_interrupts,
> .fifo_empty = rzg3e_fifo_empty,
> - .csi_setup = rzg3e_cru_csi2_setup,
> };
>
> static const u16 rzg2l_cru_regs[] = {
> @@ -412,7 +411,6 @@ static const struct rzg2l_cru_info rzg2l_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[] = {
> diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h
> index be95b41c37df..3a200db15730 100644
> --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h
> +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h
> @@ -92,9 +92,6 @@ 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);
> };
>
> /**
> @@ -204,11 +201,5 @@ void rzg3e_cru_disable_interrupts(struct rzg2l_cru_dev *cru);
>
> bool rzg2l_fifo_empty(struct rzg2l_cru_dev *cru);
> bool rzg3e_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);
> -void rzg3e_cru_csi2_setup(struct rzg2l_cru_dev *cru,
> - const struct rzg2l_cru_ip_format *ip_fmt,
> - u8 csi_vc);
>
> #endif
> diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> index a8817a7066b2..d75cd5fa9f7c 100644
> --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> @@ -257,30 +257,18 @@ static void rzg2l_cru_initialize_axi(struct rzg2l_cru_dev *cru)
> rzg2l_cru_write(cru, AMnAXIATTR, amnaxiattr);
> }
>
> -void rzg3e_cru_csi2_setup(struct rzg2l_cru_dev *cru,
> - const struct rzg2l_cru_ip_format *ip_fmt,
> - u8 csi_vc)
> +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, info->image_conv) & ~ICnMC_INF_MASK;
> -
> - /* Set virtual channel CSI2 */
> - icnmc |= ICnMC_VCSEL(csi_vc);
> -
> - rzg2l_cru_write(cru, ICnSVCNUM, csi_vc);
> - rzg2l_cru_write(cru, ICnSVC, ICnSVC_SVC0(0) | ICnSVC_SVC1(1) |
> - ICnSVC_SVC2(2) | ICnSVC_SVC3(3));
> - rzg2l_cru_write(cru, info->image_conv, icnmc);
> -}
> -
> -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);
> + if (cru->info->regs[ICnSVC]) {
> + rzg2l_cru_write(cru, ICnSVCNUM, csi_vc);
> + rzg2l_cru_write(cru, ICnSVC, ICnSVC_SVC0(0) | ICnSVC_SVC1(1) |
> + ICnSVC_SVC2(2) | ICnSVC_SVC3(3));
> + }
>
> icnmc |= rzg2l_cru_read(cru, info->image_conv) & ~ICnMC_INF_MASK;
>
> @@ -299,7 +287,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);
> - info->csi_setup(cru, cru_ip_fmt, csi_vc);
> + rzg2l_cru_csi2_setup(cru, cru_ip_fmt, csi_vc);
>
> /* Output format */
> cru_video_fmt = rzg2l_cru_ip_format_to_fmt(cru->format.pixelformat);
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-08-04 21:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-01 5:34 [PATCH] media: rzg2l-cru: Drop function pointer to configure CSI Biju
2025-08-01 8:00 ` Tommaso Merciai
2025-08-04 9:48 ` Lad, Prabhakar
2025-08-04 21:43 ` Laurent Pinchart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).