Lines Matching defs:bridge
45 * A bridge is always attached to a single &drm_encoder at a time, but can be
46 * either connected to it directly, or through an intermediate bridge::
48 * encoder ---> bridge B ---> bridge A
50 * Here, the output of the encoder feeds to bridge B, and that furthers feeds to
51 * bridge A.
53 * The driver using the bridge is responsible to make the associations between
88 * drm_bridge_add - add the given bridge to the global bridge list
90 * @bridge: bridge control structure
92 void drm_bridge_add(struct drm_bridge *bridge)
95 list_add_tail(&bridge->list, &bridge_list);
101 * drm_bridge_remove - remove the given bridge from the global bridge list
103 * @bridge: bridge control structure
105 void drm_bridge_remove(struct drm_bridge *bridge)
108 list_del_init(&bridge->list);
114 * drm_bridge_attach - attach the bridge to an encoder's chain
117 * @bridge: bridge to attach
118 * @previous: previous bridge in the chain (optional)
120 * Called by a kms driver to link the bridge to an encoder's chain. The previous
121 * argument specifies the previous bridge in the chain. If NULL, the bridge is
123 * previous bridge's output.
125 * If non-NULL the previous bridge must be already attached by a call to this
135 int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge,
140 if (!encoder || !bridge)
146 if (bridge->dev)
149 bridge->dev = encoder->dev;
150 bridge->encoder = encoder;
153 list_add(&bridge->chain_node, &previous->chain_node);
155 list_add(&bridge->chain_node, &encoder->bridge_chain);
157 if (bridge->funcs->attach) {
158 ret = bridge->funcs->attach(bridge);
160 list_del(&bridge->chain_node);
161 bridge->dev = NULL;
162 bridge->encoder = NULL;
171 void drm_bridge_detach(struct drm_bridge *bridge)
173 if (WARN_ON(!bridge))
176 if (WARN_ON(!bridge->dev))
179 if (bridge->funcs->detach)
180 bridge->funcs->detach(bridge);
182 list_del(&bridge->chain_node);
183 bridge->dev = NULL;
187 * DOC: bridge callbacks
189 * The &drm_bridge_funcs ops are populated by the bridge driver. The DRM
194 * For detailed specification of the bridge callbacks see &drm_bridge_funcs.
200 * @bridge: bridge control structure
201 * @mode: desired mode to be set for the bridge
202 * @adjusted_mode: updated mode that works for this bridge
205 * encoder chain, starting from the first bridge to the last.
207 * Note: the bridge passed should be the one closest to the encoder
212 bool drm_bridge_chain_mode_fixup(struct drm_bridge *bridge,
218 if (!bridge)
221 encoder = bridge->encoder;
222 list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) {
223 if (!bridge->funcs->mode_fixup)
226 if (!bridge->funcs->mode_fixup(bridge, mode, adjusted_mode))
237 * @bridge: bridge control structure
241 * chain, starting from the first bridge to the last. If at least one bridge
244 * Note: the bridge passed should be the one closest to the encoder.
250 drm_bridge_chain_mode_valid(struct drm_bridge *bridge,
255 if (!bridge)
258 encoder = bridge->encoder;
259 list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) {
262 if (!bridge->funcs->mode_valid)
265 ret = bridge->funcs->mode_valid(bridge, mode);
276 * @bridge: bridge control structure
279 * chain, starting from the last bridge to the first. These are called before
282 * Note: the bridge passed should be the one closest to the encoder
284 void drm_bridge_chain_disable(struct drm_bridge *bridge)
289 if (!bridge)
292 encoder = bridge->encoder;
297 if (iter == bridge)
306 * @bridge: bridge control structure
309 * encoder chain, starting from the first bridge to the last. These are called
312 * Note: the bridge passed should be the one closest to the encoder
314 void drm_bridge_chain_post_disable(struct drm_bridge *bridge)
318 if (!bridge)
321 encoder = bridge->encoder;
322 list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) {
323 if (bridge->funcs->post_disable)
324 bridge->funcs->post_disable(bridge);
332 * @bridge: bridge control structure
337 * encoder chain, starting from the first bridge to the last.
339 * Note: the bridge passed should be the one closest to the encoder
341 void drm_bridge_chain_mode_set(struct drm_bridge *bridge,
347 if (!bridge)
350 encoder = bridge->encoder;
351 list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) {
352 if (bridge->funcs->mode_set)
353 bridge->funcs->mode_set(bridge, mode, adjusted_mode);
361 * @bridge: bridge control structure
364 * chain, starting from the last bridge to the first. These are called
367 * Note: the bridge passed should be the one closest to the encoder
369 void drm_bridge_chain_pre_enable(struct drm_bridge *bridge)
374 if (!bridge)
377 encoder = bridge->encoder;
387 * @bridge: bridge control structure
390 * chain, starting from the first bridge to the last. These are called
393 * Note that the bridge passed should be the one closest to the encoder
395 void drm_bridge_chain_enable(struct drm_bridge *bridge)
399 if (!bridge)
402 encoder = bridge->encoder;
403 list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) {
404 if (bridge->funcs->enable)
405 bridge->funcs->enable(bridge);
412 * @bridge: bridge control structure
417 * starting from the last bridge to the first. These are called before calling
420 * Note: the bridge passed should be the one closest to the encoder
422 void drm_atomic_bridge_chain_disable(struct drm_bridge *bridge,
428 if (!bridge)
431 encoder = bridge->encoder;
438 if (iter == bridge)
447 * @bridge: bridge control structure
452 * starting from the first bridge to the last. These are called after completing
455 * Note: the bridge passed should be the one closest to the encoder
457 void drm_atomic_bridge_chain_post_disable(struct drm_bridge *bridge,
462 if (!bridge)
465 encoder = bridge->encoder;
466 list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) {
467 if (bridge->funcs->atomic_post_disable)
468 bridge->funcs->atomic_post_disable(bridge, old_state);
469 else if (bridge->funcs->post_disable)
470 bridge->funcs->post_disable(bridge);
478 * @bridge: bridge control structure
483 * starting from the last bridge to the first. These are called before calling
486 * Note: the bridge passed should be the one closest to the encoder
488 void drm_atomic_bridge_chain_pre_enable(struct drm_bridge *bridge,
494 if (!bridge)
497 encoder = bridge->encoder;
504 if (iter == bridge)
512 * @bridge: bridge control structure
517 * starting from the first bridge to the last. These are called after completing
520 * Note: the bridge passed should be the one closest to the encoder
522 void drm_atomic_bridge_chain_enable(struct drm_bridge *bridge,
527 if (!bridge)
530 encoder = bridge->encoder;
531 list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) {
532 if (bridge->funcs->atomic_enable)
533 bridge->funcs->atomic_enable(bridge, old_state);
534 else if (bridge->funcs->enable)
535 bridge->funcs->enable(bridge);
542 * of_drm_find_bridge - find the bridge corresponding to the device node in
543 * the global bridge list
552 struct drm_bridge *bridge;
556 list_for_each_entry(bridge, &bridge_list, list) {
557 if (bridge->of_node == np) {
559 return bridge;
570 MODULE_DESCRIPTION("DRM bridge infrastructure");