[PATCH] mediatek: Set default value for Panel Orientation connector prop.

Subsystems: drm drivers, drm drivers for mediatek, the rest

STALE1672d

11 messages, 3 authors, 2022-01-05 · open the first message on its own page

[PATCH] mediatek: Set default value for Panel Orientation connector prop.

From: Mark Yacoub <hidden>
Date: 2021-10-22 17:24:23

From: Mark Yacoub <redacted>

[Why]
Creating the prop uses UNKNOWN as the initial value, which is not a
supported value if the props is to be supported.

[How]
Set the panel orientation default value to NORMAL right after creating
the prop.

Tested on Jacuzzi(MTK)
Fixes IGT@kms_properties@get_properties-sanity-{atomic,non-atomic}

Signed-off-by: Mark Yacoub <redacted>
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index 0ad7157660afa..b7c2528a8f41c 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -1039,6 +1039,8 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
 		DRM_ERROR("Unable to init panel orientation\n");
 		goto err_cleanup_encoder;
 	}
+	drm_connector_set_panel_orientation(dsi->connector,
+					    DRM_MODE_PANEL_ORIENTATION_NORMAL);
 
 	drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
 
-- 
2.33.0.1079.g6e70778dc9-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH] mediatek: Set default value for Panel Orientation connector prop.

From: Sean Paul <sean@poorly.run>
Date: 2021-10-26 01:13:24

On Fri, Oct 22, 2021 at 01:24:03PM -0400, Mark Yacoub wrote:
From: Mark Yacoub <redacted>

[Why]
Creating the prop uses UNKNOWN as the initial value, which is not a
supported value if the props is to be supported.

[How]
Set the panel orientation default value to NORMAL right after creating
the prop.
Reviewed-by: Sean Paul <redacted>
quoted hunk
Tested on Jacuzzi(MTK)
Fixes IGT@kms_properties@get_properties-sanity-{atomic,non-atomic}

Signed-off-by: Mark Yacoub <redacted>
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index 0ad7157660afa..b7c2528a8f41c 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -1039,6 +1039,8 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
 		DRM_ERROR("Unable to init panel orientation\n");
 		goto err_cleanup_encoder;
 	}
+	drm_connector_set_panel_orientation(dsi->connector,
+					    DRM_MODE_PANEL_ORIENTATION_NORMAL);
 
 	drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
 
-- 
2.33.0.1079.g6e70778dc9-goog
-- 
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH] mediatek: Set default value for Panel Orientation connector prop.

From: Mark Yacoub <hidden>
Date: 2021-12-14 15:13:15

Hey CK, can we have this merged?
Thank you!

On Mon, Oct 25, 2021 at 9:13 PM Sean Paul [off-list ref] wrote:
On Fri, Oct 22, 2021 at 01:24:03PM -0400, Mark Yacoub wrote:
quoted
From: Mark Yacoub <redacted>

[Why]
Creating the prop uses UNKNOWN as the initial value, which is not a
supported value if the props is to be supported.

[How]
Set the panel orientation default value to NORMAL right after creating
the prop.
Reviewed-by: Sean Paul <redacted>
quoted
Tested on Jacuzzi(MTK)
Fixes IGT@kms_properties@get_properties-sanity-{atomic,non-atomic}

Signed-off-by: Mark Yacoub <redacted>
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index 0ad7157660afa..b7c2528a8f41c 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -1039,6 +1039,8 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
              DRM_ERROR("Unable to init panel orientation\n");
              goto err_cleanup_encoder;
      }
+     drm_connector_set_panel_orientation(dsi->connector,
+                                         DRM_MODE_PANEL_ORIENTATION_NORMAL);

      drm_connector_attach_encoder(dsi->connector, &dsi->encoder);

--
2.33.0.1079.g6e70778dc9-goog
--
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH] mediatek: Set default value for Panel Orientation connector prop.

From: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Date: 2021-12-15 16:14:58

Hi, Mark:

Mark Yacoub [off-list ref] 於 2021年12月14日 週二 下午11:13寫道:
Hey CK, can we have this merged?
Thank you!

On Mon, Oct 25, 2021 at 9:13 PM Sean Paul [off-list ref] wrote:
quoted
On Fri, Oct 22, 2021 at 01:24:03PM -0400, Mark Yacoub wrote:
quoted
From: Mark Yacoub <redacted>

[Why]
Creating the prop uses UNKNOWN as the initial value, which is not a
supported value if the props is to be supported.

[How]
Set the panel orientation default value to NORMAL right after creating
the prop.
Reviewed-by: Sean Paul <redacted>
quoted
Tested on Jacuzzi(MTK)
Fixes IGT@kms_properties@get_properties-sanity-{atomic,non-atomic}

Signed-off-by: Mark Yacoub <redacted>
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index 0ad7157660afa..b7c2528a8f41c 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -1039,6 +1039,8 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
              DRM_ERROR("Unable to init panel orientation\n");
              goto err_cleanup_encoder;
      }
+     drm_connector_set_panel_orientation(dsi->connector,
+                                         DRM_MODE_PANEL_ORIENTATION_NORMAL);
In drm_connector_set_panel_orientation() [1], I find that the
orientation could be set only once. Once you set it to normal, it
could not be set to other orientation. Right?

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/drm_connector.c?h=v5.16-rc5#n2302

Regards,
Chun-Kuang.
quoted
quoted
      drm_connector_attach_encoder(dsi->connector, &dsi->encoder);

--
2.33.0.1079.g6e70778dc9-goog
--
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH] mediatek: Set default value for Panel Orientation connector prop.

From: Mark Yacoub <hidden>
Date: 2021-12-15 17:27:21

On Wed, Dec 15, 2021 at 11:14 AM Chun-Kuang Hu [off-list ref] wrote:
Hi, Mark:

Mark Yacoub [off-list ref] 於 2021年12月14日 週二 下午11:13寫道:
quoted
Hey CK, can we have this merged?
Thank you!

On Mon, Oct 25, 2021 at 9:13 PM Sean Paul [off-list ref] wrote:
quoted
On Fri, Oct 22, 2021 at 01:24:03PM -0400, Mark Yacoub wrote:
quoted
From: Mark Yacoub <redacted>

[Why]
Creating the prop uses UNKNOWN as the initial value, which is not a
supported value if the props is to be supported.

[How]
Set the panel orientation default value to NORMAL right after creating
the prop.
Reviewed-by: Sean Paul <redacted>
quoted
Tested on Jacuzzi(MTK)
Fixes IGT@kms_properties@get_properties-sanity-{atomic,non-atomic}

Signed-off-by: Mark Yacoub <redacted>
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index 0ad7157660afa..b7c2528a8f41c 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -1039,6 +1039,8 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
              DRM_ERROR("Unable to init panel orientation\n");
              goto err_cleanup_encoder;
      }
+     drm_connector_set_panel_orientation(dsi->connector,
+                                         DRM_MODE_PANEL_ORIENTATION_NORMAL);
In drm_connector_set_panel_orientation() [1], I find that the
orientation could be set only once. Once you set it to normal, it
could not be set to other orientation. Right?
Hello,
Yeah this looks true, and makes sense according to the documentation:
https://01.org/linuxgraphics/gfx-docs/drm/gpu/drm-kms.html#:~:text=one%20standardized%20property%3A-,panel%20orientation%3A,-On%20some%20devices

Panel orientation has to do with the how the hardware is mounted, in
contrast with the Rotation property. All the HW we have right now has
a normal panel orientation so it makes sense to be set this way. Among
other drivers, panel orientation is always set right after the
property is initialized.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/drm_connector.c?h=v5.16-rc5#n2302

Regards,
Chun-Kuang.
quoted
quoted
quoted
      drm_connector_attach_encoder(dsi->connector, &dsi->encoder);

--
2.33.0.1079.g6e70778dc9-goog
--
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH] mediatek: Set default value for Panel Orientation connector prop.

From: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Date: 2021-12-16 16:53:49

Hi, Mark:

Mark Yacoub [off-list ref] 於 2021年12月16日 週四 上午1:25寫道:
On Wed, Dec 15, 2021 at 11:14 AM Chun-Kuang Hu [off-list ref] wrote:
quoted
Hi, Mark:

Mark Yacoub [off-list ref] 於 2021年12月14日 週二 下午11:13寫道:
quoted
Hey CK, can we have this merged?
Thank you!

On Mon, Oct 25, 2021 at 9:13 PM Sean Paul [off-list ref] wrote:
quoted
On Fri, Oct 22, 2021 at 01:24:03PM -0400, Mark Yacoub wrote:
quoted
From: Mark Yacoub <redacted>

[Why]
Creating the prop uses UNKNOWN as the initial value, which is not a
supported value if the props is to be supported.

[How]
Set the panel orientation default value to NORMAL right after creating
the prop.
Reviewed-by: Sean Paul <redacted>
quoted
Tested on Jacuzzi(MTK)
Fixes IGT@kms_properties@get_properties-sanity-{atomic,non-atomic}

Signed-off-by: Mark Yacoub <redacted>
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index 0ad7157660afa..b7c2528a8f41c 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -1039,6 +1039,8 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
              DRM_ERROR("Unable to init panel orientation\n");
              goto err_cleanup_encoder;
      }
+     drm_connector_set_panel_orientation(dsi->connector,
+                                         DRM_MODE_PANEL_ORIENTATION_NORMAL);
In drm_connector_set_panel_orientation() [1], I find that the
orientation could be set only once. Once you set it to normal, it
could not be set to other orientation. Right?
Hello,
Yeah this looks true, and makes sense according to the documentation:
https://01.org/linuxgraphics/gfx-docs/drm/gpu/drm-kms.html#:~:text=one%20standardized%20property%3A-,panel%20orientation%3A,-On%20some%20devices

Panel orientation has to do with the how the hardware is mounted, in
contrast with the Rotation property. All the HW we have right now has
a normal panel orientation so it makes sense to be set this way. Among
Many evidence [1], [2], [3], show that Chromebook plan to have other
orientation on mt8183, so I think you should consider this.

[1] https://patchwork.kernel.org/project/linux-mediatek/patch/20210409045314.3420733-2-hsinyi@chromium.org/
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c?h=v5.16-rc5#n1474
[3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/mediatek/mt8183-kukui-krane-sku176.dts?h=v5.16-rc5#n22

Regards,
Chun-Kuang.


other drivers, panel orientation is always set right after the
property is initialized.
quoted
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/drm_connector.c?h=v5.16-rc5#n2302

Regards,
Chun-Kuang.
quoted
quoted
quoted
      drm_connector_attach_encoder(dsi->connector, &dsi->encoder);

--
2.33.0.1079.g6e70778dc9-goog
--
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH] mediatek: Set default value for Panel Orientation connector prop.

From: Mark Yacoub <hidden>
Date: 2021-12-16 18:29:34

This makes sense. Thanks for pointing that out I wasn't aware of it.
I'll take a closer look and try to come up with something better.

Thanks Chun-Kuang!

On Thu, Dec 16, 2021 at 11:53 AM Chun-Kuang Hu [off-list ref] wrote:
Hi, Mark:

Mark Yacoub [off-list ref] 於 2021年12月16日 週四 上午1:25寫道:
quoted
On Wed, Dec 15, 2021 at 11:14 AM Chun-Kuang Hu [off-list ref] wrote:
quoted
Hi, Mark:

Mark Yacoub [off-list ref] 於 2021年12月14日 週二 下午11:13寫道:
quoted
Hey CK, can we have this merged?
Thank you!

On Mon, Oct 25, 2021 at 9:13 PM Sean Paul [off-list ref] wrote:
quoted
On Fri, Oct 22, 2021 at 01:24:03PM -0400, Mark Yacoub wrote:
quoted
From: Mark Yacoub <redacted>

[Why]
Creating the prop uses UNKNOWN as the initial value, which is not a
supported value if the props is to be supported.

[How]
Set the panel orientation default value to NORMAL right after creating
the prop.
Reviewed-by: Sean Paul <redacted>
quoted
Tested on Jacuzzi(MTK)
Fixes IGT@kms_properties@get_properties-sanity-{atomic,non-atomic}

Signed-off-by: Mark Yacoub <redacted>
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index 0ad7157660afa..b7c2528a8f41c 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -1039,6 +1039,8 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
              DRM_ERROR("Unable to init panel orientation\n");
              goto err_cleanup_encoder;
      }
+     drm_connector_set_panel_orientation(dsi->connector,
+                                         DRM_MODE_PANEL_ORIENTATION_NORMAL);
In drm_connector_set_panel_orientation() [1], I find that the
orientation could be set only once. Once you set it to normal, it
could not be set to other orientation. Right?
Hello,
Yeah this looks true, and makes sense according to the documentation:
https://01.org/linuxgraphics/gfx-docs/drm/gpu/drm-kms.html#:~:text=one%20standardized%20property%3A-,panel%20orientation%3A,-On%20some%20devices

Panel orientation has to do with the how the hardware is mounted, in
contrast with the Rotation property. All the HW we have right now has
a normal panel orientation so it makes sense to be set this way. Among
Many evidence [1], [2], [3], show that Chromebook plan to have other
orientation on mt8183, so I think you should consider this.

[1] https://patchwork.kernel.org/project/linux-mediatek/patch/20210409045314.3420733-2-hsinyi@chromium.org/
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c?h=v5.16-rc5#n1474
[3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/mediatek/mt8183-kukui-krane-sku176.dts?h=v5.16-rc5#n22

Regards,
Chun-Kuang.


quoted
other drivers, panel orientation is always set right after the
property is initialized.
quoted
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/drm_connector.c?h=v5.16-rc5#n2302

Regards,
Chun-Kuang.
quoted
quoted
quoted
      drm_connector_attach_encoder(dsi->connector, &dsi->encoder);

--
2.33.0.1079.g6e70778dc9-goog
--
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

[PATCH v2] drm/mediatek: Set default value for Panel Orientation connector prop.

From: Mark Yacoub <hidden>
Date: 2021-12-29 18:41:39

[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.

v1:
Set panel orientation only if DSI panel does not exist.

Tested on Jacuzzi(MTK)
Fixes IGT@kms_properties@get_properties-sanity-{atomic,non-atomic}

Signed-off-by: Mark Yacoub <redacted>
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index 0ad7157660afa..7cf71705775f0 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -1040,6 +1040,13 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
 		goto err_cleanup_encoder;
 	}
 
+	// A drm_panel can have its own orientation. If there is no panel, set the
+	// orientation to NORMAL.
+	if (!dsi->panel) {
+		drm_connector_set_panel_orientation(
+			dsi->connector, DRM_MODE_PANEL_ORIENTATION_NORMAL);
+	}
+
 	drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
 
 	return 0;
-- 
2.34.1.448.ga2b2bfdf31-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

[PATCH v2] drm/mediatek: Set default value for Panel Orientation connector prop.

From: Mark Yacoub <hidden>
Date: 2021-12-29 18:44:26

[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.

v1:
Set panel orientation only if DSI panel does not exist.

Tested on Jacuzzi(MTK)
Fixes IGT@kms_properties@get_properties-sanity-{atomic,non-atomic}

Signed-off-by: Mark Yacoub <redacted>
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index 0ad7157660afa..9d33dd93118e0 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -1040,6 +1040,13 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
 		goto err_cleanup_encoder;
 	}
 
+	/* A drm_panel can have its own orientation. If there is no panel, set the
+	 * orientation to NORMAL. */
+	if (!dsi->panel) {
+		drm_connector_set_panel_orientation(
+			dsi->connector, DRM_MODE_PANEL_ORIENTATION_NORMAL);
+	}
+
 	drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
 
 	return 0;
-- 
2.34.1.448.ga2b2bfdf31-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH v2] drm/mediatek: Set default value for Panel Orientation connector prop.

From: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Date: 2022-01-03 12:39:37

Hi, Mark:

Mark Yacoub [off-list ref] 於 2021年12月30日 週四 上午2:44寫道:
quoted hunk
[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.

v1:
Set panel orientation only if DSI panel does not exist.

Tested on Jacuzzi(MTK)
Fixes IGT@kms_properties@get_properties-sanity-{atomic,non-atomic}

Signed-off-by: Mark Yacoub <redacted>
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index 0ad7157660afa..9d33dd93118e0 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -1040,6 +1040,13 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
                goto err_cleanup_encoder;
        }

+       /* A drm_panel can have its own orientation. If there is no panel, set the
+        * orientation to NORMAL. */
+       if (!dsi->panel) {
Please send patch based on latest kernel version. In latest kernel
version, struct mtk_dsi{} has no member 'panel'.

Regards,
Chun-Kuang.
+               drm_connector_set_panel_orientation(
+                       dsi->connector, DRM_MODE_PANEL_ORIENTATION_NORMAL);
+       }
+
        drm_connector_attach_encoder(dsi->connector, &dsi->encoder);

        return 0;
--
2.34.1.448.ga2b2bfdf31-goog
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

[PATCH v3] drm/mediatek: Set default value for Panel Orientation connector prop.

From: Mark Yacoub <hidden>
Date: 2022-01-05 21:23:46

[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@kms_properties@get_properties-sanity-{atomic,non-atomic}

Signed-off-by: Mark Yacoub <redacted>
---
 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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help