On Tue, Sep 30, 2025 at 05:09:09PM +0800, Damon Ding wrote:
> If there is neither a panel nor a bridge, the display timing can be
> parsed from the display-timings node under the dp node.
> 
> In order to get rid of &analogix_dp_plat_data.get_modes() and make
> the codes more consistent, apply DRM legacy bridge to parse display
> timings.
> 
> Signed-off-by: Damon Ding <[email protected]>
> 
> ------
> 
> Changes in v6:
> - Apply DRM legacy bridge to parse display timings intead of
>   implementing the same codes only for Exynos DP.
> ---
>  drivers/gpu/drm/exynos/Kconfig     |  1 +
>  drivers/gpu/drm/exynos/exynos_dp.c | 71 +++++++++---------------------
>  2 files changed, 22 insertions(+), 50 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig
> index 0d13828e7d9e..66665d317848 100644
> --- a/drivers/gpu/drm/exynos/Kconfig
> +++ b/drivers/gpu/drm/exynos/Kconfig
> @@ -72,6 +72,7 @@ config DRM_EXYNOS_DP
>       select DRM_ANALOGIX_DP
>       select DRM_DISPLAY_DP_HELPER
>       default DRM_EXYNOS
> +     select DRM_LEGACY_BRIDGE
>       select DRM_PANEL
>       help
>         This enables support for DP device.
> diff --git a/drivers/gpu/drm/exynos/exynos_dp.c 
> b/drivers/gpu/drm/exynos/exynos_dp.c
> index e20513164032..507d0a98fe5b 100644
> --- a/drivers/gpu/drm/exynos/exynos_dp.c
> +++ b/drivers/gpu/drm/exynos/exynos_dp.c
> @@ -19,6 +19,7 @@
>  #include <video/videomode.h>
>  
>  #include <drm/bridge/analogix_dp.h>
> +#include <drm/bridge/legacy-bridge.h>
>  #include <drm/drm_atomic_helper.h>
>  #include <drm/drm_bridge.h>
>  #include <drm/drm_crtc.h>
> @@ -38,11 +39,23 @@ struct exynos_dp_device {
>       struct drm_device          *drm_dev;
>       struct device              *dev;
>  
> -     struct videomode           vm;
>       struct analogix_dp_device *adp;
>       struct analogix_dp_plat_data plat_data;
>  };
>  
> +static int exynos_dp_legacy_bridge_init(struct exynos_dp_device *dp,
> +                                     struct drm_bridge **bridge)
> +{
> +     if (!bridge)
> +             return -EINVAL;

Well, this can't happen, can it?

> +
> +     *bridge = devm_drm_legacy_bridge(dp->dev, dp->dev->of_node, 
> DRM_MODE_CONNECTOR_eDP);
> +     if (IS_ERR(*bridge))
> +             return PTR_ERR(*bridge);
> +
> +     return 0;
> +}

I'd suggest inlining the function. It doesn't make sense to have
one-line wrapper.

> +
>  static int exynos_dp_crtc_clock_enable(struct analogix_dp_plat_data 
> *plat_data,
>                               bool enable)
>  {

[...]

>  static int exynos_dp_bridge_attach(struct analogix_dp_plat_data *plat_data,
>                                  struct drm_bridge *bridge,
>                                  struct drm_connector *connector)
>  {
>       struct exynos_dp_device *dp = to_dp(plat_data);
> +     enum drm_bridge_attach_flags flags = 0;
>       int ret;
>  
>       /* Pre-empt DP connector creation if there's a bridge */
>       if (plat_data->next_bridge) {
> -             ret = drm_bridge_attach(&dp->encoder, plat_data->next_bridge, 
> bridge,
> -                                     0);
> +             if (drm_bridge_is_legacy(plat_data->next_bridge))

I see... You are going to kill this line in one of the next patches, but
the API will stay. I suggest adding a flag to the exynos_dp_device and
then removing the flag once you migrate to drm_bridge_connector.

> +                     flags = DRM_BRIDGE_ATTACH_NO_CONNECTOR;
> +
> +             ret = drm_bridge_attach(&dp->encoder, plat_data->next_bridge, 
> bridge, flags);
>               if (ret)
>                       return ret;
>       }

-- 
With best wishes
Dmitry

Reply via email to