[PATCH v3] drm/mediatek: Set default value for Panel Orientation connector prop.
Mark Yacoub
markyacoub at chromium.org
Wed Jan 5 21:23:27 UTC 2022
[Why]
Creating the prop uses UNKNOWN as the initial value, which is not a
supported value if the prop is to be supported.
[How]
Set the panel orientation default value to NORMAL right after creating
the prop if no DSI panel exists.
Panels have their own orientations, and panel orientation can't be
overriden once initialized to a value.
v2:
Move to the latest code where struct mtk_dsi{} has no member 'panel'.
v1:
Set panel orientation only if DSI panel does not exist.
Tested on Jacuzzi(MTK)
Fixes IGT at kms_properties@get_properties-sanity-{atomic,non-atomic}
Signed-off-by: Mark Yacoub <markyacoub at chromium.org>
---
drivers/gpu/drm/mediatek/mtk_dsi.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index 5d90d2eb00193..9e1d4e297ca48 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -941,8 +941,10 @@ static const struct mipi_dsi_host_ops mtk_dsi_ops = {
.transfer = mtk_dsi_host_transfer,
};
-static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
+static int mtk_dsi_encoder_init(struct device *dev, struct drm_device *drm)
{
+ struct mtk_dsi *dsi = dev_get_drvdata(dev);
+ struct drm_panel *panel;
int ret;
ret = drm_simple_encoder_init(drm, &dsi->encoder,
@@ -967,6 +969,15 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
}
drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
+ ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0, &panel,
+ &dsi->next_bridge);
+ /* A drm_panel can have its own orientation. If there is no panel, set the
+ * orientation to NORMAL. */
+ if (ret || !panel) {
+ drm_connector_set_panel_orientation(
+ dsi->connector, DRM_MODE_PANEL_ORIENTATION_NORMAL);
+ }
+
return 0;
err_cleanup_encoder:
@@ -976,11 +987,8 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
static int mtk_dsi_bind(struct device *dev, struct device *master, void *data)
{
- int ret;
struct drm_device *drm = data;
- struct mtk_dsi *dsi = dev_get_drvdata(dev);
-
- ret = mtk_dsi_encoder_init(drm, dsi);
+ int ret = mtk_dsi_encoder_init(dev, drm);
if (ret)
return ret;
--
2.34.1.448.ga2b2bfdf31-goog
More information about the dri-devel
mailing list