All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/8] Add a panel API to set orientation properly
@ 2022-06-07  9:05 ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Hans de Goede, Thierry Reding, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-mediatek,
	Rob Clark, Stephen Boyd, Douglas Anderson, Rob Herring,
	linux-arm-kernel, linux-kernel

Panels usually call drm_connector_set_panel_orientation(), which is
later than drm/kms driver calling drm_dev_register(). This leads to a
WARN()[1].

The orientation property is known earlier. For example, some panels
parse the property through device tree during probe.

The series add a panel API drm_connector_set_orientation_from_panel()
for drm/kms drivers. The drivers can call the API to set panel's
orientation before drm_dev_register().

Panel needs to implement .get_orientation callback to return the property.

[1] https://patchwork.kernel.org/project/linux-mediatek/patch/20220530081910.3947168-2-hsinyi@chromium.org/

v4 of this series is "Add a panel API to return panel orientation":
https://lore.kernel.org/lkml/20220606152431.1889185-1-hsinyi@chromium.org/

Hsin-Yi Wang (8):
  drm/panel: Add an API to allow drm to set orientation from panel
  drm/panel: boe-tv101wum-nl6: Implement .get_orientation callback
  drm/panel: panel-edp: Implement .get_orientation callback
  drm/panel: lvds: Implement .get_orientation callback
  drm/panel: panel-simple: Implement .get_orientation callback
  drm/panel: ili9881c: Implement .get_orientation callback
  drm/panel: elida-kd35t133: Implement .get_orientation callback
  drm/mediatek: Config orientation property if panel provides it

 drivers/gpu/drm/drm_connector.c               | 32 +++++++++++++++++++
 drivers/gpu/drm/mediatek/mtk_dsi.c            | 15 +++++++++
 .../gpu/drm/panel/panel-boe-tv101wum-nl6.c    | 12 +++++++
 drivers/gpu/drm/panel/panel-edp.c             | 13 +++++++-
 drivers/gpu/drm/panel/panel-elida-kd35t133.c  | 12 +++++++
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 12 +++++++
 drivers/gpu/drm/panel/panel-lvds.c            | 13 ++++++++
 drivers/gpu/drm/panel/panel-simple.c          | 14 +++++++-
 include/drm/drm_connector.h                   |  4 +++
 include/drm/drm_panel.h                       |  9 ++++++
 10 files changed, 134 insertions(+), 2 deletions(-)

-- 
2.36.1.255.ge46751e96f-goog


^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v5 0/8] Add a panel API to set orientation properly
@ 2022-06-07  9:05 ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Rob Clark, Rob Herring, David Airlie, linux-kernel,
	Douglas Anderson, Stephen Boyd, Hans de Goede, Thierry Reding,
	linux-mediatek, dri-devel, Thomas Zimmermann, Matthias Brugger,
	Sam Ravnborg, linux-arm-kernel

Panels usually call drm_connector_set_panel_orientation(), which is
later than drm/kms driver calling drm_dev_register(). This leads to a
WARN()[1].

The orientation property is known earlier. For example, some panels
parse the property through device tree during probe.

The series add a panel API drm_connector_set_orientation_from_panel()
for drm/kms drivers. The drivers can call the API to set panel's
orientation before drm_dev_register().

Panel needs to implement .get_orientation callback to return the property.

[1] https://patchwork.kernel.org/project/linux-mediatek/patch/20220530081910.3947168-2-hsinyi@chromium.org/

v4 of this series is "Add a panel API to return panel orientation":
https://lore.kernel.org/lkml/20220606152431.1889185-1-hsinyi@chromium.org/

Hsin-Yi Wang (8):
  drm/panel: Add an API to allow drm to set orientation from panel
  drm/panel: boe-tv101wum-nl6: Implement .get_orientation callback
  drm/panel: panel-edp: Implement .get_orientation callback
  drm/panel: lvds: Implement .get_orientation callback
  drm/panel: panel-simple: Implement .get_orientation callback
  drm/panel: ili9881c: Implement .get_orientation callback
  drm/panel: elida-kd35t133: Implement .get_orientation callback
  drm/mediatek: Config orientation property if panel provides it

 drivers/gpu/drm/drm_connector.c               | 32 +++++++++++++++++++
 drivers/gpu/drm/mediatek/mtk_dsi.c            | 15 +++++++++
 .../gpu/drm/panel/panel-boe-tv101wum-nl6.c    | 12 +++++++
 drivers/gpu/drm/panel/panel-edp.c             | 13 +++++++-
 drivers/gpu/drm/panel/panel-elida-kd35t133.c  | 12 +++++++
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 12 +++++++
 drivers/gpu/drm/panel/panel-lvds.c            | 13 ++++++++
 drivers/gpu/drm/panel/panel-simple.c          | 14 +++++++-
 include/drm/drm_connector.h                   |  4 +++
 include/drm/drm_panel.h                       |  9 ++++++
 10 files changed, 134 insertions(+), 2 deletions(-)

-- 
2.36.1.255.ge46751e96f-goog


^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v5 0/8] Add a panel API to set orientation properly
@ 2022-06-07  9:05 ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Hans de Goede, Thierry Reding, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-mediatek,
	Rob Clark, Stephen Boyd, Douglas Anderson, Rob Herring,
	linux-arm-kernel, linux-kernel

Panels usually call drm_connector_set_panel_orientation(), which is
later than drm/kms driver calling drm_dev_register(). This leads to a
WARN()[1].

The orientation property is known earlier. For example, some panels
parse the property through device tree during probe.

The series add a panel API drm_connector_set_orientation_from_panel()
for drm/kms drivers. The drivers can call the API to set panel's
orientation before drm_dev_register().

Panel needs to implement .get_orientation callback to return the property.

[1] https://patchwork.kernel.org/project/linux-mediatek/patch/20220530081910.3947168-2-hsinyi@chromium.org/

v4 of this series is "Add a panel API to return panel orientation":
https://lore.kernel.org/lkml/20220606152431.1889185-1-hsinyi@chromium.org/

Hsin-Yi Wang (8):
  drm/panel: Add an API to allow drm to set orientation from panel
  drm/panel: boe-tv101wum-nl6: Implement .get_orientation callback
  drm/panel: panel-edp: Implement .get_orientation callback
  drm/panel: lvds: Implement .get_orientation callback
  drm/panel: panel-simple: Implement .get_orientation callback
  drm/panel: ili9881c: Implement .get_orientation callback
  drm/panel: elida-kd35t133: Implement .get_orientation callback
  drm/mediatek: Config orientation property if panel provides it

 drivers/gpu/drm/drm_connector.c               | 32 +++++++++++++++++++
 drivers/gpu/drm/mediatek/mtk_dsi.c            | 15 +++++++++
 .../gpu/drm/panel/panel-boe-tv101wum-nl6.c    | 12 +++++++
 drivers/gpu/drm/panel/panel-edp.c             | 13 +++++++-
 drivers/gpu/drm/panel/panel-elida-kd35t133.c  | 12 +++++++
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 12 +++++++
 drivers/gpu/drm/panel/panel-lvds.c            | 13 ++++++++
 drivers/gpu/drm/panel/panel-simple.c          | 14 +++++++-
 include/drm/drm_connector.h                   |  4 +++
 include/drm/drm_panel.h                       |  9 ++++++
 10 files changed, 134 insertions(+), 2 deletions(-)

-- 
2.36.1.255.ge46751e96f-goog


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v5 0/8] Add a panel API to set orientation properly
@ 2022-06-07  9:05 ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Hans de Goede, Thierry Reding, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-mediatek,
	Rob Clark, Stephen Boyd, Douglas Anderson, Rob Herring,
	linux-arm-kernel, linux-kernel

Panels usually call drm_connector_set_panel_orientation(), which is
later than drm/kms driver calling drm_dev_register(). This leads to a
WARN()[1].

The orientation property is known earlier. For example, some panels
parse the property through device tree during probe.

The series add a panel API drm_connector_set_orientation_from_panel()
for drm/kms drivers. The drivers can call the API to set panel's
orientation before drm_dev_register().

Panel needs to implement .get_orientation callback to return the property.

[1] https://patchwork.kernel.org/project/linux-mediatek/patch/20220530081910.3947168-2-hsinyi@chromium.org/

v4 of this series is "Add a panel API to return panel orientation":
https://lore.kernel.org/lkml/20220606152431.1889185-1-hsinyi@chromium.org/

Hsin-Yi Wang (8):
  drm/panel: Add an API to allow drm to set orientation from panel
  drm/panel: boe-tv101wum-nl6: Implement .get_orientation callback
  drm/panel: panel-edp: Implement .get_orientation callback
  drm/panel: lvds: Implement .get_orientation callback
  drm/panel: panel-simple: Implement .get_orientation callback
  drm/panel: ili9881c: Implement .get_orientation callback
  drm/panel: elida-kd35t133: Implement .get_orientation callback
  drm/mediatek: Config orientation property if panel provides it

 drivers/gpu/drm/drm_connector.c               | 32 +++++++++++++++++++
 drivers/gpu/drm/mediatek/mtk_dsi.c            | 15 +++++++++
 .../gpu/drm/panel/panel-boe-tv101wum-nl6.c    | 12 +++++++
 drivers/gpu/drm/panel/panel-edp.c             | 13 +++++++-
 drivers/gpu/drm/panel/panel-elida-kd35t133.c  | 12 +++++++
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 12 +++++++
 drivers/gpu/drm/panel/panel-lvds.c            | 13 ++++++++
 drivers/gpu/drm/panel/panel-simple.c          | 14 +++++++-
 include/drm/drm_connector.h                   |  4 +++
 include/drm/drm_panel.h                       |  9 ++++++
 10 files changed, 134 insertions(+), 2 deletions(-)

-- 
2.36.1.255.ge46751e96f-goog


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

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH v5 1/8] drm/panel: Add an API to allow drm to set orientation from panel
  2022-06-07  9:05 ` Hsin-Yi Wang
  (?)
  (?)
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  -1 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Hans de Goede, Thierry Reding, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-mediatek,
	Rob Clark, Stephen Boyd, Douglas Anderson, Rob Herring,
	linux-arm-kernel, linux-kernel

Panels usually call drm_connector_set_panel_orientation(), which is
later than drm/kms driver calling drm_dev_register(). This leads to a
WARN().

The orientation property is known earlier. For example, some panels
parse the property through device tree during probe.

Add an API to return the property from panel to drm/kms driver, so the
drivers are able to call drm_connector_set_orientation_from_panel() before
drm_dev_register().

Suggested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
---
v4 -> v5:
- Simplify the caller from drm_connector_set_panel_orientation(connector,
drm_panel_get_orientation(panel)) to
drm_connector_set_orientation_from_panel(connector, panel).
The main function is also moved from drm_panel to drm_connector.
- Add some notice for the original drm_connector_set_panel_orientation()
usage.
- sort callbacks.
---
 drivers/gpu/drm/drm_connector.c | 32 ++++++++++++++++++++++++++++++++
 include/drm/drm_connector.h     |  4 ++++
 include/drm/drm_panel.h         |  9 +++++++++
 3 files changed, 45 insertions(+)

diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 1c48d162c77e..859165a1c8f1 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -24,6 +24,7 @@
 #include <drm/drm_connector.h>
 #include <drm/drm_edid.h>
 #include <drm/drm_encoder.h>
+#include <drm/drm_panel.h>
 #include <drm/drm_utils.h>
 #include <drm/drm_print.h>
 #include <drm/drm_drv.h>
@@ -2320,6 +2321,9 @@ EXPORT_SYMBOL(drm_connector_set_vrr_capable_property);
  * It is allowed to call this function with a panel_orientation of
  * DRM_MODE_PANEL_ORIENTATION_UNKNOWN, in which case it is a no-op.
  *
+ * The function shouldn't be called in panel after drm is registered (i.e.
+ * drm_dev_register() is called in drm).
+ *
  * Returns:
  * Zero on success, negative errno on failure.
  */
@@ -2389,6 +2393,34 @@ int drm_connector_set_panel_orientation_with_quirk(
 }
 EXPORT_SYMBOL(drm_connector_set_panel_orientation_with_quirk);
 
+/**
+ * drm_connector_set_orientation_from_panel -
+ * 	set the connector's panel_orientation from panel's callback.
+ * @connector: connector for which to init the panel-orientation property.
+ * @panel: panel that can provide orientation information.
+ *
+ * Drm drivers should call this function before drm_dev_register().
+ * Orientation is obtained from panel's .get_orientation() callback.
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_connector_set_orientation_from_panel(
+	struct drm_connector *connector,
+	struct drm_panel *panel)
+{
+	enum drm_panel_orientation panel_orientation;
+
+	if (panel && panel->funcs && panel->funcs->get_orientation)
+		panel_orientation = panel->funcs->get_orientation(panel);
+	else
+		panel_orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
+
+	return drm_connector_set_panel_orientation(connector,
+						   panel_orientation);
+}
+EXPORT_SYMBOL(drm_connector_set_orientation_from_panel);
+
 static const struct drm_prop_enum_list privacy_screen_enum[] = {
 	{ PRIVACY_SCREEN_DISABLED,		"Disabled" },
 	{ PRIVACY_SCREEN_ENABLED,		"Enabled" },
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index 3ac4bf87f257..94b422b55cc1 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -38,6 +38,7 @@ struct drm_modeset_acquire_ctx;
 struct drm_device;
 struct drm_crtc;
 struct drm_encoder;
+struct drm_panel;
 struct drm_property;
 struct drm_property_blob;
 struct drm_printer;
@@ -1802,6 +1803,9 @@ int drm_connector_set_panel_orientation_with_quirk(
 	struct drm_connector *connector,
 	enum drm_panel_orientation panel_orientation,
 	int width, int height);
+int drm_connector_set_orientation_from_panel(
+	struct drm_connector *connector,
+	struct drm_panel *panel);
 int drm_connector_attach_max_bpc_property(struct drm_connector *connector,
 					  int min, int max);
 void drm_connector_create_privacy_screen_properties(struct drm_connector *conn);
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index d279ee455f01..3a271128c078 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -116,6 +116,15 @@ struct drm_panel_funcs {
 	int (*get_modes)(struct drm_panel *panel,
 			 struct drm_connector *connector);
 
+	/**
+	 * @get_orientation:
+	 *
+	 * Return the panel orientation set by device tree or EDID.
+	 *
+	 * This function is optional.
+	 */
+	enum drm_panel_orientation (*get_orientation)(struct drm_panel *panel);
+
 	/**
 	 * @get_timings:
 	 *
-- 
2.36.1.255.ge46751e96f-goog


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 1/8] drm/panel: Add an API to allow drm to set orientation from panel
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Rob Clark, Rob Herring, David Airlie, linux-kernel,
	Douglas Anderson, Stephen Boyd, Hans de Goede, Thierry Reding,
	linux-mediatek, dri-devel, Thomas Zimmermann, Matthias Brugger,
	Sam Ravnborg, linux-arm-kernel

Panels usually call drm_connector_set_panel_orientation(), which is
later than drm/kms driver calling drm_dev_register(). This leads to a
WARN().

The orientation property is known earlier. For example, some panels
parse the property through device tree during probe.

Add an API to return the property from panel to drm/kms driver, so the
drivers are able to call drm_connector_set_orientation_from_panel() before
drm_dev_register().

Suggested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
---
v4 -> v5:
- Simplify the caller from drm_connector_set_panel_orientation(connector,
drm_panel_get_orientation(panel)) to
drm_connector_set_orientation_from_panel(connector, panel).
The main function is also moved from drm_panel to drm_connector.
- Add some notice for the original drm_connector_set_panel_orientation()
usage.
- sort callbacks.
---
 drivers/gpu/drm/drm_connector.c | 32 ++++++++++++++++++++++++++++++++
 include/drm/drm_connector.h     |  4 ++++
 include/drm/drm_panel.h         |  9 +++++++++
 3 files changed, 45 insertions(+)

diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 1c48d162c77e..859165a1c8f1 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -24,6 +24,7 @@
 #include <drm/drm_connector.h>
 #include <drm/drm_edid.h>
 #include <drm/drm_encoder.h>
+#include <drm/drm_panel.h>
 #include <drm/drm_utils.h>
 #include <drm/drm_print.h>
 #include <drm/drm_drv.h>
@@ -2320,6 +2321,9 @@ EXPORT_SYMBOL(drm_connector_set_vrr_capable_property);
  * It is allowed to call this function with a panel_orientation of
  * DRM_MODE_PANEL_ORIENTATION_UNKNOWN, in which case it is a no-op.
  *
+ * The function shouldn't be called in panel after drm is registered (i.e.
+ * drm_dev_register() is called in drm).
+ *
  * Returns:
  * Zero on success, negative errno on failure.
  */
@@ -2389,6 +2393,34 @@ int drm_connector_set_panel_orientation_with_quirk(
 }
 EXPORT_SYMBOL(drm_connector_set_panel_orientation_with_quirk);
 
+/**
+ * drm_connector_set_orientation_from_panel -
+ * 	set the connector's panel_orientation from panel's callback.
+ * @connector: connector for which to init the panel-orientation property.
+ * @panel: panel that can provide orientation information.
+ *
+ * Drm drivers should call this function before drm_dev_register().
+ * Orientation is obtained from panel's .get_orientation() callback.
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_connector_set_orientation_from_panel(
+	struct drm_connector *connector,
+	struct drm_panel *panel)
+{
+	enum drm_panel_orientation panel_orientation;
+
+	if (panel && panel->funcs && panel->funcs->get_orientation)
+		panel_orientation = panel->funcs->get_orientation(panel);
+	else
+		panel_orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
+
+	return drm_connector_set_panel_orientation(connector,
+						   panel_orientation);
+}
+EXPORT_SYMBOL(drm_connector_set_orientation_from_panel);
+
 static const struct drm_prop_enum_list privacy_screen_enum[] = {
 	{ PRIVACY_SCREEN_DISABLED,		"Disabled" },
 	{ PRIVACY_SCREEN_ENABLED,		"Enabled" },
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index 3ac4bf87f257..94b422b55cc1 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -38,6 +38,7 @@ struct drm_modeset_acquire_ctx;
 struct drm_device;
 struct drm_crtc;
 struct drm_encoder;
+struct drm_panel;
 struct drm_property;
 struct drm_property_blob;
 struct drm_printer;
@@ -1802,6 +1803,9 @@ int drm_connector_set_panel_orientation_with_quirk(
 	struct drm_connector *connector,
 	enum drm_panel_orientation panel_orientation,
 	int width, int height);
+int drm_connector_set_orientation_from_panel(
+	struct drm_connector *connector,
+	struct drm_panel *panel);
 int drm_connector_attach_max_bpc_property(struct drm_connector *connector,
 					  int min, int max);
 void drm_connector_create_privacy_screen_properties(struct drm_connector *conn);
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index d279ee455f01..3a271128c078 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -116,6 +116,15 @@ struct drm_panel_funcs {
 	int (*get_modes)(struct drm_panel *panel,
 			 struct drm_connector *connector);
 
+	/**
+	 * @get_orientation:
+	 *
+	 * Return the panel orientation set by device tree or EDID.
+	 *
+	 * This function is optional.
+	 */
+	enum drm_panel_orientation (*get_orientation)(struct drm_panel *panel);
+
 	/**
 	 * @get_timings:
 	 *
-- 
2.36.1.255.ge46751e96f-goog


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 1/8] drm/panel: Add an API to allow drm to set orientation from panel
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Hans de Goede, Thierry Reding, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-mediatek,
	Rob Clark, Stephen Boyd, Douglas Anderson, Rob Herring,
	linux-arm-kernel, linux-kernel

Panels usually call drm_connector_set_panel_orientation(), which is
later than drm/kms driver calling drm_dev_register(). This leads to a
WARN().

The orientation property is known earlier. For example, some panels
parse the property through device tree during probe.

Add an API to return the property from panel to drm/kms driver, so the
drivers are able to call drm_connector_set_orientation_from_panel() before
drm_dev_register().

Suggested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
---
v4 -> v5:
- Simplify the caller from drm_connector_set_panel_orientation(connector,
drm_panel_get_orientation(panel)) to
drm_connector_set_orientation_from_panel(connector, panel).
The main function is also moved from drm_panel to drm_connector.
- Add some notice for the original drm_connector_set_panel_orientation()
usage.
- sort callbacks.
---
 drivers/gpu/drm/drm_connector.c | 32 ++++++++++++++++++++++++++++++++
 include/drm/drm_connector.h     |  4 ++++
 include/drm/drm_panel.h         |  9 +++++++++
 3 files changed, 45 insertions(+)

diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 1c48d162c77e..859165a1c8f1 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -24,6 +24,7 @@
 #include <drm/drm_connector.h>
 #include <drm/drm_edid.h>
 #include <drm/drm_encoder.h>
+#include <drm/drm_panel.h>
 #include <drm/drm_utils.h>
 #include <drm/drm_print.h>
 #include <drm/drm_drv.h>
@@ -2320,6 +2321,9 @@ EXPORT_SYMBOL(drm_connector_set_vrr_capable_property);
  * It is allowed to call this function with a panel_orientation of
  * DRM_MODE_PANEL_ORIENTATION_UNKNOWN, in which case it is a no-op.
  *
+ * The function shouldn't be called in panel after drm is registered (i.e.
+ * drm_dev_register() is called in drm).
+ *
  * Returns:
  * Zero on success, negative errno on failure.
  */
@@ -2389,6 +2393,34 @@ int drm_connector_set_panel_orientation_with_quirk(
 }
 EXPORT_SYMBOL(drm_connector_set_panel_orientation_with_quirk);
 
+/**
+ * drm_connector_set_orientation_from_panel -
+ * 	set the connector's panel_orientation from panel's callback.
+ * @connector: connector for which to init the panel-orientation property.
+ * @panel: panel that can provide orientation information.
+ *
+ * Drm drivers should call this function before drm_dev_register().
+ * Orientation is obtained from panel's .get_orientation() callback.
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_connector_set_orientation_from_panel(
+	struct drm_connector *connector,
+	struct drm_panel *panel)
+{
+	enum drm_panel_orientation panel_orientation;
+
+	if (panel && panel->funcs && panel->funcs->get_orientation)
+		panel_orientation = panel->funcs->get_orientation(panel);
+	else
+		panel_orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
+
+	return drm_connector_set_panel_orientation(connector,
+						   panel_orientation);
+}
+EXPORT_SYMBOL(drm_connector_set_orientation_from_panel);
+
 static const struct drm_prop_enum_list privacy_screen_enum[] = {
 	{ PRIVACY_SCREEN_DISABLED,		"Disabled" },
 	{ PRIVACY_SCREEN_ENABLED,		"Enabled" },
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index 3ac4bf87f257..94b422b55cc1 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -38,6 +38,7 @@ struct drm_modeset_acquire_ctx;
 struct drm_device;
 struct drm_crtc;
 struct drm_encoder;
+struct drm_panel;
 struct drm_property;
 struct drm_property_blob;
 struct drm_printer;
@@ -1802,6 +1803,9 @@ int drm_connector_set_panel_orientation_with_quirk(
 	struct drm_connector *connector,
 	enum drm_panel_orientation panel_orientation,
 	int width, int height);
+int drm_connector_set_orientation_from_panel(
+	struct drm_connector *connector,
+	struct drm_panel *panel);
 int drm_connector_attach_max_bpc_property(struct drm_connector *connector,
 					  int min, int max);
 void drm_connector_create_privacy_screen_properties(struct drm_connector *conn);
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index d279ee455f01..3a271128c078 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -116,6 +116,15 @@ struct drm_panel_funcs {
 	int (*get_modes)(struct drm_panel *panel,
 			 struct drm_connector *connector);
 
+	/**
+	 * @get_orientation:
+	 *
+	 * Return the panel orientation set by device tree or EDID.
+	 *
+	 * This function is optional.
+	 */
+	enum drm_panel_orientation (*get_orientation)(struct drm_panel *panel);
+
 	/**
 	 * @get_timings:
 	 *
-- 
2.36.1.255.ge46751e96f-goog


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 1/8] drm/panel: Add an API to allow drm to set orientation from panel
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Hans de Goede, Thierry Reding, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-mediatek,
	Rob Clark, Stephen Boyd, Douglas Anderson, Rob Herring,
	linux-arm-kernel, linux-kernel

Panels usually call drm_connector_set_panel_orientation(), which is
later than drm/kms driver calling drm_dev_register(). This leads to a
WARN().

The orientation property is known earlier. For example, some panels
parse the property through device tree during probe.

Add an API to return the property from panel to drm/kms driver, so the
drivers are able to call drm_connector_set_orientation_from_panel() before
drm_dev_register().

Suggested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
---
v4 -> v5:
- Simplify the caller from drm_connector_set_panel_orientation(connector,
drm_panel_get_orientation(panel)) to
drm_connector_set_orientation_from_panel(connector, panel).
The main function is also moved from drm_panel to drm_connector.
- Add some notice for the original drm_connector_set_panel_orientation()
usage.
- sort callbacks.
---
 drivers/gpu/drm/drm_connector.c | 32 ++++++++++++++++++++++++++++++++
 include/drm/drm_connector.h     |  4 ++++
 include/drm/drm_panel.h         |  9 +++++++++
 3 files changed, 45 insertions(+)

diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 1c48d162c77e..859165a1c8f1 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -24,6 +24,7 @@
 #include <drm/drm_connector.h>
 #include <drm/drm_edid.h>
 #include <drm/drm_encoder.h>
+#include <drm/drm_panel.h>
 #include <drm/drm_utils.h>
 #include <drm/drm_print.h>
 #include <drm/drm_drv.h>
@@ -2320,6 +2321,9 @@ EXPORT_SYMBOL(drm_connector_set_vrr_capable_property);
  * It is allowed to call this function with a panel_orientation of
  * DRM_MODE_PANEL_ORIENTATION_UNKNOWN, in which case it is a no-op.
  *
+ * The function shouldn't be called in panel after drm is registered (i.e.
+ * drm_dev_register() is called in drm).
+ *
  * Returns:
  * Zero on success, negative errno on failure.
  */
@@ -2389,6 +2393,34 @@ int drm_connector_set_panel_orientation_with_quirk(
 }
 EXPORT_SYMBOL(drm_connector_set_panel_orientation_with_quirk);
 
+/**
+ * drm_connector_set_orientation_from_panel -
+ * 	set the connector's panel_orientation from panel's callback.
+ * @connector: connector for which to init the panel-orientation property.
+ * @panel: panel that can provide orientation information.
+ *
+ * Drm drivers should call this function before drm_dev_register().
+ * Orientation is obtained from panel's .get_orientation() callback.
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_connector_set_orientation_from_panel(
+	struct drm_connector *connector,
+	struct drm_panel *panel)
+{
+	enum drm_panel_orientation panel_orientation;
+
+	if (panel && panel->funcs && panel->funcs->get_orientation)
+		panel_orientation = panel->funcs->get_orientation(panel);
+	else
+		panel_orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
+
+	return drm_connector_set_panel_orientation(connector,
+						   panel_orientation);
+}
+EXPORT_SYMBOL(drm_connector_set_orientation_from_panel);
+
 static const struct drm_prop_enum_list privacy_screen_enum[] = {
 	{ PRIVACY_SCREEN_DISABLED,		"Disabled" },
 	{ PRIVACY_SCREEN_ENABLED,		"Enabled" },
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index 3ac4bf87f257..94b422b55cc1 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -38,6 +38,7 @@ struct drm_modeset_acquire_ctx;
 struct drm_device;
 struct drm_crtc;
 struct drm_encoder;
+struct drm_panel;
 struct drm_property;
 struct drm_property_blob;
 struct drm_printer;
@@ -1802,6 +1803,9 @@ int drm_connector_set_panel_orientation_with_quirk(
 	struct drm_connector *connector,
 	enum drm_panel_orientation panel_orientation,
 	int width, int height);
+int drm_connector_set_orientation_from_panel(
+	struct drm_connector *connector,
+	struct drm_panel *panel);
 int drm_connector_attach_max_bpc_property(struct drm_connector *connector,
 					  int min, int max);
 void drm_connector_create_privacy_screen_properties(struct drm_connector *conn);
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index d279ee455f01..3a271128c078 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -116,6 +116,15 @@ struct drm_panel_funcs {
 	int (*get_modes)(struct drm_panel *panel,
 			 struct drm_connector *connector);
 
+	/**
+	 * @get_orientation:
+	 *
+	 * Return the panel orientation set by device tree or EDID.
+	 *
+	 * This function is optional.
+	 */
+	enum drm_panel_orientation (*get_orientation)(struct drm_panel *panel);
+
 	/**
 	 * @get_timings:
 	 *
-- 
2.36.1.255.ge46751e96f-goog


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

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 2/8] drm/panel: boe-tv101wum-nl6: Implement .get_orientation callback
  2022-06-07  9:05 ` Hsin-Yi Wang
  (?)
  (?)
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  -1 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Hans de Goede, Thierry Reding, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-mediatek,
	Rob Clark, Stephen Boyd, Douglas Anderson, Rob Herring,
	linux-arm-kernel, linux-kernel

To return the orientation property to drm/kms driver.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
---
v4->v5:
Move the usage text from caller to function doc. Leave todo instead.
Same for other panel patches.
---
 drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
index 1be150ac758f..07f722f33fc5 100644
--- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
+++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
@@ -1511,16 +1511,28 @@ static int boe_panel_get_modes(struct drm_panel *panel,
 	connector->display_info.width_mm = boe->desc->size.width_mm;
 	connector->display_info.height_mm = boe->desc->size.height_mm;
 	connector->display_info.bpc = boe->desc->bpc;
+	/*
+	 * TODO: Remove once all drm drivers call
+	 * drm_connector_set_orientation_from_panel()
+	 */
 	drm_connector_set_panel_orientation(connector, boe->orientation);
 
 	return 1;
 }
 
+static enum drm_panel_orientation boe_panel_get_orientation(struct drm_panel *panel)
+{
+	struct boe_panel *boe = to_boe_panel(panel);
+
+	return boe->orientation;
+}
+
 static const struct drm_panel_funcs boe_panel_funcs = {
 	.unprepare = boe_panel_unprepare,
 	.prepare = boe_panel_prepare,
 	.enable = boe_panel_enable,
 	.get_modes = boe_panel_get_modes,
+	.get_orientation = boe_panel_get_orientation,
 };
 
 static int boe_panel_add(struct boe_panel *boe)
-- 
2.36.1.255.ge46751e96f-goog


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 2/8] drm/panel: boe-tv101wum-nl6: Implement .get_orientation callback
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Rob Clark, Rob Herring, David Airlie, linux-kernel,
	Douglas Anderson, Stephen Boyd, Hans de Goede, Thierry Reding,
	linux-mediatek, dri-devel, Thomas Zimmermann, Matthias Brugger,
	Sam Ravnborg, linux-arm-kernel

To return the orientation property to drm/kms driver.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
---
v4->v5:
Move the usage text from caller to function doc. Leave todo instead.
Same for other panel patches.
---
 drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
index 1be150ac758f..07f722f33fc5 100644
--- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
+++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
@@ -1511,16 +1511,28 @@ static int boe_panel_get_modes(struct drm_panel *panel,
 	connector->display_info.width_mm = boe->desc->size.width_mm;
 	connector->display_info.height_mm = boe->desc->size.height_mm;
 	connector->display_info.bpc = boe->desc->bpc;
+	/*
+	 * TODO: Remove once all drm drivers call
+	 * drm_connector_set_orientation_from_panel()
+	 */
 	drm_connector_set_panel_orientation(connector, boe->orientation);
 
 	return 1;
 }
 
+static enum drm_panel_orientation boe_panel_get_orientation(struct drm_panel *panel)
+{
+	struct boe_panel *boe = to_boe_panel(panel);
+
+	return boe->orientation;
+}
+
 static const struct drm_panel_funcs boe_panel_funcs = {
 	.unprepare = boe_panel_unprepare,
 	.prepare = boe_panel_prepare,
 	.enable = boe_panel_enable,
 	.get_modes = boe_panel_get_modes,
+	.get_orientation = boe_panel_get_orientation,
 };
 
 static int boe_panel_add(struct boe_panel *boe)
-- 
2.36.1.255.ge46751e96f-goog


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 2/8] drm/panel: boe-tv101wum-nl6: Implement .get_orientation callback
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Hans de Goede, Thierry Reding, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-mediatek,
	Rob Clark, Stephen Boyd, Douglas Anderson, Rob Herring,
	linux-arm-kernel, linux-kernel

To return the orientation property to drm/kms driver.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
---
v4->v5:
Move the usage text from caller to function doc. Leave todo instead.
Same for other panel patches.
---
 drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
index 1be150ac758f..07f722f33fc5 100644
--- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
+++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
@@ -1511,16 +1511,28 @@ static int boe_panel_get_modes(struct drm_panel *panel,
 	connector->display_info.width_mm = boe->desc->size.width_mm;
 	connector->display_info.height_mm = boe->desc->size.height_mm;
 	connector->display_info.bpc = boe->desc->bpc;
+	/*
+	 * TODO: Remove once all drm drivers call
+	 * drm_connector_set_orientation_from_panel()
+	 */
 	drm_connector_set_panel_orientation(connector, boe->orientation);
 
 	return 1;
 }
 
+static enum drm_panel_orientation boe_panel_get_orientation(struct drm_panel *panel)
+{
+	struct boe_panel *boe = to_boe_panel(panel);
+
+	return boe->orientation;
+}
+
 static const struct drm_panel_funcs boe_panel_funcs = {
 	.unprepare = boe_panel_unprepare,
 	.prepare = boe_panel_prepare,
 	.enable = boe_panel_enable,
 	.get_modes = boe_panel_get_modes,
+	.get_orientation = boe_panel_get_orientation,
 };
 
 static int boe_panel_add(struct boe_panel *boe)
-- 
2.36.1.255.ge46751e96f-goog


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 2/8] drm/panel: boe-tv101wum-nl6: Implement .get_orientation callback
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Hans de Goede, Thierry Reding, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-mediatek,
	Rob Clark, Stephen Boyd, Douglas Anderson, Rob Herring,
	linux-arm-kernel, linux-kernel

To return the orientation property to drm/kms driver.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
---
v4->v5:
Move the usage text from caller to function doc. Leave todo instead.
Same for other panel patches.
---
 drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
index 1be150ac758f..07f722f33fc5 100644
--- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
+++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
@@ -1511,16 +1511,28 @@ static int boe_panel_get_modes(struct drm_panel *panel,
 	connector->display_info.width_mm = boe->desc->size.width_mm;
 	connector->display_info.height_mm = boe->desc->size.height_mm;
 	connector->display_info.bpc = boe->desc->bpc;
+	/*
+	 * TODO: Remove once all drm drivers call
+	 * drm_connector_set_orientation_from_panel()
+	 */
 	drm_connector_set_panel_orientation(connector, boe->orientation);
 
 	return 1;
 }
 
+static enum drm_panel_orientation boe_panel_get_orientation(struct drm_panel *panel)
+{
+	struct boe_panel *boe = to_boe_panel(panel);
+
+	return boe->orientation;
+}
+
 static const struct drm_panel_funcs boe_panel_funcs = {
 	.unprepare = boe_panel_unprepare,
 	.prepare = boe_panel_prepare,
 	.enable = boe_panel_enable,
 	.get_modes = boe_panel_get_modes,
+	.get_orientation = boe_panel_get_orientation,
 };
 
 static int boe_panel_add(struct boe_panel *boe)
-- 
2.36.1.255.ge46751e96f-goog


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

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 3/8] drm/panel: panel-edp: Implement .get_orientation callback
  2022-06-07  9:05 ` Hsin-Yi Wang
  (?)
  (?)
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  -1 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Hans de Goede, Thierry Reding, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-mediatek,
	Rob Clark, Stephen Boyd, Douglas Anderson, Rob Herring,
	linux-arm-kernel, linux-kernel

To return the orientation property to drm/kms driver.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
---
 drivers/gpu/drm/panel/panel-edp.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c
index c96014464355..ee622c1dd532 100644
--- a/drivers/gpu/drm/panel/panel-edp.c
+++ b/drivers/gpu/drm/panel/panel-edp.c
@@ -586,7 +586,10 @@ static int panel_edp_get_modes(struct drm_panel *panel,
 	else if (!num)
 		dev_warn(p->base.dev, "No display modes\n");
 
-	/* set up connector's "panel orientation" property */
+	/*
+	 * TODO: Remove once all drm drivers call
+	 * drm_connector_set_orientation_from_panel()
+	 */
 	drm_connector_set_panel_orientation(connector, p->orientation);
 
 	return num;
@@ -609,6 +612,13 @@ static int panel_edp_get_timings(struct drm_panel *panel,
 	return p->desc->num_timings;
 }
 
+static enum drm_panel_orientation panel_edp_get_orientation(struct drm_panel *panel)
+{
+	struct panel_edp *p = to_panel_edp(panel);
+
+       return p->orientation;
+}
+
 static int detected_panel_show(struct seq_file *s, void *data)
 {
 	struct drm_panel *panel = s->private;
@@ -637,6 +647,7 @@ static const struct drm_panel_funcs panel_edp_funcs = {
 	.prepare = panel_edp_prepare,
 	.enable = panel_edp_enable,
 	.get_modes = panel_edp_get_modes,
+	.get_orientation = panel_edp_get_orientation,
 	.get_timings = panel_edp_get_timings,
 	.debugfs_init = panel_edp_debugfs_init,
 };
-- 
2.36.1.255.ge46751e96f-goog


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 3/8] drm/panel: panel-edp: Implement .get_orientation callback
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Rob Clark, Rob Herring, David Airlie, linux-kernel,
	Douglas Anderson, Stephen Boyd, Hans de Goede, Thierry Reding,
	linux-mediatek, dri-devel, Thomas Zimmermann, Matthias Brugger,
	Sam Ravnborg, linux-arm-kernel

To return the orientation property to drm/kms driver.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
---
 drivers/gpu/drm/panel/panel-edp.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c
index c96014464355..ee622c1dd532 100644
--- a/drivers/gpu/drm/panel/panel-edp.c
+++ b/drivers/gpu/drm/panel/panel-edp.c
@@ -586,7 +586,10 @@ static int panel_edp_get_modes(struct drm_panel *panel,
 	else if (!num)
 		dev_warn(p->base.dev, "No display modes\n");
 
-	/* set up connector's "panel orientation" property */
+	/*
+	 * TODO: Remove once all drm drivers call
+	 * drm_connector_set_orientation_from_panel()
+	 */
 	drm_connector_set_panel_orientation(connector, p->orientation);
 
 	return num;
@@ -609,6 +612,13 @@ static int panel_edp_get_timings(struct drm_panel *panel,
 	return p->desc->num_timings;
 }
 
+static enum drm_panel_orientation panel_edp_get_orientation(struct drm_panel *panel)
+{
+	struct panel_edp *p = to_panel_edp(panel);
+
+       return p->orientation;
+}
+
 static int detected_panel_show(struct seq_file *s, void *data)
 {
 	struct drm_panel *panel = s->private;
@@ -637,6 +647,7 @@ static const struct drm_panel_funcs panel_edp_funcs = {
 	.prepare = panel_edp_prepare,
 	.enable = panel_edp_enable,
 	.get_modes = panel_edp_get_modes,
+	.get_orientation = panel_edp_get_orientation,
 	.get_timings = panel_edp_get_timings,
 	.debugfs_init = panel_edp_debugfs_init,
 };
-- 
2.36.1.255.ge46751e96f-goog


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 3/8] drm/panel: panel-edp: Implement .get_orientation callback
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Hans de Goede, Thierry Reding, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-mediatek,
	Rob Clark, Stephen Boyd, Douglas Anderson, Rob Herring,
	linux-arm-kernel, linux-kernel

To return the orientation property to drm/kms driver.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
---
 drivers/gpu/drm/panel/panel-edp.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c
index c96014464355..ee622c1dd532 100644
--- a/drivers/gpu/drm/panel/panel-edp.c
+++ b/drivers/gpu/drm/panel/panel-edp.c
@@ -586,7 +586,10 @@ static int panel_edp_get_modes(struct drm_panel *panel,
 	else if (!num)
 		dev_warn(p->base.dev, "No display modes\n");
 
-	/* set up connector's "panel orientation" property */
+	/*
+	 * TODO: Remove once all drm drivers call
+	 * drm_connector_set_orientation_from_panel()
+	 */
 	drm_connector_set_panel_orientation(connector, p->orientation);
 
 	return num;
@@ -609,6 +612,13 @@ static int panel_edp_get_timings(struct drm_panel *panel,
 	return p->desc->num_timings;
 }
 
+static enum drm_panel_orientation panel_edp_get_orientation(struct drm_panel *panel)
+{
+	struct panel_edp *p = to_panel_edp(panel);
+
+       return p->orientation;
+}
+
 static int detected_panel_show(struct seq_file *s, void *data)
 {
 	struct drm_panel *panel = s->private;
@@ -637,6 +647,7 @@ static const struct drm_panel_funcs panel_edp_funcs = {
 	.prepare = panel_edp_prepare,
 	.enable = panel_edp_enable,
 	.get_modes = panel_edp_get_modes,
+	.get_orientation = panel_edp_get_orientation,
 	.get_timings = panel_edp_get_timings,
 	.debugfs_init = panel_edp_debugfs_init,
 };
-- 
2.36.1.255.ge46751e96f-goog


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

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 3/8] drm/panel: panel-edp: Implement .get_orientation callback
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Hans de Goede, Thierry Reding, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-mediatek,
	Rob Clark, Stephen Boyd, Douglas Anderson, Rob Herring,
	linux-arm-kernel, linux-kernel

To return the orientation property to drm/kms driver.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
---
 drivers/gpu/drm/panel/panel-edp.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c
index c96014464355..ee622c1dd532 100644
--- a/drivers/gpu/drm/panel/panel-edp.c
+++ b/drivers/gpu/drm/panel/panel-edp.c
@@ -586,7 +586,10 @@ static int panel_edp_get_modes(struct drm_panel *panel,
 	else if (!num)
 		dev_warn(p->base.dev, "No display modes\n");
 
-	/* set up connector's "panel orientation" property */
+	/*
+	 * TODO: Remove once all drm drivers call
+	 * drm_connector_set_orientation_from_panel()
+	 */
 	drm_connector_set_panel_orientation(connector, p->orientation);
 
 	return num;
@@ -609,6 +612,13 @@ static int panel_edp_get_timings(struct drm_panel *panel,
 	return p->desc->num_timings;
 }
 
+static enum drm_panel_orientation panel_edp_get_orientation(struct drm_panel *panel)
+{
+	struct panel_edp *p = to_panel_edp(panel);
+
+       return p->orientation;
+}
+
 static int detected_panel_show(struct seq_file *s, void *data)
 {
 	struct drm_panel *panel = s->private;
@@ -637,6 +647,7 @@ static const struct drm_panel_funcs panel_edp_funcs = {
 	.prepare = panel_edp_prepare,
 	.enable = panel_edp_enable,
 	.get_modes = panel_edp_get_modes,
+	.get_orientation = panel_edp_get_orientation,
 	.get_timings = panel_edp_get_timings,
 	.debugfs_init = panel_edp_debugfs_init,
 };
-- 
2.36.1.255.ge46751e96f-goog


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 4/8] drm/panel: lvds: Implement .get_orientation callback
  2022-06-07  9:05 ` Hsin-Yi Wang
  (?)
  (?)
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  -1 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Hans de Goede, Thierry Reding, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-mediatek,
	Rob Clark, Stephen Boyd, Douglas Anderson, Rob Herring,
	linux-arm-kernel, linux-kernel

To return the orientation property to drm/kms driver.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
---
 drivers/gpu/drm/panel/panel-lvds.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
index f11252fb00fe..7a4fedc63e8e 100644
--- a/drivers/gpu/drm/panel/panel-lvds.c
+++ b/drivers/gpu/drm/panel/panel-lvds.c
@@ -99,15 +99,28 @@ static int panel_lvds_get_modes(struct drm_panel *panel,
 	drm_display_info_set_bus_formats(&connector->display_info,
 					 &lvds->bus_format, 1);
 	connector->display_info.bus_flags = lvds->bus_flags;
+
+	/*
+	 * TODO: Remove once all drm drivers call
+	 * drm_connector_set_orientation_from_panel()
+	 */
 	drm_connector_set_panel_orientation(connector, lvds->orientation);
 
 	return 1;
 }
 
+static enum drm_panel_orientation panel_lvds_get_orientation(struct drm_panel *panel)
+{
+       struct panel_lvds *lvds = to_panel_lvds(panel);
+
+       return lvds->orientation;
+}
+
 static const struct drm_panel_funcs panel_lvds_funcs = {
 	.unprepare = panel_lvds_unprepare,
 	.prepare = panel_lvds_prepare,
 	.get_modes = panel_lvds_get_modes,
+	.get_orientation = panel_lvds_get_orientation,
 };
 
 static int panel_lvds_parse_dt(struct panel_lvds *lvds)
-- 
2.36.1.255.ge46751e96f-goog


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 4/8] drm/panel: lvds: Implement .get_orientation callback
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Rob Clark, Rob Herring, David Airlie, linux-kernel,
	Douglas Anderson, Stephen Boyd, Hans de Goede, Thierry Reding,
	linux-mediatek, dri-devel, Thomas Zimmermann, Matthias Brugger,
	Sam Ravnborg, linux-arm-kernel

To return the orientation property to drm/kms driver.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
---
 drivers/gpu/drm/panel/panel-lvds.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
index f11252fb00fe..7a4fedc63e8e 100644
--- a/drivers/gpu/drm/panel/panel-lvds.c
+++ b/drivers/gpu/drm/panel/panel-lvds.c
@@ -99,15 +99,28 @@ static int panel_lvds_get_modes(struct drm_panel *panel,
 	drm_display_info_set_bus_formats(&connector->display_info,
 					 &lvds->bus_format, 1);
 	connector->display_info.bus_flags = lvds->bus_flags;
+
+	/*
+	 * TODO: Remove once all drm drivers call
+	 * drm_connector_set_orientation_from_panel()
+	 */
 	drm_connector_set_panel_orientation(connector, lvds->orientation);
 
 	return 1;
 }
 
+static enum drm_panel_orientation panel_lvds_get_orientation(struct drm_panel *panel)
+{
+       struct panel_lvds *lvds = to_panel_lvds(panel);
+
+       return lvds->orientation;
+}
+
 static const struct drm_panel_funcs panel_lvds_funcs = {
 	.unprepare = panel_lvds_unprepare,
 	.prepare = panel_lvds_prepare,
 	.get_modes = panel_lvds_get_modes,
+	.get_orientation = panel_lvds_get_orientation,
 };
 
 static int panel_lvds_parse_dt(struct panel_lvds *lvds)
-- 
2.36.1.255.ge46751e96f-goog


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 4/8] drm/panel: lvds: Implement .get_orientation callback
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Hans de Goede, Thierry Reding, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-mediatek,
	Rob Clark, Stephen Boyd, Douglas Anderson, Rob Herring,
	linux-arm-kernel, linux-kernel

To return the orientation property to drm/kms driver.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
---
 drivers/gpu/drm/panel/panel-lvds.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
index f11252fb00fe..7a4fedc63e8e 100644
--- a/drivers/gpu/drm/panel/panel-lvds.c
+++ b/drivers/gpu/drm/panel/panel-lvds.c
@@ -99,15 +99,28 @@ static int panel_lvds_get_modes(struct drm_panel *panel,
 	drm_display_info_set_bus_formats(&connector->display_info,
 					 &lvds->bus_format, 1);
 	connector->display_info.bus_flags = lvds->bus_flags;
+
+	/*
+	 * TODO: Remove once all drm drivers call
+	 * drm_connector_set_orientation_from_panel()
+	 */
 	drm_connector_set_panel_orientation(connector, lvds->orientation);
 
 	return 1;
 }
 
+static enum drm_panel_orientation panel_lvds_get_orientation(struct drm_panel *panel)
+{
+       struct panel_lvds *lvds = to_panel_lvds(panel);
+
+       return lvds->orientation;
+}
+
 static const struct drm_panel_funcs panel_lvds_funcs = {
 	.unprepare = panel_lvds_unprepare,
 	.prepare = panel_lvds_prepare,
 	.get_modes = panel_lvds_get_modes,
+	.get_orientation = panel_lvds_get_orientation,
 };
 
 static int panel_lvds_parse_dt(struct panel_lvds *lvds)
-- 
2.36.1.255.ge46751e96f-goog


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 4/8] drm/panel: lvds: Implement .get_orientation callback
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Hans de Goede, Thierry Reding, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-mediatek,
	Rob Clark, Stephen Boyd, Douglas Anderson, Rob Herring,
	linux-arm-kernel, linux-kernel

To return the orientation property to drm/kms driver.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
---
 drivers/gpu/drm/panel/panel-lvds.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
index f11252fb00fe..7a4fedc63e8e 100644
--- a/drivers/gpu/drm/panel/panel-lvds.c
+++ b/drivers/gpu/drm/panel/panel-lvds.c
@@ -99,15 +99,28 @@ static int panel_lvds_get_modes(struct drm_panel *panel,
 	drm_display_info_set_bus_formats(&connector->display_info,
 					 &lvds->bus_format, 1);
 	connector->display_info.bus_flags = lvds->bus_flags;
+
+	/*
+	 * TODO: Remove once all drm drivers call
+	 * drm_connector_set_orientation_from_panel()
+	 */
 	drm_connector_set_panel_orientation(connector, lvds->orientation);
 
 	return 1;
 }
 
+static enum drm_panel_orientation panel_lvds_get_orientation(struct drm_panel *panel)
+{
+       struct panel_lvds *lvds = to_panel_lvds(panel);
+
+       return lvds->orientation;
+}
+
 static const struct drm_panel_funcs panel_lvds_funcs = {
 	.unprepare = panel_lvds_unprepare,
 	.prepare = panel_lvds_prepare,
 	.get_modes = panel_lvds_get_modes,
+	.get_orientation = panel_lvds_get_orientation,
 };
 
 static int panel_lvds_parse_dt(struct panel_lvds *lvds)
-- 
2.36.1.255.ge46751e96f-goog


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

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 5/8] drm/panel: panel-simple: Implement .get_orientation callback
  2022-06-07  9:05 ` Hsin-Yi Wang
  (?)
  (?)
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  -1 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Hans de Goede, Thierry Reding, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-mediatek,
	Rob Clark, Stephen Boyd, Douglas Anderson, Rob Herring,
	linux-arm-kernel, linux-kernel

To return the orientation property to drm/kms driver.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
---
v4->v5:
sort callbacks.
---
 drivers/gpu/drm/panel/panel-simple.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index 4a2e580a2f7b..b4b919525189 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -411,7 +411,10 @@ static int panel_simple_get_modes(struct drm_panel *panel,
 	/* add hard-coded panel modes */
 	num += panel_simple_get_non_edid_modes(p, connector);
 
-	/* set up connector's "panel orientation" property */
+	/*
+	 * TODO: Remove once all drm drivers call
+	 * drm_connector_set_orientation_from_panel()
+	 */
 	drm_connector_set_panel_orientation(connector, p->orientation);
 
 	return num;
@@ -434,12 +437,21 @@ static int panel_simple_get_timings(struct drm_panel *panel,
 	return p->desc->num_timings;
 }
 
+static enum drm_panel_orientation panel_simple_get_orientation(struct drm_panel *panel)
+{
+       struct panel_simple *p = to_panel_simple(panel);
+
+       return p->orientation;
+}
+
+
 static const struct drm_panel_funcs panel_simple_funcs = {
 	.disable = panel_simple_disable,
 	.unprepare = panel_simple_unprepare,
 	.prepare = panel_simple_prepare,
 	.enable = panel_simple_enable,
 	.get_modes = panel_simple_get_modes,
+	.get_orientation = panel_simple_get_orientation,
 	.get_timings = panel_simple_get_timings,
 };
 
-- 
2.36.1.255.ge46751e96f-goog


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 5/8] drm/panel: panel-simple: Implement .get_orientation callback
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Rob Clark, Rob Herring, David Airlie, linux-kernel,
	Douglas Anderson, Stephen Boyd, Hans de Goede, Thierry Reding,
	linux-mediatek, dri-devel, Thomas Zimmermann, Matthias Brugger,
	Sam Ravnborg, linux-arm-kernel

To return the orientation property to drm/kms driver.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
---
v4->v5:
sort callbacks.
---
 drivers/gpu/drm/panel/panel-simple.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index 4a2e580a2f7b..b4b919525189 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -411,7 +411,10 @@ static int panel_simple_get_modes(struct drm_panel *panel,
 	/* add hard-coded panel modes */
 	num += panel_simple_get_non_edid_modes(p, connector);
 
-	/* set up connector's "panel orientation" property */
+	/*
+	 * TODO: Remove once all drm drivers call
+	 * drm_connector_set_orientation_from_panel()
+	 */
 	drm_connector_set_panel_orientation(connector, p->orientation);
 
 	return num;
@@ -434,12 +437,21 @@ static int panel_simple_get_timings(struct drm_panel *panel,
 	return p->desc->num_timings;
 }
 
+static enum drm_panel_orientation panel_simple_get_orientation(struct drm_panel *panel)
+{
+       struct panel_simple *p = to_panel_simple(panel);
+
+       return p->orientation;
+}
+
+
 static const struct drm_panel_funcs panel_simple_funcs = {
 	.disable = panel_simple_disable,
 	.unprepare = panel_simple_unprepare,
 	.prepare = panel_simple_prepare,
 	.enable = panel_simple_enable,
 	.get_modes = panel_simple_get_modes,
+	.get_orientation = panel_simple_get_orientation,
 	.get_timings = panel_simple_get_timings,
 };
 
-- 
2.36.1.255.ge46751e96f-goog


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 5/8] drm/panel: panel-simple: Implement .get_orientation callback
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Hans de Goede, Thierry Reding, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-mediatek,
	Rob Clark, Stephen Boyd, Douglas Anderson, Rob Herring,
	linux-arm-kernel, linux-kernel

To return the orientation property to drm/kms driver.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
---
v4->v5:
sort callbacks.
---
 drivers/gpu/drm/panel/panel-simple.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index 4a2e580a2f7b..b4b919525189 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -411,7 +411,10 @@ static int panel_simple_get_modes(struct drm_panel *panel,
 	/* add hard-coded panel modes */
 	num += panel_simple_get_non_edid_modes(p, connector);
 
-	/* set up connector's "panel orientation" property */
+	/*
+	 * TODO: Remove once all drm drivers call
+	 * drm_connector_set_orientation_from_panel()
+	 */
 	drm_connector_set_panel_orientation(connector, p->orientation);
 
 	return num;
@@ -434,12 +437,21 @@ static int panel_simple_get_timings(struct drm_panel *panel,
 	return p->desc->num_timings;
 }
 
+static enum drm_panel_orientation panel_simple_get_orientation(struct drm_panel *panel)
+{
+       struct panel_simple *p = to_panel_simple(panel);
+
+       return p->orientation;
+}
+
+
 static const struct drm_panel_funcs panel_simple_funcs = {
 	.disable = panel_simple_disable,
 	.unprepare = panel_simple_unprepare,
 	.prepare = panel_simple_prepare,
 	.enable = panel_simple_enable,
 	.get_modes = panel_simple_get_modes,
+	.get_orientation = panel_simple_get_orientation,
 	.get_timings = panel_simple_get_timings,
 };
 
-- 
2.36.1.255.ge46751e96f-goog


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 5/8] drm/panel: panel-simple: Implement .get_orientation callback
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Hans de Goede, Thierry Reding, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-mediatek,
	Rob Clark, Stephen Boyd, Douglas Anderson, Rob Herring,
	linux-arm-kernel, linux-kernel

To return the orientation property to drm/kms driver.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
---
v4->v5:
sort callbacks.
---
 drivers/gpu/drm/panel/panel-simple.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index 4a2e580a2f7b..b4b919525189 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -411,7 +411,10 @@ static int panel_simple_get_modes(struct drm_panel *panel,
 	/* add hard-coded panel modes */
 	num += panel_simple_get_non_edid_modes(p, connector);
 
-	/* set up connector's "panel orientation" property */
+	/*
+	 * TODO: Remove once all drm drivers call
+	 * drm_connector_set_orientation_from_panel()
+	 */
 	drm_connector_set_panel_orientation(connector, p->orientation);
 
 	return num;
@@ -434,12 +437,21 @@ static int panel_simple_get_timings(struct drm_panel *panel,
 	return p->desc->num_timings;
 }
 
+static enum drm_panel_orientation panel_simple_get_orientation(struct drm_panel *panel)
+{
+       struct panel_simple *p = to_panel_simple(panel);
+
+       return p->orientation;
+}
+
+
 static const struct drm_panel_funcs panel_simple_funcs = {
 	.disable = panel_simple_disable,
 	.unprepare = panel_simple_unprepare,
 	.prepare = panel_simple_prepare,
 	.enable = panel_simple_enable,
 	.get_modes = panel_simple_get_modes,
+	.get_orientation = panel_simple_get_orientation,
 	.get_timings = panel_simple_get_timings,
 };
 
-- 
2.36.1.255.ge46751e96f-goog


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

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 6/8] drm/panel: ili9881c: Implement .get_orientation callback
  2022-06-07  9:05 ` Hsin-Yi Wang
  (?)
  (?)
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  -1 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Hans de Goede, Thierry Reding, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-mediatek,
	Rob Clark, Stephen Boyd, Douglas Anderson, Rob Herring,
	linux-arm-kernel, linux-kernel

To return the orientation property to drm/kms driver.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
---
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
index ba30d11547ad..58d6798c25ed 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
@@ -853,17 +853,29 @@ static int ili9881c_get_modes(struct drm_panel *panel,
 	connector->display_info.width_mm = mode->width_mm;
 	connector->display_info.height_mm = mode->height_mm;
 
+	/*
+	 * TODO: Remove once all drm drivers call
+	 * drm_connector_set_orientation_from_panel()
+	 */
 	drm_connector_set_panel_orientation(connector, ctx->orientation);
 
 	return 1;
 }
 
+static enum drm_panel_orientation ili9881c_get_orientation(struct drm_panel *panel)
+{
+       struct ili9881c *ctx = panel_to_ili9881c(panel);
+
+       return ctx->orientation;
+}
+
 static const struct drm_panel_funcs ili9881c_funcs = {
 	.prepare	= ili9881c_prepare,
 	.unprepare	= ili9881c_unprepare,
 	.enable		= ili9881c_enable,
 	.disable	= ili9881c_disable,
 	.get_modes	= ili9881c_get_modes,
+	.get_orientation = ili9881c_get_orientation,
 };
 
 static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi)
-- 
2.36.1.255.ge46751e96f-goog


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 6/8] drm/panel: ili9881c: Implement .get_orientation callback
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Rob Clark, Rob Herring, David Airlie, linux-kernel,
	Douglas Anderson, Stephen Boyd, Hans de Goede, Thierry Reding,
	linux-mediatek, dri-devel, Thomas Zimmermann, Matthias Brugger,
	Sam Ravnborg, linux-arm-kernel

To return the orientation property to drm/kms driver.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
---
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
index ba30d11547ad..58d6798c25ed 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
@@ -853,17 +853,29 @@ static int ili9881c_get_modes(struct drm_panel *panel,
 	connector->display_info.width_mm = mode->width_mm;
 	connector->display_info.height_mm = mode->height_mm;
 
+	/*
+	 * TODO: Remove once all drm drivers call
+	 * drm_connector_set_orientation_from_panel()
+	 */
 	drm_connector_set_panel_orientation(connector, ctx->orientation);
 
 	return 1;
 }
 
+static enum drm_panel_orientation ili9881c_get_orientation(struct drm_panel *panel)
+{
+       struct ili9881c *ctx = panel_to_ili9881c(panel);
+
+       return ctx->orientation;
+}
+
 static const struct drm_panel_funcs ili9881c_funcs = {
 	.prepare	= ili9881c_prepare,
 	.unprepare	= ili9881c_unprepare,
 	.enable		= ili9881c_enable,
 	.disable	= ili9881c_disable,
 	.get_modes	= ili9881c_get_modes,
+	.get_orientation = ili9881c_get_orientation,
 };
 
 static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi)
-- 
2.36.1.255.ge46751e96f-goog


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 6/8] drm/panel: ili9881c: Implement .get_orientation callback
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Hans de Goede, Thierry Reding, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-mediatek,
	Rob Clark, Stephen Boyd, Douglas Anderson, Rob Herring,
	linux-arm-kernel, linux-kernel

To return the orientation property to drm/kms driver.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
---
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
index ba30d11547ad..58d6798c25ed 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
@@ -853,17 +853,29 @@ static int ili9881c_get_modes(struct drm_panel *panel,
 	connector->display_info.width_mm = mode->width_mm;
 	connector->display_info.height_mm = mode->height_mm;
 
+	/*
+	 * TODO: Remove once all drm drivers call
+	 * drm_connector_set_orientation_from_panel()
+	 */
 	drm_connector_set_panel_orientation(connector, ctx->orientation);
 
 	return 1;
 }
 
+static enum drm_panel_orientation ili9881c_get_orientation(struct drm_panel *panel)
+{
+       struct ili9881c *ctx = panel_to_ili9881c(panel);
+
+       return ctx->orientation;
+}
+
 static const struct drm_panel_funcs ili9881c_funcs = {
 	.prepare	= ili9881c_prepare,
 	.unprepare	= ili9881c_unprepare,
 	.enable		= ili9881c_enable,
 	.disable	= ili9881c_disable,
 	.get_modes	= ili9881c_get_modes,
+	.get_orientation = ili9881c_get_orientation,
 };
 
 static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi)
-- 
2.36.1.255.ge46751e96f-goog


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 6/8] drm/panel: ili9881c: Implement .get_orientation callback
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Hans de Goede, Thierry Reding, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-mediatek,
	Rob Clark, Stephen Boyd, Douglas Anderson, Rob Herring,
	linux-arm-kernel, linux-kernel

To return the orientation property to drm/kms driver.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
---
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
index ba30d11547ad..58d6798c25ed 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
@@ -853,17 +853,29 @@ static int ili9881c_get_modes(struct drm_panel *panel,
 	connector->display_info.width_mm = mode->width_mm;
 	connector->display_info.height_mm = mode->height_mm;
 
+	/*
+	 * TODO: Remove once all drm drivers call
+	 * drm_connector_set_orientation_from_panel()
+	 */
 	drm_connector_set_panel_orientation(connector, ctx->orientation);
 
 	return 1;
 }
 
+static enum drm_panel_orientation ili9881c_get_orientation(struct drm_panel *panel)
+{
+       struct ili9881c *ctx = panel_to_ili9881c(panel);
+
+       return ctx->orientation;
+}
+
 static const struct drm_panel_funcs ili9881c_funcs = {
 	.prepare	= ili9881c_prepare,
 	.unprepare	= ili9881c_unprepare,
 	.enable		= ili9881c_enable,
 	.disable	= ili9881c_disable,
 	.get_modes	= ili9881c_get_modes,
+	.get_orientation = ili9881c_get_orientation,
 };
 
 static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi)
-- 
2.36.1.255.ge46751e96f-goog


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

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 7/8] drm/panel: elida-kd35t133: Implement .get_orientation callback
  2022-06-07  9:05 ` Hsin-Yi Wang
  (?)
  (?)
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  -1 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Hans de Goede, Thierry Reding, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-mediatek,
	Rob Clark, Stephen Boyd, Douglas Anderson, Rob Herring,
	linux-arm-kernel, linux-kernel

To return the orientation property to drm/kms driver.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
---
 drivers/gpu/drm/panel/panel-elida-kd35t133.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
index 80227617a4d6..fa613d1d7a8f 100644
--- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c
+++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
@@ -217,15 +217,27 @@ static int kd35t133_get_modes(struct drm_panel *panel,
 	connector->display_info.width_mm = mode->width_mm;
 	connector->display_info.height_mm = mode->height_mm;
 	drm_mode_probed_add(connector, mode);
+	/*
+	 * TODO: Remove once all drm drivers call
+	 * drm_connector_set_orientation_from_panel()
+	 */
 	drm_connector_set_panel_orientation(connector, ctx->orientation);
 
 	return 1;
 }
 
+static enum drm_panel_orientation kd35t133_get_orientation(struct drm_panel *panel)
+{
+       struct kd35t133 *ctx = panel_to_kd35t133(panel);
+
+       return ctx->orientation;
+}
+
 static const struct drm_panel_funcs kd35t133_funcs = {
 	.unprepare	= kd35t133_unprepare,
 	.prepare	= kd35t133_prepare,
 	.get_modes	= kd35t133_get_modes,
+	.get_orientation = kd35t133_get_orientation,
 };
 
 static int kd35t133_probe(struct mipi_dsi_device *dsi)
-- 
2.36.1.255.ge46751e96f-goog


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 7/8] drm/panel: elida-kd35t133: Implement .get_orientation callback
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Rob Clark, Rob Herring, David Airlie, linux-kernel,
	Douglas Anderson, Stephen Boyd, Hans de Goede, Thierry Reding,
	linux-mediatek, dri-devel, Thomas Zimmermann, Matthias Brugger,
	Sam Ravnborg, linux-arm-kernel

To return the orientation property to drm/kms driver.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
---
 drivers/gpu/drm/panel/panel-elida-kd35t133.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
index 80227617a4d6..fa613d1d7a8f 100644
--- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c
+++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
@@ -217,15 +217,27 @@ static int kd35t133_get_modes(struct drm_panel *panel,
 	connector->display_info.width_mm = mode->width_mm;
 	connector->display_info.height_mm = mode->height_mm;
 	drm_mode_probed_add(connector, mode);
+	/*
+	 * TODO: Remove once all drm drivers call
+	 * drm_connector_set_orientation_from_panel()
+	 */
 	drm_connector_set_panel_orientation(connector, ctx->orientation);
 
 	return 1;
 }
 
+static enum drm_panel_orientation kd35t133_get_orientation(struct drm_panel *panel)
+{
+       struct kd35t133 *ctx = panel_to_kd35t133(panel);
+
+       return ctx->orientation;
+}
+
 static const struct drm_panel_funcs kd35t133_funcs = {
 	.unprepare	= kd35t133_unprepare,
 	.prepare	= kd35t133_prepare,
 	.get_modes	= kd35t133_get_modes,
+	.get_orientation = kd35t133_get_orientation,
 };
 
 static int kd35t133_probe(struct mipi_dsi_device *dsi)
-- 
2.36.1.255.ge46751e96f-goog


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 7/8] drm/panel: elida-kd35t133: Implement .get_orientation callback
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Hans de Goede, Thierry Reding, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-mediatek,
	Rob Clark, Stephen Boyd, Douglas Anderson, Rob Herring,
	linux-arm-kernel, linux-kernel

To return the orientation property to drm/kms driver.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
---
 drivers/gpu/drm/panel/panel-elida-kd35t133.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
index 80227617a4d6..fa613d1d7a8f 100644
--- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c
+++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
@@ -217,15 +217,27 @@ static int kd35t133_get_modes(struct drm_panel *panel,
 	connector->display_info.width_mm = mode->width_mm;
 	connector->display_info.height_mm = mode->height_mm;
 	drm_mode_probed_add(connector, mode);
+	/*
+	 * TODO: Remove once all drm drivers call
+	 * drm_connector_set_orientation_from_panel()
+	 */
 	drm_connector_set_panel_orientation(connector, ctx->orientation);
 
 	return 1;
 }
 
+static enum drm_panel_orientation kd35t133_get_orientation(struct drm_panel *panel)
+{
+       struct kd35t133 *ctx = panel_to_kd35t133(panel);
+
+       return ctx->orientation;
+}
+
 static const struct drm_panel_funcs kd35t133_funcs = {
 	.unprepare	= kd35t133_unprepare,
 	.prepare	= kd35t133_prepare,
 	.get_modes	= kd35t133_get_modes,
+	.get_orientation = kd35t133_get_orientation,
 };
 
 static int kd35t133_probe(struct mipi_dsi_device *dsi)
-- 
2.36.1.255.ge46751e96f-goog


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 7/8] drm/panel: elida-kd35t133: Implement .get_orientation callback
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Hans de Goede, Thierry Reding, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-mediatek,
	Rob Clark, Stephen Boyd, Douglas Anderson, Rob Herring,
	linux-arm-kernel, linux-kernel

To return the orientation property to drm/kms driver.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
---
 drivers/gpu/drm/panel/panel-elida-kd35t133.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
index 80227617a4d6..fa613d1d7a8f 100644
--- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c
+++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
@@ -217,15 +217,27 @@ static int kd35t133_get_modes(struct drm_panel *panel,
 	connector->display_info.width_mm = mode->width_mm;
 	connector->display_info.height_mm = mode->height_mm;
 	drm_mode_probed_add(connector, mode);
+	/*
+	 * TODO: Remove once all drm drivers call
+	 * drm_connector_set_orientation_from_panel()
+	 */
 	drm_connector_set_panel_orientation(connector, ctx->orientation);
 
 	return 1;
 }
 
+static enum drm_panel_orientation kd35t133_get_orientation(struct drm_panel *panel)
+{
+       struct kd35t133 *ctx = panel_to_kd35t133(panel);
+
+       return ctx->orientation;
+}
+
 static const struct drm_panel_funcs kd35t133_funcs = {
 	.unprepare	= kd35t133_unprepare,
 	.prepare	= kd35t133_prepare,
 	.get_modes	= kd35t133_get_modes,
+	.get_orientation = kd35t133_get_orientation,
 };
 
 static int kd35t133_probe(struct mipi_dsi_device *dsi)
-- 
2.36.1.255.ge46751e96f-goog


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

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 8/8] drm/mediatek: Config orientation property if panel provides it
  2022-06-07  9:05 ` Hsin-Yi Wang
  (?)
  (?)
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  -1 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Hans de Goede, Thierry Reding, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-mediatek,
	Rob Clark, Stephen Boyd, Douglas Anderson, Rob Herring,
	linux-arm-kernel, linux-kernel

Panel orientation property should be set before drm_dev_register().
Mediatek drm driver calls drm_dev_register() in .bind(). However, most
panels sets orientation property relatively late, mostly in .get_modes()
callback, since this is when they are able to get the connector and
binds the orientation property to it, though the value should be known
when the panel is probed.

Let the drm driver check if the remote end point is a panel and if it
contains the orientation property. If it does, set it before
drm_dev_register() is called.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
v4->v5:
- use the new function in v5.
- don't use drm_of_find_panel_or_bridge().
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index d9f10a33e6fa..998b1237e193 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -185,6 +185,7 @@ struct mtk_dsi {
 	struct drm_encoder encoder;
 	struct drm_bridge bridge;
 	struct drm_bridge *next_bridge;
+	struct drm_panel *panel;
 	struct drm_connector *connector;
 	struct phy *phy;
 
@@ -822,6 +823,10 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
 		ret = PTR_ERR(dsi->connector);
 		goto err_cleanup_encoder;
 	}
+
+	/* Read panel orientation */
+	drm_connector_set_orientation_from_panel(dsi->connector, dsi->panel);
+
 	drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
 
 	return 0;
@@ -836,6 +841,16 @@ 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);
+	struct device_node *panel_node;
+
+	/* Get panel if existed */
+	panel_node = of_graph_get_remote_node(dev->of_node, 0, 0);
+	if (panel_node) {
+		dsi->panel = of_drm_find_panel(panel_node);
+		if (IS_ERR(dsi->panel))
+			dsi->panel = NULL;
+		of_node_put(panel_node);
+	}
 
 	ret = mtk_dsi_encoder_init(drm, dsi);
 	if (ret)
-- 
2.36.1.255.ge46751e96f-goog


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 8/8] drm/mediatek: Config orientation property if panel provides it
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Rob Clark, Rob Herring, David Airlie, linux-kernel,
	Douglas Anderson, Stephen Boyd, Hans de Goede, Thierry Reding,
	linux-mediatek, dri-devel, Thomas Zimmermann, Matthias Brugger,
	Sam Ravnborg, linux-arm-kernel

Panel orientation property should be set before drm_dev_register().
Mediatek drm driver calls drm_dev_register() in .bind(). However, most
panels sets orientation property relatively late, mostly in .get_modes()
callback, since this is when they are able to get the connector and
binds the orientation property to it, though the value should be known
when the panel is probed.

Let the drm driver check if the remote end point is a panel and if it
contains the orientation property. If it does, set it before
drm_dev_register() is called.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
v4->v5:
- use the new function in v5.
- don't use drm_of_find_panel_or_bridge().
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index d9f10a33e6fa..998b1237e193 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -185,6 +185,7 @@ struct mtk_dsi {
 	struct drm_encoder encoder;
 	struct drm_bridge bridge;
 	struct drm_bridge *next_bridge;
+	struct drm_panel *panel;
 	struct drm_connector *connector;
 	struct phy *phy;
 
@@ -822,6 +823,10 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
 		ret = PTR_ERR(dsi->connector);
 		goto err_cleanup_encoder;
 	}
+
+	/* Read panel orientation */
+	drm_connector_set_orientation_from_panel(dsi->connector, dsi->panel);
+
 	drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
 
 	return 0;
@@ -836,6 +841,16 @@ 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);
+	struct device_node *panel_node;
+
+	/* Get panel if existed */
+	panel_node = of_graph_get_remote_node(dev->of_node, 0, 0);
+	if (panel_node) {
+		dsi->panel = of_drm_find_panel(panel_node);
+		if (IS_ERR(dsi->panel))
+			dsi->panel = NULL;
+		of_node_put(panel_node);
+	}
 
 	ret = mtk_dsi_encoder_init(drm, dsi);
 	if (ret)
-- 
2.36.1.255.ge46751e96f-goog


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 8/8] drm/mediatek: Config orientation property if panel provides it
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Hans de Goede, Thierry Reding, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-mediatek,
	Rob Clark, Stephen Boyd, Douglas Anderson, Rob Herring,
	linux-arm-kernel, linux-kernel

Panel orientation property should be set before drm_dev_register().
Mediatek drm driver calls drm_dev_register() in .bind(). However, most
panels sets orientation property relatively late, mostly in .get_modes()
callback, since this is when they are able to get the connector and
binds the orientation property to it, though the value should be known
when the panel is probed.

Let the drm driver check if the remote end point is a panel and if it
contains the orientation property. If it does, set it before
drm_dev_register() is called.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
v4->v5:
- use the new function in v5.
- don't use drm_of_find_panel_or_bridge().
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index d9f10a33e6fa..998b1237e193 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -185,6 +185,7 @@ struct mtk_dsi {
 	struct drm_encoder encoder;
 	struct drm_bridge bridge;
 	struct drm_bridge *next_bridge;
+	struct drm_panel *panel;
 	struct drm_connector *connector;
 	struct phy *phy;
 
@@ -822,6 +823,10 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
 		ret = PTR_ERR(dsi->connector);
 		goto err_cleanup_encoder;
 	}
+
+	/* Read panel orientation */
+	drm_connector_set_orientation_from_panel(dsi->connector, dsi->panel);
+
 	drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
 
 	return 0;
@@ -836,6 +841,16 @@ 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);
+	struct device_node *panel_node;
+
+	/* Get panel if existed */
+	panel_node = of_graph_get_remote_node(dev->of_node, 0, 0);
+	if (panel_node) {
+		dsi->panel = of_drm_find_panel(panel_node);
+		if (IS_ERR(dsi->panel))
+			dsi->panel = NULL;
+		of_node_put(panel_node);
+	}
 
 	ret = mtk_dsi_encoder_init(drm, dsi);
 	if (ret)
-- 
2.36.1.255.ge46751e96f-goog


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH v5 8/8] drm/mediatek: Config orientation property if panel provides it
@ 2022-06-07  9:05   ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  9:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Hans de Goede, Thierry Reding, Sam Ravnborg, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-mediatek,
	Rob Clark, Stephen Boyd, Douglas Anderson, Rob Herring,
	linux-arm-kernel, linux-kernel

Panel orientation property should be set before drm_dev_register().
Mediatek drm driver calls drm_dev_register() in .bind(). However, most
panels sets orientation property relatively late, mostly in .get_modes()
callback, since this is when they are able to get the connector and
binds the orientation property to it, though the value should be known
when the panel is probed.

Let the drm driver check if the remote end point is a panel and if it
contains the orientation property. If it does, set it before
drm_dev_register() is called.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
v4->v5:
- use the new function in v5.
- don't use drm_of_find_panel_or_bridge().
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index d9f10a33e6fa..998b1237e193 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -185,6 +185,7 @@ struct mtk_dsi {
 	struct drm_encoder encoder;
 	struct drm_bridge bridge;
 	struct drm_bridge *next_bridge;
+	struct drm_panel *panel;
 	struct drm_connector *connector;
 	struct phy *phy;
 
@@ -822,6 +823,10 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
 		ret = PTR_ERR(dsi->connector);
 		goto err_cleanup_encoder;
 	}
+
+	/* Read panel orientation */
+	drm_connector_set_orientation_from_panel(dsi->connector, dsi->panel);
+
 	drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
 
 	return 0;
@@ -836,6 +841,16 @@ 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);
+	struct device_node *panel_node;
+
+	/* Get panel if existed */
+	panel_node = of_graph_get_remote_node(dev->of_node, 0, 0);
+	if (panel_node) {
+		dsi->panel = of_drm_find_panel(panel_node);
+		if (IS_ERR(dsi->panel))
+			dsi->panel = NULL;
+		of_node_put(panel_node);
+	}
 
 	ret = mtk_dsi_encoder_init(drm, dsi);
 	if (ret)
-- 
2.36.1.255.ge46751e96f-goog


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

^ permalink raw reply related	[flat|nested] 44+ messages in thread

* Re: [PATCH v5 8/8] drm/mediatek: Config orientation property if panel provides it
  2022-06-07  9:05   ` Hsin-Yi Wang
  (?)
  (?)
@ 2022-06-07 15:32     ` Doug Anderson
  -1 siblings, 0 replies; 44+ messages in thread
From: Doug Anderson @ 2022-06-07 15:32 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: Rob Clark, Chun-Kuang Hu, Rob Herring, David Airlie, LKML,
	Stephen Boyd, Hans de Goede, Thierry Reding,
	moderated list:ARM/Mediatek SoC support, dri-devel,
	Thomas Zimmermann, Matthias Brugger, Sam Ravnborg, Linux ARM

Hi,

On Tue, Jun 7, 2022 at 2:06 AM Hsin-Yi Wang <hsinyi@chromium.org> wrote:
>
> Panel orientation property should be set before drm_dev_register().
> Mediatek drm driver calls drm_dev_register() in .bind(). However, most
> panels sets orientation property relatively late, mostly in .get_modes()
> callback, since this is when they are able to get the connector and
> binds the orientation property to it, though the value should be known
> when the panel is probed.
>
> Let the drm driver check if the remote end point is a panel and if it
> contains the orientation property. If it does, set it before
> drm_dev_register() is called.
>
> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
> v4->v5:
> - use the new function in v5.
> - don't use drm_of_find_panel_or_bridge().
> ---
>  drivers/gpu/drm/mediatek/mtk_dsi.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index d9f10a33e6fa..998b1237e193 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -185,6 +185,7 @@ struct mtk_dsi {
>         struct drm_encoder encoder;
>         struct drm_bridge bridge;
>         struct drm_bridge *next_bridge;
> +       struct drm_panel *panel;
>         struct drm_connector *connector;
>         struct phy *phy;
>
> @@ -822,6 +823,10 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
>                 ret = PTR_ERR(dsi->connector);
>                 goto err_cleanup_encoder;
>         }
> +
> +       /* Read panel orientation */
> +       drm_connector_set_orientation_from_panel(dsi->connector, dsi->panel);
> +
>         drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
>
>         return 0;
> @@ -836,6 +841,16 @@ 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);
> +       struct device_node *panel_node;
> +
> +       /* Get panel if existed */
> +       panel_node = of_graph_get_remote_node(dev->of_node, 0, 0);
> +       if (panel_node) {
> +               dsi->panel = of_drm_find_panel(panel_node);
> +               if (IS_ERR(dsi->panel))
> +                       dsi->panel = NULL;
> +               of_node_put(panel_node);
> +       }

While the above works, it feels like we could do better. What about this?

* We add _some_ way to determine if a bridge is actually a
panel_bridge. If nothing else maybe this could be
drm_bridge_is_panel() and it could just check if bridge.funcs ==
panel_bridge_bridge_funcs

* In drm_bridge_connector_init(), when we're looping through all the
bridges we find the panel_bridge if it's there.

* At the end of drm_bridge_connector_init() if we found a panel_bridge
then we call a function like drm_panel_bridge_set_orientation().


Then you can fully get rid of the mediatek patch, right? The above
will only work if you're using a panel_bridge / bridge_connector, but
that's "the future" anyway and we want to encourage people to
transition to that.

-Doug

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v5 8/8] drm/mediatek: Config orientation property if panel provides it
@ 2022-06-07 15:32     ` Doug Anderson
  0 siblings, 0 replies; 44+ messages in thread
From: Doug Anderson @ 2022-06-07 15:32 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: Chun-Kuang Hu, Hans de Goede, Thierry Reding, Sam Ravnborg,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Philipp Zabel, David Airlie, Daniel Vetter, Matthias Brugger,
	dri-devel, moderated list:ARM/Mediatek SoC support, Rob Clark,
	Stephen Boyd, Rob Herring, Linux ARM, LKML

Hi,

On Tue, Jun 7, 2022 at 2:06 AM Hsin-Yi Wang <hsinyi@chromium.org> wrote:
>
> Panel orientation property should be set before drm_dev_register().
> Mediatek drm driver calls drm_dev_register() in .bind(). However, most
> panels sets orientation property relatively late, mostly in .get_modes()
> callback, since this is when they are able to get the connector and
> binds the orientation property to it, though the value should be known
> when the panel is probed.
>
> Let the drm driver check if the remote end point is a panel and if it
> contains the orientation property. If it does, set it before
> drm_dev_register() is called.
>
> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
> v4->v5:
> - use the new function in v5.
> - don't use drm_of_find_panel_or_bridge().
> ---
>  drivers/gpu/drm/mediatek/mtk_dsi.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index d9f10a33e6fa..998b1237e193 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -185,6 +185,7 @@ struct mtk_dsi {
>         struct drm_encoder encoder;
>         struct drm_bridge bridge;
>         struct drm_bridge *next_bridge;
> +       struct drm_panel *panel;
>         struct drm_connector *connector;
>         struct phy *phy;
>
> @@ -822,6 +823,10 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
>                 ret = PTR_ERR(dsi->connector);
>                 goto err_cleanup_encoder;
>         }
> +
> +       /* Read panel orientation */
> +       drm_connector_set_orientation_from_panel(dsi->connector, dsi->panel);
> +
>         drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
>
>         return 0;
> @@ -836,6 +841,16 @@ 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);
> +       struct device_node *panel_node;
> +
> +       /* Get panel if existed */
> +       panel_node = of_graph_get_remote_node(dev->of_node, 0, 0);
> +       if (panel_node) {
> +               dsi->panel = of_drm_find_panel(panel_node);
> +               if (IS_ERR(dsi->panel))
> +                       dsi->panel = NULL;
> +               of_node_put(panel_node);
> +       }

While the above works, it feels like we could do better. What about this?

* We add _some_ way to determine if a bridge is actually a
panel_bridge. If nothing else maybe this could be
drm_bridge_is_panel() and it could just check if bridge.funcs ==
panel_bridge_bridge_funcs

* In drm_bridge_connector_init(), when we're looping through all the
bridges we find the panel_bridge if it's there.

* At the end of drm_bridge_connector_init() if we found a panel_bridge
then we call a function like drm_panel_bridge_set_orientation().


Then you can fully get rid of the mediatek patch, right? The above
will only work if you're using a panel_bridge / bridge_connector, but
that's "the future" anyway and we want to encourage people to
transition to that.

-Doug

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v5 8/8] drm/mediatek: Config orientation property if panel provides it
@ 2022-06-07 15:32     ` Doug Anderson
  0 siblings, 0 replies; 44+ messages in thread
From: Doug Anderson @ 2022-06-07 15:32 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: Chun-Kuang Hu, Hans de Goede, Thierry Reding, Sam Ravnborg,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Philipp Zabel, David Airlie, Daniel Vetter, Matthias Brugger,
	dri-devel, moderated list:ARM/Mediatek SoC support, Rob Clark,
	Stephen Boyd, Rob Herring, Linux ARM, LKML

Hi,

On Tue, Jun 7, 2022 at 2:06 AM Hsin-Yi Wang <hsinyi@chromium.org> wrote:
>
> Panel orientation property should be set before drm_dev_register().
> Mediatek drm driver calls drm_dev_register() in .bind(). However, most
> panels sets orientation property relatively late, mostly in .get_modes()
> callback, since this is when they are able to get the connector and
> binds the orientation property to it, though the value should be known
> when the panel is probed.
>
> Let the drm driver check if the remote end point is a panel and if it
> contains the orientation property. If it does, set it before
> drm_dev_register() is called.
>
> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
> v4->v5:
> - use the new function in v5.
> - don't use drm_of_find_panel_or_bridge().
> ---
>  drivers/gpu/drm/mediatek/mtk_dsi.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index d9f10a33e6fa..998b1237e193 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -185,6 +185,7 @@ struct mtk_dsi {
>         struct drm_encoder encoder;
>         struct drm_bridge bridge;
>         struct drm_bridge *next_bridge;
> +       struct drm_panel *panel;
>         struct drm_connector *connector;
>         struct phy *phy;
>
> @@ -822,6 +823,10 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
>                 ret = PTR_ERR(dsi->connector);
>                 goto err_cleanup_encoder;
>         }
> +
> +       /* Read panel orientation */
> +       drm_connector_set_orientation_from_panel(dsi->connector, dsi->panel);
> +
>         drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
>
>         return 0;
> @@ -836,6 +841,16 @@ 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);
> +       struct device_node *panel_node;
> +
> +       /* Get panel if existed */
> +       panel_node = of_graph_get_remote_node(dev->of_node, 0, 0);
> +       if (panel_node) {
> +               dsi->panel = of_drm_find_panel(panel_node);
> +               if (IS_ERR(dsi->panel))
> +                       dsi->panel = NULL;
> +               of_node_put(panel_node);
> +       }

While the above works, it feels like we could do better. What about this?

* We add _some_ way to determine if a bridge is actually a
panel_bridge. If nothing else maybe this could be
drm_bridge_is_panel() and it could just check if bridge.funcs ==
panel_bridge_bridge_funcs

* In drm_bridge_connector_init(), when we're looping through all the
bridges we find the panel_bridge if it's there.

* At the end of drm_bridge_connector_init() if we found a panel_bridge
then we call a function like drm_panel_bridge_set_orientation().


Then you can fully get rid of the mediatek patch, right? The above
will only work if you're using a panel_bridge / bridge_connector, but
that's "the future" anyway and we want to encourage people to
transition to that.

-Doug

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v5 8/8] drm/mediatek: Config orientation property if panel provides it
@ 2022-06-07 15:32     ` Doug Anderson
  0 siblings, 0 replies; 44+ messages in thread
From: Doug Anderson @ 2022-06-07 15:32 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: Chun-Kuang Hu, Hans de Goede, Thierry Reding, Sam Ravnborg,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Philipp Zabel, David Airlie, Daniel Vetter, Matthias Brugger,
	dri-devel, moderated list:ARM/Mediatek SoC support, Rob Clark,
	Stephen Boyd, Rob Herring, Linux ARM, LKML

Hi,

On Tue, Jun 7, 2022 at 2:06 AM Hsin-Yi Wang <hsinyi@chromium.org> wrote:
>
> Panel orientation property should be set before drm_dev_register().
> Mediatek drm driver calls drm_dev_register() in .bind(). However, most
> panels sets orientation property relatively late, mostly in .get_modes()
> callback, since this is when they are able to get the connector and
> binds the orientation property to it, though the value should be known
> when the panel is probed.
>
> Let the drm driver check if the remote end point is a panel and if it
> contains the orientation property. If it does, set it before
> drm_dev_register() is called.
>
> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
> v4->v5:
> - use the new function in v5.
> - don't use drm_of_find_panel_or_bridge().
> ---
>  drivers/gpu/drm/mediatek/mtk_dsi.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index d9f10a33e6fa..998b1237e193 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -185,6 +185,7 @@ struct mtk_dsi {
>         struct drm_encoder encoder;
>         struct drm_bridge bridge;
>         struct drm_bridge *next_bridge;
> +       struct drm_panel *panel;
>         struct drm_connector *connector;
>         struct phy *phy;
>
> @@ -822,6 +823,10 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
>                 ret = PTR_ERR(dsi->connector);
>                 goto err_cleanup_encoder;
>         }
> +
> +       /* Read panel orientation */
> +       drm_connector_set_orientation_from_panel(dsi->connector, dsi->panel);
> +
>         drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
>
>         return 0;
> @@ -836,6 +841,16 @@ 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);
> +       struct device_node *panel_node;
> +
> +       /* Get panel if existed */
> +       panel_node = of_graph_get_remote_node(dev->of_node, 0, 0);
> +       if (panel_node) {
> +               dsi->panel = of_drm_find_panel(panel_node);
> +               if (IS_ERR(dsi->panel))
> +                       dsi->panel = NULL;
> +               of_node_put(panel_node);
> +       }

While the above works, it feels like we could do better. What about this?

* We add _some_ way to determine if a bridge is actually a
panel_bridge. If nothing else maybe this could be
drm_bridge_is_panel() and it could just check if bridge.funcs ==
panel_bridge_bridge_funcs

* In drm_bridge_connector_init(), when we're looping through all the
bridges we find the panel_bridge if it's there.

* At the end of drm_bridge_connector_init() if we found a panel_bridge
then we call a function like drm_panel_bridge_set_orientation().


Then you can fully get rid of the mediatek patch, right? The above
will only work if you're using a panel_bridge / bridge_connector, but
that's "the future" anyway and we want to encourage people to
transition to that.

-Doug

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

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v5 8/8] drm/mediatek: Config orientation property if panel provides it
  2022-06-07 15:32     ` Doug Anderson
  (?)
  (?)
@ 2022-06-08  9:35       ` Hsin-Yi Wang
  -1 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-08  9:35 UTC (permalink / raw)
  To: Doug Anderson
  Cc: Chun-Kuang Hu, Hans de Goede, Thierry Reding, Sam Ravnborg,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Philipp Zabel, David Airlie, Daniel Vetter, Matthias Brugger,
	dri-devel, moderated list:ARM/Mediatek SoC support, Rob Clark,
	Stephen Boyd, Rob Herring, Linux ARM, LKML

On Tue, Jun 7, 2022 at 11:39 PM Doug Anderson <dianders@chromium.org> wrote:
>
> Hi,
>
> On Tue, Jun 7, 2022 at 2:06 AM Hsin-Yi Wang <hsinyi@chromium.org> wrote:
> >
> > Panel orientation property should be set before drm_dev_register().
> > Mediatek drm driver calls drm_dev_register() in .bind(). However, most
> > panels sets orientation property relatively late, mostly in .get_modes()
> > callback, since this is when they are able to get the connector and
> > binds the orientation property to it, though the value should be known
> > when the panel is probed.
> >
> > Let the drm driver check if the remote end point is a panel and if it
> > contains the orientation property. If it does, set it before
> > drm_dev_register() is called.
> >
> > Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> > Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> > Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> > ---
> > v4->v5:
> > - use the new function in v5.
> > - don't use drm_of_find_panel_or_bridge().
> > ---
> >  drivers/gpu/drm/mediatek/mtk_dsi.c | 15 +++++++++++++++
> >  1 file changed, 15 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > index d9f10a33e6fa..998b1237e193 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > @@ -185,6 +185,7 @@ struct mtk_dsi {
> >         struct drm_encoder encoder;
> >         struct drm_bridge bridge;
> >         struct drm_bridge *next_bridge;
> > +       struct drm_panel *panel;
> >         struct drm_connector *connector;
> >         struct phy *phy;
> >
> > @@ -822,6 +823,10 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
> >                 ret = PTR_ERR(dsi->connector);
> >                 goto err_cleanup_encoder;
> >         }
> > +
> > +       /* Read panel orientation */
> > +       drm_connector_set_orientation_from_panel(dsi->connector, dsi->panel);
> > +
> >         drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
> >
> >         return 0;
> > @@ -836,6 +841,16 @@ 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);
> > +       struct device_node *panel_node;
> > +
> > +       /* Get panel if existed */
> > +       panel_node = of_graph_get_remote_node(dev->of_node, 0, 0);
> > +       if (panel_node) {
> > +               dsi->panel = of_drm_find_panel(panel_node);
> > +               if (IS_ERR(dsi->panel))
> > +                       dsi->panel = NULL;
> > +               of_node_put(panel_node);
> > +       }
>
> While the above works, it feels like we could do better. What about this?
>
> * We add _some_ way to determine if a bridge is actually a
> panel_bridge. If nothing else maybe this could be
> drm_bridge_is_panel() and it could just check if bridge.funcs ==
> panel_bridge_bridge_funcs
>
> * In drm_bridge_connector_init(), when we're looping through all the
> bridges we find the panel_bridge if it's there.
>
> * At the end of drm_bridge_connector_init() if we found a panel_bridge
> then we call a function like drm_panel_bridge_set_orientation().
>
>
> Then you can fully get rid of the mediatek patch, right? The above
> will only work if you're using a panel_bridge / bridge_connector, but
> that's "the future" anyway and we want to encourage people to
> transition to that.
>
This also works with the mtk dsi, and it's more generic. I'll drop
this patch and go with this implementation in the next version. Thanks
for the suggestion.

> -Doug

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v5 8/8] drm/mediatek: Config orientation property if panel provides it
@ 2022-06-08  9:35       ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-08  9:35 UTC (permalink / raw)
  To: Doug Anderson
  Cc: Rob Clark, Chun-Kuang Hu, Rob Herring, David Airlie, LKML,
	Stephen Boyd, Hans de Goede, Thierry Reding,
	moderated list:ARM/Mediatek SoC support, dri-devel,
	Thomas Zimmermann, Matthias Brugger, Sam Ravnborg, Linux ARM

On Tue, Jun 7, 2022 at 11:39 PM Doug Anderson <dianders@chromium.org> wrote:
>
> Hi,
>
> On Tue, Jun 7, 2022 at 2:06 AM Hsin-Yi Wang <hsinyi@chromium.org> wrote:
> >
> > Panel orientation property should be set before drm_dev_register().
> > Mediatek drm driver calls drm_dev_register() in .bind(). However, most
> > panels sets orientation property relatively late, mostly in .get_modes()
> > callback, since this is when they are able to get the connector and
> > binds the orientation property to it, though the value should be known
> > when the panel is probed.
> >
> > Let the drm driver check if the remote end point is a panel and if it
> > contains the orientation property. If it does, set it before
> > drm_dev_register() is called.
> >
> > Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> > Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> > Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> > ---
> > v4->v5:
> > - use the new function in v5.
> > - don't use drm_of_find_panel_or_bridge().
> > ---
> >  drivers/gpu/drm/mediatek/mtk_dsi.c | 15 +++++++++++++++
> >  1 file changed, 15 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > index d9f10a33e6fa..998b1237e193 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > @@ -185,6 +185,7 @@ struct mtk_dsi {
> >         struct drm_encoder encoder;
> >         struct drm_bridge bridge;
> >         struct drm_bridge *next_bridge;
> > +       struct drm_panel *panel;
> >         struct drm_connector *connector;
> >         struct phy *phy;
> >
> > @@ -822,6 +823,10 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
> >                 ret = PTR_ERR(dsi->connector);
> >                 goto err_cleanup_encoder;
> >         }
> > +
> > +       /* Read panel orientation */
> > +       drm_connector_set_orientation_from_panel(dsi->connector, dsi->panel);
> > +
> >         drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
> >
> >         return 0;
> > @@ -836,6 +841,16 @@ 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);
> > +       struct device_node *panel_node;
> > +
> > +       /* Get panel if existed */
> > +       panel_node = of_graph_get_remote_node(dev->of_node, 0, 0);
> > +       if (panel_node) {
> > +               dsi->panel = of_drm_find_panel(panel_node);
> > +               if (IS_ERR(dsi->panel))
> > +                       dsi->panel = NULL;
> > +               of_node_put(panel_node);
> > +       }
>
> While the above works, it feels like we could do better. What about this?
>
> * We add _some_ way to determine if a bridge is actually a
> panel_bridge. If nothing else maybe this could be
> drm_bridge_is_panel() and it could just check if bridge.funcs ==
> panel_bridge_bridge_funcs
>
> * In drm_bridge_connector_init(), when we're looping through all the
> bridges we find the panel_bridge if it's there.
>
> * At the end of drm_bridge_connector_init() if we found a panel_bridge
> then we call a function like drm_panel_bridge_set_orientation().
>
>
> Then you can fully get rid of the mediatek patch, right? The above
> will only work if you're using a panel_bridge / bridge_connector, but
> that's "the future" anyway and we want to encourage people to
> transition to that.
>
This also works with the mtk dsi, and it's more generic. I'll drop
this patch and go with this implementation in the next version. Thanks
for the suggestion.

> -Doug

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v5 8/8] drm/mediatek: Config orientation property if panel provides it
@ 2022-06-08  9:35       ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-08  9:35 UTC (permalink / raw)
  To: Doug Anderson
  Cc: Chun-Kuang Hu, Hans de Goede, Thierry Reding, Sam Ravnborg,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Philipp Zabel, David Airlie, Daniel Vetter, Matthias Brugger,
	dri-devel, moderated list:ARM/Mediatek SoC support, Rob Clark,
	Stephen Boyd, Rob Herring, Linux ARM, LKML

On Tue, Jun 7, 2022 at 11:39 PM Doug Anderson <dianders@chromium.org> wrote:
>
> Hi,
>
> On Tue, Jun 7, 2022 at 2:06 AM Hsin-Yi Wang <hsinyi@chromium.org> wrote:
> >
> > Panel orientation property should be set before drm_dev_register().
> > Mediatek drm driver calls drm_dev_register() in .bind(). However, most
> > panels sets orientation property relatively late, mostly in .get_modes()
> > callback, since this is when they are able to get the connector and
> > binds the orientation property to it, though the value should be known
> > when the panel is probed.
> >
> > Let the drm driver check if the remote end point is a panel and if it
> > contains the orientation property. If it does, set it before
> > drm_dev_register() is called.
> >
> > Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> > Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> > Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> > ---
> > v4->v5:
> > - use the new function in v5.
> > - don't use drm_of_find_panel_or_bridge().
> > ---
> >  drivers/gpu/drm/mediatek/mtk_dsi.c | 15 +++++++++++++++
> >  1 file changed, 15 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > index d9f10a33e6fa..998b1237e193 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > @@ -185,6 +185,7 @@ struct mtk_dsi {
> >         struct drm_encoder encoder;
> >         struct drm_bridge bridge;
> >         struct drm_bridge *next_bridge;
> > +       struct drm_panel *panel;
> >         struct drm_connector *connector;
> >         struct phy *phy;
> >
> > @@ -822,6 +823,10 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
> >                 ret = PTR_ERR(dsi->connector);
> >                 goto err_cleanup_encoder;
> >         }
> > +
> > +       /* Read panel orientation */
> > +       drm_connector_set_orientation_from_panel(dsi->connector, dsi->panel);
> > +
> >         drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
> >
> >         return 0;
> > @@ -836,6 +841,16 @@ 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);
> > +       struct device_node *panel_node;
> > +
> > +       /* Get panel if existed */
> > +       panel_node = of_graph_get_remote_node(dev->of_node, 0, 0);
> > +       if (panel_node) {
> > +               dsi->panel = of_drm_find_panel(panel_node);
> > +               if (IS_ERR(dsi->panel))
> > +                       dsi->panel = NULL;
> > +               of_node_put(panel_node);
> > +       }
>
> While the above works, it feels like we could do better. What about this?
>
> * We add _some_ way to determine if a bridge is actually a
> panel_bridge. If nothing else maybe this could be
> drm_bridge_is_panel() and it could just check if bridge.funcs ==
> panel_bridge_bridge_funcs
>
> * In drm_bridge_connector_init(), when we're looping through all the
> bridges we find the panel_bridge if it's there.
>
> * At the end of drm_bridge_connector_init() if we found a panel_bridge
> then we call a function like drm_panel_bridge_set_orientation().
>
>
> Then you can fully get rid of the mediatek patch, right? The above
> will only work if you're using a panel_bridge / bridge_connector, but
> that's "the future" anyway and we want to encourage people to
> transition to that.
>
This also works with the mtk dsi, and it's more generic. I'll drop
this patch and go with this implementation in the next version. Thanks
for the suggestion.

> -Doug

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

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH v5 8/8] drm/mediatek: Config orientation property if panel provides it
@ 2022-06-08  9:35       ` Hsin-Yi Wang
  0 siblings, 0 replies; 44+ messages in thread
From: Hsin-Yi Wang @ 2022-06-08  9:35 UTC (permalink / raw)
  To: Doug Anderson
  Cc: Chun-Kuang Hu, Hans de Goede, Thierry Reding, Sam Ravnborg,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Philipp Zabel, David Airlie, Daniel Vetter, Matthias Brugger,
	dri-devel, moderated list:ARM/Mediatek SoC support, Rob Clark,
	Stephen Boyd, Rob Herring, Linux ARM, LKML

On Tue, Jun 7, 2022 at 11:39 PM Doug Anderson <dianders@chromium.org> wrote:
>
> Hi,
>
> On Tue, Jun 7, 2022 at 2:06 AM Hsin-Yi Wang <hsinyi@chromium.org> wrote:
> >
> > Panel orientation property should be set before drm_dev_register().
> > Mediatek drm driver calls drm_dev_register() in .bind(). However, most
> > panels sets orientation property relatively late, mostly in .get_modes()
> > callback, since this is when they are able to get the connector and
> > binds the orientation property to it, though the value should be known
> > when the panel is probed.
> >
> > Let the drm driver check if the remote end point is a panel and if it
> > contains the orientation property. If it does, set it before
> > drm_dev_register() is called.
> >
> > Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> > Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> > Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> > ---
> > v4->v5:
> > - use the new function in v5.
> > - don't use drm_of_find_panel_or_bridge().
> > ---
> >  drivers/gpu/drm/mediatek/mtk_dsi.c | 15 +++++++++++++++
> >  1 file changed, 15 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > index d9f10a33e6fa..998b1237e193 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > @@ -185,6 +185,7 @@ struct mtk_dsi {
> >         struct drm_encoder encoder;
> >         struct drm_bridge bridge;
> >         struct drm_bridge *next_bridge;
> > +       struct drm_panel *panel;
> >         struct drm_connector *connector;
> >         struct phy *phy;
> >
> > @@ -822,6 +823,10 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
> >                 ret = PTR_ERR(dsi->connector);
> >                 goto err_cleanup_encoder;
> >         }
> > +
> > +       /* Read panel orientation */
> > +       drm_connector_set_orientation_from_panel(dsi->connector, dsi->panel);
> > +
> >         drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
> >
> >         return 0;
> > @@ -836,6 +841,16 @@ 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);
> > +       struct device_node *panel_node;
> > +
> > +       /* Get panel if existed */
> > +       panel_node = of_graph_get_remote_node(dev->of_node, 0, 0);
> > +       if (panel_node) {
> > +               dsi->panel = of_drm_find_panel(panel_node);
> > +               if (IS_ERR(dsi->panel))
> > +                       dsi->panel = NULL;
> > +               of_node_put(panel_node);
> > +       }
>
> While the above works, it feels like we could do better. What about this?
>
> * We add _some_ way to determine if a bridge is actually a
> panel_bridge. If nothing else maybe this could be
> drm_bridge_is_panel() and it could just check if bridge.funcs ==
> panel_bridge_bridge_funcs
>
> * In drm_bridge_connector_init(), when we're looping through all the
> bridges we find the panel_bridge if it's there.
>
> * At the end of drm_bridge_connector_init() if we found a panel_bridge
> then we call a function like drm_panel_bridge_set_orientation().
>
>
> Then you can fully get rid of the mediatek patch, right? The above
> will only work if you're using a panel_bridge / bridge_connector, but
> that's "the future" anyway and we want to encourage people to
> transition to that.
>
This also works with the mtk dsi, and it's more generic. I'll drop
this patch and go with this implementation in the next version. Thanks
for the suggestion.

> -Doug

^ permalink raw reply	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2022-06-08 10:01 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-07  9:05 [PATCH v5 0/8] Add a panel API to set orientation properly Hsin-Yi Wang
2022-06-07  9:05 ` Hsin-Yi Wang
2022-06-07  9:05 ` Hsin-Yi Wang
2022-06-07  9:05 ` Hsin-Yi Wang
2022-06-07  9:05 ` [PATCH v5 1/8] drm/panel: Add an API to allow drm to set orientation from panel Hsin-Yi Wang
2022-06-07  9:05   ` Hsin-Yi Wang
2022-06-07  9:05   ` Hsin-Yi Wang
2022-06-07  9:05   ` Hsin-Yi Wang
2022-06-07  9:05 ` [PATCH v5 2/8] drm/panel: boe-tv101wum-nl6: Implement .get_orientation callback Hsin-Yi Wang
2022-06-07  9:05   ` Hsin-Yi Wang
2022-06-07  9:05   ` Hsin-Yi Wang
2022-06-07  9:05   ` Hsin-Yi Wang
2022-06-07  9:05 ` [PATCH v5 3/8] drm/panel: panel-edp: " Hsin-Yi Wang
2022-06-07  9:05   ` Hsin-Yi Wang
2022-06-07  9:05   ` Hsin-Yi Wang
2022-06-07  9:05   ` Hsin-Yi Wang
2022-06-07  9:05 ` [PATCH v5 4/8] drm/panel: lvds: " Hsin-Yi Wang
2022-06-07  9:05   ` Hsin-Yi Wang
2022-06-07  9:05   ` Hsin-Yi Wang
2022-06-07  9:05   ` Hsin-Yi Wang
2022-06-07  9:05 ` [PATCH v5 5/8] drm/panel: panel-simple: " Hsin-Yi Wang
2022-06-07  9:05   ` Hsin-Yi Wang
2022-06-07  9:05   ` Hsin-Yi Wang
2022-06-07  9:05   ` Hsin-Yi Wang
2022-06-07  9:05 ` [PATCH v5 6/8] drm/panel: ili9881c: " Hsin-Yi Wang
2022-06-07  9:05   ` Hsin-Yi Wang
2022-06-07  9:05   ` Hsin-Yi Wang
2022-06-07  9:05   ` Hsin-Yi Wang
2022-06-07  9:05 ` [PATCH v5 7/8] drm/panel: elida-kd35t133: " Hsin-Yi Wang
2022-06-07  9:05   ` Hsin-Yi Wang
2022-06-07  9:05   ` Hsin-Yi Wang
2022-06-07  9:05   ` Hsin-Yi Wang
2022-06-07  9:05 ` [PATCH v5 8/8] drm/mediatek: Config orientation property if panel provides it Hsin-Yi Wang
2022-06-07  9:05   ` Hsin-Yi Wang
2022-06-07  9:05   ` Hsin-Yi Wang
2022-06-07  9:05   ` Hsin-Yi Wang
2022-06-07 15:32   ` Doug Anderson
2022-06-07 15:32     ` Doug Anderson
2022-06-07 15:32     ` Doug Anderson
2022-06-07 15:32     ` Doug Anderson
2022-06-08  9:35     ` Hsin-Yi Wang
2022-06-08  9:35       ` Hsin-Yi Wang
2022-06-08  9:35       ` Hsin-Yi Wang
2022-06-08  9:35       ` Hsin-Yi Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.