[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190630203614.5290-4-robdclark@gmail.com>
Date: Sun, 30 Jun 2019 13:36:07 -0700
From: Rob Clark <robdclark@...il.com>
To: dri-devel@...ts.freedesktop.org, linux-arm-msm@...r.kernel.org
Cc: freedreno@...ts.freedesktop.org, aarch64-laptops@...ts.linaro.org,
Rob Clark <robdclark@...omium.org>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <maxime.ripard@...tlin.com>,
Sean Paul <sean@...rly.run>, David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>, linux-kernel@...r.kernel.org
Subject: [PATCH 3/4] drm: add helper to lookup panel-id
From: Rob Clark <robdclark@...omium.org>
Finds the panel-id from chosen, so drivers can use this to pick the
correct endpoint when looking up panel.
Signed-off-by: Rob Clark <robdclark@...omium.org>
---
drivers/gpu/drm/drm_of.c | 21 +++++++++++++++++++++
include/drm/drm_of.h | 7 +++++++
2 files changed, 28 insertions(+)
diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c
index 43d89dd59c6b..3ba65750048b 100644
--- a/drivers/gpu/drm/drm_of.c
+++ b/drivers/gpu/drm/drm_of.c
@@ -279,3 +279,24 @@ int drm_of_find_panel_or_bridge(const struct device_node *np,
return ret;
}
EXPORT_SYMBOL_GPL(drm_of_find_panel_or_bridge);
+
+/**
+ * drm_of_find_panel_id - return id of panel from chosen
+ *
+ * Returns the panel id, or zero if none specified
+ */
+int drm_of_find_panel_id(void)
+{
+ struct device_node *np = NULL;
+ u32 panel_id;
+
+ np = of_find_node_by_path("/chosen");
+ if (!np)
+ return 0;
+
+ if (of_property_read_u32(np, "panel-id", &panel_id))
+ return 0;
+
+ return panel_id;
+}
+EXPORT_SYMBOL_GPL(drm_of_find_panel_id);
diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h
index ead34ab5ca4e..6cd2d59cb1db 100644
--- a/include/drm/drm_of.h
+++ b/include/drm/drm_of.h
@@ -35,6 +35,8 @@ int drm_of_find_panel_or_bridge(const struct device_node *np,
int port, int endpoint,
struct drm_panel **panel,
struct drm_bridge **bridge);
+int drm_of_find_panel_id(void);
+
#else
static inline uint32_t drm_of_crtc_port_mask(struct drm_device *dev,
struct device_node *port)
@@ -77,6 +79,11 @@ static inline int drm_of_find_panel_or_bridge(const struct device_node *np,
{
return -EINVAL;
}
+
+static inline int drm_of_find_panel_id(void)
+{
+ return 0;
+}
#endif
/*
--
2.20.1
Powered by blists - more mailing lists