]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm: rcar-du: Store CMM device pointer instead of platform_device
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Mon, 23 Mar 2026 16:45:24 +0000 (18:45 +0200)
committerTomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Thu, 26 Mar 2026 13:16:24 +0000 (15:16 +0200)
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>
Link: https://patch.msgid.link/20260323164526.2292491-3-laurent.pinchart+renesas@ideasonboard.com
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
drivers/gpu/drm/renesas/rcar-du/rcar_cmm.c
drivers/gpu/drm/renesas/rcar-du/rcar_cmm.h
drivers/gpu/drm/renesas/rcar-du/rcar_du_crtc.h
drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.h
drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c

index 93ba115d654f90afd733df68125fb56a073e844b..5bced9d778e8d65a5c5608a30436653a617a2f0e 100644 (file)
@@ -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;
index 628072acc98b95d6f5711b30a269eaf36349417c..c420113430b90e59f099a3c39157582d740c1be6 100644 (file)
@@ -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;
index d0f38a8b35618166e23b371dcbd27b4c20ded285..07a40b305be82b30f187d7cf3aa78a547734ac7d 100644 (file)
@@ -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;
 
index 5cfa2bb7ad93dc2453a361934bb48406b1605a50..9e160dede4e62b338b60745a143d307272fd7775 100644 (file)
@@ -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];
index 60e6f43b8ab2f62a6744583e201699b760b9c1fe..f38e45d38ad23e0eb01a93bbb18785df3a1aefce 100644 (file)
@@ -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)