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

drm/sun4i: Use simple encoder

The ingenic driver uses empty implementations for its encoders. Replace
the code with the generic simple encoder.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200305155950.2705-15-tzimmermann@suse.de

+17 -61
+3 -9
drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
··· 22 22 #include <drm/drm_panel.h> 23 23 #include <drm/drm_print.h> 24 24 #include <drm/drm_probe_helper.h> 25 + #include <drm/drm_simple_kms_helper.h> 25 26 26 27 #include "sun4i_backend.h" 27 28 #include "sun4i_crtc.h" ··· 203 202 .enable = sun4i_hdmi_enable, 204 203 .mode_set = sun4i_hdmi_mode_set, 205 204 .mode_valid = sun4i_hdmi_mode_valid, 206 - }; 207 - 208 - static const struct drm_encoder_funcs sun4i_hdmi_funcs = { 209 - .destroy = drm_encoder_cleanup, 210 205 }; 211 206 212 207 static int sun4i_hdmi_get_modes(struct drm_connector *connector) ··· 608 611 609 612 drm_encoder_helper_add(&hdmi->encoder, 610 613 &sun4i_hdmi_helper_funcs); 611 - ret = drm_encoder_init(drm, 612 - &hdmi->encoder, 613 - &sun4i_hdmi_funcs, 614 - DRM_MODE_ENCODER_TMDS, 615 - NULL); 614 + ret = drm_simple_encoder_init(drm, &hdmi->encoder, 615 + DRM_MODE_ENCODER_TMDS); 616 616 if (ret) { 617 617 dev_err(dev, "Couldn't initialise the HDMI encoder\n"); 618 618 goto err_put_ddc_i2c;
+3 -9
drivers/gpu/drm/sun4i/sun4i_lvds.c
··· 12 12 #include <drm/drm_panel.h> 13 13 #include <drm/drm_print.h> 14 14 #include <drm/drm_probe_helper.h> 15 + #include <drm/drm_simple_kms_helper.h> 15 16 16 17 #include "sun4i_crtc.h" 17 18 #include "sun4i_tcon.h" ··· 97 96 .enable = sun4i_lvds_encoder_enable, 98 97 }; 99 98 100 - static const struct drm_encoder_funcs sun4i_lvds_enc_funcs = { 101 - .destroy = drm_encoder_cleanup, 102 - }; 103 - 104 99 int sun4i_lvds_init(struct drm_device *drm, struct sun4i_tcon *tcon) 105 100 { 106 101 struct drm_encoder *encoder; ··· 118 121 119 122 drm_encoder_helper_add(&lvds->encoder, 120 123 &sun4i_lvds_enc_helper_funcs); 121 - ret = drm_encoder_init(drm, 122 - &lvds->encoder, 123 - &sun4i_lvds_enc_funcs, 124 - DRM_MODE_ENCODER_LVDS, 125 - NULL); 124 + ret = drm_simple_encoder_init(drm, &lvds->encoder, 125 + DRM_MODE_ENCODER_LVDS); 126 126 if (ret) { 127 127 dev_err(drm->dev, "Couldn't initialise the lvds encoder\n"); 128 128 goto err_out;
+3 -14
drivers/gpu/drm/sun4i/sun4i_rgb.c
··· 14 14 #include <drm/drm_panel.h> 15 15 #include <drm/drm_print.h> 16 16 #include <drm/drm_probe_helper.h> 17 + #include <drm/drm_simple_kms_helper.h> 17 18 18 19 #include "sun4i_crtc.h" 19 20 #include "sun4i_tcon.h" ··· 189 188 .mode_valid = sun4i_rgb_mode_valid, 190 189 }; 191 190 192 - static void sun4i_rgb_enc_destroy(struct drm_encoder *encoder) 193 - { 194 - drm_encoder_cleanup(encoder); 195 - } 196 - 197 - static struct drm_encoder_funcs sun4i_rgb_enc_funcs = { 198 - .destroy = sun4i_rgb_enc_destroy, 199 - }; 200 - 201 191 int sun4i_rgb_init(struct drm_device *drm, struct sun4i_tcon *tcon) 202 192 { 203 193 struct drm_encoder *encoder; ··· 210 218 211 219 drm_encoder_helper_add(&rgb->encoder, 212 220 &sun4i_rgb_enc_helper_funcs); 213 - ret = drm_encoder_init(drm, 214 - &rgb->encoder, 215 - &sun4i_rgb_enc_funcs, 216 - DRM_MODE_ENCODER_NONE, 217 - NULL); 221 + ret = drm_simple_encoder_init(drm, &rgb->encoder, 222 + DRM_MODE_ENCODER_NONE); 218 223 if (ret) { 219 224 dev_err(drm->dev, "Couldn't initialise the rgb encoder\n"); 220 225 goto err_out;
+3 -14
drivers/gpu/drm/sun4i/sun4i_tv.c
··· 19 19 #include <drm/drm_panel.h> 20 20 #include <drm/drm_print.h> 21 21 #include <drm/drm_probe_helper.h> 22 + #include <drm/drm_simple_kms_helper.h> 22 23 23 24 #include "sun4i_crtc.h" 24 25 #include "sun4i_drv.h" ··· 474 473 .mode_set = sun4i_tv_mode_set, 475 474 }; 476 475 477 - static void sun4i_tv_destroy(struct drm_encoder *encoder) 478 - { 479 - drm_encoder_cleanup(encoder); 480 - } 481 - 482 - static struct drm_encoder_funcs sun4i_tv_funcs = { 483 - .destroy = sun4i_tv_destroy, 484 - }; 485 - 486 476 static int sun4i_tv_comp_get_modes(struct drm_connector *connector) 487 477 { 488 478 int i; ··· 584 592 585 593 drm_encoder_helper_add(&tv->encoder, 586 594 &sun4i_tv_helper_funcs); 587 - ret = drm_encoder_init(drm, 588 - &tv->encoder, 589 - &sun4i_tv_funcs, 590 - DRM_MODE_ENCODER_TVDAC, 591 - NULL); 595 + ret = drm_simple_encoder_init(drm, &tv->encoder, 596 + DRM_MODE_ENCODER_TVDAC); 592 597 if (ret) { 593 598 dev_err(dev, "Couldn't initialise the TV encoder\n"); 594 599 goto err_disable_clk;
+3 -9
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
··· 24 24 #include <drm/drm_panel.h> 25 25 #include <drm/drm_print.h> 26 26 #include <drm/drm_probe_helper.h> 27 + #include <drm/drm_simple_kms_helper.h> 27 28 28 29 #include "sun4i_crtc.h" 29 30 #include "sun4i_tcon.h" ··· 847 846 .enable = sun6i_dsi_encoder_enable, 848 847 }; 849 848 850 - static const struct drm_encoder_funcs sun6i_dsi_enc_funcs = { 851 - .destroy = drm_encoder_cleanup, 852 - }; 853 - 854 849 static u32 sun6i_dsi_dcs_build_pkt_hdr(struct sun6i_dsi *dsi, 855 850 const struct mipi_dsi_msg *msg) 856 851 { ··· 1059 1062 1060 1063 drm_encoder_helper_add(&dsi->encoder, 1061 1064 &sun6i_dsi_enc_helper_funcs); 1062 - ret = drm_encoder_init(drm, 1063 - &dsi->encoder, 1064 - &sun6i_dsi_enc_funcs, 1065 - DRM_MODE_ENCODER_DSI, 1066 - NULL); 1065 + ret = drm_simple_encoder_init(drm, &dsi->encoder, 1066 + DRM_MODE_ENCODER_DSI); 1067 1067 if (ret) { 1068 1068 dev_err(dsi->dev, "Couldn't initialise the DSI encoder\n"); 1069 1069 return ret;
+2 -6
drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
··· 10 10 11 11 #include <drm/drm_crtc_helper.h> 12 12 #include <drm/drm_of.h> 13 + #include <drm/drm_simple_kms_helper.h> 13 14 14 15 #include "sun8i_dw_hdmi.h" 15 16 #include "sun8i_tcon_top.h" ··· 28 27 static const struct drm_encoder_helper_funcs 29 28 sun8i_dw_hdmi_encoder_helper_funcs = { 30 29 .mode_set = sun8i_dw_hdmi_encoder_mode_set, 31 - }; 32 - 33 - static const struct drm_encoder_funcs sun8i_dw_hdmi_encoder_funcs = { 34 - .destroy = drm_encoder_cleanup, 35 30 }; 36 31 37 32 static enum drm_mode_status ··· 217 220 } 218 221 219 222 drm_encoder_helper_add(encoder, &sun8i_dw_hdmi_encoder_helper_funcs); 220 - drm_encoder_init(drm, encoder, &sun8i_dw_hdmi_encoder_funcs, 221 - DRM_MODE_ENCODER_TMDS, NULL); 223 + drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS); 222 224 223 225 sun8i_hdmi_phy_init(hdmi->phy); 224 226