From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
To: dri-devel@lists.freedesktop.org
Cc: linux-renesas-soc@vger.kernel.org,
Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>,
Biju Das <biju.das.jz@bp.renesas.com>
Subject: [PATCH v2 2/4] drm: rcar-du: Store CMM device pointer instead of platform_device
Date: Mon, 23 Mar 2026 18:45:24 +0200 [thread overview]
Message-ID: <20260323164526.2292491-3-laurent.pinchart+renesas@ideasonboard.com> (raw)
In-Reply-To: <20260323164526.2292491-1-laurent.pinchart+renesas@ideasonboard.com>
The DU driver stores the CMM devices as pointers to struct
platform_device, and passes them to the API exposed by the CMM driver.
This is similar to how the VSP is handled, except that the VSP uses
struct device pointers. Replace the CMM platform_device pointers with
device pointers for consistency.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
Changes since v1:
- Renamed function arguments from pdev to dev
---
drivers/gpu/drm/renesas/rcar-du/rcar_cmm.c | 26 +++++++++----------
drivers/gpu/drm/renesas/rcar-du/rcar_cmm.h | 18 ++++++-------
.../gpu/drm/renesas/rcar-du/rcar_du_crtc.h | 2 +-
drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.h | 2 +-
drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c | 6 ++---
5 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_cmm.c b/drivers/gpu/drm/renesas/rcar-du/rcar_cmm.c
index 93ba115d654f..5bced9d778e8 100644
--- a/drivers/gpu/drm/renesas/rcar-du/rcar_cmm.c
+++ b/drivers/gpu/drm/renesas/rcar-du/rcar_cmm.c
@@ -59,7 +59,7 @@ static void rcar_cmm_lut_write(struct rcar_cmm *rcmm,
/*
* rcar_cmm_setup() - Configure the CMM unit
- * @pdev: The platform device associated with the CMM instance
+ * @dev: The device associated with the CMM instance
* @config: The CMM unit configuration
*
* Configure the CMM unit with the given configuration. Currently enabling,
@@ -73,10 +73,10 @@ static void rcar_cmm_lut_write(struct rcar_cmm *rcmm,
* TODO: Add support for LUT double buffer operations to avoid updating the
* LUT table entries while a frame is being displayed.
*/
-int rcar_cmm_setup(struct platform_device *pdev,
+int rcar_cmm_setup(struct device *dev,
const struct rcar_cmm_config *config)
{
- struct rcar_cmm *rcmm = platform_get_drvdata(pdev);
+ struct rcar_cmm *rcmm = dev_get_drvdata(dev);
/* Disable LUT if no table is provided. */
if (!config->lut.table) {
@@ -102,7 +102,7 @@ EXPORT_SYMBOL_GPL(rcar_cmm_setup);
/*
* rcar_cmm_enable() - Enable the CMM unit
- * @pdev: The platform device associated with the CMM instance
+ * @dev: The device associated with the CMM instance
*
* When the output of the corresponding DU channel is routed to the CMM unit,
* the unit shall be enabled before the DU channel is started, and remain
@@ -113,11 +113,11 @@ EXPORT_SYMBOL_GPL(rcar_cmm_setup);
* It is an error to attempt to enable an already enabled CMM unit, or to
* attempt to disable a disabled unit.
*/
-int rcar_cmm_enable(struct platform_device *pdev)
+int rcar_cmm_enable(struct device *dev)
{
int ret;
- ret = pm_runtime_resume_and_get(&pdev->dev);
+ ret = pm_runtime_resume_and_get(dev);
if (ret < 0)
return ret;
@@ -127,7 +127,7 @@ EXPORT_SYMBOL_GPL(rcar_cmm_enable);
/*
* rcar_cmm_disable() - Disable the CMM unit
- * @pdev: The platform device associated with the CMM instance
+ * @dev: The device associated with the CMM instance
*
* See rcar_cmm_enable() for usage information.
*
@@ -135,27 +135,27 @@ EXPORT_SYMBOL_GPL(rcar_cmm_enable);
* state shall thus be restored with rcar_cmm_setup() when re-enabling the CMM
* unit after the next rcar_cmm_enable() call.
*/
-void rcar_cmm_disable(struct platform_device *pdev)
+void rcar_cmm_disable(struct device *dev)
{
- struct rcar_cmm *rcmm = platform_get_drvdata(pdev);
+ struct rcar_cmm *rcmm = dev_get_drvdata(dev);
rcar_cmm_write(rcmm, CM2_LUT_CTRL, 0);
rcmm->lut.enabled = false;
- pm_runtime_put(&pdev->dev);
+ pm_runtime_put(dev);
}
EXPORT_SYMBOL_GPL(rcar_cmm_disable);
/*
* rcar_cmm_init() - Initialize the CMM unit
- * @pdev: The platform device associated with the CMM instance
+ * @dev: The device associated with the CMM instance
*
* Return: 0 on success, -EPROBE_DEFER if the CMM is not available yet,
* -ENODEV if the DRM_RCAR_CMM config option is disabled
*/
-int rcar_cmm_init(struct platform_device *pdev)
+int rcar_cmm_init(struct device *dev)
{
- struct rcar_cmm *rcmm = platform_get_drvdata(pdev);
+ struct rcar_cmm *rcmm = dev_get_drvdata(dev);
if (!rcmm)
return -EPROBE_DEFER;
diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_cmm.h b/drivers/gpu/drm/renesas/rcar-du/rcar_cmm.h
index 628072acc98b..c420113430b9 100644
--- a/drivers/gpu/drm/renesas/rcar-du/rcar_cmm.h
+++ b/drivers/gpu/drm/renesas/rcar-du/rcar_cmm.h
@@ -10,8 +10,8 @@
#define CM2_LUT_SIZE 256
+struct device;
struct drm_color_lut;
-struct platform_device;
/**
* struct rcar_cmm_config - CMM configuration
@@ -26,29 +26,29 @@ struct rcar_cmm_config {
};
#if IS_ENABLED(CONFIG_DRM_RCAR_CMM)
-int rcar_cmm_init(struct platform_device *pdev);
+int rcar_cmm_init(struct device *dev);
-int rcar_cmm_enable(struct platform_device *pdev);
-void rcar_cmm_disable(struct platform_device *pdev);
+int rcar_cmm_enable(struct device *dev);
+void rcar_cmm_disable(struct device *dev);
-int rcar_cmm_setup(struct platform_device *pdev,
+int rcar_cmm_setup(struct device *dev,
const struct rcar_cmm_config *config);
#else
-static inline int rcar_cmm_init(struct platform_device *pdev)
+static inline int rcar_cmm_init(struct device *dev)
{
return -ENODEV;
}
-static inline int rcar_cmm_enable(struct platform_device *pdev)
+static inline int rcar_cmm_enable(struct device *dev)
{
return 0;
}
-static inline void rcar_cmm_disable(struct platform_device *pdev)
+static inline void rcar_cmm_disable(struct device *dev)
{
}
-static inline int rcar_cmm_setup(struct platform_device *pdev,
+static inline int rcar_cmm_setup(struct device *dev,
const struct rcar_cmm_config *config)
{
return 0;
diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_du_crtc.h b/drivers/gpu/drm/renesas/rcar-du/rcar_du_crtc.h
index d0f38a8b3561..07a40b305be8 100644
--- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_crtc.h
+++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_crtc.h
@@ -65,7 +65,7 @@ struct rcar_du_crtc {
unsigned int vblank_count;
struct rcar_du_group *group;
- struct platform_device *cmm;
+ struct device *cmm;
struct rcar_du_vsp *vsp;
unsigned int vsp_pipe;
diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.h b/drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.h
index 5cfa2bb7ad93..9e160dede4e6 100644
--- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.h
+++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.h
@@ -106,7 +106,7 @@ struct rcar_du_device {
unsigned int num_crtcs;
struct rcar_du_group groups[RCAR_DU_MAX_GROUPS];
- struct platform_device *cmms[RCAR_DU_MAX_CRTCS];
+ struct device *cmms[RCAR_DU_MAX_CRTCS];
struct rcar_du_vsp vsps[RCAR_DU_MAX_VSPS];
struct drm_bridge *lvds[RCAR_DU_MAX_LVDS];
struct drm_bridge *dsi[RCAR_DU_MAX_DSI];
diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c
index 60e6f43b8ab2..f38e45d38ad2 100644
--- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c
+++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c
@@ -806,13 +806,13 @@ static int rcar_du_cmm_init(struct rcar_du_device *rcdu)
* -ENODEV is used to report that the CMM config option is
* disabled: return 0 and let the DU continue probing.
*/
- ret = rcar_cmm_init(pdev);
+ ret = rcar_cmm_init(&pdev->dev);
if (ret) {
platform_device_put(pdev);
return ret == -ENODEV ? 0 : ret;
}
- rcdu->cmms[i] = pdev;
+ rcdu->cmms[i] = &pdev->dev;
/*
* Enforce suspend/resume ordering by making the CMM a provider
@@ -835,7 +835,7 @@ static void rcar_du_modeset_cleanup(struct drm_device *dev, void *res)
unsigned int i;
for (i = 0; i < ARRAY_SIZE(rcdu->cmms); ++i)
- platform_device_put(rcdu->cmms[i]);
+ put_device(rcdu->cmms[i]);
}
int rcar_du_modeset_init(struct rcar_du_device *rcdu)
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2026-03-23 16:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 16:45 [PATCH v2 0/4] drm: rcar-du: Improve device_link handling Laurent Pinchart
2026-03-23 16:45 ` [PATCH v2 1/4] drm: rcar-du: Ensure correct suspend/resume ordering with VSP Laurent Pinchart
2026-03-24 21:42 ` Claude review: " Claude Code Review Bot
2026-03-23 16:45 ` Laurent Pinchart [this message]
2026-03-24 21:42 ` Claude review: drm: rcar-du: Store CMM device pointer instead of platform_device Claude Code Review Bot
2026-03-23 16:45 ` [PATCH v2 3/4] drm: rcar-du: Use __free() to simplify device_node handling Laurent Pinchart
2026-03-24 21:42 ` Claude review: " Claude Code Review Bot
2026-03-23 16:45 ` [PATCH v2 4/4] drm: rcar-du: Don't leak device_link to CMM Laurent Pinchart
2026-03-24 21:42 ` Claude review: " Claude Code Review Bot
2026-03-24 21:42 ` Claude review: drm: rcar-du: Improve device_link handling Claude Code Review Bot
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=20260323164526.2292491-3-laurent.pinchart+renesas@ideasonboard.com \
--to=laurent.pinchart+renesas@ideasonboard.com \
--cc=biju.das.jz@bp.renesas.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=tomi.valkeinen@ideasonboard.com \
--cc=tommaso.merciai.xr@bp.renesas.com \
/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