Skip to contentSkip to conversation

drm/panel: panel-lg-ld070wx3: Add support for get_orientation() op

PATCH New Svyatoslav Ryhel 1 participant 1 message Nov 14

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/panel: panel-lg-ld070wx3: Add support for get_orientation() op

Implement the get_orientation() operation using a standard helper. The Nvidia Tegra Note 7, which uses this panel, has it mounted with a 180-degree rotation, making this change essential for the device correct work.

---
 drivers/gpu/drm/panel/panel-lg-ld070wx3.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/gpu/drm/panel/panel-lg-ld070wx3.c +14 -0
index 0280addb6500d..eed1dc1e1bc31 100644
@@ -11,6 +11,7 @@
 #include <video/mipi_display.h>
 
 #include <drm/drm_mipi_dsi.h>
+#include <drm/drm_of.h>
 #include <drm/drm_modes.h>
 #include <drm/drm_panel.h>
 #include <drm/drm_probe_helper.h>
@@ -24,6 +25,7 @@ struct lg_ld070wx3 {
 	struct mipi_dsi_device *dsi;
 
 	struct regulator_bulk_data *supplies;
+	enum drm_panel_orientation orientation;
 };
 
 static inline struct lg_ld070wx3 *to_lg_ld070wx3(struct drm_panel *panel)
@@ -110,10 +112,18 @@ static int lg_ld070wx3_get_modes(struct drm_panel *panel,
 	return drm_connector_helper_get_modes_fixed(connector, &lg_ld070wx3_mode);
 }
 
+static enum drm_panel_orientation lg_ld070wx3_get_orientation(struct drm_panel *panel)
+{
+	struct lg_ld070wx3 *priv = to_lg_ld070wx3(panel);
+
+	return priv->orientation;
+}
+
 static const struct drm_panel_funcs lg_ld070wx3_panel_funcs = {
 	.prepare = lg_ld070wx3_prepare,
 	.unprepare = lg_ld070wx3_unprepare,
 	.get_modes = lg_ld070wx3_get_modes,
+	.get_orientation = lg_ld070wx3_get_orientation,
 };
 
 static int lg_ld070wx3_probe(struct mipi_dsi_device *dsi)
@@ -133,6 +143,10 @@ static int lg_ld070wx3_probe(struct mipi_dsi_device *dsi)
 	if (ret < 0)
 		return dev_err_probe(dev, ret, "failed to get supplies\n");
 
+	ret = drm_of_get_panel_orientation(dev->of_node, &priv->orientation);
+	if (ret)
+		return dev_err_probe(dev, ret, "failed to get orientation\n");
+
 	priv->dsi = dsi;
 	mipi_dsi_set_drvdata(dsi, priv);
 
Signature · 1 line
2.53.0