Skip to content

Commit 609252e

Browse files
shuijingliChun-Kuang Hu
authored andcommitted
drm/mediatek: dsi: Add mode_valid callback to DSI bridge
Support IGT (Intel GPU Tools) in Mediatek DSI driver. According to the description of MIPI Alliance Specification for D-PHY Version 1.1, the maximum supported data rate is 1.5Gbps, so add mode_valid callback to dsi bridge to filter out the data rate exceeding the Specification. Signed-off-by: Shuijing Li <shuijing.li@mediatek.com> Reviewed-by: CK Hu <ck.hu@mediatek.com> Link: https://patchwork.kernel.org/project/dri-devel/patch/20230823092047.32258-1-shuijing.li@mediatek.com/ Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
1 parent fcaf976 commit 609252e

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

drivers/gpu/drm/mediatek/mtk_dsi.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,25 @@ static void mtk_dsi_bridge_atomic_post_disable(struct drm_bridge *bridge,
808808
mtk_dsi_poweroff(dsi);
809809
}
810810

811+
static enum drm_mode_status
812+
mtk_dsi_bridge_mode_valid(struct drm_bridge *bridge,
813+
const struct drm_display_info *info,
814+
const struct drm_display_mode *mode)
815+
{
816+
struct mtk_dsi *dsi = bridge_to_dsi(bridge);
817+
u32 bpp;
818+
819+
if (dsi->format == MIPI_DSI_FMT_RGB565)
820+
bpp = 16;
821+
else
822+
bpp = 24;
823+
824+
if (mode->clock * bpp / dsi->lanes > 1500000)
825+
return MODE_CLOCK_HIGH;
826+
827+
return MODE_OK;
828+
}
829+
811830
static const struct drm_bridge_funcs mtk_dsi_bridge_funcs = {
812831
.attach = mtk_dsi_bridge_attach,
813832
.atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
@@ -817,6 +836,7 @@ static const struct drm_bridge_funcs mtk_dsi_bridge_funcs = {
817836
.atomic_pre_enable = mtk_dsi_bridge_atomic_pre_enable,
818837
.atomic_post_disable = mtk_dsi_bridge_atomic_post_disable,
819838
.atomic_reset = drm_atomic_helper_bridge_reset,
839+
.mode_valid = mtk_dsi_bridge_mode_valid,
820840
.mode_set = mtk_dsi_bridge_mode_set,
821841
};
822842

0 commit comments

Comments
 (0)