[PATCH v3 4/4] drm/panel: clockworkpi-cwd686: Implement .get_orientation callback

Max Fierke
2022-09-18T03:45:09Z

Returns the panel's configured orientation

Signed-off-by: Max Fierke <max@maxfierke.com>
---
Changes in v3:
- no changes

Changes in v2:
- this was added as .get_orientation is now available in drm-misc-next since v1

drivers/gpu/drm/panel/panel-clockworkpi-cwd686.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-clockworkpi-cwd686.c b/drivers/gpu/drm/panel/panel-clockworkpi-cwd686.c
index 87d20d784596..2c433a458c8b 100644
--- a/drivers/gpu/drm/panel/panel-clockworkpi-cwd686.c
+++ b/drivers/gpu/drm/panel/panel-clockworkpi-cwd686.c
@@ -340,7 +340,10 @@ static int cwd686_get_modes(struct drm_panel *panel, struct drm_connector *conne
drm_mode_set_name(mode);
mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;

- /* Set up connector's "panel orientation" property */
+ /*
+ * TODO: Remove once all drm drivers call
+ * drm_connector_set_orientation_from_panel()
+ */
drm_connector_set_panel_orientation(connector, ctx->orientation);

drm_mode_probed_add(connector, mode);
@@ -348,10 +351,18 @@ static int cwd686_get_modes(struct drm_panel *panel, struct drm_connector *conne
return 1; /* Number of modes */
}

+static enum drm_panel_orientation cwd686_get_orientation(struct drm_panel *panel)
+{
+ struct cwd686 *ctx = panel_to_cwd686(panel);
+
+ return ctx->orientation;
+}
+
static const struct drm_panel_funcs cwd686_drm_funcs = {
.unprepare = cwd686_unprepare,
.prepare = cwd686_prepare,
.get_modes = cwd686_get_modes,
+ .get_orientation = cwd686_get_orientation,
};

static int cwd686_probe(struct mipi_dsi_device *dsi)
--
2.37.2