All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/8] Add a panel API to return panel orientation
@ 2022-06-06 15:24 ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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_panel_get_orientation() for drm/kms
drivers. The drivers can use the API to get panel's orientation, so they
can call drm_connector_set_panel_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/

Hsin-Yi Wang (8):
  drm/panel: Add an API drm_panel_get_orientation() to return panel
    orientation
  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_panel.c                    |  9 +++++++++
 drivers/gpu/drm/mediatek/mtk_dsi.c             | 10 ++++++++++
 drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 14 ++++++++++++++
 drivers/gpu/drm/panel/panel-edp.c              | 15 ++++++++++++++-
 drivers/gpu/drm/panel/panel-elida-kd35t133.c   | 14 ++++++++++++++
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c  | 14 ++++++++++++++
 drivers/gpu/drm/panel/panel-lvds.c             | 15 +++++++++++++++
 drivers/gpu/drm/panel/panel-simple.c           | 16 +++++++++++++++-
 include/drm/drm_panel.h                        | 10 ++++++++++
 9 files changed, 115 insertions(+), 2 deletions(-)

-- 
2.36.1.255.ge46751e96f-goog


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

* [PATCH v4 0/8] Add a panel API to return panel orientation
@ 2022-06-06 15:24 ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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_panel_get_orientation() for drm/kms
drivers. The drivers can use the API to get panel's orientation, so they
can call drm_connector_set_panel_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/

Hsin-Yi Wang (8):
  drm/panel: Add an API drm_panel_get_orientation() to return panel
    orientation
  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_panel.c                    |  9 +++++++++
 drivers/gpu/drm/mediatek/mtk_dsi.c             | 10 ++++++++++
 drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 14 ++++++++++++++
 drivers/gpu/drm/panel/panel-edp.c              | 15 ++++++++++++++-
 drivers/gpu/drm/panel/panel-elida-kd35t133.c   | 14 ++++++++++++++
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c  | 14 ++++++++++++++
 drivers/gpu/drm/panel/panel-lvds.c             | 15 +++++++++++++++
 drivers/gpu/drm/panel/panel-simple.c           | 16 +++++++++++++++-
 include/drm/drm_panel.h                        | 10 ++++++++++
 9 files changed, 115 insertions(+), 2 deletions(-)

-- 
2.36.1.255.ge46751e96f-goog


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

* [PATCH v4 0/8] Add a panel API to return panel orientation
@ 2022-06-06 15:24 ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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_panel_get_orientation() for drm/kms
drivers. The drivers can use the API to get panel's orientation, so they
can call drm_connector_set_panel_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/

Hsin-Yi Wang (8):
  drm/panel: Add an API drm_panel_get_orientation() to return panel
    orientation
  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_panel.c                    |  9 +++++++++
 drivers/gpu/drm/mediatek/mtk_dsi.c             | 10 ++++++++++
 drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 14 ++++++++++++++
 drivers/gpu/drm/panel/panel-edp.c              | 15 ++++++++++++++-
 drivers/gpu/drm/panel/panel-elida-kd35t133.c   | 14 ++++++++++++++
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c  | 14 ++++++++++++++
 drivers/gpu/drm/panel/panel-lvds.c             | 15 +++++++++++++++
 drivers/gpu/drm/panel/panel-simple.c           | 16 +++++++++++++++-
 include/drm/drm_panel.h                        | 10 ++++++++++
 9 files changed, 115 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] 88+ messages in thread

* [PATCH v4 0/8] Add a panel API to return panel orientation
@ 2022-06-06 15:24 ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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_panel_get_orientation() for drm/kms
drivers. The drivers can use the API to get panel's orientation, so they
can call drm_connector_set_panel_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/

Hsin-Yi Wang (8):
  drm/panel: Add an API drm_panel_get_orientation() to return panel
    orientation
  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_panel.c                    |  9 +++++++++
 drivers/gpu/drm/mediatek/mtk_dsi.c             | 10 ++++++++++
 drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 14 ++++++++++++++
 drivers/gpu/drm/panel/panel-edp.c              | 15 ++++++++++++++-
 drivers/gpu/drm/panel/panel-elida-kd35t133.c   | 14 ++++++++++++++
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c  | 14 ++++++++++++++
 drivers/gpu/drm/panel/panel-lvds.c             | 15 +++++++++++++++
 drivers/gpu/drm/panel/panel-simple.c           | 16 +++++++++++++++-
 include/drm/drm_panel.h                        | 10 ++++++++++
 9 files changed, 115 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] 88+ messages in thread

* [PATCH v4 1/8] drm/panel: Add an API drm_panel_get_orientation() to return panel orientation
  2022-06-06 15:24 ` Hsin-Yi Wang
  (?)
  (?)
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  -1 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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_panel_orientation() 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>
---
v3->v4: Add a blank line.
---
 drivers/gpu/drm/drm_panel.c |  9 +++++++++
 include/drm/drm_panel.h     | 10 ++++++++++
 2 files changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
index f634371c717a..e12056cfeca8 100644
--- a/drivers/gpu/drm/drm_panel.c
+++ b/drivers/gpu/drm/drm_panel.c
@@ -223,6 +223,15 @@ int drm_panel_get_modes(struct drm_panel *panel,
 }
 EXPORT_SYMBOL(drm_panel_get_modes);
 
+enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel)
+{
+	if (panel && panel->funcs && panel->funcs->get_orientation)
+		return panel->funcs->get_orientation(panel);
+
+	return DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
+}
+EXPORT_SYMBOL(drm_panel_get_orientation);
+
 #ifdef CONFIG_OF
 /**
  * of_drm_find_panel - look up a panel using a device tree node
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index d279ee455f01..5dadbf3b0370 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -133,6 +133,15 @@ struct drm_panel_funcs {
 	 * Allows panels to create panels-specific debugfs files.
 	 */
 	void (*debugfs_init)(struct drm_panel *panel, struct dentry *root);
+
+	/**
+	 * @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);
 };
 
 /**
@@ -202,6 +211,7 @@ int drm_panel_enable(struct drm_panel *panel);
 int drm_panel_disable(struct drm_panel *panel);
 
 int drm_panel_get_modes(struct drm_panel *panel, struct drm_connector *connector);
+enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel);
 
 #if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL)
 struct drm_panel *of_drm_find_panel(const struct device_node *np);
-- 
2.36.1.255.ge46751e96f-goog


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

* [PATCH v4 1/8] drm/panel: Add an API drm_panel_get_orientation() to return panel orientation
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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_panel_orientation() 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>
---
v3->v4: Add a blank line.
---
 drivers/gpu/drm/drm_panel.c |  9 +++++++++
 include/drm/drm_panel.h     | 10 ++++++++++
 2 files changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
index f634371c717a..e12056cfeca8 100644
--- a/drivers/gpu/drm/drm_panel.c
+++ b/drivers/gpu/drm/drm_panel.c
@@ -223,6 +223,15 @@ int drm_panel_get_modes(struct drm_panel *panel,
 }
 EXPORT_SYMBOL(drm_panel_get_modes);
 
+enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel)
+{
+	if (panel && panel->funcs && panel->funcs->get_orientation)
+		return panel->funcs->get_orientation(panel);
+
+	return DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
+}
+EXPORT_SYMBOL(drm_panel_get_orientation);
+
 #ifdef CONFIG_OF
 /**
  * of_drm_find_panel - look up a panel using a device tree node
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index d279ee455f01..5dadbf3b0370 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -133,6 +133,15 @@ struct drm_panel_funcs {
 	 * Allows panels to create panels-specific debugfs files.
 	 */
 	void (*debugfs_init)(struct drm_panel *panel, struct dentry *root);
+
+	/**
+	 * @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);
 };
 
 /**
@@ -202,6 +211,7 @@ int drm_panel_enable(struct drm_panel *panel);
 int drm_panel_disable(struct drm_panel *panel);
 
 int drm_panel_get_modes(struct drm_panel *panel, struct drm_connector *connector);
+enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel);
 
 #if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL)
 struct drm_panel *of_drm_find_panel(const struct device_node *np);
-- 
2.36.1.255.ge46751e96f-goog


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

* [PATCH v4 1/8] drm/panel: Add an API drm_panel_get_orientation() to return panel orientation
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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_panel_orientation() 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>
---
v3->v4: Add a blank line.
---
 drivers/gpu/drm/drm_panel.c |  9 +++++++++
 include/drm/drm_panel.h     | 10 ++++++++++
 2 files changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
index f634371c717a..e12056cfeca8 100644
--- a/drivers/gpu/drm/drm_panel.c
+++ b/drivers/gpu/drm/drm_panel.c
@@ -223,6 +223,15 @@ int drm_panel_get_modes(struct drm_panel *panel,
 }
 EXPORT_SYMBOL(drm_panel_get_modes);
 
+enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel)
+{
+	if (panel && panel->funcs && panel->funcs->get_orientation)
+		return panel->funcs->get_orientation(panel);
+
+	return DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
+}
+EXPORT_SYMBOL(drm_panel_get_orientation);
+
 #ifdef CONFIG_OF
 /**
  * of_drm_find_panel - look up a panel using a device tree node
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index d279ee455f01..5dadbf3b0370 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -133,6 +133,15 @@ struct drm_panel_funcs {
 	 * Allows panels to create panels-specific debugfs files.
 	 */
 	void (*debugfs_init)(struct drm_panel *panel, struct dentry *root);
+
+	/**
+	 * @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);
 };
 
 /**
@@ -202,6 +211,7 @@ int drm_panel_enable(struct drm_panel *panel);
 int drm_panel_disable(struct drm_panel *panel);
 
 int drm_panel_get_modes(struct drm_panel *panel, struct drm_connector *connector);
+enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel);
 
 #if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL)
 struct drm_panel *of_drm_find_panel(const struct device_node *np);
-- 
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] 88+ messages in thread

* [PATCH v4 1/8] drm/panel: Add an API drm_panel_get_orientation() to return panel orientation
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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_panel_orientation() 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>
---
v3->v4: Add a blank line.
---
 drivers/gpu/drm/drm_panel.c |  9 +++++++++
 include/drm/drm_panel.h     | 10 ++++++++++
 2 files changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
index f634371c717a..e12056cfeca8 100644
--- a/drivers/gpu/drm/drm_panel.c
+++ b/drivers/gpu/drm/drm_panel.c
@@ -223,6 +223,15 @@ int drm_panel_get_modes(struct drm_panel *panel,
 }
 EXPORT_SYMBOL(drm_panel_get_modes);
 
+enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel)
+{
+	if (panel && panel->funcs && panel->funcs->get_orientation)
+		return panel->funcs->get_orientation(panel);
+
+	return DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
+}
+EXPORT_SYMBOL(drm_panel_get_orientation);
+
 #ifdef CONFIG_OF
 /**
  * of_drm_find_panel - look up a panel using a device tree node
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index d279ee455f01..5dadbf3b0370 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -133,6 +133,15 @@ struct drm_panel_funcs {
 	 * Allows panels to create panels-specific debugfs files.
 	 */
 	void (*debugfs_init)(struct drm_panel *panel, struct dentry *root);
+
+	/**
+	 * @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);
 };
 
 /**
@@ -202,6 +211,7 @@ int drm_panel_enable(struct drm_panel *panel);
 int drm_panel_disable(struct drm_panel *panel);
 
 int drm_panel_get_modes(struct drm_panel *panel, struct drm_connector *connector);
+enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel);
 
 #if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL)
 struct drm_panel *of_drm_find_panel(const struct device_node *np);
-- 
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] 88+ messages in thread

* [PATCH v4 2/8] drm/panel: boe-tv101wum-nl6: Implement .get_orientation callback
  2022-06-06 15:24 ` Hsin-Yi Wang
  (?)
  (?)
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  -1 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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-boe-tv101wum-nl6.c | 14 ++++++++++++++
 1 file changed, 14 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..a9cd07234179 100644
--- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
+++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
@@ -1511,16 +1511,30 @@ 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;
+	/*
+	 * drm drivers are expected to call drm_panel_get_orientation() to get
+	 * panel's orientation then drm_connector_set_panel_orientation() to
+	 * set the property before drm_dev_register(). Otherwise there will be
+	 * a WARN_ON if orientation is set after drm is registered.
+	 */
 	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] 88+ messages in thread

* [PATCH v4 2/8] drm/panel: boe-tv101wum-nl6: Implement .get_orientation callback
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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-boe-tv101wum-nl6.c | 14 ++++++++++++++
 1 file changed, 14 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..a9cd07234179 100644
--- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
+++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
@@ -1511,16 +1511,30 @@ 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;
+	/*
+	 * drm drivers are expected to call drm_panel_get_orientation() to get
+	 * panel's orientation then drm_connector_set_panel_orientation() to
+	 * set the property before drm_dev_register(). Otherwise there will be
+	 * a WARN_ON if orientation is set after drm is registered.
+	 */
 	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] 88+ messages in thread

* [PATCH v4 2/8] drm/panel: boe-tv101wum-nl6: Implement .get_orientation callback
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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-boe-tv101wum-nl6.c | 14 ++++++++++++++
 1 file changed, 14 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..a9cd07234179 100644
--- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
+++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
@@ -1511,16 +1511,30 @@ 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;
+	/*
+	 * drm drivers are expected to call drm_panel_get_orientation() to get
+	 * panel's orientation then drm_connector_set_panel_orientation() to
+	 * set the property before drm_dev_register(). Otherwise there will be
+	 * a WARN_ON if orientation is set after drm is registered.
+	 */
 	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] 88+ messages in thread

* [PATCH v4 2/8] drm/panel: boe-tv101wum-nl6: Implement .get_orientation callback
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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-boe-tv101wum-nl6.c | 14 ++++++++++++++
 1 file changed, 14 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..a9cd07234179 100644
--- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
+++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
@@ -1511,16 +1511,30 @@ 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;
+	/*
+	 * drm drivers are expected to call drm_panel_get_orientation() to get
+	 * panel's orientation then drm_connector_set_panel_orientation() to
+	 * set the property before drm_dev_register(). Otherwise there will be
+	 * a WARN_ON if orientation is set after drm is registered.
+	 */
 	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] 88+ messages in thread

* [PATCH v4 3/8] drm/panel: panel-edp: Implement .get_orientation callback
  2022-06-06 15:24 ` Hsin-Yi Wang
  (?)
  (?)
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  -1 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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 | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c
index c96014464355..c0a43bc7d24a 100644
--- a/drivers/gpu/drm/panel/panel-edp.c
+++ b/drivers/gpu/drm/panel/panel-edp.c
@@ -586,7 +586,12 @@ 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 */
+	/*
+	 * drm drivers are expected to call drm_panel_get_orientation() to get
+	 * panel's orientation then drm_connector_set_panel_orientation() to
+	 * set the property before drm_dev_register(). Otherwise there will be
+	 * a WARN_ON if orientation is set after drm is registered.
+	 */
 	drm_connector_set_panel_orientation(connector, p->orientation);
 
 	return num;
@@ -609,6 +614,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 +649,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] 88+ messages in thread

* [PATCH v4 3/8] drm/panel: panel-edp: Implement .get_orientation callback
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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 | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c
index c96014464355..c0a43bc7d24a 100644
--- a/drivers/gpu/drm/panel/panel-edp.c
+++ b/drivers/gpu/drm/panel/panel-edp.c
@@ -586,7 +586,12 @@ 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 */
+	/*
+	 * drm drivers are expected to call drm_panel_get_orientation() to get
+	 * panel's orientation then drm_connector_set_panel_orientation() to
+	 * set the property before drm_dev_register(). Otherwise there will be
+	 * a WARN_ON if orientation is set after drm is registered.
+	 */
 	drm_connector_set_panel_orientation(connector, p->orientation);
 
 	return num;
@@ -609,6 +614,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 +649,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] 88+ messages in thread

* [PATCH v4 3/8] drm/panel: panel-edp: Implement .get_orientation callback
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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 | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c
index c96014464355..c0a43bc7d24a 100644
--- a/drivers/gpu/drm/panel/panel-edp.c
+++ b/drivers/gpu/drm/panel/panel-edp.c
@@ -586,7 +586,12 @@ 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 */
+	/*
+	 * drm drivers are expected to call drm_panel_get_orientation() to get
+	 * panel's orientation then drm_connector_set_panel_orientation() to
+	 * set the property before drm_dev_register(). Otherwise there will be
+	 * a WARN_ON if orientation is set after drm is registered.
+	 */
 	drm_connector_set_panel_orientation(connector, p->orientation);
 
 	return num;
@@ -609,6 +614,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 +649,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] 88+ messages in thread

* [PATCH v4 3/8] drm/panel: panel-edp: Implement .get_orientation callback
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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 | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c
index c96014464355..c0a43bc7d24a 100644
--- a/drivers/gpu/drm/panel/panel-edp.c
+++ b/drivers/gpu/drm/panel/panel-edp.c
@@ -586,7 +586,12 @@ 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 */
+	/*
+	 * drm drivers are expected to call drm_panel_get_orientation() to get
+	 * panel's orientation then drm_connector_set_panel_orientation() to
+	 * set the property before drm_dev_register(). Otherwise there will be
+	 * a WARN_ON if orientation is set after drm is registered.
+	 */
 	drm_connector_set_panel_orientation(connector, p->orientation);
 
 	return num;
@@ -609,6 +614,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 +649,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] 88+ messages in thread

* [PATCH v4 4/8] drm/panel: lvds: Implement .get_orientation callback
  2022-06-06 15:24 ` Hsin-Yi Wang
  (?)
  (?)
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  -1 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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>
---
v3->v4: rebase to latest linux-next to solve conflict.
---
 drivers/gpu/drm/panel/panel-lvds.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
index f11252fb00fe..491b64c2c8d6 100644
--- a/drivers/gpu/drm/panel/panel-lvds.c
+++ b/drivers/gpu/drm/panel/panel-lvds.c
@@ -99,15 +99,30 @@ 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;
+
+	/*
+	 * drm drivers are expected to call drm_panel_get_orientation() to get
+	 * panel's orientation then drm_connector_set_panel_orientation() to
+	 * set the property before drm_dev_register(). Otherwise there will be
+	 * a WARN_ON if orientation is set after drm is registered.
+	 */
 	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] 88+ messages in thread

* [PATCH v4 4/8] drm/panel: lvds: Implement .get_orientation callback
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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>
---
v3->v4: rebase to latest linux-next to solve conflict.
---
 drivers/gpu/drm/panel/panel-lvds.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
index f11252fb00fe..491b64c2c8d6 100644
--- a/drivers/gpu/drm/panel/panel-lvds.c
+++ b/drivers/gpu/drm/panel/panel-lvds.c
@@ -99,15 +99,30 @@ 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;
+
+	/*
+	 * drm drivers are expected to call drm_panel_get_orientation() to get
+	 * panel's orientation then drm_connector_set_panel_orientation() to
+	 * set the property before drm_dev_register(). Otherwise there will be
+	 * a WARN_ON if orientation is set after drm is registered.
+	 */
 	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] 88+ messages in thread

* [PATCH v4 4/8] drm/panel: lvds: Implement .get_orientation callback
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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>
---
v3->v4: rebase to latest linux-next to solve conflict.
---
 drivers/gpu/drm/panel/panel-lvds.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
index f11252fb00fe..491b64c2c8d6 100644
--- a/drivers/gpu/drm/panel/panel-lvds.c
+++ b/drivers/gpu/drm/panel/panel-lvds.c
@@ -99,15 +99,30 @@ 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;
+
+	/*
+	 * drm drivers are expected to call drm_panel_get_orientation() to get
+	 * panel's orientation then drm_connector_set_panel_orientation() to
+	 * set the property before drm_dev_register(). Otherwise there will be
+	 * a WARN_ON if orientation is set after drm is registered.
+	 */
 	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] 88+ messages in thread

* [PATCH v4 4/8] drm/panel: lvds: Implement .get_orientation callback
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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>
---
v3->v4: rebase to latest linux-next to solve conflict.
---
 drivers/gpu/drm/panel/panel-lvds.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
index f11252fb00fe..491b64c2c8d6 100644
--- a/drivers/gpu/drm/panel/panel-lvds.c
+++ b/drivers/gpu/drm/panel/panel-lvds.c
@@ -99,15 +99,30 @@ 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;
+
+	/*
+	 * drm drivers are expected to call drm_panel_get_orientation() to get
+	 * panel's orientation then drm_connector_set_panel_orientation() to
+	 * set the property before drm_dev_register(). Otherwise there will be
+	 * a WARN_ON if orientation is set after drm is registered.
+	 */
 	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] 88+ messages in thread

* [PATCH v4 5/8] drm/panel: panel-simple: Implement .get_orientation callback
  2022-06-06 15:24 ` Hsin-Yi Wang
  (?)
  (?)
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  -1 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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-simple.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index 4a2e580a2f7b..f232b8cf4075 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -411,7 +411,12 @@ 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 */
+	/*
+	 * drm drivers are expected to call drm_panel_get_orientation() to get
+	 * panel's orientation then drm_connector_set_panel_orientation() to
+	 * set the property before drm_dev_register(). Otherwise there will be
+	 * a WARN_ON if orientation is set after drm is registered.
+	 */
 	drm_connector_set_panel_orientation(connector, p->orientation);
 
 	return num;
@@ -434,6 +439,14 @@ 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,
@@ -441,6 +454,7 @@ static const struct drm_panel_funcs panel_simple_funcs = {
 	.enable = panel_simple_enable,
 	.get_modes = panel_simple_get_modes,
 	.get_timings = panel_simple_get_timings,
+	.get_orientation = panel_simple_get_orientation,
 };
 
 static struct panel_desc panel_dpi;
-- 
2.36.1.255.ge46751e96f-goog


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

* [PATCH v4 5/8] drm/panel: panel-simple: Implement .get_orientation callback
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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-simple.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index 4a2e580a2f7b..f232b8cf4075 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -411,7 +411,12 @@ 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 */
+	/*
+	 * drm drivers are expected to call drm_panel_get_orientation() to get
+	 * panel's orientation then drm_connector_set_panel_orientation() to
+	 * set the property before drm_dev_register(). Otherwise there will be
+	 * a WARN_ON if orientation is set after drm is registered.
+	 */
 	drm_connector_set_panel_orientation(connector, p->orientation);
 
 	return num;
@@ -434,6 +439,14 @@ 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,
@@ -441,6 +454,7 @@ static const struct drm_panel_funcs panel_simple_funcs = {
 	.enable = panel_simple_enable,
 	.get_modes = panel_simple_get_modes,
 	.get_timings = panel_simple_get_timings,
+	.get_orientation = panel_simple_get_orientation,
 };
 
 static struct panel_desc panel_dpi;
-- 
2.36.1.255.ge46751e96f-goog


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

* [PATCH v4 5/8] drm/panel: panel-simple: Implement .get_orientation callback
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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-simple.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index 4a2e580a2f7b..f232b8cf4075 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -411,7 +411,12 @@ 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 */
+	/*
+	 * drm drivers are expected to call drm_panel_get_orientation() to get
+	 * panel's orientation then drm_connector_set_panel_orientation() to
+	 * set the property before drm_dev_register(). Otherwise there will be
+	 * a WARN_ON if orientation is set after drm is registered.
+	 */
 	drm_connector_set_panel_orientation(connector, p->orientation);
 
 	return num;
@@ -434,6 +439,14 @@ 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,
@@ -441,6 +454,7 @@ static const struct drm_panel_funcs panel_simple_funcs = {
 	.enable = panel_simple_enable,
 	.get_modes = panel_simple_get_modes,
 	.get_timings = panel_simple_get_timings,
+	.get_orientation = panel_simple_get_orientation,
 };
 
 static struct panel_desc panel_dpi;
-- 
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] 88+ messages in thread

* [PATCH v4 5/8] drm/panel: panel-simple: Implement .get_orientation callback
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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-simple.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index 4a2e580a2f7b..f232b8cf4075 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -411,7 +411,12 @@ 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 */
+	/*
+	 * drm drivers are expected to call drm_panel_get_orientation() to get
+	 * panel's orientation then drm_connector_set_panel_orientation() to
+	 * set the property before drm_dev_register(). Otherwise there will be
+	 * a WARN_ON if orientation is set after drm is registered.
+	 */
 	drm_connector_set_panel_orientation(connector, p->orientation);
 
 	return num;
@@ -434,6 +439,14 @@ 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,
@@ -441,6 +454,7 @@ static const struct drm_panel_funcs panel_simple_funcs = {
 	.enable = panel_simple_enable,
 	.get_modes = panel_simple_get_modes,
 	.get_timings = panel_simple_get_timings,
+	.get_orientation = panel_simple_get_orientation,
 };
 
 static struct panel_desc panel_dpi;
-- 
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] 88+ messages in thread

* [PATCH v4 6/8] drm/panel: ili9881c: Implement .get_orientation callback
  2022-06-06 15:24 ` Hsin-Yi Wang
  (?)
  (?)
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  -1 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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 | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
index ba30d11547ad..c098a0ed6be7 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
@@ -853,17 +853,31 @@ 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;
 
+	/*
+	 * drm drivers are expected to call drm_panel_get_orientation() to get
+	 * panel's orientation then drm_connector_set_panel_orientation() to
+	 * set the property before drm_dev_register(). Otherwise there will be
+	 * a WARN_ON if orientation is set after drm is registered.
+	 */
 	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] 88+ messages in thread

* [PATCH v4 6/8] drm/panel: ili9881c: Implement .get_orientation callback
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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 | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
index ba30d11547ad..c098a0ed6be7 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
@@ -853,17 +853,31 @@ 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;
 
+	/*
+	 * drm drivers are expected to call drm_panel_get_orientation() to get
+	 * panel's orientation then drm_connector_set_panel_orientation() to
+	 * set the property before drm_dev_register(). Otherwise there will be
+	 * a WARN_ON if orientation is set after drm is registered.
+	 */
 	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] 88+ messages in thread

* [PATCH v4 6/8] drm/panel: ili9881c: Implement .get_orientation callback
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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 | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
index ba30d11547ad..c098a0ed6be7 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
@@ -853,17 +853,31 @@ 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;
 
+	/*
+	 * drm drivers are expected to call drm_panel_get_orientation() to get
+	 * panel's orientation then drm_connector_set_panel_orientation() to
+	 * set the property before drm_dev_register(). Otherwise there will be
+	 * a WARN_ON if orientation is set after drm is registered.
+	 */
 	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] 88+ messages in thread

* [PATCH v4 6/8] drm/panel: ili9881c: Implement .get_orientation callback
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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 | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
index ba30d11547ad..c098a0ed6be7 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
@@ -853,17 +853,31 @@ 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;
 
+	/*
+	 * drm drivers are expected to call drm_panel_get_orientation() to get
+	 * panel's orientation then drm_connector_set_panel_orientation() to
+	 * set the property before drm_dev_register(). Otherwise there will be
+	 * a WARN_ON if orientation is set after drm is registered.
+	 */
 	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] 88+ messages in thread

* [PATCH v4 7/8] drm/panel: elida-kd35t133: Implement .get_orientation callback
  2022-06-06 15:24 ` Hsin-Yi Wang
  (?)
  (?)
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  -1 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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 | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
index 80227617a4d6..fa85a288afdc 100644
--- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c
+++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
@@ -217,15 +217,29 @@ 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);
+	/*
+	 * drm drivers are expected to call drm_panel_get_orientation() to get
+	 * panel's orientation then drm_connector_set_panel_orientation() to
+	 * set the property before drm_dev_register(). Otherwise there will be
+	 * a WARN_ON if orientation is set after drm is registered.
+	 */
 	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] 88+ messages in thread

* [PATCH v4 7/8] drm/panel: elida-kd35t133: Implement .get_orientation callback
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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 | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
index 80227617a4d6..fa85a288afdc 100644
--- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c
+++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
@@ -217,15 +217,29 @@ 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);
+	/*
+	 * drm drivers are expected to call drm_panel_get_orientation() to get
+	 * panel's orientation then drm_connector_set_panel_orientation() to
+	 * set the property before drm_dev_register(). Otherwise there will be
+	 * a WARN_ON if orientation is set after drm is registered.
+	 */
 	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] 88+ messages in thread

* [PATCH v4 7/8] drm/panel: elida-kd35t133: Implement .get_orientation callback
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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 | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
index 80227617a4d6..fa85a288afdc 100644
--- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c
+++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
@@ -217,15 +217,29 @@ 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);
+	/*
+	 * drm drivers are expected to call drm_panel_get_orientation() to get
+	 * panel's orientation then drm_connector_set_panel_orientation() to
+	 * set the property before drm_dev_register(). Otherwise there will be
+	 * a WARN_ON if orientation is set after drm is registered.
+	 */
 	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] 88+ messages in thread

* [PATCH v4 7/8] drm/panel: elida-kd35t133: Implement .get_orientation callback
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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 | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-elida-kd35t133.c b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
index 80227617a4d6..fa85a288afdc 100644
--- a/drivers/gpu/drm/panel/panel-elida-kd35t133.c
+++ b/drivers/gpu/drm/panel/panel-elida-kd35t133.c
@@ -217,15 +217,29 @@ 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);
+	/*
+	 * drm drivers are expected to call drm_panel_get_orientation() to get
+	 * panel's orientation then drm_connector_set_panel_orientation() to
+	 * set the property before drm_dev_register(). Otherwise there will be
+	 * a WARN_ON if orientation is set after drm is registered.
+	 */
 	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] 88+ messages in thread

* [PATCH v4 8/8] drm/mediatek: Config orientation property if panel provides it
  2022-06-06 15:24 ` Hsin-Yi Wang
  (?)
  (?)
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  -1 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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>
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index d9f10a33e6fa..c56282412bfa 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,12 @@ 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 */
+	if (dsi->panel)
+		drm_connector_set_panel_orientation(dsi->connector,
+				drm_panel_get_orientation(dsi->panel));
+
 	drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
 
 	return 0;
@@ -837,6 +844,9 @@ static int mtk_dsi_bind(struct device *dev, struct device *master, void *data)
 	struct drm_device *drm = data;
 	struct mtk_dsi *dsi = dev_get_drvdata(dev);
 
+	/* Get panel if existed */
+	drm_of_find_panel_or_bridge(dev->of_node, 0, 0, &dsi->panel, NULL);
+
 	ret = mtk_dsi_encoder_init(drm, dsi);
 	if (ret)
 		return ret;
-- 
2.36.1.255.ge46751e96f-goog


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

* [PATCH v4 8/8] drm/mediatek: Config orientation property if panel provides it
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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>
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index d9f10a33e6fa..c56282412bfa 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,12 @@ 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 */
+	if (dsi->panel)
+		drm_connector_set_panel_orientation(dsi->connector,
+				drm_panel_get_orientation(dsi->panel));
+
 	drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
 
 	return 0;
@@ -837,6 +844,9 @@ static int mtk_dsi_bind(struct device *dev, struct device *master, void *data)
 	struct drm_device *drm = data;
 	struct mtk_dsi *dsi = dev_get_drvdata(dev);
 
+	/* Get panel if existed */
+	drm_of_find_panel_or_bridge(dev->of_node, 0, 0, &dsi->panel, NULL);
+
 	ret = mtk_dsi_encoder_init(drm, dsi);
 	if (ret)
 		return ret;
-- 
2.36.1.255.ge46751e96f-goog


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

* [PATCH v4 8/8] drm/mediatek: Config orientation property if panel provides it
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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>
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index d9f10a33e6fa..c56282412bfa 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,12 @@ 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 */
+	if (dsi->panel)
+		drm_connector_set_panel_orientation(dsi->connector,
+				drm_panel_get_orientation(dsi->panel));
+
 	drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
 
 	return 0;
@@ -837,6 +844,9 @@ static int mtk_dsi_bind(struct device *dev, struct device *master, void *data)
 	struct drm_device *drm = data;
 	struct mtk_dsi *dsi = dev_get_drvdata(dev);
 
+	/* Get panel if existed */
+	drm_of_find_panel_or_bridge(dev->of_node, 0, 0, &dsi->panel, NULL);
+
 	ret = mtk_dsi_encoder_init(drm, dsi);
 	if (ret)
 		return 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] 88+ messages in thread

* [PATCH v4 8/8] drm/mediatek: Config orientation property if panel provides it
@ 2022-06-06 15:24   ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-06 15:24 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>
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index d9f10a33e6fa..c56282412bfa 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,12 @@ 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 */
+	if (dsi->panel)
+		drm_connector_set_panel_orientation(dsi->connector,
+				drm_panel_get_orientation(dsi->panel));
+
 	drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
 
 	return 0;
@@ -837,6 +844,9 @@ static int mtk_dsi_bind(struct device *dev, struct device *master, void *data)
 	struct drm_device *drm = data;
 	struct mtk_dsi *dsi = dev_get_drvdata(dev);
 
+	/* Get panel if existed */
+	drm_of_find_panel_or_bridge(dev->of_node, 0, 0, &dsi->panel, NULL);
+
 	ret = mtk_dsi_encoder_init(drm, dsi);
 	if (ret)
 		return 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] 88+ messages in thread

* Re: [PATCH v4 1/8] drm/panel: Add an API drm_panel_get_orientation() to return panel orientation
  2022-06-06 15:24   ` Hsin-Yi Wang
  (?)
  (?)
@ 2022-06-06 19:06     ` Stephen Boyd
  -1 siblings, 0 replies; 88+ messages in thread
From: Stephen Boyd @ 2022-06-06 19:06 UTC (permalink / raw)
  To: Chun-Kuang Hu, Hsin-Yi Wang
  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, Douglas Anderson, Rob Herring, linux-arm-kernel,
	linux-kernel

Quoting Hsin-Yi Wang (2022-06-06 08:24:24)
> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> index f634371c717a..e12056cfeca8 100644
> --- a/drivers/gpu/drm/drm_panel.c
> +++ b/drivers/gpu/drm/drm_panel.c
> @@ -223,6 +223,15 @@ int drm_panel_get_modes(struct drm_panel *panel,
>  }
>  EXPORT_SYMBOL(drm_panel_get_modes);
>
> +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel)

Should 'panel' be marked const to indicate that it can't be modified?

> +{
> +       if (panel && panel->funcs && panel->funcs->get_orientation)
> +               return panel->funcs->get_orientation(panel);

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

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

Quoting Hsin-Yi Wang (2022-06-06 08:24:24)
> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> index f634371c717a..e12056cfeca8 100644
> --- a/drivers/gpu/drm/drm_panel.c
> +++ b/drivers/gpu/drm/drm_panel.c
> @@ -223,6 +223,15 @@ int drm_panel_get_modes(struct drm_panel *panel,
>  }
>  EXPORT_SYMBOL(drm_panel_get_modes);
>
> +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel)

Should 'panel' be marked const to indicate that it can't be modified?

> +{
> +       if (panel && panel->funcs && panel->funcs->get_orientation)
> +               return panel->funcs->get_orientation(panel);

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

* Re: [PATCH v4 1/8] drm/panel: Add an API drm_panel_get_orientation() to return panel orientation
@ 2022-06-06 19:06     ` Stephen Boyd
  0 siblings, 0 replies; 88+ messages in thread
From: Stephen Boyd @ 2022-06-06 19:06 UTC (permalink / raw)
  To: Chun-Kuang Hu, Hsin-Yi Wang
  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, Douglas Anderson, Rob Herring, linux-arm-kernel,
	linux-kernel

Quoting Hsin-Yi Wang (2022-06-06 08:24:24)
> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> index f634371c717a..e12056cfeca8 100644
> --- a/drivers/gpu/drm/drm_panel.c
> +++ b/drivers/gpu/drm/drm_panel.c
> @@ -223,6 +223,15 @@ int drm_panel_get_modes(struct drm_panel *panel,
>  }
>  EXPORT_SYMBOL(drm_panel_get_modes);
>
> +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel)

Should 'panel' be marked const to indicate that it can't be modified?

> +{
> +       if (panel && panel->funcs && panel->funcs->get_orientation)
> +               return panel->funcs->get_orientation(panel);

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

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

* Re: [PATCH v4 1/8] drm/panel: Add an API drm_panel_get_orientation() to return panel orientation
@ 2022-06-06 19:06     ` Stephen Boyd
  0 siblings, 0 replies; 88+ messages in thread
From: Stephen Boyd @ 2022-06-06 19:06 UTC (permalink / raw)
  To: Chun-Kuang Hu, Hsin-Yi Wang
  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, Douglas Anderson, Rob Herring, linux-arm-kernel,
	linux-kernel

Quoting Hsin-Yi Wang (2022-06-06 08:24:24)
> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> index f634371c717a..e12056cfeca8 100644
> --- a/drivers/gpu/drm/drm_panel.c
> +++ b/drivers/gpu/drm/drm_panel.c
> @@ -223,6 +223,15 @@ int drm_panel_get_modes(struct drm_panel *panel,
>  }
>  EXPORT_SYMBOL(drm_panel_get_modes);
>
> +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel)

Should 'panel' be marked const to indicate that it can't be modified?

> +{
> +       if (panel && panel->funcs && panel->funcs->get_orientation)
> +               return panel->funcs->get_orientation(panel);

_______________________________________________
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] 88+ messages in thread

* Re: [PATCH v4 4/8] drm/panel: lvds: Implement .get_orientation callback
  2022-06-06 15:24   ` Hsin-Yi Wang
  (?)
  (?)
@ 2022-06-06 19:08     ` Stephen Boyd
  -1 siblings, 0 replies; 88+ messages in thread
From: Stephen Boyd @ 2022-06-06 19:08 UTC (permalink / raw)
  To: Chun-Kuang Hu, Hsin-Yi Wang
  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, Douglas Anderson, Rob Herring, linux-arm-kernel,
	linux-kernel

Quoting Hsin-Yi Wang (2022-06-06 08:24:27)
> diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
> index f11252fb00fe..491b64c2c8d6 100644
> --- a/drivers/gpu/drm/panel/panel-lvds.c
> +++ b/drivers/gpu/drm/panel/panel-lvds.c
> @@ -99,15 +99,30 @@ 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;
> +
> +       /*
> +        * drm drivers are expected to call drm_panel_get_orientation() to get
> +        * panel's orientation then drm_connector_set_panel_orientation() to
> +        * set the property before drm_dev_register(). Otherwise there will be
> +        * a WARN_ON if orientation is set after drm is registered.
> +        */

Should this comment also be a "TODO: Remove once all drm drivers call
drm_connector_set_panel_orientation()"?

>         drm_connector_set_panel_orientation(connector, lvds->orientation);
>
>         return 1;
>  }
>
> +static enum drm_panel_orientation panel_lvds_get_orientation,(struct drm_panel *panel)

Stray comma here                                            ---^

> +{
> +       struct panel_lvds *lvds = to_panel_lvds(panel);
> +
> +       return lvds->orientation;
> +}
> +

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

* Re: [PATCH v4 4/8] drm/panel: lvds: Implement .get_orientation callback
@ 2022-06-06 19:08     ` Stephen Boyd
  0 siblings, 0 replies; 88+ messages in thread
From: Stephen Boyd @ 2022-06-06 19:08 UTC (permalink / raw)
  To: Chun-Kuang Hu, Hsin-Yi Wang
  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, Douglas Anderson, Rob Herring, linux-arm-kernel,
	linux-kernel

Quoting Hsin-Yi Wang (2022-06-06 08:24:27)
> diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
> index f11252fb00fe..491b64c2c8d6 100644
> --- a/drivers/gpu/drm/panel/panel-lvds.c
> +++ b/drivers/gpu/drm/panel/panel-lvds.c
> @@ -99,15 +99,30 @@ 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;
> +
> +       /*
> +        * drm drivers are expected to call drm_panel_get_orientation() to get
> +        * panel's orientation then drm_connector_set_panel_orientation() to
> +        * set the property before drm_dev_register(). Otherwise there will be
> +        * a WARN_ON if orientation is set after drm is registered.
> +        */

Should this comment also be a "TODO: Remove once all drm drivers call
drm_connector_set_panel_orientation()"?

>         drm_connector_set_panel_orientation(connector, lvds->orientation);
>
>         return 1;
>  }
>
> +static enum drm_panel_orientation panel_lvds_get_orientation,(struct drm_panel *panel)

Stray comma here                                            ---^

> +{
> +       struct panel_lvds *lvds = to_panel_lvds(panel);
> +
> +       return lvds->orientation;
> +}
> +

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

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

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

Quoting Hsin-Yi Wang (2022-06-06 08:24:27)
> diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
> index f11252fb00fe..491b64c2c8d6 100644
> --- a/drivers/gpu/drm/panel/panel-lvds.c
> +++ b/drivers/gpu/drm/panel/panel-lvds.c
> @@ -99,15 +99,30 @@ 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;
> +
> +       /*
> +        * drm drivers are expected to call drm_panel_get_orientation() to get
> +        * panel's orientation then drm_connector_set_panel_orientation() to
> +        * set the property before drm_dev_register(). Otherwise there will be
> +        * a WARN_ON if orientation is set after drm is registered.
> +        */

Should this comment also be a "TODO: Remove once all drm drivers call
drm_connector_set_panel_orientation()"?

>         drm_connector_set_panel_orientation(connector, lvds->orientation);
>
>         return 1;
>  }
>
> +static enum drm_panel_orientation panel_lvds_get_orientation,(struct drm_panel *panel)

Stray comma here                                            ---^

> +{
> +       struct panel_lvds *lvds = to_panel_lvds(panel);
> +
> +       return lvds->orientation;
> +}
> +

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

* Re: [PATCH v4 4/8] drm/panel: lvds: Implement .get_orientation callback
@ 2022-06-06 19:08     ` Stephen Boyd
  0 siblings, 0 replies; 88+ messages in thread
From: Stephen Boyd @ 2022-06-06 19:08 UTC (permalink / raw)
  To: Chun-Kuang Hu, Hsin-Yi Wang
  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, Douglas Anderson, Rob Herring, linux-arm-kernel,
	linux-kernel

Quoting Hsin-Yi Wang (2022-06-06 08:24:27)
> diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
> index f11252fb00fe..491b64c2c8d6 100644
> --- a/drivers/gpu/drm/panel/panel-lvds.c
> +++ b/drivers/gpu/drm/panel/panel-lvds.c
> @@ -99,15 +99,30 @@ 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;
> +
> +       /*
> +        * drm drivers are expected to call drm_panel_get_orientation() to get
> +        * panel's orientation then drm_connector_set_panel_orientation() to
> +        * set the property before drm_dev_register(). Otherwise there will be
> +        * a WARN_ON if orientation is set after drm is registered.
> +        */

Should this comment also be a "TODO: Remove once all drm drivers call
drm_connector_set_panel_orientation()"?

>         drm_connector_set_panel_orientation(connector, lvds->orientation);
>
>         return 1;
>  }
>
> +static enum drm_panel_orientation panel_lvds_get_orientation,(struct drm_panel *panel)

Stray comma here                                            ---^

> +{
> +       struct panel_lvds *lvds = to_panel_lvds(panel);
> +
> +       return lvds->orientation;
> +}
> +

_______________________________________________
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] 88+ messages in thread

* Re: [PATCH v4 8/8] drm/mediatek: Config orientation property if panel provides it
  2022-06-06 15:24   ` Hsin-Yi Wang
  (?)
  (?)
@ 2022-06-06 19:16     ` Stephen Boyd
  -1 siblings, 0 replies; 88+ messages in thread
From: Stephen Boyd @ 2022-06-06 19:16 UTC (permalink / raw)
  To: Chun-Kuang Hu, Hsin-Yi Wang
  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, Douglas Anderson, Rob Herring, linux-arm-kernel,
	linux-kernel

Quoting Hsin-Yi Wang (2022-06-06 08:24:31)
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index d9f10a33e6fa..c56282412bfa 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -822,6 +823,12 @@ 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 */
> +       if (dsi->panel)
> +               drm_connector_set_panel_orientation(dsi->connector,
> +                               drm_panel_get_orientation(dsi->panel));
> +

It could be simplified like so?

	drm_connector_set_orientation_from_panel(dsi->connector, dsi->panel);

Then the API could get the orientation if the panel pointer is valid.
Does any code need to use/modify the orientation value besides
drm_connector_set_panel_orientation()?

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

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

* Re: [PATCH v4 8/8] drm/mediatek: Config orientation property if panel provides it
@ 2022-06-06 19:16     ` Stephen Boyd
  0 siblings, 0 replies; 88+ messages in thread
From: Stephen Boyd @ 2022-06-06 19:16 UTC (permalink / raw)
  To: Chun-Kuang Hu, Hsin-Yi Wang
  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, Douglas Anderson, Rob Herring, linux-arm-kernel,
	linux-kernel

Quoting Hsin-Yi Wang (2022-06-06 08:24:31)
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index d9f10a33e6fa..c56282412bfa 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -822,6 +823,12 @@ 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 */
> +       if (dsi->panel)
> +               drm_connector_set_panel_orientation(dsi->connector,
> +                               drm_panel_get_orientation(dsi->panel));
> +

It could be simplified like so?

	drm_connector_set_orientation_from_panel(dsi->connector, dsi->panel);

Then the API could get the orientation if the panel pointer is valid.
Does any code need to use/modify the orientation value besides
drm_connector_set_panel_orientation()?

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

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

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

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

Quoting Hsin-Yi Wang (2022-06-06 08:24:31)
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index d9f10a33e6fa..c56282412bfa 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -822,6 +823,12 @@ 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 */
> +       if (dsi->panel)
> +               drm_connector_set_panel_orientation(dsi->connector,
> +                               drm_panel_get_orientation(dsi->panel));
> +

It could be simplified like so?

	drm_connector_set_orientation_from_panel(dsi->connector, dsi->panel);

Then the API could get the orientation if the panel pointer is valid.
Does any code need to use/modify the orientation value besides
drm_connector_set_panel_orientation()?

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

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

* Re: [PATCH v4 8/8] drm/mediatek: Config orientation property if panel provides it
@ 2022-06-06 19:16     ` Stephen Boyd
  0 siblings, 0 replies; 88+ messages in thread
From: Stephen Boyd @ 2022-06-06 19:16 UTC (permalink / raw)
  To: Chun-Kuang Hu, Hsin-Yi Wang
  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, Douglas Anderson, Rob Herring, linux-arm-kernel,
	linux-kernel

Quoting Hsin-Yi Wang (2022-06-06 08:24:31)
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index d9f10a33e6fa..c56282412bfa 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -822,6 +823,12 @@ 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 */
> +       if (dsi->panel)
> +               drm_connector_set_panel_orientation(dsi->connector,
> +                               drm_panel_get_orientation(dsi->panel));
> +

It could be simplified like so?

	drm_connector_set_orientation_from_panel(dsi->connector, dsi->panel);

Then the API could get the orientation if the panel pointer is valid.
Does any code need to use/modify the orientation value besides
drm_connector_set_panel_orientation()?

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

_______________________________________________
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] 88+ messages in thread

* Re: [PATCH v4 1/8] drm/panel: Add an API drm_panel_get_orientation() to return panel orientation
  2022-06-06 15:24   ` Hsin-Yi Wang
  (?)
  (?)
@ 2022-06-06 19:20     ` Sam Ravnborg
  -1 siblings, 0 replies; 88+ messages in thread
From: Sam Ravnborg @ 2022-06-06 19:20 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: Chun-Kuang Hu, Hans de Goede, Thierry Reding, 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

Hi Hsin-Yi,
On Mon, Jun 06, 2022 at 11:24:24PM +0800, Hsin-Yi Wang wrote:
> 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_panel_orientation() 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>
> ---
> v3->v4: Add a blank line.
> ---
>  drivers/gpu/drm/drm_panel.c |  9 +++++++++
>  include/drm/drm_panel.h     | 10 ++++++++++
>  2 files changed, 19 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> index f634371c717a..e12056cfeca8 100644
> --- a/drivers/gpu/drm/drm_panel.c
> +++ b/drivers/gpu/drm/drm_panel.c
> @@ -223,6 +223,15 @@ int drm_panel_get_modes(struct drm_panel *panel,
>  }
>  EXPORT_SYMBOL(drm_panel_get_modes);
>  
> +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel)
const as mentioned by Stephen.

> +{
> +	if (panel && panel->funcs && panel->funcs->get_orientation)
> +		return panel->funcs->get_orientation(panel);
> +
> +	return DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
> +}
> +EXPORT_SYMBOL(drm_panel_get_orientation);
> +
>  #ifdef CONFIG_OF
>  /**
>   * of_drm_find_panel - look up a panel using a device tree node
> diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
> index d279ee455f01..5dadbf3b0370 100644
> --- a/include/drm/drm_panel.h
> +++ b/include/drm/drm_panel.h
> @@ -133,6 +133,15 @@ struct drm_panel_funcs {
>  	 * Allows panels to create panels-specific debugfs files.
>  	 */
>  	void (*debugfs_init)(struct drm_panel *panel, struct dentry *root);
> +
> +	/**
> +	 * @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);

Please move this up so it is together with the other get_* methods, in
alphabetic order. That is, right after get_modes(), and then this also
matches the order in the .c file with is extra bonus.

With the two fixes:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

>  };
>  
>  /**
> @@ -202,6 +211,7 @@ int drm_panel_enable(struct drm_panel *panel);
>  int drm_panel_disable(struct drm_panel *panel);
>  
>  int drm_panel_get_modes(struct drm_panel *panel, struct drm_connector *connector);
> +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel);
>  
>  #if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL)
>  struct drm_panel *of_drm_find_panel(const struct device_node *np);
> -- 
> 2.36.1.255.ge46751e96f-goog

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

* Re: [PATCH v4 1/8] drm/panel: Add an API drm_panel_get_orientation() to return panel orientation
@ 2022-06-06 19:20     ` Sam Ravnborg
  0 siblings, 0 replies; 88+ messages in thread
From: Sam Ravnborg @ 2022-06-06 19:20 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: Chun-Kuang Hu, Hans de Goede, Thierry Reding, 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

Hi Hsin-Yi,
On Mon, Jun 06, 2022 at 11:24:24PM +0800, Hsin-Yi Wang wrote:
> 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_panel_orientation() 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>
> ---
> v3->v4: Add a blank line.
> ---
>  drivers/gpu/drm/drm_panel.c |  9 +++++++++
>  include/drm/drm_panel.h     | 10 ++++++++++
>  2 files changed, 19 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> index f634371c717a..e12056cfeca8 100644
> --- a/drivers/gpu/drm/drm_panel.c
> +++ b/drivers/gpu/drm/drm_panel.c
> @@ -223,6 +223,15 @@ int drm_panel_get_modes(struct drm_panel *panel,
>  }
>  EXPORT_SYMBOL(drm_panel_get_modes);
>  
> +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel)
const as mentioned by Stephen.

> +{
> +	if (panel && panel->funcs && panel->funcs->get_orientation)
> +		return panel->funcs->get_orientation(panel);
> +
> +	return DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
> +}
> +EXPORT_SYMBOL(drm_panel_get_orientation);
> +
>  #ifdef CONFIG_OF
>  /**
>   * of_drm_find_panel - look up a panel using a device tree node
> diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
> index d279ee455f01..5dadbf3b0370 100644
> --- a/include/drm/drm_panel.h
> +++ b/include/drm/drm_panel.h
> @@ -133,6 +133,15 @@ struct drm_panel_funcs {
>  	 * Allows panels to create panels-specific debugfs files.
>  	 */
>  	void (*debugfs_init)(struct drm_panel *panel, struct dentry *root);
> +
> +	/**
> +	 * @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);

Please move this up so it is together with the other get_* methods, in
alphabetic order. That is, right after get_modes(), and then this also
matches the order in the .c file with is extra bonus.

With the two fixes:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

>  };
>  
>  /**
> @@ -202,6 +211,7 @@ int drm_panel_enable(struct drm_panel *panel);
>  int drm_panel_disable(struct drm_panel *panel);
>  
>  int drm_panel_get_modes(struct drm_panel *panel, struct drm_connector *connector);
> +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel);
>  
>  #if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL)
>  struct drm_panel *of_drm_find_panel(const struct device_node *np);
> -- 
> 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] 88+ messages in thread

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

Hi Hsin-Yi,
On Mon, Jun 06, 2022 at 11:24:24PM +0800, Hsin-Yi Wang wrote:
> 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_panel_orientation() 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>
> ---
> v3->v4: Add a blank line.
> ---
>  drivers/gpu/drm/drm_panel.c |  9 +++++++++
>  include/drm/drm_panel.h     | 10 ++++++++++
>  2 files changed, 19 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> index f634371c717a..e12056cfeca8 100644
> --- a/drivers/gpu/drm/drm_panel.c
> +++ b/drivers/gpu/drm/drm_panel.c
> @@ -223,6 +223,15 @@ int drm_panel_get_modes(struct drm_panel *panel,
>  }
>  EXPORT_SYMBOL(drm_panel_get_modes);
>  
> +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel)
const as mentioned by Stephen.

> +{
> +	if (panel && panel->funcs && panel->funcs->get_orientation)
> +		return panel->funcs->get_orientation(panel);
> +
> +	return DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
> +}
> +EXPORT_SYMBOL(drm_panel_get_orientation);
> +
>  #ifdef CONFIG_OF
>  /**
>   * of_drm_find_panel - look up a panel using a device tree node
> diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
> index d279ee455f01..5dadbf3b0370 100644
> --- a/include/drm/drm_panel.h
> +++ b/include/drm/drm_panel.h
> @@ -133,6 +133,15 @@ struct drm_panel_funcs {
>  	 * Allows panels to create panels-specific debugfs files.
>  	 */
>  	void (*debugfs_init)(struct drm_panel *panel, struct dentry *root);
> +
> +	/**
> +	 * @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);

Please move this up so it is together with the other get_* methods, in
alphabetic order. That is, right after get_modes(), and then this also
matches the order in the .c file with is extra bonus.

With the two fixes:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

>  };
>  
>  /**
> @@ -202,6 +211,7 @@ int drm_panel_enable(struct drm_panel *panel);
>  int drm_panel_disable(struct drm_panel *panel);
>  
>  int drm_panel_get_modes(struct drm_panel *panel, struct drm_connector *connector);
> +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel);
>  
>  #if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL)
>  struct drm_panel *of_drm_find_panel(const struct device_node *np);
> -- 
> 2.36.1.255.ge46751e96f-goog

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

* Re: [PATCH v4 1/8] drm/panel: Add an API drm_panel_get_orientation() to return panel orientation
@ 2022-06-06 19:20     ` Sam Ravnborg
  0 siblings, 0 replies; 88+ messages in thread
From: Sam Ravnborg @ 2022-06-06 19:20 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: Chun-Kuang Hu, Hans de Goede, Thierry Reding, 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

Hi Hsin-Yi,
On Mon, Jun 06, 2022 at 11:24:24PM +0800, Hsin-Yi Wang wrote:
> 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_panel_orientation() 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>
> ---
> v3->v4: Add a blank line.
> ---
>  drivers/gpu/drm/drm_panel.c |  9 +++++++++
>  include/drm/drm_panel.h     | 10 ++++++++++
>  2 files changed, 19 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> index f634371c717a..e12056cfeca8 100644
> --- a/drivers/gpu/drm/drm_panel.c
> +++ b/drivers/gpu/drm/drm_panel.c
> @@ -223,6 +223,15 @@ int drm_panel_get_modes(struct drm_panel *panel,
>  }
>  EXPORT_SYMBOL(drm_panel_get_modes);
>  
> +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel)
const as mentioned by Stephen.

> +{
> +	if (panel && panel->funcs && panel->funcs->get_orientation)
> +		return panel->funcs->get_orientation(panel);
> +
> +	return DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
> +}
> +EXPORT_SYMBOL(drm_panel_get_orientation);
> +
>  #ifdef CONFIG_OF
>  /**
>   * of_drm_find_panel - look up a panel using a device tree node
> diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
> index d279ee455f01..5dadbf3b0370 100644
> --- a/include/drm/drm_panel.h
> +++ b/include/drm/drm_panel.h
> @@ -133,6 +133,15 @@ struct drm_panel_funcs {
>  	 * Allows panels to create panels-specific debugfs files.
>  	 */
>  	void (*debugfs_init)(struct drm_panel *panel, struct dentry *root);
> +
> +	/**
> +	 * @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);

Please move this up so it is together with the other get_* methods, in
alphabetic order. That is, right after get_modes(), and then this also
matches the order in the .c file with is extra bonus.

With the two fixes:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

>  };
>  
>  /**
> @@ -202,6 +211,7 @@ int drm_panel_enable(struct drm_panel *panel);
>  int drm_panel_disable(struct drm_panel *panel);
>  
>  int drm_panel_get_modes(struct drm_panel *panel, struct drm_connector *connector);
> +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel);
>  
>  #if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL)
>  struct drm_panel *of_drm_find_panel(const struct device_node *np);
> -- 
> 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] 88+ messages in thread

* Re: [PATCH v4 5/8] drm/panel: panel-simple: Implement .get_orientation callback
  2022-06-06 15:24   ` Hsin-Yi Wang
  (?)
  (?)
@ 2022-06-06 19:25     ` Sam Ravnborg
  -1 siblings, 0 replies; 88+ messages in thread
From: Sam Ravnborg @ 2022-06-06 19:25 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: Chun-Kuang Hu, Hans de Goede, Thierry Reding, 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

Hi Hsin-Yi,

On Mon, Jun 06, 2022 at 11:24:28PM +0800, Hsin-Yi Wang wrote:
> 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-simple.c | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> index 4a2e580a2f7b..f232b8cf4075 100644
> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -411,7 +411,12 @@ 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 */
> +	/*
> +	 * drm drivers are expected to call drm_panel_get_orientation() to get
> +	 * panel's orientation then drm_connector_set_panel_orientation() to
> +	 * set the property before drm_dev_register(). Otherwise there will be
> +	 * a WARN_ON if orientation is set after drm is registered.
> +	 */

This comment is not really relevant here. If we need to explain this
then put it in drm_panel.c/h - as this applies for all panels and not
just the panel_simple.
Keep in mind, this is the source new panels often use a inspiration and
no need to have this copied around.

>  	drm_connector_set_panel_orientation(connector, p->orientation);
>  
>  	return num;
> @@ -434,6 +439,14 @@ 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,
> @@ -441,6 +454,7 @@ static const struct drm_panel_funcs panel_simple_funcs = {
>  	.enable = panel_simple_enable,
>  	.get_modes = panel_simple_get_modes,
>  	.get_timings = panel_simple_get_timings,
> +	.get_orientation = panel_simple_get_orientation,

I like the order in this list to match the order in the .h file.
So my OCD would like you to move it up right after get_modes,
but feel free to ignore this.

With the suggested changes:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

>  };
>  
>  static struct panel_desc panel_dpi;
> -- 
> 2.36.1.255.ge46751e96f-goog

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

* Re: [PATCH v4 5/8] drm/panel: panel-simple: Implement .get_orientation callback
@ 2022-06-06 19:25     ` Sam Ravnborg
  0 siblings, 0 replies; 88+ messages in thread
From: Sam Ravnborg @ 2022-06-06 19:25 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: Chun-Kuang Hu, Hans de Goede, Thierry Reding, 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

Hi Hsin-Yi,

On Mon, Jun 06, 2022 at 11:24:28PM +0800, Hsin-Yi Wang wrote:
> 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-simple.c | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> index 4a2e580a2f7b..f232b8cf4075 100644
> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -411,7 +411,12 @@ 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 */
> +	/*
> +	 * drm drivers are expected to call drm_panel_get_orientation() to get
> +	 * panel's orientation then drm_connector_set_panel_orientation() to
> +	 * set the property before drm_dev_register(). Otherwise there will be
> +	 * a WARN_ON if orientation is set after drm is registered.
> +	 */

This comment is not really relevant here. If we need to explain this
then put it in drm_panel.c/h - as this applies for all panels and not
just the panel_simple.
Keep in mind, this is the source new panels often use a inspiration and
no need to have this copied around.

>  	drm_connector_set_panel_orientation(connector, p->orientation);
>  
>  	return num;
> @@ -434,6 +439,14 @@ 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,
> @@ -441,6 +454,7 @@ static const struct drm_panel_funcs panel_simple_funcs = {
>  	.enable = panel_simple_enable,
>  	.get_modes = panel_simple_get_modes,
>  	.get_timings = panel_simple_get_timings,
> +	.get_orientation = panel_simple_get_orientation,

I like the order in this list to match the order in the .h file.
So my OCD would like you to move it up right after get_modes,
but feel free to ignore this.

With the suggested changes:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

>  };
>  
>  static struct panel_desc panel_dpi;
> -- 
> 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] 88+ messages in thread

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

Hi Hsin-Yi,

On Mon, Jun 06, 2022 at 11:24:28PM +0800, Hsin-Yi Wang wrote:
> 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-simple.c | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> index 4a2e580a2f7b..f232b8cf4075 100644
> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -411,7 +411,12 @@ 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 */
> +	/*
> +	 * drm drivers are expected to call drm_panel_get_orientation() to get
> +	 * panel's orientation then drm_connector_set_panel_orientation() to
> +	 * set the property before drm_dev_register(). Otherwise there will be
> +	 * a WARN_ON if orientation is set after drm is registered.
> +	 */

This comment is not really relevant here. If we need to explain this
then put it in drm_panel.c/h - as this applies for all panels and not
just the panel_simple.
Keep in mind, this is the source new panels often use a inspiration and
no need to have this copied around.

>  	drm_connector_set_panel_orientation(connector, p->orientation);
>  
>  	return num;
> @@ -434,6 +439,14 @@ 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,
> @@ -441,6 +454,7 @@ static const struct drm_panel_funcs panel_simple_funcs = {
>  	.enable = panel_simple_enable,
>  	.get_modes = panel_simple_get_modes,
>  	.get_timings = panel_simple_get_timings,
> +	.get_orientation = panel_simple_get_orientation,

I like the order in this list to match the order in the .h file.
So my OCD would like you to move it up right after get_modes,
but feel free to ignore this.

With the suggested changes:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

>  };
>  
>  static struct panel_desc panel_dpi;
> -- 
> 2.36.1.255.ge46751e96f-goog

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

* Re: [PATCH v4 5/8] drm/panel: panel-simple: Implement .get_orientation callback
@ 2022-06-06 19:25     ` Sam Ravnborg
  0 siblings, 0 replies; 88+ messages in thread
From: Sam Ravnborg @ 2022-06-06 19:25 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: Chun-Kuang Hu, Hans de Goede, Thierry Reding, 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

Hi Hsin-Yi,

On Mon, Jun 06, 2022 at 11:24:28PM +0800, Hsin-Yi Wang wrote:
> 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-simple.c | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> index 4a2e580a2f7b..f232b8cf4075 100644
> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -411,7 +411,12 @@ 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 */
> +	/*
> +	 * drm drivers are expected to call drm_panel_get_orientation() to get
> +	 * panel's orientation then drm_connector_set_panel_orientation() to
> +	 * set the property before drm_dev_register(). Otherwise there will be
> +	 * a WARN_ON if orientation is set after drm is registered.
> +	 */

This comment is not really relevant here. If we need to explain this
then put it in drm_panel.c/h - as this applies for all panels and not
just the panel_simple.
Keep in mind, this is the source new panels often use a inspiration and
no need to have this copied around.

>  	drm_connector_set_panel_orientation(connector, p->orientation);
>  
>  	return num;
> @@ -434,6 +439,14 @@ 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,
> @@ -441,6 +454,7 @@ static const struct drm_panel_funcs panel_simple_funcs = {
>  	.enable = panel_simple_enable,
>  	.get_modes = panel_simple_get_modes,
>  	.get_timings = panel_simple_get_timings,
> +	.get_orientation = panel_simple_get_orientation,

I like the order in this list to match the order in the .h file.
So my OCD would like you to move it up right after get_modes,
but feel free to ignore this.

With the suggested changes:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

>  };
>  
>  static struct panel_desc panel_dpi;
> -- 
> 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] 88+ messages in thread

* Re: [PATCH v4 0/8] Add a panel API to return panel orientation
  2022-06-06 15:24 ` Hsin-Yi Wang
  (?)
  (?)
@ 2022-06-06 19:28   ` Sam Ravnborg
  -1 siblings, 0 replies; 88+ messages in thread
From: Sam Ravnborg @ 2022-06-06 19:28 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: Chun-Kuang Hu, Hans de Goede, Thierry Reding, 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

Hi Hsin-Yi,
thanks for this nice series.

On Mon, Jun 06, 2022 at 11:24:23PM +0800, Hsin-Yi Wang wrote:
> 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_panel_get_orientation() for drm/kms
> drivers. The drivers can use the API to get panel's orientation, so they
> can call drm_connector_set_panel_orientation() before drm_dev_register().
> 
> Panel needs to implement .get_orientation callback to return the property.

The following comment appears in every panel driver:
+       /*
+        * drm drivers are expected to call drm_panel_get_orientation() to get
+        * panel's orientation then drm_connector_set_panel_orientation() to
+        * set the property before drm_dev_register(). Otherwise there will be
+        * a WARN_ON if orientation is set after drm is registered.
+        */

Please move it to the drm_panel c or h file, it is noise to add it to
all panel drivers.

	Sam

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

* Re: [PATCH v4 0/8] Add a panel API to return panel orientation
@ 2022-06-06 19:28   ` Sam Ravnborg
  0 siblings, 0 replies; 88+ messages in thread
From: Sam Ravnborg @ 2022-06-06 19:28 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: Chun-Kuang Hu, Hans de Goede, Thierry Reding, 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

Hi Hsin-Yi,
thanks for this nice series.

On Mon, Jun 06, 2022 at 11:24:23PM +0800, Hsin-Yi Wang wrote:
> 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_panel_get_orientation() for drm/kms
> drivers. The drivers can use the API to get panel's orientation, so they
> can call drm_connector_set_panel_orientation() before drm_dev_register().
> 
> Panel needs to implement .get_orientation callback to return the property.

The following comment appears in every panel driver:
+       /*
+        * drm drivers are expected to call drm_panel_get_orientation() to get
+        * panel's orientation then drm_connector_set_panel_orientation() to
+        * set the property before drm_dev_register(). Otherwise there will be
+        * a WARN_ON if orientation is set after drm is registered.
+        */

Please move it to the drm_panel c or h file, it is noise to add it to
all panel drivers.

	Sam

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

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

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

Hi Hsin-Yi,
thanks for this nice series.

On Mon, Jun 06, 2022 at 11:24:23PM +0800, Hsin-Yi Wang wrote:
> 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_panel_get_orientation() for drm/kms
> drivers. The drivers can use the API to get panel's orientation, so they
> can call drm_connector_set_panel_orientation() before drm_dev_register().
> 
> Panel needs to implement .get_orientation callback to return the property.

The following comment appears in every panel driver:
+       /*
+        * drm drivers are expected to call drm_panel_get_orientation() to get
+        * panel's orientation then drm_connector_set_panel_orientation() to
+        * set the property before drm_dev_register(). Otherwise there will be
+        * a WARN_ON if orientation is set after drm is registered.
+        */

Please move it to the drm_panel c or h file, it is noise to add it to
all panel drivers.

	Sam

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

* Re: [PATCH v4 0/8] Add a panel API to return panel orientation
@ 2022-06-06 19:28   ` Sam Ravnborg
  0 siblings, 0 replies; 88+ messages in thread
From: Sam Ravnborg @ 2022-06-06 19:28 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: Chun-Kuang Hu, Hans de Goede, Thierry Reding, 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

Hi Hsin-Yi,
thanks for this nice series.

On Mon, Jun 06, 2022 at 11:24:23PM +0800, Hsin-Yi Wang wrote:
> 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_panel_get_orientation() for drm/kms
> drivers. The drivers can use the API to get panel's orientation, so they
> can call drm_connector_set_panel_orientation() before drm_dev_register().
> 
> Panel needs to implement .get_orientation callback to return the property.

The following comment appears in every panel driver:
+       /*
+        * drm drivers are expected to call drm_panel_get_orientation() to get
+        * panel's orientation then drm_connector_set_panel_orientation() to
+        * set the property before drm_dev_register(). Otherwise there will be
+        * a WARN_ON if orientation is set after drm is registered.
+        */

Please move it to the drm_panel c or h file, it is noise to add it to
all panel drivers.

	Sam

_______________________________________________
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] 88+ messages in thread

* Re: [PATCH v4 8/8] drm/mediatek: Config orientation property if panel provides it
  2022-06-06 15:24   ` Hsin-Yi Wang
  (?)
  (?)
@ 2022-06-06 19:31     ` Sam Ravnborg
  -1 siblings, 0 replies; 88+ messages in thread
From: Sam Ravnborg @ 2022-06-06 19:31 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: Chun-Kuang Hu, Hans de Goede, Thierry Reding, 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

Hi Hsin-Yi,

On Mon, Jun 06, 2022 at 11:24:31PM +0800, Hsin-Yi Wang 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.

I do not know the best way to do what you need to do here.
But it seems wrong to introduce a deprecated function
(drm_of_find_panel_or_bridge), to set the rotation property early.

I think you need to find a way to do this utilising the panel_bridge or
something.

	Sam

> 
> 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>
> ---
>  drivers/gpu/drm/mediatek/mtk_dsi.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index d9f10a33e6fa..c56282412bfa 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,12 @@ 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 */
> +	if (dsi->panel)
> +		drm_connector_set_panel_orientation(dsi->connector,
> +				drm_panel_get_orientation(dsi->panel));
> +
>  	drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
>  
>  	return 0;
> @@ -837,6 +844,9 @@ static int mtk_dsi_bind(struct device *dev, struct device *master, void *data)
>  	struct drm_device *drm = data;
>  	struct mtk_dsi *dsi = dev_get_drvdata(dev);
>  
> +	/* Get panel if existed */
> +	drm_of_find_panel_or_bridge(dev->of_node, 0, 0, &dsi->panel, NULL);
> +
>  	ret = mtk_dsi_encoder_init(drm, dsi);
>  	if (ret)
>  		return ret;
> -- 
> 2.36.1.255.ge46751e96f-goog

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

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

Hi Hsin-Yi,

On Mon, Jun 06, 2022 at 11:24:31PM +0800, Hsin-Yi Wang 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.

I do not know the best way to do what you need to do here.
But it seems wrong to introduce a deprecated function
(drm_of_find_panel_or_bridge), to set the rotation property early.

I think you need to find a way to do this utilising the panel_bridge or
something.

	Sam

> 
> 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>
> ---
>  drivers/gpu/drm/mediatek/mtk_dsi.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index d9f10a33e6fa..c56282412bfa 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,12 @@ 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 */
> +	if (dsi->panel)
> +		drm_connector_set_panel_orientation(dsi->connector,
> +				drm_panel_get_orientation(dsi->panel));
> +
>  	drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
>  
>  	return 0;
> @@ -837,6 +844,9 @@ static int mtk_dsi_bind(struct device *dev, struct device *master, void *data)
>  	struct drm_device *drm = data;
>  	struct mtk_dsi *dsi = dev_get_drvdata(dev);
>  
> +	/* Get panel if existed */
> +	drm_of_find_panel_or_bridge(dev->of_node, 0, 0, &dsi->panel, NULL);
> +
>  	ret = mtk_dsi_encoder_init(drm, dsi);
>  	if (ret)
>  		return ret;
> -- 
> 2.36.1.255.ge46751e96f-goog

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

* Re: [PATCH v4 8/8] drm/mediatek: Config orientation property if panel provides it
@ 2022-06-06 19:31     ` Sam Ravnborg
  0 siblings, 0 replies; 88+ messages in thread
From: Sam Ravnborg @ 2022-06-06 19:31 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: Chun-Kuang Hu, Hans de Goede, Thierry Reding, 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

Hi Hsin-Yi,

On Mon, Jun 06, 2022 at 11:24:31PM +0800, Hsin-Yi Wang 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.

I do not know the best way to do what you need to do here.
But it seems wrong to introduce a deprecated function
(drm_of_find_panel_or_bridge), to set the rotation property early.

I think you need to find a way to do this utilising the panel_bridge or
something.

	Sam

> 
> 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>
> ---
>  drivers/gpu/drm/mediatek/mtk_dsi.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index d9f10a33e6fa..c56282412bfa 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,12 @@ 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 */
> +	if (dsi->panel)
> +		drm_connector_set_panel_orientation(dsi->connector,
> +				drm_panel_get_orientation(dsi->panel));
> +
>  	drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
>  
>  	return 0;
> @@ -837,6 +844,9 @@ static int mtk_dsi_bind(struct device *dev, struct device *master, void *data)
>  	struct drm_device *drm = data;
>  	struct mtk_dsi *dsi = dev_get_drvdata(dev);
>  
> +	/* Get panel if existed */
> +	drm_of_find_panel_or_bridge(dev->of_node, 0, 0, &dsi->panel, NULL);
> +
>  	ret = mtk_dsi_encoder_init(drm, dsi);
>  	if (ret)
>  		return 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	[flat|nested] 88+ messages in thread

* Re: [PATCH v4 8/8] drm/mediatek: Config orientation property if panel provides it
@ 2022-06-06 19:31     ` Sam Ravnborg
  0 siblings, 0 replies; 88+ messages in thread
From: Sam Ravnborg @ 2022-06-06 19:31 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: Chun-Kuang Hu, Hans de Goede, Thierry Reding, 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

Hi Hsin-Yi,

On Mon, Jun 06, 2022 at 11:24:31PM +0800, Hsin-Yi Wang 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.

I do not know the best way to do what you need to do here.
But it seems wrong to introduce a deprecated function
(drm_of_find_panel_or_bridge), to set the rotation property early.

I think you need to find a way to do this utilising the panel_bridge or
something.

	Sam

> 
> 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>
> ---
>  drivers/gpu/drm/mediatek/mtk_dsi.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index d9f10a33e6fa..c56282412bfa 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,12 @@ 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 */
> +	if (dsi->panel)
> +		drm_connector_set_panel_orientation(dsi->connector,
> +				drm_panel_get_orientation(dsi->panel));
> +
>  	drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
>  
>  	return 0;
> @@ -837,6 +844,9 @@ static int mtk_dsi_bind(struct device *dev, struct device *master, void *data)
>  	struct drm_device *drm = data;
>  	struct mtk_dsi *dsi = dev_get_drvdata(dev);
>  
> +	/* Get panel if existed */
> +	drm_of_find_panel_or_bridge(dev->of_node, 0, 0, &dsi->panel, NULL);
> +
>  	ret = mtk_dsi_encoder_init(drm, dsi);
>  	if (ret)
>  		return 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	[flat|nested] 88+ messages in thread

* Re: [PATCH v4 1/8] drm/panel: Add an API drm_panel_get_orientation() to return panel orientation
  2022-06-06 19:20     ` Sam Ravnborg
  (?)
  (?)
@ 2022-06-06 20:15       ` Hans de Goede
  -1 siblings, 0 replies; 88+ messages in thread
From: Hans de Goede @ 2022-06-06 20:15 UTC (permalink / raw)
  To: Sam Ravnborg, Hsin-Yi Wang
  Cc: Chun-Kuang Hu, Thierry Reding, 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

Hi,

On 6/6/22 21:20, Sam Ravnborg wrote:
> Hi Hsin-Yi,
> On Mon, Jun 06, 2022 at 11:24:24PM +0800, Hsin-Yi Wang wrote:
>> 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_panel_orientation() 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>
>> ---
>> v3->v4: Add a blank line.
>> ---
>>  drivers/gpu/drm/drm_panel.c |  9 +++++++++
>>  include/drm/drm_panel.h     | 10 ++++++++++
>>  2 files changed, 19 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
>> index f634371c717a..e12056cfeca8 100644
>> --- a/drivers/gpu/drm/drm_panel.c
>> +++ b/drivers/gpu/drm/drm_panel.c
>> @@ -223,6 +223,15 @@ int drm_panel_get_modes(struct drm_panel *panel,
>>  }
>>  EXPORT_SYMBOL(drm_panel_get_modes);
>>  
>> +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel)
> const as mentioned by Stephen.
> 
>> +{
>> +	if (panel && panel->funcs && panel->funcs->get_orientation)
>> +		return panel->funcs->get_orientation(panel);
>> +
>> +	return DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
>> +}
>> +EXPORT_SYMBOL(drm_panel_get_orientation);
>> +
>>  #ifdef CONFIG_OF
>>  /**
>>   * of_drm_find_panel - look up a panel using a device tree node
>> diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
>> index d279ee455f01..5dadbf3b0370 100644
>> --- a/include/drm/drm_panel.h
>> +++ b/include/drm/drm_panel.h
>> @@ -133,6 +133,15 @@ struct drm_panel_funcs {
>>  	 * Allows panels to create panels-specific debugfs files.
>>  	 */
>>  	void (*debugfs_init)(struct drm_panel *panel, struct dentry *root);
>> +
>> +	/**
>> +	 * @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);
> 
> Please move this up so it is together with the other get_* methods, in
> alphabetic order. That is, right after get_modes(), and then this also
> matches the order in the .c file with is extra bonus.

The downside of moving this up is that it will break drivers which don't
use c99 style named-struct-field initializers for there drm_panel_funcs.

I admit that no drivers should be using the old style struct init, but
are we sure that that is the case?

Regards,

Hans



> 
> With the two fixes:
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> 
>>  };
>>  
>>  /**
>> @@ -202,6 +211,7 @@ int drm_panel_enable(struct drm_panel *panel);
>>  int drm_panel_disable(struct drm_panel *panel);
>>  
>>  int drm_panel_get_modes(struct drm_panel *panel, struct drm_connector *connector);
>> +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel);
>>  
>>  #if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL)
>>  struct drm_panel *of_drm_find_panel(const struct device_node *np);
>> -- 
>> 2.36.1.255.ge46751e96f-goog
> 


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

* Re: [PATCH v4 1/8] drm/panel: Add an API drm_panel_get_orientation() to return panel orientation
@ 2022-06-06 20:15       ` Hans de Goede
  0 siblings, 0 replies; 88+ messages in thread
From: Hans de Goede @ 2022-06-06 20:15 UTC (permalink / raw)
  To: Sam Ravnborg, Hsin-Yi Wang
  Cc: Chun-Kuang Hu, Thierry Reding, 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

Hi,

On 6/6/22 21:20, Sam Ravnborg wrote:
> Hi Hsin-Yi,
> On Mon, Jun 06, 2022 at 11:24:24PM +0800, Hsin-Yi Wang wrote:
>> 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_panel_orientation() 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>
>> ---
>> v3->v4: Add a blank line.
>> ---
>>  drivers/gpu/drm/drm_panel.c |  9 +++++++++
>>  include/drm/drm_panel.h     | 10 ++++++++++
>>  2 files changed, 19 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
>> index f634371c717a..e12056cfeca8 100644
>> --- a/drivers/gpu/drm/drm_panel.c
>> +++ b/drivers/gpu/drm/drm_panel.c
>> @@ -223,6 +223,15 @@ int drm_panel_get_modes(struct drm_panel *panel,
>>  }
>>  EXPORT_SYMBOL(drm_panel_get_modes);
>>  
>> +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel)
> const as mentioned by Stephen.
> 
>> +{
>> +	if (panel && panel->funcs && panel->funcs->get_orientation)
>> +		return panel->funcs->get_orientation(panel);
>> +
>> +	return DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
>> +}
>> +EXPORT_SYMBOL(drm_panel_get_orientation);
>> +
>>  #ifdef CONFIG_OF
>>  /**
>>   * of_drm_find_panel - look up a panel using a device tree node
>> diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
>> index d279ee455f01..5dadbf3b0370 100644
>> --- a/include/drm/drm_panel.h
>> +++ b/include/drm/drm_panel.h
>> @@ -133,6 +133,15 @@ struct drm_panel_funcs {
>>  	 * Allows panels to create panels-specific debugfs files.
>>  	 */
>>  	void (*debugfs_init)(struct drm_panel *panel, struct dentry *root);
>> +
>> +	/**
>> +	 * @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);
> 
> Please move this up so it is together with the other get_* methods, in
> alphabetic order. That is, right after get_modes(), and then this also
> matches the order in the .c file with is extra bonus.

The downside of moving this up is that it will break drivers which don't
use c99 style named-struct-field initializers for there drm_panel_funcs.

I admit that no drivers should be using the old style struct init, but
are we sure that that is the case?

Regards,

Hans



> 
> With the two fixes:
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> 
>>  };
>>  
>>  /**
>> @@ -202,6 +211,7 @@ int drm_panel_enable(struct drm_panel *panel);
>>  int drm_panel_disable(struct drm_panel *panel);
>>  
>>  int drm_panel_get_modes(struct drm_panel *panel, struct drm_connector *connector);
>> +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel);
>>  
>>  #if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL)
>>  struct drm_panel *of_drm_find_panel(const struct device_node *np);
>> -- 
>> 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] 88+ messages in thread

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

Hi,

On 6/6/22 21:20, Sam Ravnborg wrote:
> Hi Hsin-Yi,
> On Mon, Jun 06, 2022 at 11:24:24PM +0800, Hsin-Yi Wang wrote:
>> 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_panel_orientation() 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>
>> ---
>> v3->v4: Add a blank line.
>> ---
>>  drivers/gpu/drm/drm_panel.c |  9 +++++++++
>>  include/drm/drm_panel.h     | 10 ++++++++++
>>  2 files changed, 19 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
>> index f634371c717a..e12056cfeca8 100644
>> --- a/drivers/gpu/drm/drm_panel.c
>> +++ b/drivers/gpu/drm/drm_panel.c
>> @@ -223,6 +223,15 @@ int drm_panel_get_modes(struct drm_panel *panel,
>>  }
>>  EXPORT_SYMBOL(drm_panel_get_modes);
>>  
>> +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel)
> const as mentioned by Stephen.
> 
>> +{
>> +	if (panel && panel->funcs && panel->funcs->get_orientation)
>> +		return panel->funcs->get_orientation(panel);
>> +
>> +	return DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
>> +}
>> +EXPORT_SYMBOL(drm_panel_get_orientation);
>> +
>>  #ifdef CONFIG_OF
>>  /**
>>   * of_drm_find_panel - look up a panel using a device tree node
>> diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
>> index d279ee455f01..5dadbf3b0370 100644
>> --- a/include/drm/drm_panel.h
>> +++ b/include/drm/drm_panel.h
>> @@ -133,6 +133,15 @@ struct drm_panel_funcs {
>>  	 * Allows panels to create panels-specific debugfs files.
>>  	 */
>>  	void (*debugfs_init)(struct drm_panel *panel, struct dentry *root);
>> +
>> +	/**
>> +	 * @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);
> 
> Please move this up so it is together with the other get_* methods, in
> alphabetic order. That is, right after get_modes(), and then this also
> matches the order in the .c file with is extra bonus.

The downside of moving this up is that it will break drivers which don't
use c99 style named-struct-field initializers for there drm_panel_funcs.

I admit that no drivers should be using the old style struct init, but
are we sure that that is the case?

Regards,

Hans



> 
> With the two fixes:
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> 
>>  };
>>  
>>  /**
>> @@ -202,6 +211,7 @@ int drm_panel_enable(struct drm_panel *panel);
>>  int drm_panel_disable(struct drm_panel *panel);
>>  
>>  int drm_panel_get_modes(struct drm_panel *panel, struct drm_connector *connector);
>> +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel);
>>  
>>  #if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL)
>>  struct drm_panel *of_drm_find_panel(const struct device_node *np);
>> -- 
>> 2.36.1.255.ge46751e96f-goog
> 


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

* Re: [PATCH v4 1/8] drm/panel: Add an API drm_panel_get_orientation() to return panel orientation
@ 2022-06-06 20:15       ` Hans de Goede
  0 siblings, 0 replies; 88+ messages in thread
From: Hans de Goede @ 2022-06-06 20:15 UTC (permalink / raw)
  To: Sam Ravnborg, Hsin-Yi Wang
  Cc: Chun-Kuang Hu, Thierry Reding, 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

Hi,

On 6/6/22 21:20, Sam Ravnborg wrote:
> Hi Hsin-Yi,
> On Mon, Jun 06, 2022 at 11:24:24PM +0800, Hsin-Yi Wang wrote:
>> 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_panel_orientation() 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>
>> ---
>> v3->v4: Add a blank line.
>> ---
>>  drivers/gpu/drm/drm_panel.c |  9 +++++++++
>>  include/drm/drm_panel.h     | 10 ++++++++++
>>  2 files changed, 19 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
>> index f634371c717a..e12056cfeca8 100644
>> --- a/drivers/gpu/drm/drm_panel.c
>> +++ b/drivers/gpu/drm/drm_panel.c
>> @@ -223,6 +223,15 @@ int drm_panel_get_modes(struct drm_panel *panel,
>>  }
>>  EXPORT_SYMBOL(drm_panel_get_modes);
>>  
>> +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel)
> const as mentioned by Stephen.
> 
>> +{
>> +	if (panel && panel->funcs && panel->funcs->get_orientation)
>> +		return panel->funcs->get_orientation(panel);
>> +
>> +	return DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
>> +}
>> +EXPORT_SYMBOL(drm_panel_get_orientation);
>> +
>>  #ifdef CONFIG_OF
>>  /**
>>   * of_drm_find_panel - look up a panel using a device tree node
>> diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
>> index d279ee455f01..5dadbf3b0370 100644
>> --- a/include/drm/drm_panel.h
>> +++ b/include/drm/drm_panel.h
>> @@ -133,6 +133,15 @@ struct drm_panel_funcs {
>>  	 * Allows panels to create panels-specific debugfs files.
>>  	 */
>>  	void (*debugfs_init)(struct drm_panel *panel, struct dentry *root);
>> +
>> +	/**
>> +	 * @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);
> 
> Please move this up so it is together with the other get_* methods, in
> alphabetic order. That is, right after get_modes(), and then this also
> matches the order in the .c file with is extra bonus.

The downside of moving this up is that it will break drivers which don't
use c99 style named-struct-field initializers for there drm_panel_funcs.

I admit that no drivers should be using the old style struct init, but
are we sure that that is the case?

Regards,

Hans



> 
> With the two fixes:
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> 
>>  };
>>  
>>  /**
>> @@ -202,6 +211,7 @@ int drm_panel_enable(struct drm_panel *panel);
>>  int drm_panel_disable(struct drm_panel *panel);
>>  
>>  int drm_panel_get_modes(struct drm_panel *panel, struct drm_connector *connector);
>> +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel);
>>  
>>  #if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL)
>>  struct drm_panel *of_drm_find_panel(const struct device_node *np);
>> -- 
>> 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] 88+ messages in thread

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

Hi Hans,

> > Please move this up so it is together with the other get_* methods, in
> > alphabetic order. That is, right after get_modes(), and then this also
> > matches the order in the .c file with is extra bonus.
> 
> The downside of moving this up is that it will break drivers which don't
> use c99 style named-struct-field initializers for there drm_panel_funcs.
> 
> I admit that no drivers should be using the old style struct init, but
> are we sure that that is the case?

There is no in-tree driver that uses old style struct init for
drm_panel_funcs - so we are safe here.

I just did a quick git grep -A 4 drm_panel_funcs to verify it,
browsing through the output did not reveal any old style users.

	Sam

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

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

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

Hi Hans,

> > Please move this up so it is together with the other get_* methods, in
> > alphabetic order. That is, right after get_modes(), and then this also
> > matches the order in the .c file with is extra bonus.
> 
> The downside of moving this up is that it will break drivers which don't
> use c99 style named-struct-field initializers for there drm_panel_funcs.
> 
> I admit that no drivers should be using the old style struct init, but
> are we sure that that is the case?

There is no in-tree driver that uses old style struct init for
drm_panel_funcs - so we are safe here.

I just did a quick git grep -A 4 drm_panel_funcs to verify it,
browsing through the output did not reveal any old style users.

	Sam

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

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

Hi Hans,

> > Please move this up so it is together with the other get_* methods, in
> > alphabetic order. That is, right after get_modes(), and then this also
> > matches the order in the .c file with is extra bonus.
> 
> The downside of moving this up is that it will break drivers which don't
> use c99 style named-struct-field initializers for there drm_panel_funcs.
> 
> I admit that no drivers should be using the old style struct init, but
> are we sure that that is the case?

There is no in-tree driver that uses old style struct init for
drm_panel_funcs - so we are safe here.

I just did a quick git grep -A 4 drm_panel_funcs to verify it,
browsing through the output did not reveal any old style users.

	Sam

_______________________________________________
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] 88+ messages in thread

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

Hi Hans,

> > Please move this up so it is together with the other get_* methods, in
> > alphabetic order. That is, right after get_modes(), and then this also
> > matches the order in the .c file with is extra bonus.
> 
> The downside of moving this up is that it will break drivers which don't
> use c99 style named-struct-field initializers for there drm_panel_funcs.
> 
> I admit that no drivers should be using the old style struct init, but
> are we sure that that is the case?

There is no in-tree driver that uses old style struct init for
drm_panel_funcs - so we are safe here.

I just did a quick git grep -A 4 drm_panel_funcs to verify it,
browsing through the output did not reveal any old style users.

	Sam

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

* Re: [PATCH v4 8/8] drm/mediatek: Config orientation property if panel provides it
  2022-06-06 19:16     ` Stephen Boyd
  (?)
  (?)
@ 2022-06-07  3:46       ` Hsin-Yi Wang
  -1 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  3:46 UTC (permalink / raw)
  To: Stephen Boyd
  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, linux-mediatek, Rob Clark, Douglas Anderson,
	Rob Herring, linux-arm-kernel, linux-kernel

On Tue, Jun 7, 2022 at 3:16 AM Stephen Boyd <swboyd@chromium.org> wrote:
>
> Quoting Hsin-Yi Wang (2022-06-06 08:24:31)
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > index d9f10a33e6fa..c56282412bfa 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > @@ -822,6 +823,12 @@ 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 */
> > +       if (dsi->panel)
> > +               drm_connector_set_panel_orientation(dsi->connector,
> > +                               drm_panel_get_orientation(dsi->panel));
> > +
>
> It could be simplified like so?
>
>         drm_connector_set_orientation_from_panel(dsi->connector, dsi->panel);
>
> Then the API could get the orientation if the panel pointer is valid.
> Does any code need to use/modify the orientation value besides
> drm_connector_set_panel_orientation()?
>

We can add another function to call
drm_connector_set_orientation_from_panel(), which will be like

void drm_connector_set_orientation_from_panel(connector, panel)
{
     if (panel)
          drm_connector_set_panel_orientation(connector,drm_panel_get_orientation(panel));
}

Though it's very should but I can add this if this can make the caller
more convenient.

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

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

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

On Tue, Jun 7, 2022 at 3:16 AM Stephen Boyd <swboyd@chromium.org> wrote:
>
> Quoting Hsin-Yi Wang (2022-06-06 08:24:31)
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > index d9f10a33e6fa..c56282412bfa 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > @@ -822,6 +823,12 @@ 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 */
> > +       if (dsi->panel)
> > +               drm_connector_set_panel_orientation(dsi->connector,
> > +                               drm_panel_get_orientation(dsi->panel));
> > +
>
> It could be simplified like so?
>
>         drm_connector_set_orientation_from_panel(dsi->connector, dsi->panel);
>
> Then the API could get the orientation if the panel pointer is valid.
> Does any code need to use/modify the orientation value besides
> drm_connector_set_panel_orientation()?
>

We can add another function to call
drm_connector_set_orientation_from_panel(), which will be like

void drm_connector_set_orientation_from_panel(connector, panel)
{
     if (panel)
          drm_connector_set_panel_orientation(connector,drm_panel_get_orientation(panel));
}

Though it's very should but I can add this if this can make the caller
more convenient.

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

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

* Re: [PATCH v4 8/8] drm/mediatek: Config orientation property if panel provides it
@ 2022-06-07  3:46       ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  3:46 UTC (permalink / raw)
  To: Stephen Boyd
  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, linux-mediatek, Rob Clark, Douglas Anderson,
	Rob Herring, linux-arm-kernel, linux-kernel

On Tue, Jun 7, 2022 at 3:16 AM Stephen Boyd <swboyd@chromium.org> wrote:
>
> Quoting Hsin-Yi Wang (2022-06-06 08:24:31)
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > index d9f10a33e6fa..c56282412bfa 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > @@ -822,6 +823,12 @@ 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 */
> > +       if (dsi->panel)
> > +               drm_connector_set_panel_orientation(dsi->connector,
> > +                               drm_panel_get_orientation(dsi->panel));
> > +
>
> It could be simplified like so?
>
>         drm_connector_set_orientation_from_panel(dsi->connector, dsi->panel);
>
> Then the API could get the orientation if the panel pointer is valid.
> Does any code need to use/modify the orientation value besides
> drm_connector_set_panel_orientation()?
>

We can add another function to call
drm_connector_set_orientation_from_panel(), which will be like

void drm_connector_set_orientation_from_panel(connector, panel)
{
     if (panel)
          drm_connector_set_panel_orientation(connector,drm_panel_get_orientation(panel));
}

Though it's very should but I can add this if this can make the caller
more convenient.

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

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

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

* Re: [PATCH v4 8/8] drm/mediatek: Config orientation property if panel provides it
@ 2022-06-07  3:46       ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  3:46 UTC (permalink / raw)
  To: Stephen Boyd
  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, linux-mediatek, Rob Clark, Douglas Anderson,
	Rob Herring, linux-arm-kernel, linux-kernel

On Tue, Jun 7, 2022 at 3:16 AM Stephen Boyd <swboyd@chromium.org> wrote:
>
> Quoting Hsin-Yi Wang (2022-06-06 08:24:31)
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > index d9f10a33e6fa..c56282412bfa 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > @@ -822,6 +823,12 @@ 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 */
> > +       if (dsi->panel)
> > +               drm_connector_set_panel_orientation(dsi->connector,
> > +                               drm_panel_get_orientation(dsi->panel));
> > +
>
> It could be simplified like so?
>
>         drm_connector_set_orientation_from_panel(dsi->connector, dsi->panel);
>
> Then the API could get the orientation if the panel pointer is valid.
> Does any code need to use/modify the orientation value besides
> drm_connector_set_panel_orientation()?
>

We can add another function to call
drm_connector_set_orientation_from_panel(), which will be like

void drm_connector_set_orientation_from_panel(connector, panel)
{
     if (panel)
          drm_connector_set_panel_orientation(connector,drm_panel_get_orientation(panel));
}

Though it's very should but I can add this if this can make the caller
more convenient.

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

_______________________________________________
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] 88+ messages in thread

* Re: [PATCH v4 8/8] drm/mediatek: Config orientation property if panel provides it
  2022-06-06 19:31     ` Sam Ravnborg
  (?)
  (?)
@ 2022-06-07  3:53       ` Hsin-Yi Wang
  -1 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  3:53 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Chun-Kuang Hu, Hans de Goede, Thierry Reding, 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

On Tue, Jun 7, 2022 at 3:31 AM Sam Ravnborg <sam@ravnborg.org> wrote:
>
> Hi Hsin-Yi,
>
> On Mon, Jun 06, 2022 at 11:24:31PM +0800, Hsin-Yi Wang 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.
>
> I do not know the best way to do what you need to do here.
> But it seems wrong to introduce a deprecated function
> (drm_of_find_panel_or_bridge), to set the rotation property early.
>
How about of_drm_find_panel()?

> I think you need to find a way to do this utilising the panel_bridge or
> something.
>
>         Sam
>
> >
> > 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>
> > ---
> >  drivers/gpu/drm/mediatek/mtk_dsi.c | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > index d9f10a33e6fa..c56282412bfa 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,12 @@ 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 */
> > +     if (dsi->panel)
> > +             drm_connector_set_panel_orientation(dsi->connector,
> > +                             drm_panel_get_orientation(dsi->panel));
> > +
> >       drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
> >
> >       return 0;
> > @@ -837,6 +844,9 @@ static int mtk_dsi_bind(struct device *dev, struct device *master, void *data)
> >       struct drm_device *drm = data;
> >       struct mtk_dsi *dsi = dev_get_drvdata(dev);
> >
> > +     /* Get panel if existed */
> > +     drm_of_find_panel_or_bridge(dev->of_node, 0, 0, &dsi->panel, NULL);
> > +
> >       ret = mtk_dsi_encoder_init(drm, dsi);
> >       if (ret)
> >               return ret;
> > --
> > 2.36.1.255.ge46751e96f-goog

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

* Re: [PATCH v4 8/8] drm/mediatek: Config orientation property if panel provides it
@ 2022-06-07  3:53       ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  3:53 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Chun-Kuang Hu, Hans de Goede, Thierry Reding, 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

On Tue, Jun 7, 2022 at 3:31 AM Sam Ravnborg <sam@ravnborg.org> wrote:
>
> Hi Hsin-Yi,
>
> On Mon, Jun 06, 2022 at 11:24:31PM +0800, Hsin-Yi Wang 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.
>
> I do not know the best way to do what you need to do here.
> But it seems wrong to introduce a deprecated function
> (drm_of_find_panel_or_bridge), to set the rotation property early.
>
How about of_drm_find_panel()?

> I think you need to find a way to do this utilising the panel_bridge or
> something.
>
>         Sam
>
> >
> > 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>
> > ---
> >  drivers/gpu/drm/mediatek/mtk_dsi.c | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > index d9f10a33e6fa..c56282412bfa 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,12 @@ 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 */
> > +     if (dsi->panel)
> > +             drm_connector_set_panel_orientation(dsi->connector,
> > +                             drm_panel_get_orientation(dsi->panel));
> > +
> >       drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
> >
> >       return 0;
> > @@ -837,6 +844,9 @@ static int mtk_dsi_bind(struct device *dev, struct device *master, void *data)
> >       struct drm_device *drm = data;
> >       struct mtk_dsi *dsi = dev_get_drvdata(dev);
> >
> > +     /* Get panel if existed */
> > +     drm_of_find_panel_or_bridge(dev->of_node, 0, 0, &dsi->panel, NULL);
> > +
> >       ret = mtk_dsi_encoder_init(drm, dsi);
> >       if (ret)
> >               return 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	[flat|nested] 88+ messages in thread

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

On Tue, Jun 7, 2022 at 3:31 AM Sam Ravnborg <sam@ravnborg.org> wrote:
>
> Hi Hsin-Yi,
>
> On Mon, Jun 06, 2022 at 11:24:31PM +0800, Hsin-Yi Wang 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.
>
> I do not know the best way to do what you need to do here.
> But it seems wrong to introduce a deprecated function
> (drm_of_find_panel_or_bridge), to set the rotation property early.
>
How about of_drm_find_panel()?

> I think you need to find a way to do this utilising the panel_bridge or
> something.
>
>         Sam
>
> >
> > 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>
> > ---
> >  drivers/gpu/drm/mediatek/mtk_dsi.c | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > index d9f10a33e6fa..c56282412bfa 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,12 @@ 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 */
> > +     if (dsi->panel)
> > +             drm_connector_set_panel_orientation(dsi->connector,
> > +                             drm_panel_get_orientation(dsi->panel));
> > +
> >       drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
> >
> >       return 0;
> > @@ -837,6 +844,9 @@ static int mtk_dsi_bind(struct device *dev, struct device *master, void *data)
> >       struct drm_device *drm = data;
> >       struct mtk_dsi *dsi = dev_get_drvdata(dev);
> >
> > +     /* Get panel if existed */
> > +     drm_of_find_panel_or_bridge(dev->of_node, 0, 0, &dsi->panel, NULL);
> > +
> >       ret = mtk_dsi_encoder_init(drm, dsi);
> >       if (ret)
> >               return ret;
> > --
> > 2.36.1.255.ge46751e96f-goog

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

* Re: [PATCH v4 8/8] drm/mediatek: Config orientation property if panel provides it
@ 2022-06-07  3:53       ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  3:53 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Chun-Kuang Hu, Hans de Goede, Thierry Reding, 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

On Tue, Jun 7, 2022 at 3:31 AM Sam Ravnborg <sam@ravnborg.org> wrote:
>
> Hi Hsin-Yi,
>
> On Mon, Jun 06, 2022 at 11:24:31PM +0800, Hsin-Yi Wang 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.
>
> I do not know the best way to do what you need to do here.
> But it seems wrong to introduce a deprecated function
> (drm_of_find_panel_or_bridge), to set the rotation property early.
>
How about of_drm_find_panel()?

> I think you need to find a way to do this utilising the panel_bridge or
> something.
>
>         Sam
>
> >
> > 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>
> > ---
> >  drivers/gpu/drm/mediatek/mtk_dsi.c | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > index d9f10a33e6fa..c56282412bfa 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,12 @@ 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 */
> > +     if (dsi->panel)
> > +             drm_connector_set_panel_orientation(dsi->connector,
> > +                             drm_panel_get_orientation(dsi->panel));
> > +
> >       drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
> >
> >       return 0;
> > @@ -837,6 +844,9 @@ static int mtk_dsi_bind(struct device *dev, struct device *master, void *data)
> >       struct drm_device *drm = data;
> >       struct mtk_dsi *dsi = dev_get_drvdata(dev);
> >
> > +     /* Get panel if existed */
> > +     drm_of_find_panel_or_bridge(dev->of_node, 0, 0, &dsi->panel, NULL);
> > +
> >       ret = mtk_dsi_encoder_init(drm, dsi);
> >       if (ret)
> >               return 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	[flat|nested] 88+ messages in thread

* Re: [PATCH v4 5/8] drm/panel: panel-simple: Implement .get_orientation callback
  2022-06-06 19:25     ` Sam Ravnborg
  (?)
  (?)
@ 2022-06-07  3:54       ` Hsin-Yi Wang
  -1 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  3:54 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Chun-Kuang Hu, Hans de Goede, Thierry Reding, 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

On Tue, Jun 7, 2022 at 3:25 AM Sam Ravnborg <sam@ravnborg.org> wrote:
>
> Hi Hsin-Yi,
>
> On Mon, Jun 06, 2022 at 11:24:28PM +0800, Hsin-Yi Wang wrote:
> > 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-simple.c | 16 +++++++++++++++-
> >  1 file changed, 15 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> > index 4a2e580a2f7b..f232b8cf4075 100644
> > --- a/drivers/gpu/drm/panel/panel-simple.c
> > +++ b/drivers/gpu/drm/panel/panel-simple.c
> > @@ -411,7 +411,12 @@ 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 */
> > +     /*
> > +      * drm drivers are expected to call drm_panel_get_orientation() to get
> > +      * panel's orientation then drm_connector_set_panel_orientation() to
> > +      * set the property before drm_dev_register(). Otherwise there will be
> > +      * a WARN_ON if orientation is set after drm is registered.
> > +      */
>
> This comment is not really relevant here. If we need to explain this
> then put it in drm_panel.c/h - as this applies for all panels and not
> just the panel_simple.
> Keep in mind, this is the source new panels often use a inspiration and
> no need to have this copied around.
>
Will update this.

> >       drm_connector_set_panel_orientation(connector, p->orientation);
> >
> >       return num;
> > @@ -434,6 +439,14 @@ 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,
> > @@ -441,6 +454,7 @@ static const struct drm_panel_funcs panel_simple_funcs = {
> >       .enable = panel_simple_enable,
> >       .get_modes = panel_simple_get_modes,
> >       .get_timings = panel_simple_get_timings,
> > +     .get_orientation = panel_simple_get_orientation,
>
> I like the order in this list to match the order in the .h file.
> So my OCD would like you to move it up right after get_modes,
> but feel free to ignore this.
>
Sure.

> With the suggested changes:
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
>
> >  };
> >
> >  static struct panel_desc panel_dpi;
> > --
> > 2.36.1.255.ge46751e96f-goog

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

* Re: [PATCH v4 5/8] drm/panel: panel-simple: Implement .get_orientation callback
@ 2022-06-07  3:54       ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  3:54 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Chun-Kuang Hu, Hans de Goede, Thierry Reding, 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

On Tue, Jun 7, 2022 at 3:25 AM Sam Ravnborg <sam@ravnborg.org> wrote:
>
> Hi Hsin-Yi,
>
> On Mon, Jun 06, 2022 at 11:24:28PM +0800, Hsin-Yi Wang wrote:
> > 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-simple.c | 16 +++++++++++++++-
> >  1 file changed, 15 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> > index 4a2e580a2f7b..f232b8cf4075 100644
> > --- a/drivers/gpu/drm/panel/panel-simple.c
> > +++ b/drivers/gpu/drm/panel/panel-simple.c
> > @@ -411,7 +411,12 @@ 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 */
> > +     /*
> > +      * drm drivers are expected to call drm_panel_get_orientation() to get
> > +      * panel's orientation then drm_connector_set_panel_orientation() to
> > +      * set the property before drm_dev_register(). Otherwise there will be
> > +      * a WARN_ON if orientation is set after drm is registered.
> > +      */
>
> This comment is not really relevant here. If we need to explain this
> then put it in drm_panel.c/h - as this applies for all panels and not
> just the panel_simple.
> Keep in mind, this is the source new panels often use a inspiration and
> no need to have this copied around.
>
Will update this.

> >       drm_connector_set_panel_orientation(connector, p->orientation);
> >
> >       return num;
> > @@ -434,6 +439,14 @@ 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,
> > @@ -441,6 +454,7 @@ static const struct drm_panel_funcs panel_simple_funcs = {
> >       .enable = panel_simple_enable,
> >       .get_modes = panel_simple_get_modes,
> >       .get_timings = panel_simple_get_timings,
> > +     .get_orientation = panel_simple_get_orientation,
>
> I like the order in this list to match the order in the .h file.
> So my OCD would like you to move it up right after get_modes,
> but feel free to ignore this.
>
Sure.

> With the suggested changes:
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
>
> >  };
> >
> >  static struct panel_desc panel_dpi;
> > --
> > 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] 88+ messages in thread

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

On Tue, Jun 7, 2022 at 3:25 AM Sam Ravnborg <sam@ravnborg.org> wrote:
>
> Hi Hsin-Yi,
>
> On Mon, Jun 06, 2022 at 11:24:28PM +0800, Hsin-Yi Wang wrote:
> > 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-simple.c | 16 +++++++++++++++-
> >  1 file changed, 15 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> > index 4a2e580a2f7b..f232b8cf4075 100644
> > --- a/drivers/gpu/drm/panel/panel-simple.c
> > +++ b/drivers/gpu/drm/panel/panel-simple.c
> > @@ -411,7 +411,12 @@ 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 */
> > +     /*
> > +      * drm drivers are expected to call drm_panel_get_orientation() to get
> > +      * panel's orientation then drm_connector_set_panel_orientation() to
> > +      * set the property before drm_dev_register(). Otherwise there will be
> > +      * a WARN_ON if orientation is set after drm is registered.
> > +      */
>
> This comment is not really relevant here. If we need to explain this
> then put it in drm_panel.c/h - as this applies for all panels and not
> just the panel_simple.
> Keep in mind, this is the source new panels often use a inspiration and
> no need to have this copied around.
>
Will update this.

> >       drm_connector_set_panel_orientation(connector, p->orientation);
> >
> >       return num;
> > @@ -434,6 +439,14 @@ 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,
> > @@ -441,6 +454,7 @@ static const struct drm_panel_funcs panel_simple_funcs = {
> >       .enable = panel_simple_enable,
> >       .get_modes = panel_simple_get_modes,
> >       .get_timings = panel_simple_get_timings,
> > +     .get_orientation = panel_simple_get_orientation,
>
> I like the order in this list to match the order in the .h file.
> So my OCD would like you to move it up right after get_modes,
> but feel free to ignore this.
>
Sure.

> With the suggested changes:
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
>
> >  };
> >
> >  static struct panel_desc panel_dpi;
> > --
> > 2.36.1.255.ge46751e96f-goog

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

* Re: [PATCH v4 5/8] drm/panel: panel-simple: Implement .get_orientation callback
@ 2022-06-07  3:54       ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  3:54 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Chun-Kuang Hu, Hans de Goede, Thierry Reding, 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

On Tue, Jun 7, 2022 at 3:25 AM Sam Ravnborg <sam@ravnborg.org> wrote:
>
> Hi Hsin-Yi,
>
> On Mon, Jun 06, 2022 at 11:24:28PM +0800, Hsin-Yi Wang wrote:
> > 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-simple.c | 16 +++++++++++++++-
> >  1 file changed, 15 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> > index 4a2e580a2f7b..f232b8cf4075 100644
> > --- a/drivers/gpu/drm/panel/panel-simple.c
> > +++ b/drivers/gpu/drm/panel/panel-simple.c
> > @@ -411,7 +411,12 @@ 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 */
> > +     /*
> > +      * drm drivers are expected to call drm_panel_get_orientation() to get
> > +      * panel's orientation then drm_connector_set_panel_orientation() to
> > +      * set the property before drm_dev_register(). Otherwise there will be
> > +      * a WARN_ON if orientation is set after drm is registered.
> > +      */
>
> This comment is not really relevant here. If we need to explain this
> then put it in drm_panel.c/h - as this applies for all panels and not
> just the panel_simple.
> Keep in mind, this is the source new panels often use a inspiration and
> no need to have this copied around.
>
Will update this.

> >       drm_connector_set_panel_orientation(connector, p->orientation);
> >
> >       return num;
> > @@ -434,6 +439,14 @@ 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,
> > @@ -441,6 +454,7 @@ static const struct drm_panel_funcs panel_simple_funcs = {
> >       .enable = panel_simple_enable,
> >       .get_modes = panel_simple_get_modes,
> >       .get_timings = panel_simple_get_timings,
> > +     .get_orientation = panel_simple_get_orientation,
>
> I like the order in this list to match the order in the .h file.
> So my OCD would like you to move it up right after get_modes,
> but feel free to ignore this.
>
Sure.

> With the suggested changes:
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
>
> >  };
> >
> >  static struct panel_desc panel_dpi;
> > --
> > 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] 88+ messages in thread

* Re: [PATCH v4 1/8] drm/panel: Add an API drm_panel_get_orientation() to return panel orientation
  2022-06-06 19:06     ` Stephen Boyd
  (?)
  (?)
@ 2022-06-07  7:53       ` Hsin-Yi Wang
  -1 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  7:53 UTC (permalink / raw)
  To: Stephen Boyd
  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, linux-mediatek, Rob Clark, Douglas Anderson,
	Rob Herring, linux-arm-kernel, linux-kernel

On Tue, Jun 7, 2022 at 3:06 AM Stephen Boyd <swboyd@chromium.org> wrote:
>
> Quoting Hsin-Yi Wang (2022-06-06 08:24:24)
> > diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> > index f634371c717a..e12056cfeca8 100644
> > --- a/drivers/gpu/drm/drm_panel.c
> > +++ b/drivers/gpu/drm/drm_panel.c
> > @@ -223,6 +223,15 @@ int drm_panel_get_modes(struct drm_panel *panel,
> >  }
> >  EXPORT_SYMBOL(drm_panel_get_modes);
> >
> > +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel)
>
> Should 'panel' be marked const to indicate that it can't be modified?
>

But .get_orientation() will need to call to_XXX_panel, eg.
static inline struct boe_panel *to_boe_panel(struct drm_panel *panel)

==> .get_modes(panel) <-- can't be const.
==> drm_panel_get_orientation(panel) <-- can't be const.

We can definitely cast it in the functions, or make to_XXX_panel()
accept const, but I think this will lose the meaning of using const
anyway.

> > +{
> > +       if (panel && panel->funcs && panel->funcs->get_orientation)
> > +               return panel->funcs->get_orientation(panel);

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

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

On Tue, Jun 7, 2022 at 3:06 AM Stephen Boyd <swboyd@chromium.org> wrote:
>
> Quoting Hsin-Yi Wang (2022-06-06 08:24:24)
> > diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> > index f634371c717a..e12056cfeca8 100644
> > --- a/drivers/gpu/drm/drm_panel.c
> > +++ b/drivers/gpu/drm/drm_panel.c
> > @@ -223,6 +223,15 @@ int drm_panel_get_modes(struct drm_panel *panel,
> >  }
> >  EXPORT_SYMBOL(drm_panel_get_modes);
> >
> > +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel)
>
> Should 'panel' be marked const to indicate that it can't be modified?
>

But .get_orientation() will need to call to_XXX_panel, eg.
static inline struct boe_panel *to_boe_panel(struct drm_panel *panel)

==> .get_modes(panel) <-- can't be const.
==> drm_panel_get_orientation(panel) <-- can't be const.

We can definitely cast it in the functions, or make to_XXX_panel()
accept const, but I think this will lose the meaning of using const
anyway.

> > +{
> > +       if (panel && panel->funcs && panel->funcs->get_orientation)
> > +               return panel->funcs->get_orientation(panel);

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

* Re: [PATCH v4 1/8] drm/panel: Add an API drm_panel_get_orientation() to return panel orientation
@ 2022-06-07  7:53       ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  7:53 UTC (permalink / raw)
  To: Stephen Boyd
  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, linux-mediatek, Rob Clark, Douglas Anderson,
	Rob Herring, linux-arm-kernel, linux-kernel

On Tue, Jun 7, 2022 at 3:06 AM Stephen Boyd <swboyd@chromium.org> wrote:
>
> Quoting Hsin-Yi Wang (2022-06-06 08:24:24)
> > diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> > index f634371c717a..e12056cfeca8 100644
> > --- a/drivers/gpu/drm/drm_panel.c
> > +++ b/drivers/gpu/drm/drm_panel.c
> > @@ -223,6 +223,15 @@ int drm_panel_get_modes(struct drm_panel *panel,
> >  }
> >  EXPORT_SYMBOL(drm_panel_get_modes);
> >
> > +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel)
>
> Should 'panel' be marked const to indicate that it can't be modified?
>

But .get_orientation() will need to call to_XXX_panel, eg.
static inline struct boe_panel *to_boe_panel(struct drm_panel *panel)

==> .get_modes(panel) <-- can't be const.
==> drm_panel_get_orientation(panel) <-- can't be const.

We can definitely cast it in the functions, or make to_XXX_panel()
accept const, but I think this will lose the meaning of using const
anyway.

> > +{
> > +       if (panel && panel->funcs && panel->funcs->get_orientation)
> > +               return panel->funcs->get_orientation(panel);

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

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

* Re: [PATCH v4 1/8] drm/panel: Add an API drm_panel_get_orientation() to return panel orientation
@ 2022-06-07  7:53       ` Hsin-Yi Wang
  0 siblings, 0 replies; 88+ messages in thread
From: Hsin-Yi Wang @ 2022-06-07  7:53 UTC (permalink / raw)
  To: Stephen Boyd
  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, linux-mediatek, Rob Clark, Douglas Anderson,
	Rob Herring, linux-arm-kernel, linux-kernel

On Tue, Jun 7, 2022 at 3:06 AM Stephen Boyd <swboyd@chromium.org> wrote:
>
> Quoting Hsin-Yi Wang (2022-06-06 08:24:24)
> > diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> > index f634371c717a..e12056cfeca8 100644
> > --- a/drivers/gpu/drm/drm_panel.c
> > +++ b/drivers/gpu/drm/drm_panel.c
> > @@ -223,6 +223,15 @@ int drm_panel_get_modes(struct drm_panel *panel,
> >  }
> >  EXPORT_SYMBOL(drm_panel_get_modes);
> >
> > +enum drm_panel_orientation drm_panel_get_orientation(struct drm_panel *panel)
>
> Should 'panel' be marked const to indicate that it can't be modified?
>

But .get_orientation() will need to call to_XXX_panel, eg.
static inline struct boe_panel *to_boe_panel(struct drm_panel *panel)

==> .get_modes(panel) <-- can't be const.
==> drm_panel_get_orientation(panel) <-- can't be const.

We can definitely cast it in the functions, or make to_XXX_panel()
accept const, but I think this will lose the meaning of using const
anyway.

> > +{
> > +       if (panel && panel->funcs && panel->funcs->get_orientation)
> > +               return panel->funcs->get_orientation(panel);

_______________________________________________
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] 88+ messages in thread

end of thread, other threads:[~2022-06-07  7:58 UTC | newest]

Thread overview: 88+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-06 15:24 [PATCH v4 0/8] Add a panel API to return panel orientation Hsin-Yi Wang
2022-06-06 15:24 ` Hsin-Yi Wang
2022-06-06 15:24 ` Hsin-Yi Wang
2022-06-06 15:24 ` Hsin-Yi Wang
2022-06-06 15:24 ` [PATCH v4 1/8] drm/panel: Add an API drm_panel_get_orientation() " Hsin-Yi Wang
2022-06-06 15:24   ` Hsin-Yi Wang
2022-06-06 15:24   ` Hsin-Yi Wang
2022-06-06 15:24   ` Hsin-Yi Wang
2022-06-06 19:06   ` Stephen Boyd
2022-06-06 19:06     ` Stephen Boyd
2022-06-06 19:06     ` Stephen Boyd
2022-06-06 19:06     ` Stephen Boyd
2022-06-07  7:53     ` Hsin-Yi Wang
2022-06-07  7:53       ` Hsin-Yi Wang
2022-06-07  7:53       ` Hsin-Yi Wang
2022-06-07  7:53       ` Hsin-Yi Wang
2022-06-06 19:20   ` Sam Ravnborg
2022-06-06 19:20     ` Sam Ravnborg
2022-06-06 19:20     ` Sam Ravnborg
2022-06-06 19:20     ` Sam Ravnborg
2022-06-06 20:15     ` Hans de Goede
2022-06-06 20:15       ` Hans de Goede
2022-06-06 20:15       ` Hans de Goede
2022-06-06 20:15       ` Hans de Goede
2022-06-06 20:50       ` Sam Ravnborg
2022-06-06 20:50         ` Sam Ravnborg
2022-06-06 20:50         ` Sam Ravnborg
2022-06-06 20:50         ` Sam Ravnborg
2022-06-06 15:24 ` [PATCH v4 2/8] drm/panel: boe-tv101wum-nl6: Implement .get_orientation callback Hsin-Yi Wang
2022-06-06 15:24   ` Hsin-Yi Wang
2022-06-06 15:24   ` Hsin-Yi Wang
2022-06-06 15:24   ` Hsin-Yi Wang
2022-06-06 15:24 ` [PATCH v4 3/8] drm/panel: panel-edp: " Hsin-Yi Wang
2022-06-06 15:24   ` Hsin-Yi Wang
2022-06-06 15:24   ` Hsin-Yi Wang
2022-06-06 15:24   ` Hsin-Yi Wang
2022-06-06 15:24 ` [PATCH v4 4/8] drm/panel: lvds: " Hsin-Yi Wang
2022-06-06 15:24   ` Hsin-Yi Wang
2022-06-06 15:24   ` Hsin-Yi Wang
2022-06-06 15:24   ` Hsin-Yi Wang
2022-06-06 19:08   ` Stephen Boyd
2022-06-06 19:08     ` Stephen Boyd
2022-06-06 19:08     ` Stephen Boyd
2022-06-06 19:08     ` Stephen Boyd
2022-06-06 15:24 ` [PATCH v4 5/8] drm/panel: panel-simple: " Hsin-Yi Wang
2022-06-06 15:24   ` Hsin-Yi Wang
2022-06-06 15:24   ` Hsin-Yi Wang
2022-06-06 15:24   ` Hsin-Yi Wang
2022-06-06 19:25   ` Sam Ravnborg
2022-06-06 19:25     ` Sam Ravnborg
2022-06-06 19:25     ` Sam Ravnborg
2022-06-06 19:25     ` Sam Ravnborg
2022-06-07  3:54     ` Hsin-Yi Wang
2022-06-07  3:54       ` Hsin-Yi Wang
2022-06-07  3:54       ` Hsin-Yi Wang
2022-06-07  3:54       ` Hsin-Yi Wang
2022-06-06 15:24 ` [PATCH v4 6/8] drm/panel: ili9881c: " Hsin-Yi Wang
2022-06-06 15:24   ` Hsin-Yi Wang
2022-06-06 15:24   ` Hsin-Yi Wang
2022-06-06 15:24   ` Hsin-Yi Wang
2022-06-06 15:24 ` [PATCH v4 7/8] drm/panel: elida-kd35t133: " Hsin-Yi Wang
2022-06-06 15:24   ` Hsin-Yi Wang
2022-06-06 15:24   ` Hsin-Yi Wang
2022-06-06 15:24   ` Hsin-Yi Wang
2022-06-06 15:24 ` [PATCH v4 8/8] drm/mediatek: Config orientation property if panel provides it Hsin-Yi Wang
2022-06-06 15:24   ` Hsin-Yi Wang
2022-06-06 15:24   ` Hsin-Yi Wang
2022-06-06 15:24   ` Hsin-Yi Wang
2022-06-06 19:16   ` Stephen Boyd
2022-06-06 19:16     ` Stephen Boyd
2022-06-06 19:16     ` Stephen Boyd
2022-06-06 19:16     ` Stephen Boyd
2022-06-07  3:46     ` Hsin-Yi Wang
2022-06-07  3:46       ` Hsin-Yi Wang
2022-06-07  3:46       ` Hsin-Yi Wang
2022-06-07  3:46       ` Hsin-Yi Wang
2022-06-06 19:31   ` Sam Ravnborg
2022-06-06 19:31     ` Sam Ravnborg
2022-06-06 19:31     ` Sam Ravnborg
2022-06-06 19:31     ` Sam Ravnborg
2022-06-07  3:53     ` Hsin-Yi Wang
2022-06-07  3:53       ` Hsin-Yi Wang
2022-06-07  3:53       ` Hsin-Yi Wang
2022-06-07  3:53       ` Hsin-Yi Wang
2022-06-06 19:28 ` [PATCH v4 0/8] Add a panel API to return panel orientation Sam Ravnborg
2022-06-06 19:28   ` Sam Ravnborg
2022-06-06 19:28   ` Sam Ravnborg
2022-06-06 19:28   ` Sam Ravnborg

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.