Re: [PATCH v2 09/15] drm/mediatek: remove dependency on DRM simple helpers

From: CK Hu (胡俊光)

Date: Tue Aug 25 2026 - 04:07:02 EST


On Mon, 2026-07-20 at 17:40 +0200, Diogo Silva wrote:
> External email : Please do not click links or open attachments until you have verified the sender or the content.
>
>
> The simple KMS helpers are deprecated because they only add an
> intermediate layer between drivers and atomic modesetting.
>
> Open-code drm_simple_encoder_init() by calling drm_encoder_init()
> directly and providing driver-local drm_encoder_funcs.

Reviewed-by: CK Hu <ck.hu@xxxxxxxxxxxx>

>
> Signed-off-by: Diogo Silva <diogompaissilva@xxxxxxxxx>
> ---
> drivers/gpu/drm/mediatek/mtk_dsi.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index 3f3f56eed3f9..7cd136bd9605 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -21,12 +21,12 @@
> #include <drm/drm_atomic_helper.h>
> #include <drm/drm_bridge.h>
> #include <drm/drm_bridge_connector.h>
> +#include <drm/drm_encoder.h>
> #include <drm/drm_mipi_dsi.h>
> #include <drm/drm_of.h>
> #include <drm/drm_panel.h>
> #include <drm/drm_print.h>
> #include <drm/drm_probe_helper.h>
> -#include <drm/drm_simple_kms_helper.h>
>
> #include "mtk_ddp_comp.h"
> #include "mtk_disp_drv.h"
> @@ -913,12 +913,16 @@ void mtk_dsi_ddp_stop(struct device *dev)
> mtk_dsi_poweroff(dsi);
> }
>
> +static const struct drm_encoder_funcs mtk_dsi_encoder_funcs = {
> + .destroy = drm_encoder_cleanup,
> +};
> +
> static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
> {
> int ret;
>
> - ret = drm_simple_encoder_init(drm, &dsi->encoder,
> - DRM_MODE_ENCODER_DSI);
> + ret = drm_encoder_init(drm, &dsi->encoder, &mtk_dsi_encoder_funcs,
> + DRM_MODE_ENCODER_DSI, NULL);
> if (ret) {
> drm_err(drm, "Failed to encoder init to drm\n");
> return ret;
>
> --
> 2.54.0
>
>