[PATCH] drm/mediatek: mtk_dpi: Open-code drm_simple_encoder_init()

Chun-Kuang Hu chunkuang.hu at kernel.org
Wed May 13 07:59:45 PDT 2026


Hi, Shivam:

Shivam Kalra via B4 Relay
<devnull+shivamkalra98.zohomail.in at kernel.org> 於 2026年4月3日週五
下午12:00寫道:
>
> From: Shivam Kalra <shivamkalra98 at zohomail.in>
>
> The helper drm_simple_encoder_init() is a trivial wrapper around
> drm_encoder_init() that only provides a static drm_encoder_funcs with
> .destroy set to drm_encoder_cleanup(). Open-code the initialization
> with a driver-specific instance of drm_encoder_funcs and remove the
> dependency on drm_simple_kms_helper.

Applied to mediatek-drm-next [1], thanks.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next

Regards,
Chun-Kuang.

>
> Suggested-by: Thomas Zimmermann <tzimmermann at suse.de>
> Signed-off-by: Shivam Kalra <shivamkalra98 at zohomail.in>
> ---
> Addresses the "Open-code drm_simple_encoder_init()" task from
> Documentation/gpu/todo.rst.
> ---
>  drivers/gpu/drm/mediatek/mtk_dpi.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index 53360b5d12ba..5b83ca6aecb2 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -25,8 +25,8 @@
>  #include <drm/drm_bridge_connector.h>
>  #include <drm/drm_crtc.h>
>  #include <drm/drm_edid.h>
> +#include <drm/drm_encoder.h>
>  #include <drm/drm_of.h>
> -#include <drm/drm_simple_kms_helper.h>
>
>  #include "mtk_ddp_comp.h"
>  #include "mtk_disp_drv.h"
> @@ -993,6 +993,10 @@ static const struct drm_bridge_funcs mtk_dpi_bridge_funcs = {
>         .debugfs_init = mtk_dpi_debugfs_init,
>  };
>
> +static const struct drm_encoder_funcs mtk_dpi_encoder_funcs = {
> +       .destroy = drm_encoder_cleanup,
> +};
> +
>  void mtk_dpi_start(struct device *dev)
>  {
>         struct mtk_dpi *dpi = dev_get_drvdata(dev);
> @@ -1026,8 +1030,8 @@ static int mtk_dpi_bind(struct device *dev, struct device *master, void *data)
>         int ret;
>
>         dpi->mmsys_dev = priv->mmsys_dev;
> -       ret = drm_simple_encoder_init(drm_dev, &dpi->encoder,
> -                                     DRM_MODE_ENCODER_TMDS);
> +       ret = drm_encoder_init(drm_dev, &dpi->encoder, &mtk_dpi_encoder_funcs,
> +                              DRM_MODE_ENCODER_TMDS, NULL);
>         if (ret) {
>                 dev_err(dev, "Failed to initialize decoder: %d\n", ret);
>                 return ret;
>
> ---
> base-commit: 4b9c36c83b34f710da9573291404f6a2246251c1
> change-id: 20260403-drm-mediatek-opencode-encoder-init-36336e4c4ff3
>
> Best regards,
> --
> Shivam Kalra <shivamkalra98 at zohomail.in>
>
>



More information about the Linux-mediatek mailing list