mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Biju Das <biju.das.jz@bp.renesas.com>
To: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>,
	Tommaso Merciai <tomm.merciai@gmail.com>,
	Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>
Cc: "linux-renesas-soc@vger.kernel.org"
	<linux-renesas-soc@vger.kernel.org>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	"magnus.damm" <magnus.damm@gmail.com>,
	Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v10 08/12] drm: renesas: rz-du: Separate the DU instance from the DRM device
Date: Mon, 23 Nov 2026 16:59:32 +0000	[thread overview]
Message-ID: <OS3PR01MB65968FEBCB08429F11188CE986452@OS3PR01MB6596.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <68fcf838eee14c1906f23b2b7c74c560793cd1d4.1794502191.git.tommaso.merciai.xr@bp.renesas.com>

Hi Tommaso,

> -----Original Message-----
> From: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
> Sent: 13 November 2026 12:20
> Subject: [PATCH v10 08/12] drm: renesas: rz-du: Separate the DU instance from the DRM device
> 
> On RZ/G3E two DU instances share a DRM device, which can only be created once both instances have been
> probed.
> 
> Split the DU device structure: keep the match data and the registers in a structure allocated with the
> platform device, and allocate the KMS objects with the DRM device in a new rzg2l_du_instance_init()
> helper, as they are released with it.
> 
> No functional change intended.
> 
> Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
> ---
> v9->v10:
>  - New patch.
> 
>  drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c | 61 ++++++++++++++------
>  1 file changed, 44 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c b/drivers/gpu/drm/renesas/rz-
> du/rzg2l_du_drv.c
> index d3cccbdf9012..d102876c07e1 100644
> --- a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c
> +++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c
> @@ -162,6 +162,27 @@ static int rzg2l_du_pm_resume(struct device *dev)  static
> DEFINE_SIMPLE_DEV_PM_OPS(rzg2l_du_pm_ops,
>  				rzg2l_du_pm_suspend, rzg2l_du_pm_resume);
> 
> +/*
> +-----------------------------------------------------------------------
> +------
> + * DU instance
> + */
> +
> +static int rzg2l_du_instance_init(struct rzg2l_du_device *du,
> +				  struct drm_device *ddev)
> +{
> +	struct rzg2l_du_device *rcdu;
> +
> +	rcdu = drmm_kzalloc(ddev, sizeof(*rcdu), GFP_KERNEL);
> +	if (!rcdu)
> +		return -ENOMEM;

Why there is duplicate allocation of rcdu? One in probe() and here

Cheers,
Biju

> +
> +	rcdu->dev = du->dev;
> +	rcdu->info = du->info;
> +	rcdu->mmio = du->mmio;
> +	rcdu->ddev = ddev;
> +
> +	return rzg2l_du_modeset_init_du(rcdu); }
> +
>  /* -----------------------------------------------------------------------------
>   * Platform driver
>   */
> @@ -190,44 +211,48 @@ static void rzg2l_du_shutdown(struct platform_device *pdev)
> 
>  static int rzg2l_du_probe(struct platform_device *pdev)  {
> +	const struct rzg2l_du_device_info *info;
>  	struct rzg2l_du_device *rcdu;
>  	struct rzg2l_du_drm *rzgdrm;
> +	void __iomem *mmio;
>  	int ret;
> 
>  	if (drm_firmware_drivers_only())
>  		return -ENODEV;
> 
> -	/* Allocate and initialize the RZ/G2L device structure. */
> -	rzgdrm = devm_drm_dev_alloc(&pdev->dev, &rzg2l_du_driver,
> -				    struct rzg2l_du_drm, ddev);
> -	if (IS_ERR(rzgdrm))
> -		return PTR_ERR(rzgdrm);
> +	info = of_device_get_match_data(&pdev->dev);
> +
> +	/* I/O resources */
> +	mmio = devm_platform_ioremap_resource(pdev, 0);
> +	if (IS_ERR(mmio))
> +		return PTR_ERR(mmio);
> +
> +	ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> +	if (ret)
> +		return ret;
> 
> -	rcdu = drmm_kzalloc(&rzgdrm->ddev, sizeof(*rcdu), GFP_KERNEL);
> +	/* Allocate and initialize the RZ/G2L device structure. */
> +	rcdu = devm_kzalloc(&pdev->dev, sizeof(*rcdu), GFP_KERNEL);
>  	if (!rcdu)
>  		return -ENOMEM;
> 
>  	platform_set_drvdata(pdev, rcdu);
> 
>  	rcdu->dev = &pdev->dev;
> -	rcdu->info = of_device_get_match_data(rcdu->dev);
> -	rcdu->ddev = &rzgdrm->ddev;
> -
> -	/* I/O resources */
> -	rcdu->mmio = devm_platform_ioremap_resource(pdev, 0);
> -	if (IS_ERR(rcdu->mmio))
> -		return PTR_ERR(rcdu->mmio);
> +	rcdu->info = info;
> +	rcdu->mmio = mmio;
> 
> -	ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
> -	if (ret)
> -		return ret;
> +	rzgdrm = devm_drm_dev_alloc(&pdev->dev, &rzg2l_du_driver,
> +				    struct rzg2l_du_drm, ddev);
> +	if (IS_ERR(rzgdrm))
> +		return PTR_ERR(rzgdrm);
> 
>  	/* DRM/KMS objects */
>  	ret = rzg2l_du_modeset_init_drm(&rzgdrm->ddev);
>  	if (ret < 0)
>  		goto error;
> 
> -	ret = rzg2l_du_modeset_init_du(rcdu);
> +	ret = rzg2l_du_instance_init(rcdu, &rzgdrm->ddev);
>  	if (ret < 0)
>  		goto error;
> 
> @@ -243,6 +268,8 @@ static int rzg2l_du_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto error_fini;
> 
> +	rcdu->ddev = &rzgdrm->ddev;
> +
>  	drm_info(&rzgdrm->ddev, "Device %s probed\n", dev_name(&pdev->dev));
> 
>  	drm_client_setup(&rzgdrm->ddev, NULL);
> --
> 2.54.0


  reply	other threads:[~2026-11-23 16:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 12:19 [PATCH v10 00/12] drm: renesas: rz-du: Add RZ/G3E support Tommaso Merciai
2026-11-13 12:19 ` [PATCH v10 01/12] dt-bindings: display: renesas,rzg2l-du: Add support for RZ/G3E SoC Tommaso Merciai
2026-11-13 12:19 ` [PATCH v10 02/12] drm: renesas: rz-du: vsp: Keep the planes in the VSP Tommaso Merciai
2026-11-18 14:09   ` Biju Das
2026-11-18 18:08     ` Tommaso Merciai
2026-11-13 12:19 ` [PATCH v10 03/12] drm: renesas: rz-du: Reference the DRM device by pointer Tommaso Merciai
2026-11-23 15:55   ` Biju Das
2026-11-13 12:20 ` [PATCH v10 04/12] drm: renesas: rz-du: Count all registered encoders for the possible clones Tommaso Merciai
2026-11-23 16:16   ` Biju Das
2026-11-13 12:20 ` [PATCH v10 05/12] drm: renesas: rz-du: Split the mode setting initialization Tommaso Merciai
2026-11-23 16:31   ` Biju Das
2026-11-13 12:20 ` [PATCH v10 06/12] drm: renesas: rz-du: Make the CRTC index relative to the DRM device Tommaso Merciai
2026-11-23 16:37   ` Biju Das
2026-11-13 12:20 ` [PATCH v10 07/12] drm: renesas: rz-du: Share the encoder of an output driven by several DUs Tommaso Merciai
2026-11-23 16:44   ` Biju Das
2026-11-13 12:20 ` [PATCH v10 08/12] drm: renesas: rz-du: Separate the DU instance from the DRM device Tommaso Merciai
2026-11-23 16:59   ` Biju Das [this message]
2026-11-13 12:20 ` [PATCH v10 09/12] drm: renesas: rz-du: Move the DRM device initialization to helpers Tommaso Merciai
2026-11-13 12:20 ` [PATCH v10 10/12] drm: renesas: rz-du: Support several DU instances in one DRM device Tommaso Merciai
2026-11-13 12:20 ` [PATCH v10 11/12] drm: renesas: rz-du: Add RZ/G3E (R9A09G047) DU support Tommaso Merciai
2026-11-13 12:20 ` [PATCH v10 12/12] arm64: dts: renesas: r9a09g047: Add DU{0,1} nodes Tommaso Merciai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=OS3PR01MB65968FEBCB08429F11188CE986452@OS3PR01MB6596.jpnprd01.prod.outlook.com \
    --to=biju.das.jz@bp.renesas.com \
    --cc=airlied@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=geert+renesas@glider.be \
    --cc=krzk+dt@kernel.org \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=magnus.damm@gmail.com \
    --cc=mripard@kernel.org \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=robh@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tomm.merciai@gmail.com \
    --cc=tommaso.merciai.xr@bp.renesas.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®