summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/mediatek/mtk_dsi.c
diff options
context:
space:
mode:
authorMichael Walle <mwalle@kernel.org>2024-06-06 11:21:22 +0200
committerChun-Kuang Hu <chunkuang.hu@kernel.org>2024-06-28 12:25:18 +0000
commit9ff6df49e6cbcc9834865870d7c4f3059b0891d3 (patch)
tree79fe0bd3ff2939bffc3636efd34103c817a40edf /drivers/gpu/drm/mediatek/mtk_dsi.c
parent45b70f71a1c161fc2848395f6cb1ef1ac2222d3b (diff)
downloadlinux-9ff6df49e6cbcc9834865870d7c4f3059b0891d3.tar.gz
linux-9ff6df49e6cbcc9834865870d7c4f3059b0891d3.tar.bz2
linux-9ff6df49e6cbcc9834865870d7c4f3059b0891d3.zip
drm/mediatek: dpi/dsi: Fix possible_crtcs calculation
mtk_find_possible_crtcs() assumes that the main path will always have the CRTC with id 0, the ext id 1 and the third id 2. This is only true if the paths are all available. But paths are optional (see also comment in mtk_drm_kms_init()), e.g. the main path might not be enabled or available at all. Then the CRTC IDs will shift one up, e.g. ext will be 0 and the third path will be 1. To fix that, dynamically calculate the IDs by the presence of the paths. While at it, make the return code a signed one and return -ENODEV if no path is found and handle the error in the callers. Fixes: 5aa8e7647676 ("drm/mediatek: dpi/dsi: Change the getting possible_crtc way") Suggested-by: NĂ­colas F. R. A. Prado <nfraprado@collabora.com> Signed-off-by: Michael Walle <mwalle@kernel.org> Link: https://patchwork.kernel.org/project/dri-devel/patch/20240606092122.2026313-1-mwalle@kernel.org/ Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Diffstat (limited to 'drivers/gpu/drm/mediatek/mtk_dsi.c')
-rw-r--r--drivers/gpu/drm/mediatek/mtk_dsi.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index c255559cc56e..b6e3c011a12d 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -837,7 +837,10 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
return ret;
}
- dsi->encoder.possible_crtcs = mtk_find_possible_crtcs(drm, dsi->host.dev);
+ ret = mtk_find_possible_crtcs(drm, dsi->host.dev);
+ if (ret < 0)
+ goto err_cleanup_encoder;
+ dsi->encoder.possible_crtcs = ret;
ret = drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL,
DRM_BRIDGE_ATTACH_NO_CONNECTOR);