drivers/gpu/drm/drm_bridge.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/drm_bridge.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/drm_bridge.c- Extension
.c- Size
- 57653 bytes
- Lines
- 1730
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/debugfs.hlinux/err.hlinux/export.hlinux/media-bus-format.hlinux/module.hlinux/mutex.hlinux/srcu.hdrm/drm_atomic_state_helper.hdrm/drm_bridge.hdrm/drm_debugfs.hdrm/drm_edid.hdrm/drm_encoder.hdrm/drm_file.hdrm/drm_of.hdrm/drm_print.hdrm_crtc_internal.h
Detected Declarations
function drm_bridge_exitfunction drm_bridge_exitfunction drm_bridge_enterfunction __drm_bridge_freefunction drm_bridge_clear_and_putfunction drm_bridge_clear_and_putfunction drm_bridge_putfunction of_drm_find_and_get_bridgefunction drm_bridge_remove_voidfunction drm_bridge_addfunction drm_bridge_removefunction drm_bridge_atomic_duplicate_priv_statefunction drm_bridge_atomic_destroy_priv_statefunction drm_bridge_atomic_create_priv_statefunction drm_bridge_is_atomicfunction drm_bridge_addfunction drm_bridge_detachfunction internalsfunction drm_for_each_bridge_in_chain_fromfunction drm_bridge_chain_mode_setfunction drm_atomic_bridge_chain_disablefunction drm_atomic_bridge_call_post_disablefunction drm_atomic_bridge_chain_post_disablefunction list_for_each_entry_fromfunction list_for_each_entry_from_reversefunction drm_atomic_bridge_call_pre_enablefunction drm_atomic_bridge_chain_pre_enablefunction list_for_each_entry_from_reversefunction list_for_each_entry_fromfunction drm_atomic_bridge_chain_enablefunction drm_for_each_bridge_in_chain_fromfunction drm_atomic_bridge_checkfunction select_bus_fmt_recursivefunction gracefullyfunction drm_atomic_bridge_propagate_bus_flagsfunction drm_atomic_bridge_chain_checkfunction list_for_each_entry_reversefunction drm_bridge_detectfunction drm_bridge_get_modesfunction drm_bridge_hpd_disablefunction drm_bridge_hpd_enablefunction drm_bridge_hpd_enablefunction scoped_guardfunction drm_bridge_putfunction drm_bridge_debugfs_show_bridgefunction allbridges_showfunction encoder_bridges_showfunction drm_bridge_debugfs_params
Annotated Snippet
if (iter->funcs->atomic_disable) {
iter->funcs->atomic_disable(iter, state);
} else if (iter->funcs->disable) {
iter->funcs->disable(iter);
}
if (iter == bridge)
break;
}
mutex_unlock(&encoder->bridge_chain_mutex);
}
EXPORT_SYMBOL(drm_atomic_bridge_chain_disable);
static void drm_atomic_bridge_call_post_disable(struct drm_bridge *bridge,
struct drm_atomic_commit *state)
{
if (state && bridge->funcs->atomic_post_disable)
bridge->funcs->atomic_post_disable(bridge, state);
else if (bridge->funcs->post_disable)
bridge->funcs->post_disable(bridge);
}
/**
* drm_atomic_bridge_chain_post_disable - cleans up after disabling all bridges
* in the encoder chain
* @bridge: bridge control structure
* @state: atomic state being committed
*
* Calls &drm_bridge_funcs.atomic_post_disable (falls back on
* &drm_bridge_funcs.post_disable) op for all the bridges in the encoder chain,
* starting from the first bridge to the last. These are called after completing
* &drm_encoder_helper_funcs.atomic_disable
*
* If a bridge sets @pre_enable_prev_first, then the @post_disable for that
* bridge will be called before the previous one to reverse the @pre_enable
* calling direction.
*
* Example:
* Bridge A ---> Bridge B ---> Bridge C ---> Bridge D ---> Bridge E
*
* With pre_enable_prev_first flag enable in Bridge B, D, E then the resulting
* @post_disable order would be,
* Bridge B, Bridge A, Bridge E, Bridge D, Bridge C.
*
* Note: the bridge passed should be the one closest to the encoder
*/
void drm_atomic_bridge_chain_post_disable(struct drm_bridge *bridge,
struct drm_atomic_commit *state)
{
struct drm_encoder *encoder;
struct drm_bridge *next, *limit;
if (!bridge)
return;
encoder = bridge->encoder;
mutex_lock(&encoder->bridge_chain_mutex);
list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) {
limit = NULL;
if (!list_is_last(&bridge->chain_node, &encoder->bridge_chain)) {
next = list_next_entry(bridge, chain_node);
if (next->pre_enable_prev_first) {
/* next bridge had requested that prev
* was enabled first, so disabled last
*/
limit = next;
/* Find the next bridge that has NOT requested
* prev to be enabled first / disabled last
*/
list_for_each_entry_from(next, &encoder->bridge_chain,
chain_node) {
if (!next->pre_enable_prev_first) {
next = list_prev_entry(next, chain_node);
limit = next;
break;
}
if (list_is_last(&next->chain_node,
&encoder->bridge_chain)) {
limit = next;
break;
}
}
/* Call these bridges in reverse order */
list_for_each_entry_from_reverse(next, &encoder->bridge_chain,
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/err.h`, `linux/export.h`, `linux/media-bus-format.h`, `linux/module.h`, `linux/mutex.h`, `linux/srcu.h`, `drm/drm_atomic_state_helper.h`.
- Detected declarations: `function drm_bridge_exit`, `function drm_bridge_exit`, `function drm_bridge_enter`, `function __drm_bridge_free`, `function drm_bridge_clear_and_put`, `function drm_bridge_clear_and_put`, `function drm_bridge_put`, `function of_drm_find_and_get_bridge`, `function drm_bridge_remove_void`, `function drm_bridge_add`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.