Skip to content

Commit 0f6f28c

Browse files
Laurent Pincharttomba
authored andcommitted
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>
1 parent db5be3a commit 0f6f28c

5 files changed

Lines changed: 27 additions & 27 deletions

File tree

drivers/gpu/drm/renesas/rcar-du/rcar_cmm.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static void rcar_cmm_lut_write(struct rcar_cmm *rcmm,
5959

6060
/*
6161
* 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
6363
* @config: The CMM unit configuration
6464
*
6565
* Configure the CMM unit with the given configuration. Currently enabling,
@@ -73,10 +73,10 @@ static void rcar_cmm_lut_write(struct rcar_cmm *rcmm,
7373
* TODO: Add support for LUT double buffer operations to avoid updating the
7474
* LUT table entries while a frame is being displayed.
7575
*/
76-
int rcar_cmm_setup(struct platform_device *pdev,
76+
int rcar_cmm_setup(struct device *dev,
7777
const struct rcar_cmm_config *config)
7878
{
79-
struct rcar_cmm *rcmm = platform_get_drvdata(pdev);
79+
struct rcar_cmm *rcmm = dev_get_drvdata(dev);
8080

8181
/* Disable LUT if no table is provided. */
8282
if (!config->lut.table) {
@@ -102,7 +102,7 @@ EXPORT_SYMBOL_GPL(rcar_cmm_setup);
102102

103103
/*
104104
* 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
106106
*
107107
* When the output of the corresponding DU channel is routed to the CMM unit,
108108
* the unit shall be enabled before the DU channel is started, and remain
@@ -113,11 +113,11 @@ EXPORT_SYMBOL_GPL(rcar_cmm_setup);
113113
* It is an error to attempt to enable an already enabled CMM unit, or to
114114
* attempt to disable a disabled unit.
115115
*/
116-
int rcar_cmm_enable(struct platform_device *pdev)
116+
int rcar_cmm_enable(struct device *dev)
117117
{
118118
int ret;
119119

120-
ret = pm_runtime_resume_and_get(&pdev->dev);
120+
ret = pm_runtime_resume_and_get(dev);
121121
if (ret < 0)
122122
return ret;
123123

@@ -127,35 +127,35 @@ EXPORT_SYMBOL_GPL(rcar_cmm_enable);
127127

128128
/*
129129
* 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
131131
*
132132
* See rcar_cmm_enable() for usage information.
133133
*
134134
* Disabling the CMM unit disable all the internal processing blocks. The CMM
135135
* state shall thus be restored with rcar_cmm_setup() when re-enabling the CMM
136136
* unit after the next rcar_cmm_enable() call.
137137
*/
138-
void rcar_cmm_disable(struct platform_device *pdev)
138+
void rcar_cmm_disable(struct device *dev)
139139
{
140-
struct rcar_cmm *rcmm = platform_get_drvdata(pdev);
140+
struct rcar_cmm *rcmm = dev_get_drvdata(dev);
141141

142142
rcar_cmm_write(rcmm, CM2_LUT_CTRL, 0);
143143
rcmm->lut.enabled = false;
144144

145-
pm_runtime_put(&pdev->dev);
145+
pm_runtime_put(dev);
146146
}
147147
EXPORT_SYMBOL_GPL(rcar_cmm_disable);
148148

149149
/*
150150
* 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
152152
*
153153
* Return: 0 on success, -EPROBE_DEFER if the CMM is not available yet,
154154
* -ENODEV if the DRM_RCAR_CMM config option is disabled
155155
*/
156-
int rcar_cmm_init(struct platform_device *pdev)
156+
int rcar_cmm_init(struct device *dev)
157157
{
158-
struct rcar_cmm *rcmm = platform_get_drvdata(pdev);
158+
struct rcar_cmm *rcmm = dev_get_drvdata(dev);
159159

160160
if (!rcmm)
161161
return -EPROBE_DEFER;

drivers/gpu/drm/renesas/rcar-du/rcar_cmm.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
#define CM2_LUT_SIZE 256
1212

13+
struct device;
1314
struct drm_color_lut;
14-
struct platform_device;
1515

1616
/**
1717
* struct rcar_cmm_config - CMM configuration
@@ -26,29 +26,29 @@ struct rcar_cmm_config {
2626
};
2727

2828
#if IS_ENABLED(CONFIG_DRM_RCAR_CMM)
29-
int rcar_cmm_init(struct platform_device *pdev);
29+
int rcar_cmm_init(struct device *dev);
3030

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);
3333

34-
int rcar_cmm_setup(struct platform_device *pdev,
34+
int rcar_cmm_setup(struct device *dev,
3535
const struct rcar_cmm_config *config);
3636
#else
37-
static inline int rcar_cmm_init(struct platform_device *pdev)
37+
static inline int rcar_cmm_init(struct device *dev)
3838
{
3939
return -ENODEV;
4040
}
4141

42-
static inline int rcar_cmm_enable(struct platform_device *pdev)
42+
static inline int rcar_cmm_enable(struct device *dev)
4343
{
4444
return 0;
4545
}
4646

47-
static inline void rcar_cmm_disable(struct platform_device *pdev)
47+
static inline void rcar_cmm_disable(struct device *dev)
4848
{
4949
}
5050

51-
static inline int rcar_cmm_setup(struct platform_device *pdev,
51+
static inline int rcar_cmm_setup(struct device *dev,
5252
const struct rcar_cmm_config *config)
5353
{
5454
return 0;

drivers/gpu/drm/renesas/rcar-du/rcar_du_crtc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ struct rcar_du_crtc {
6565
unsigned int vblank_count;
6666

6767
struct rcar_du_group *group;
68-
struct platform_device *cmm;
68+
struct device *cmm;
6969
struct rcar_du_vsp *vsp;
7070
unsigned int vsp_pipe;
7171

drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ struct rcar_du_device {
106106
unsigned int num_crtcs;
107107

108108
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];
110110
struct rcar_du_vsp vsps[RCAR_DU_MAX_VSPS];
111111
struct drm_bridge *lvds[RCAR_DU_MAX_LVDS];
112112
struct drm_bridge *dsi[RCAR_DU_MAX_DSI];

drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -806,13 +806,13 @@ static int rcar_du_cmm_init(struct rcar_du_device *rcdu)
806806
* -ENODEV is used to report that the CMM config option is
807807
* disabled: return 0 and let the DU continue probing.
808808
*/
809-
ret = rcar_cmm_init(pdev);
809+
ret = rcar_cmm_init(&pdev->dev);
810810
if (ret) {
811811
platform_device_put(pdev);
812812
return ret == -ENODEV ? 0 : ret;
813813
}
814814

815-
rcdu->cmms[i] = pdev;
815+
rcdu->cmms[i] = &pdev->dev;
816816

817817
/*
818818
* 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)
835835
unsigned int i;
836836

837837
for (i = 0; i < ARRAY_SIZE(rcdu->cmms); ++i)
838-
platform_device_put(rcdu->cmms[i]);
838+
put_device(rcdu->cmms[i]);
839839
}
840840

841841
int rcar_du_modeset_init(struct rcar_du_device *rcdu)

0 commit comments

Comments
 (0)