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

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

+24 -32
+1 -4
drivers/gpu/drm/panel/panel-ilitek-ili9341.c
··· 577 577 } 578 578 579 579 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), 584 581 }; 585 582 586 583 static const struct drm_display_mode ili9341_dbi_mode = {
+1 -4
drivers/gpu/drm/tiny/hx8357d.c
··· 181 181 } 182 182 183 183 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), 188 185 }; 189 186 190 187 static const struct drm_display_mode yx350hv15_mode = {
+1 -4
drivers/gpu/drm/tiny/ili9163.c
··· 100 100 } 101 101 102 102 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), 107 104 }; 108 105 109 106 static const struct drm_display_mode yx240qv29_mode = {
+1 -4
drivers/gpu/drm/tiny/ili9341.c
··· 137 137 } 138 138 139 139 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), 144 141 }; 145 142 146 143 static const struct drm_display_mode yx240qv29_mode = {
+1 -4
drivers/gpu/drm/tiny/ili9486.c
··· 150 150 } 151 151 152 152 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), 157 154 }; 158 155 159 156 static const struct drm_display_mode waveshare_mode = {
+1 -4
drivers/gpu/drm/tiny/mi0283qt.c
··· 141 141 } 142 142 143 143 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), 148 145 }; 149 146 150 147 static const struct drm_display_mode mi0283qt_mode = {
+1 -4
drivers/gpu/drm/tiny/panel-mipi-dbi.c
··· 212 212 } 213 213 214 214 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), 219 216 }; 220 217 221 218 DEFINE_DRM_GEM_DMA_FOPS(panel_mipi_dbi_fops);
+1 -4
drivers/gpu/drm/tiny/st7735r.c
··· 133 133 } 134 134 135 135 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), 140 137 }; 141 138 142 139 static const struct st7735r_cfg jd_t18003_t01_cfg = {
+16
include/drm/drm_mipi_dbi.h
··· 207 207 static inline void mipi_dbi_debugfs_init(struct drm_minor *minor) {} 208 208 #endif 209 209 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 + 210 226 #endif /* __LINUX_MIPI_DBI_H */