[PATCH v2 15/21] drm/bridge: Add the drm_bridge_chain_get_prev_bridge() helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Will be useful for bridge drivers that want to do bus format
negotiation with their neighbours.

Signed-off-by: Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx>
---
Changes in v2:
* Fix the kerneldoc
* Drop the !bridge || !bridge->encoder check
---
 drivers/gpu/drm/drm_bridge.c | 17 +++++++++++++++++
 include/drm/drm_bridge.h     |  2 ++
 2 files changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
index 7f7e0ea5b06c..9c74b285da9d 100644
--- a/drivers/gpu/drm/drm_bridge.c
+++ b/drivers/gpu/drm/drm_bridge.c
@@ -238,6 +238,23 @@ drm_bridge_chain_get_next_bridge(struct drm_bridge *bridge)
 }
 EXPORT_SYMBOL(drm_bridge_chain_get_next_bridge);
 
+/**
+ * drm_bridge_chain_get_prev_bridge() - Get the previous bridge in the chain
+ * @bridge: bridge object
+ *
+ * RETURNS:
+ * the previous bridge in the chain, or NULL if @bridge is the last.
+ */
+struct drm_bridge *
+drm_bridge_chain_get_prev_bridge(struct drm_bridge *bridge)
+{
+	if (list_is_first(&bridge->chain_node, &bridge->encoder->bridge_chain))
+		return NULL;
+
+	return list_prev_entry(bridge, chain_node);
+}
+EXPORT_SYMBOL(drm_bridge_chain_get_prev_bridge);
+
 /**
  * DOC: bridge callbacks
  *
diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
index 7fdce6dc5f26..95dc58c3a4e8 100644
--- a/include/drm/drm_bridge.h
+++ b/include/drm/drm_bridge.h
@@ -521,6 +521,8 @@ int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge,
 
 struct drm_bridge *
 drm_bridge_chain_get_next_bridge(struct drm_bridge *bridge);
+struct drm_bridge *
+drm_bridge_chain_get_prev_bridge(struct drm_bridge *bridge);
 bool drm_bridge_chain_mode_fixup(struct drm_bridge *bridge,
 				 const struct drm_display_mode *mode,
 				 struct drm_display_mode *adjusted_mode);
-- 
2.21.0

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux