[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250223195643.GB15344@pendragon.ideasonboard.com>
Date: Sun, 23 Feb 2025 21:56:43 +0200
From: Laurent Pinchart <laurent.pinchart@...asonboard.com>
To: Tommaso Merciai <tommaso.merciai.xr@...renesas.com>
Cc: tomm.merciai@...il.com, linux-renesas-soc@...r.kernel.org,
linux-media@...r.kernel.org, biju.das.jz@...renesas.com,
prabhakar.mahadev-lad.rj@...renesas.com,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Magnus Damm <magnus.damm@...il.com>,
Hans Verkuil <hverkuil@...all.nl>,
Uwe Kleine-König <u.kleine-koenig@...libre.com>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 15/18] media: rzg2l-cru: Add function pointers to
enable and disable interrupts
Hi Tommaso,
Thank you for the patch.
On Fri, Feb 21, 2025 at 04:55:29PM +0100, Tommaso Merciai wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>
>
> Add `enable_interrupts` and `disable_interrupts` function pointers to the
> `rzg2l_cru_info` structure and pass them as part of the OF data. This
> prepares for supporting RZ/G3E and RZ/V2H(P) SoCs, which require different
> interrupt configurations.
>
> Implement `rzg2l_cru_enable_interrupts()` and
> `rzg2l_cru_disable_interrupts()` functions and update the code to use them
> instead of directly writing to interrupt registers.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>
> Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@...renesas.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@...asonboard.com>
You could squash this with 14/18 though.
> ---
> .../platform/renesas/rzg2l-cru/rzg2l-core.c | 2 ++
> .../platform/renesas/rzg2l-cru/rzg2l-cru.h | 7 +++++++
> .../platform/renesas/rzg2l-cru/rzg2l-video.c | 19 ++++++++++++++-----
> 3 files changed, 23 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c
> index 510e55496e8e..302f792cb415 100644
> --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c
> +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-core.c
> @@ -360,6 +360,8 @@ static const struct rzg2l_cru_info rzgl2_cru_info = {
> .image_conv = ICnMC,
> .regs = rzg2l_cru_regs,
> .irq_handler = rzg2l_cru_irq,
> + .enable_interrupts = rzg2l_cru_enable_interrupts,
> + .disable_interrupts = rzg2l_cru_disable_interrupts,
> };
>
> 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 32bea35c8c1f..3f694044d8cd 100644
> --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h
> +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h
> @@ -34,6 +34,8 @@ enum rzg2l_csi2_pads {
> RZG2L_CRU_IP_SOURCE,
> };
>
> +struct rzg2l_cru_dev;
> +
> /**
> * enum rzg2l_cru_dma_state - DMA states
> * @RZG2L_CRU_DMA_STOPPED: No operation in progress
> @@ -84,6 +86,8 @@ struct rzg2l_cru_info {
> u16 image_conv;
> const u16 *regs;
> irqreturn_t (*irq_handler)(int irq, void *data);
> + void (*enable_interrupts)(struct rzg2l_cru_dev *cru);
> + void (*disable_interrupts)(struct rzg2l_cru_dev *cru);
> };
>
> /**
> @@ -178,4 +182,7 @@ const struct rzg2l_cru_ip_format *rzg2l_cru_ip_code_to_fmt(unsigned int code);
> const struct rzg2l_cru_ip_format *rzg2l_cru_ip_format_to_fmt(u32 format);
> const struct rzg2l_cru_ip_format *rzg2l_cru_ip_index_to_fmt(u32 index);
>
> +void rzg2l_cru_enable_interrupts(struct rzg2l_cru_dev *cru);
> +void rzg2l_cru_disable_interrupts(struct rzg2l_cru_dev *cru);
> +
> #endif
> diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> index 022da19dd88a..5ffa3173af62 100644
> --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c
> @@ -254,8 +254,7 @@ void rzg2l_cru_stop_image_processing(struct rzg2l_cru_dev *cru)
> spin_lock_irqsave(&cru->qlock, flags);
>
> /* Disable and clear the interrupt */
> - rzg2l_cru_write(cru, CRUnIE, 0);
> - rzg2l_cru_write(cru, CRUnINTS, 0x001F0F0F);
> + cru->info->disable_interrupts(cru);
>
> /* Stop the operation of image conversion */
> rzg2l_cru_write(cru, ICnEN, 0);
> @@ -347,6 +346,17 @@ static int rzg2l_cru_get_virtual_channel(struct rzg2l_cru_dev *cru)
> return fd.entry[0].bus.csi2.vc;
> }
>
> +void rzg2l_cru_enable_interrupts(struct rzg2l_cru_dev *cru)
> +{
> + rzg2l_cru_write(cru, CRUnIE, CRUnIE_EFE);
> +}
> +
> +void rzg2l_cru_disable_interrupts(struct rzg2l_cru_dev *cru)
> +{
> + rzg2l_cru_write(cru, CRUnIE, 0);
> + rzg2l_cru_write(cru, CRUnINTS, 0x001f000f);
> +}
> +
> int rzg2l_cru_start_image_processing(struct rzg2l_cru_dev *cru)
> {
> struct v4l2_mbus_framefmt *fmt = rzg2l_cru_ip_get_src_fmt(cru);
> @@ -368,8 +378,7 @@ int rzg2l_cru_start_image_processing(struct rzg2l_cru_dev *cru)
> rzg2l_cru_write(cru, CRUnRST, CRUnRST_VRESETN);
>
> /* Disable and clear the interrupt before using */
> - rzg2l_cru_write(cru, CRUnIE, 0);
> - rzg2l_cru_write(cru, CRUnINTS, 0x001f000f);
> + cru->info->disable_interrupts(cru);
>
> /* Initialize the AXI master */
> rzg2l_cru_initialize_axi(cru);
> @@ -382,7 +391,7 @@ int rzg2l_cru_start_image_processing(struct rzg2l_cru_dev *cru)
> }
>
> /* Enable interrupt */
> - rzg2l_cru_write(cru, CRUnIE, CRUnIE_EFE);
> + cru->info->enable_interrupts(cru);
>
> /* Enable image processing reception */
> rzg2l_cru_write(cru, ICnEN, ICnEN_ICEN);
--
Regards,
Laurent Pinchart
Powered by blists - more mailing lists