summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_connector.c
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2018-06-28 16:13:13 +0300
committerVille Syrjälä <ville.syrjala@linux.intel.com>2018-07-05 16:52:08 +0300
commit38cb8d96933eb07231073efdcd24a6ffa43b23e6 (patch)
tree218c5e1755d7b4ddf054a2a419cccb4567266371 /drivers/gpu/drm/drm_connector.c
parent7b71ca249b265fe69ab3152a15bc6c305554a7da (diff)
downloadlinux-38cb8d96933eb07231073efdcd24a6ffa43b23e6.tar.xz
drm: Add drm_connector_has_possible_encoder()
Add a small helper for checking whether a connector and encoder are associated with each other. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180628131315.14156-8-ville.syrjala@linux.intel.com Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/drm_connector.c')
-rw-r--r--drivers/gpu/drm/drm_connector.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 7387c0377e51..5ada0640de5a 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -331,6 +331,29 @@ int drm_mode_connector_attach_encoder(struct drm_connector *connector,
}
EXPORT_SYMBOL(drm_mode_connector_attach_encoder);
+/**
+ * drm_connector_has_possible_encoder - check if the connector and encoder are assosicated with each other
+ * @connector: the connector
+ * @encoder: the encoder
+ *
+ * Returns:
+ * True if @encoder is one of the possible encoders for @connector.
+ */
+bool drm_connector_has_possible_encoder(struct drm_connector *connector,
+ struct drm_encoder *encoder)
+{
+ struct drm_encoder *enc;
+ int i;
+
+ drm_connector_for_each_possible_encoder(connector, enc, i) {
+ if (enc == encoder)
+ return true;
+ }
+
+ return false;
+}
+EXPORT_SYMBOL(drm_connector_has_possible_encoder);
+
static void drm_mode_remove(struct drm_connector *connector,
struct drm_display_mode *mode)
{