[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20220105212330.2199045-1-markyacoub@chromium.org>
Date: Wed, 5 Jan 2022 16:23:27 -0500
From: Mark Yacoub <markyacoub@...omium.org>
To: linux-mediatek@...ts.infradead.org
Cc: seanpaul@...omium.org, markyacoub@...gle.com,
markyacoub@...omium.org, chunkuang.hu@...nel.org,
p.zabel@...gutronix.de, matthias.bgg@...il.com,
jason-jh.lin@...iatek.com, tzungbi@...gle.com,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
dri-devel@...ts.freedesktop.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH v3] drm/mediatek: Set default value for Panel Orientation connector prop.
[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@..._properties@..._properties-sanity-{atomic,non-atomic}
Signed-off-by: Mark Yacoub <markyacoub@...omium.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
Powered by blists - more mailing lists