Re: [PATCH v3 RESEND 4/9] drm/bridge: synopsys: dw-mipi-dsi: Add mode fixup support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 21, 2023 at 5:37 AM Liu Ying <victor.liu@xxxxxxx> wrote:
>
> Vendor drivers may need to fixup mode due to pixel clock tree limitation,
> so introduce the ->mode_fixup() callcack to struct dw_mipi_dsi_plat_data
> and call it at atomic check stage if available.
>
> Signed-off-by: Liu Ying <victor.liu@xxxxxxx>
> ---
> v1->v3:
> * No change.
>
>  drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 14 ++++++++++++++
>  include/drm/bridge/dw_mipi_dsi.h              |  3 +++
>  2 files changed, 17 insertions(+)
>
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> index ed9288a9c444..b2da803c9de7 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> @@ -573,9 +573,23 @@ static int dw_mipi_dsi_bridge_atomic_check(struct drm_bridge *bridge,
>                                            struct drm_crtc_state *crtc_state,
>                                            struct drm_connector_state *conn_state)
>  {
> +       struct dw_mipi_dsi *dsi = bridge_to_dsi(bridge);
> +       const struct dw_mipi_dsi_plat_data *pdata = dsi->plat_data;
> +       bool ret;
> +
>         bridge_state->input_bus_cfg.flags =
>                 DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE;
>
> +       if (pdata->mode_fixup) {
> +               ret = pdata->mode_fixup(pdata->priv_data, &crtc_state->mode,
> +                                       &crtc_state->adjusted_mode);
> +               if (!ret) {
> +                       DRM_DEBUG_DRIVER("failed to fixup mode " DRM_MODE_FMT "\n",
> +                                        DRM_MODE_ARG(&crtc_state->mode));
> +                       return -EINVAL;
> +               }
> +       }
> +
>         return 0;
>  }
>
> diff --git a/include/drm/bridge/dw_mipi_dsi.h b/include/drm/bridge/dw_mipi_dsi.h
> index 246650f2814f..65d5e68065e3 100644
> --- a/include/drm/bridge/dw_mipi_dsi.h
> +++ b/include/drm/bridge/dw_mipi_dsi.h
> @@ -59,6 +59,9 @@ struct dw_mipi_dsi_plat_data {
>                                            unsigned long mode_flags,
>                                            u32 lanes, u32 format);
>
> +       bool (*mode_fixup)(void *priv_data, const struct drm_display_mode *mode,
> +                          struct drm_display_mode *adjusted_mode);
> +
>         u32 *(*get_input_bus_fmts)(void *priv_data,
>                                    struct drm_bridge *bridge,
>                                    struct drm_bridge_state *bridge_state,
> --
> 2.37.1
>

Reviewed-by: Robert Foss <rfoss@xxxxxxxxxx>




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux