From: Maya Matuszczyk <maccraft123mc@gmail.com>
To: heiko@sntech.de, Jagan Teki <jagan@amarulasolutions.com>,
Thierry Reding <thierry.reding@gmail.com>,
Sam Ravnborg <sam@ravnborg.org>, David Airlie <airlied@gmail.com>,
Daniel Vetter <daniel@ffwll.ch>
Cc: linux-rockchip@lists.infradead.org,
Maya Matuszczyk <maccraft123mc@gmail.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 3/4] drm: panel: Add orientation support for st7701
Date: Mon, 13 Feb 2023 16:38:15 +0100 [thread overview]
Message-ID: <20230213153816.213526-4-maccraft123mc@gmail.com> (raw)
In-Reply-To: <20230213153816.213526-1-maccraft123mc@gmail.com>
Note that this patch is 'heavily inspired' by orientation support in driver
for Elida KD35T133 panel
Signed-off-by: Maya Matuszczyk <maccraft123mc@gmail.com>
---
drivers/gpu/drm/panel/panel-sitronix-st7701.c | 21 ++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7701.c b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
index 660c3f435008..c9ae5c456f41 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7701.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7701.c
@@ -135,6 +135,7 @@ struct st7701 {
struct regulator_bulk_data supplies[2];
struct gpio_desc *reset;
unsigned int sleep_delay;
+ enum drm_panel_orientation orientation;
};
static inline struct st7701 *panel_to_st7701(struct drm_panel *panel)
@@ -514,15 +515,29 @@ static int st7701_get_modes(struct drm_panel *panel,
connector->display_info.width_mm = desc_mode->width_mm;
connector->display_info.height_mm = desc_mode->height_mm;
+ /*
+ * TODO: Remove once all drm drivers call
+ * drm_connector_set_orientation_from_panel()
+ */
+ drm_connector_set_panel_orientation(connector, st7701->orientation);
+
return 1;
}
+static enum drm_panel_orientation st7701_get_orientation(struct drm_panel *panel)
+{
+ struct st7701 *st7701 = panel_to_st7701(panel);
+
+ return st7701->orientation;
+}
+
static const struct drm_panel_funcs st7701_funcs = {
.disable = st7701_disable,
.unprepare = st7701_unprepare,
.prepare = st7701_prepare,
.enable = st7701_enable,
.get_modes = st7701_get_modes,
+ .get_orientation = st7701_get_orientation,
};
static const struct drm_display_mode ts8550b_mode = {
@@ -733,7 +748,7 @@ static const struct drm_display_mode kd50t048a_mode = {
.hsync_end = 480 + 2 + 10,
.htotal = 480 + 2 + 10 + 2,
- .vdisplay = 854, // was: 854 12 2 60
+ .vdisplay = 854,
.vsync_start = 854 + 2,
.vsync_end = 854 + 2 + 2,
.vtotal = 854 + 2 + 2 + 17,
@@ -854,6 +869,10 @@ static int st7701_dsi_probe(struct mipi_dsi_device *dsi)
return PTR_ERR(st7701->reset);
}
+ ret = of_drm_get_panel_orientation(dsi->dev.of_node, &st7701->orientation);
+ if (ret < 0)
+ return dev_err_probe(&dsi->dev, ret, "Failed to get orientation\n");
+
drm_panel_init(&st7701->panel, &dsi->dev, &st7701_funcs,
DRM_MODE_CONNECTOR_DSI);
--
2.39.1
next prev parent reply other threads:[~2023-02-13 15:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230213153816.213526-1-maccraft123mc@gmail.com>
2023-02-13 15:38 ` [PATCH v2 1/4] dt-bindings: display: panel: sitronix,st7701: Add Elida KD50T048A Panel Maya Matuszczyk
2023-02-13 17:07 ` Krzysztof Kozlowski
2023-02-13 15:38 ` [PATCH v2 2/4] drm: panel: Add Elida KD50T048A to Sitronix ST7701 driver Maya Matuszczyk
2023-02-13 15:38 ` Maya Matuszczyk [this message]
2023-02-13 15:38 ` [PATCH v2 4/4] arm64: dts: rockchip: Add display support to Odroid Go Super Maya Matuszczyk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230213153816.213526-4-maccraft123mc@gmail.com \
--to=maccraft123mc@gmail.com \
--cc=airlied@gmail.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=heiko@sntech.de \
--cc=jagan@amarulasolutions.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=sam@ravnborg.org \
--cc=thierry.reding@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox