Skip to content

Commit 63aa5ec

Browse files
committed
drm/mipi-dbi: Initialize default driver functions with macro
Introduce DRM_MIPI_DBI_SIMPLE_DISPLAY_PIPE_FUNCS to initialize MIPI-DBI helpers to default values and convert drivers. The prepare_fb function set by some drivers is called implicitly by simple-kms helpers, so leave it out. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Noralf Trønnes <noralf@tronnes.org> Tested-by: Javier Martinez Canillas <javierm@redhat.com> Tested-by: Noralf Trønnes <noralf@tronnes.org> # drm/tiny/mi0283qt Link: https://patchwork.freedesktop.org/patch/msgid/20221202125644.7917-5-tzimmermann@suse.de
1 parent e06c123 commit 63aa5ec

File tree

9 files changed

+24
-32
lines changed

9 files changed

+24
-32
lines changed

drivers/gpu/drm/panel/panel-ilitek-ili9341.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -577,10 +577,7 @@ static void ili9341_dbi_enable(struct drm_simple_display_pipe *pipe,
577577
}
578578

579579
static const struct drm_simple_display_pipe_funcs ili9341_dbi_funcs = {
580-
.mode_valid = mipi_dbi_pipe_mode_valid,
581-
.enable = ili9341_dbi_enable,
582-
.disable = mipi_dbi_pipe_disable,
583-
.update = mipi_dbi_pipe_update,
580+
DRM_MIPI_DBI_SIMPLE_DISPLAY_PIPE_FUNCS(ili9341_dbi_enable),
584581
};
585582

586583
static const struct drm_display_mode ili9341_dbi_mode = {

drivers/gpu/drm/tiny/hx8357d.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,7 @@ static void yx240qv29_enable(struct drm_simple_display_pipe *pipe,
181181
}
182182

183183
static const struct drm_simple_display_pipe_funcs hx8357d_pipe_funcs = {
184-
.mode_valid = mipi_dbi_pipe_mode_valid,
185-
.enable = yx240qv29_enable,
186-
.disable = mipi_dbi_pipe_disable,
187-
.update = mipi_dbi_pipe_update,
184+
DRM_MIPI_DBI_SIMPLE_DISPLAY_PIPE_FUNCS(yx240qv29_enable),
188185
};
189186

190187
static const struct drm_display_mode yx350hv15_mode = {

drivers/gpu/drm/tiny/ili9163.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,7 @@ static void yx240qv29_enable(struct drm_simple_display_pipe *pipe,
100100
}
101101

102102
static const struct drm_simple_display_pipe_funcs ili9163_pipe_funcs = {
103-
.mode_valid = mipi_dbi_pipe_mode_valid,
104-
.enable = yx240qv29_enable,
105-
.disable = mipi_dbi_pipe_disable,
106-
.update = mipi_dbi_pipe_update,
103+
DRM_MIPI_DBI_SIMPLE_DISPLAY_PIPE_FUNCS(yx240qv29_enable),
107104
};
108105

109106
static const struct drm_display_mode yx240qv29_mode = {

drivers/gpu/drm/tiny/ili9341.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,7 @@ static void yx240qv29_enable(struct drm_simple_display_pipe *pipe,
137137
}
138138

139139
static const struct drm_simple_display_pipe_funcs ili9341_pipe_funcs = {
140-
.mode_valid = mipi_dbi_pipe_mode_valid,
141-
.enable = yx240qv29_enable,
142-
.disable = mipi_dbi_pipe_disable,
143-
.update = mipi_dbi_pipe_update,
140+
DRM_MIPI_DBI_SIMPLE_DISPLAY_PIPE_FUNCS(yx240qv29_enable),
144141
};
145142

146143
static const struct drm_display_mode yx240qv29_mode = {

drivers/gpu/drm/tiny/ili9486.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,7 @@ static void waveshare_enable(struct drm_simple_display_pipe *pipe,
150150
}
151151

152152
static const struct drm_simple_display_pipe_funcs waveshare_pipe_funcs = {
153-
.mode_valid = mipi_dbi_pipe_mode_valid,
154-
.enable = waveshare_enable,
155-
.disable = mipi_dbi_pipe_disable,
156-
.update = mipi_dbi_pipe_update,
153+
DRM_MIPI_DBI_SIMPLE_DISPLAY_PIPE_FUNCS(waveshare_enable),
157154
};
158155

159156
static const struct drm_display_mode waveshare_mode = {

drivers/gpu/drm/tiny/mi0283qt.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,7 @@ static void mi0283qt_enable(struct drm_simple_display_pipe *pipe,
141141
}
142142

143143
static const struct drm_simple_display_pipe_funcs mi0283qt_pipe_funcs = {
144-
.mode_valid = mipi_dbi_pipe_mode_valid,
145-
.enable = mi0283qt_enable,
146-
.disable = mipi_dbi_pipe_disable,
147-
.update = mipi_dbi_pipe_update,
144+
DRM_MIPI_DBI_SIMPLE_DISPLAY_PIPE_FUNCS(mi0283qt_enable),
148145
};
149146

150147
static const struct drm_display_mode mi0283qt_mode = {

drivers/gpu/drm/tiny/panel-mipi-dbi.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,7 @@ static void panel_mipi_dbi_enable(struct drm_simple_display_pipe *pipe,
212212
}
213213

214214
static const struct drm_simple_display_pipe_funcs panel_mipi_dbi_pipe_funcs = {
215-
.mode_valid = mipi_dbi_pipe_mode_valid,
216-
.enable = panel_mipi_dbi_enable,
217-
.disable = mipi_dbi_pipe_disable,
218-
.update = mipi_dbi_pipe_update,
215+
DRM_MIPI_DBI_SIMPLE_DISPLAY_PIPE_FUNCS(panel_mipi_dbi_enable),
219216
};
220217

221218
DEFINE_DRM_GEM_DMA_FOPS(panel_mipi_dbi_fops);

drivers/gpu/drm/tiny/st7735r.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,7 @@ static void st7735r_pipe_enable(struct drm_simple_display_pipe *pipe,
133133
}
134134

135135
static const struct drm_simple_display_pipe_funcs st7735r_pipe_funcs = {
136-
.mode_valid = mipi_dbi_pipe_mode_valid,
137-
.enable = st7735r_pipe_enable,
138-
.disable = mipi_dbi_pipe_disable,
139-
.update = mipi_dbi_pipe_update,
136+
DRM_MIPI_DBI_SIMPLE_DISPLAY_PIPE_FUNCS(st7735r_pipe_enable),
140137
};
141138

142139
static const struct st7735r_cfg jd_t18003_t01_cfg = {

include/drm/drm_mipi_dbi.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,4 +207,20 @@ void mipi_dbi_debugfs_init(struct drm_minor *minor);
207207
static inline void mipi_dbi_debugfs_init(struct drm_minor *minor) {}
208208
#endif
209209

210+
/**
211+
* DRM_MIPI_DBI_SIMPLE_DISPLAY_PIPE_FUNCS - Initializes struct drm_simple_display_pipe_funcs
212+
* for MIPI-DBI devices
213+
* @enable_: Enable-callback implementation
214+
*
215+
* This macro initializes struct drm_simple_display_pipe_funcs with default
216+
* values for MIPI-DBI-based devices. The only callback that depends on the
217+
* hardware is @enable, for which the driver has to provide an implementation.
218+
* MIPI-based drivers are encouraged to use this macro for initialization.
219+
*/
220+
#define DRM_MIPI_DBI_SIMPLE_DISPLAY_PIPE_FUNCS(enable_) \
221+
.mode_valid = mipi_dbi_pipe_mode_valid, \
222+
.enable = (enable_), \
223+
.disable = mipi_dbi_pipe_disable, \
224+
.update = mipi_dbi_pipe_update
225+
210226
#endif /* __LINUX_MIPI_DBI_H */

0 commit comments

Comments
 (0)