Use drmm_plain_encoder_alloc() to allocate simple encoder and drmm_writeback_connector_init() in order to initialize writeback connector instance.
Reviewed-by: Suraj Kandpal <suraj.kand...@intel.com> Reviewed-by: Louis Chauvet <louis.chau...@bootlin.com> Signed-off-by: Dmitry Baryshkov <dmitry.barysh...@oss.qualcomm.com> --- drivers/gpu/drm/arm/malidp_mw.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/arm/malidp_mw.c b/drivers/gpu/drm/arm/malidp_mw.c index 600af5ad81b15d0c30f9f79588f40cca07437ed8..80f7f3474c4494554c6b6fb392e7f396b3b49c83 100644 --- a/drivers/gpu/drm/arm/malidp_mw.c +++ b/drivers/gpu/drm/arm/malidp_mw.c @@ -84,11 +84,6 @@ malidp_mw_connector_detect(struct drm_connector *connector, bool force) return connector_status_connected; } -static void malidp_mw_connector_destroy(struct drm_connector *connector) -{ - drm_connector_cleanup(connector); -} - static struct drm_connector_state * malidp_mw_connector_duplicate_state(struct drm_connector *connector) { @@ -114,7 +109,6 @@ static const struct drm_connector_funcs malidp_mw_connector_funcs = { .reset = malidp_mw_connector_reset, .detect = malidp_mw_connector_detect, .fill_modes = drm_helper_probe_single_connector_modes, - .destroy = malidp_mw_connector_destroy, .atomic_duplicate_state = malidp_mw_connector_duplicate_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; @@ -211,6 +205,7 @@ static u32 *get_writeback_formats(struct malidp_drm *malidp, int *n_formats) int malidp_mw_connector_init(struct drm_device *drm) { struct malidp_drm *malidp = drm_to_malidp(drm); + struct drm_encoder *encoder; u32 *formats; int ret, n_formats; @@ -224,11 +219,19 @@ int malidp_mw_connector_init(struct drm_device *drm) if (!formats) return -ENOMEM; - ret = drm_writeback_connector_init(drm, &malidp->mw_connector, - &malidp_mw_connector_funcs, - &malidp_mw_encoder_helper_funcs, - formats, n_formats, - 1 << drm_crtc_index(&malidp->crtc)); + encoder = drmm_plain_encoder_alloc(drm, NULL, DRM_MODE_ENCODER_VIRTUAL, + NULL); + if (IS_ERR(encoder)) + return PTR_ERR(encoder); + + drm_encoder_helper_add(encoder, &malidp_mw_encoder_helper_funcs); + + encoder->possible_crtcs = drm_crtc_mask(&malidp->crtc); + + ret = drmm_writeback_connector_init(drm, &malidp->mw_connector, + &malidp_mw_connector_funcs, + encoder, + formats, n_formats); kfree(formats); if (ret) return ret; -- 2.47.2