Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm: rcar-du: Store CMM device pointer instead of platform_device

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>

authored by

Laurent Pinchart and committed by
Tomi Valkeinen
0f6f28c8 db5be3a7

+27 -27
+13 -13
drivers/gpu/drm/renesas/rcar-du/rcar_cmm.c
··· 59 59 60 60 /* 61 61 * rcar_cmm_setup() - Configure the CMM unit 62 - * @pdev: The platform device associated with the CMM instance 62 + * @dev: The device associated with the CMM instance 63 63 * @config: The CMM unit configuration 64 64 * 65 65 * Configure the CMM unit with the given configuration. Currently enabling, ··· 73 73 * TODO: Add support for LUT double buffer operations to avoid updating the 74 74 * LUT table entries while a frame is being displayed. 75 75 */ 76 - int rcar_cmm_setup(struct platform_device *pdev, 76 + int rcar_cmm_setup(struct device *dev, 77 77 const struct rcar_cmm_config *config) 78 78 { 79 - struct rcar_cmm *rcmm = platform_get_drvdata(pdev); 79 + struct rcar_cmm *rcmm = dev_get_drvdata(dev); 80 80 81 81 /* Disable LUT if no table is provided. */ 82 82 if (!config->lut.table) { ··· 102 102 103 103 /* 104 104 * rcar_cmm_enable() - Enable the CMM unit 105 - * @pdev: The platform device associated with the CMM instance 105 + * @dev: The device associated with the CMM instance 106 106 * 107 107 * When the output of the corresponding DU channel is routed to the CMM unit, 108 108 * the unit shall be enabled before the DU channel is started, and remain ··· 113 113 * It is an error to attempt to enable an already enabled CMM unit, or to 114 114 * attempt to disable a disabled unit. 115 115 */ 116 - int rcar_cmm_enable(struct platform_device *pdev) 116 + int rcar_cmm_enable(struct device *dev) 117 117 { 118 118 int ret; 119 119 120 - ret = pm_runtime_resume_and_get(&pdev->dev); 120 + ret = pm_runtime_resume_and_get(dev); 121 121 if (ret < 0) 122 122 return ret; 123 123 ··· 127 127 128 128 /* 129 129 * rcar_cmm_disable() - Disable the CMM unit 130 - * @pdev: The platform device associated with the CMM instance 130 + * @dev: The device associated with the CMM instance 131 131 * 132 132 * See rcar_cmm_enable() for usage information. 133 133 * ··· 135 135 * state shall thus be restored with rcar_cmm_setup() when re-enabling the CMM 136 136 * unit after the next rcar_cmm_enable() call. 137 137 */ 138 - void rcar_cmm_disable(struct platform_device *pdev) 138 + void rcar_cmm_disable(struct device *dev) 139 139 { 140 - struct rcar_cmm *rcmm = platform_get_drvdata(pdev); 140 + struct rcar_cmm *rcmm = dev_get_drvdata(dev); 141 141 142 142 rcar_cmm_write(rcmm, CM2_LUT_CTRL, 0); 143 143 rcmm->lut.enabled = false; 144 144 145 - pm_runtime_put(&pdev->dev); 145 + pm_runtime_put(dev); 146 146 } 147 147 EXPORT_SYMBOL_GPL(rcar_cmm_disable); 148 148 149 149 /* 150 150 * rcar_cmm_init() - Initialize the CMM unit 151 - * @pdev: The platform device associated with the CMM instance 151 + * @dev: The device associated with the CMM instance 152 152 * 153 153 * Return: 0 on success, -EPROBE_DEFER if the CMM is not available yet, 154 154 * -ENODEV if the DRM_RCAR_CMM config option is disabled 155 155 */ 156 - int rcar_cmm_init(struct platform_device *pdev) 156 + int rcar_cmm_init(struct device *dev) 157 157 { 158 - struct rcar_cmm *rcmm = platform_get_drvdata(pdev); 158 + struct rcar_cmm *rcmm = dev_get_drvdata(dev); 159 159 160 160 if (!rcmm) 161 161 return -EPROBE_DEFER;
+9 -9
drivers/gpu/drm/renesas/rcar-du/rcar_cmm.h
··· 10 10 11 11 #define CM2_LUT_SIZE 256 12 12 13 + struct device; 13 14 struct drm_color_lut; 14 - struct platform_device; 15 15 16 16 /** 17 17 * struct rcar_cmm_config - CMM configuration ··· 26 26 }; 27 27 28 28 #if IS_ENABLED(CONFIG_DRM_RCAR_CMM) 29 - int rcar_cmm_init(struct platform_device *pdev); 29 + int rcar_cmm_init(struct device *dev); 30 30 31 - int rcar_cmm_enable(struct platform_device *pdev); 32 - void rcar_cmm_disable(struct platform_device *pdev); 31 + int rcar_cmm_enable(struct device *dev); 32 + void rcar_cmm_disable(struct device *dev); 33 33 34 - int rcar_cmm_setup(struct platform_device *pdev, 34 + int rcar_cmm_setup(struct device *dev, 35 35 const struct rcar_cmm_config *config); 36 36 #else 37 - static inline int rcar_cmm_init(struct platform_device *pdev) 37 + static inline int rcar_cmm_init(struct device *dev) 38 38 { 39 39 return -ENODEV; 40 40 } 41 41 42 - static inline int rcar_cmm_enable(struct platform_device *pdev) 42 + static inline int rcar_cmm_enable(struct device *dev) 43 43 { 44 44 return 0; 45 45 } 46 46 47 - static inline void rcar_cmm_disable(struct platform_device *pdev) 47 + static inline void rcar_cmm_disable(struct device *dev) 48 48 { 49 49 } 50 50 51 - static inline int rcar_cmm_setup(struct platform_device *pdev, 51 + static inline int rcar_cmm_setup(struct device *dev, 52 52 const struct rcar_cmm_config *config) 53 53 { 54 54 return 0;
+1 -1
drivers/gpu/drm/renesas/rcar-du/rcar_du_crtc.h
··· 65 65 unsigned int vblank_count; 66 66 67 67 struct rcar_du_group *group; 68 - struct platform_device *cmm; 68 + struct device *cmm; 69 69 struct rcar_du_vsp *vsp; 70 70 unsigned int vsp_pipe; 71 71
+1 -1
drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.h
··· 106 106 unsigned int num_crtcs; 107 107 108 108 struct rcar_du_group groups[RCAR_DU_MAX_GROUPS]; 109 - struct platform_device *cmms[RCAR_DU_MAX_CRTCS]; 109 + struct device *cmms[RCAR_DU_MAX_CRTCS]; 110 110 struct rcar_du_vsp vsps[RCAR_DU_MAX_VSPS]; 111 111 struct drm_bridge *lvds[RCAR_DU_MAX_LVDS]; 112 112 struct drm_bridge *dsi[RCAR_DU_MAX_DSI];
+3 -3
drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c
··· 806 806 * -ENODEV is used to report that the CMM config option is 807 807 * disabled: return 0 and let the DU continue probing. 808 808 */ 809 - ret = rcar_cmm_init(pdev); 809 + ret = rcar_cmm_init(&pdev->dev); 810 810 if (ret) { 811 811 platform_device_put(pdev); 812 812 return ret == -ENODEV ? 0 : ret; 813 813 } 814 814 815 - rcdu->cmms[i] = pdev; 815 + rcdu->cmms[i] = &pdev->dev; 816 816 817 817 /* 818 818 * Enforce suspend/resume ordering by making the CMM a provider ··· 835 835 unsigned int i; 836 836 837 837 for (i = 0; i < ARRAY_SIZE(rcdu->cmms); ++i) 838 - platform_device_put(rcdu->cmms[i]); 838 + put_device(rcdu->cmms[i]); 839 839 } 840 840 841 841 int rcar_du_modeset_init(struct rcar_du_device *rcdu)