Skip to content

Commit

Permalink
drm/bridge: synopsys: dw-mipi-dsi: Add mode fixup support
Browse files Browse the repository at this point in the history
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@nxp.com>
Reviewed-by: Robert Foss <rfoss@kernel.org>
Signed-off-by: Robert Foss <rfoss@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230821034008.3876938-5-victor.liu@nxp.com
  • Loading branch information
Liu Ying authored and Robert Foss committed Oct 16, 2023
1 parent d5116fb commit 5a67ec8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
14 changes: 14 additions & 0 deletions drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
3 changes: 3 additions & 0 deletions include/drm/bridge/dw_mipi_dsi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 5a67ec8

Please sign in to comment.