summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/panel/panel-edp.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2022-06-24 10:29:53 +1000
committerDave Airlie <airlied@redhat.com>2022-06-24 12:07:07 +1000
commit0936de1e96d6cbcd3d0ede8f31b1c3e6570dad2e (patch)
tree18a118445b0b63ea94556897f9b6c3696458e794 /drivers/gpu/drm/panel/panel-edp.c
parent0a2af0bd6e48775646dea5f3524a52a74afae7e0 (diff)
parent009a3a52791f31c57d755a73f6bc66fbdd8bd76c (diff)
Merge tag 'drm-misc-next-2022-06-23' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
drm-misc-next for v5.20: UAPI Changes: * media: Add various RGB666 and RGB888 format constants Cross-subsystem Changes: * media: Documentation Core Changes: * aperture: Fix segfault during hot-unplug * dp: Support waiting for HDP signal, plus driver updates; Port-validation fixes * fbcon: Improve scrolling performance; Sanitize input * Clean up <drm/drm_crtc.h> Driver Changes: * amdgpu: Cleanups * bridge: Add support for i.MX8qxp and i.MX8qm; anx7625: DPI fixes; tc358775: Fix clock settings; ti-sn65dsi83: Allow GPIO to sleep * panel: Set orientation from panel, plus driver updates * Several small cleanups Signed-off-by: Dave Airlie <airlied@redhat.com> From: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patchwork.freedesktop.org/patch/msgid/YrQeAAVvQ6jxu2dl@linux-uq9g
Diffstat (limited to 'drivers/gpu/drm/panel/panel-edp.c')
-rw-r--r--drivers/gpu/drm/panel/panel-edp.c47
1 files changed, 36 insertions, 11 deletions
diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c
index c96014464355..16bdcd83d550 100644
--- a/drivers/gpu/drm/panel/panel-edp.c
+++ b/drivers/gpu/drm/panel/panel-edp.c
@@ -39,6 +39,7 @@
#include <drm/display/drm_dp_helper.h>
#include <drm/drm_crtc.h>
#include <drm/drm_device.h>
+#include <drm/drm_edid.h>
#include <drm/drm_panel.h>
/**
@@ -417,6 +418,11 @@ static int panel_edp_get_hpd_gpio(struct device *dev, struct panel_edp *p)
return 0;
}
+static bool panel_edp_can_read_hpd(struct panel_edp *p)
+{
+ return !p->no_hpd && (p->hpd_gpio || (p->aux && p->aux->wait_hpd_asserted));
+}
+
static int panel_edp_prepare_once(struct panel_edp *p)
{
struct device *dev = p->base.dev;
@@ -441,17 +447,21 @@ static int panel_edp_prepare_once(struct panel_edp *p)
if (delay)
msleep(delay);
- if (p->hpd_gpio) {
+ if (panel_edp_can_read_hpd(p)) {
if (p->desc->delay.hpd_absent)
hpd_wait_us = p->desc->delay.hpd_absent * 1000UL;
else
hpd_wait_us = 2000000;
- err = readx_poll_timeout(gpiod_get_value_cansleep, p->hpd_gpio,
- hpd_asserted, hpd_asserted,
- 1000, hpd_wait_us);
- if (hpd_asserted < 0)
- err = hpd_asserted;
+ if (p->hpd_gpio) {
+ err = readx_poll_timeout(gpiod_get_value_cansleep,
+ p->hpd_gpio, hpd_asserted,
+ hpd_asserted, 1000, hpd_wait_us);
+ if (hpd_asserted < 0)
+ err = hpd_asserted;
+ } else {
+ err = p->aux->wait_hpd_asserted(p->aux, hpd_wait_us);
+ }
if (err) {
if (err != -ETIMEDOUT)
@@ -532,18 +542,22 @@ static int panel_edp_enable(struct drm_panel *panel)
/*
* If there is a "prepare_to_enable" delay then that's supposed to be
* the delay from HPD going high until we can turn the backlight on.
- * However, we can only count this if HPD is handled by the panel
- * driver, not if it goes to a dedicated pin on the controller.
+ * However, we can only count this if HPD is readable by the panel
+ * driver.
+ *
* If we aren't handling the HPD pin ourselves then the best we
* can do is assume that HPD went high immediately before we were
- * called (and link training took zero time).
+ * called (and link training took zero time). Note that "no-hpd"
+ * actually counts as handling HPD ourselves since we're doing the
+ * worst case delay (in prepare) ourselves.
*
* NOTE: if we ever end up in this "if" statement then we're
* guaranteed that the panel_edp_wait() call below will do no delay.
* It already handles that case, though, so we don't need any special
* code for it.
*/
- if (p->desc->delay.prepare_to_enable && !p->hpd_gpio && !p->no_hpd)
+ if (p->desc->delay.prepare_to_enable &&
+ !panel_edp_can_read_hpd(p) && !p->no_hpd)
delay = max(delay, p->desc->delay.prepare_to_enable);
if (delay)
@@ -586,7 +600,10 @@ static int panel_edp_get_modes(struct drm_panel *panel,
else if (!num)
dev_warn(p->base.dev, "No display modes\n");
- /* set up connector's "panel orientation" property */
+ /*
+ * TODO: Remove once all drm drivers call
+ * drm_connector_set_orientation_from_panel()
+ */
drm_connector_set_panel_orientation(connector, p->orientation);
return num;
@@ -609,6 +626,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 +661,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,
};