@@ -67,6 +67,11 @@ static LIST_HEAD(bridge_list);
* drm_bridge_add - add the given bridge to the global bridge list
*
* @bridge: bridge control structure
+ *
+ * Drivers shall call drm_bridge_init() prior to adding the bridge to the list.
+ * Before deleting a bridge (usually when the driver is unbound from the
+ * device), drivers shall call drm_bridge_remove() to remove it from the global
+ * list.
*/
void drm_bridge_add(struct drm_bridge *bridge)
{
@@ -89,6 +94,31 @@ void drm_bridge_remove(struct drm_bridge *bridge)
}
EXPORT_SYMBOL(drm_bridge_remove);
+/**
+ * drm_bridge_init - initialize a drm_bridge structure
+ *
+ * @bridge: bridge control structure
+ * @dev: device associated with this drm_bridge
+ * @funcs: control functions
+ * @timings: timing specification for the bridge; optional (may be NULL)
+ */
+void drm_bridge_init(struct drm_bridge *bridge, struct device *dev,
+ const struct drm_bridge_funcs *funcs,
+ const struct drm_bridge_timings *timings)
+{
+ WARN_ON(!funcs || !dev);
+
+ bridge->encoder = NULL;
+ INIT_LIST_HEAD(&bridge->chain_node);
+
+#ifdef CONFIG_OF
+ bridge->of_node = dev->of_node;
+#endif
+ bridge->timings = timings;
+ bridge->funcs = funcs;
+}
+EXPORT_SYMBOL(drm_bridge_init);
+
/**
* drm_bridge_attach - attach the bridge to an encoder's chain
*
@@ -378,6 +378,15 @@ struct drm_bridge_timings {
/**
* struct drm_bridge - central DRM bridge control structure
+ *
+ * Bridge drivers shall call drm_bridge_init() to initialize a drm_bridge
+ * structure, and then register it with drm_bridge_add().
+ *
+ * Users of bridges link a bridge driver into their overall display output
+ * pipeline by calling drm_bridge_attach().
+ *
+ * Modular drivers in OF systems can query the list of registered bridges
+ * with of_drm_find_bridge().
*/
struct drm_bridge {
/** @encoder: encoder to which this bridge is connected */
@@ -402,6 +411,9 @@ struct drm_bridge {
void drm_bridge_add(struct drm_bridge *bridge);
void drm_bridge_remove(struct drm_bridge *bridge);
+void drm_bridge_init(struct drm_bridge *bridge, struct device *dev,
+ const struct drm_bridge_funcs *funcs,
+ const struct drm_bridge_timings *timings);
struct drm_bridge *of_drm_find_bridge(struct device_node *np);
int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge,
struct drm_bridge *previous);