drivers/gpu/drm/bridge/panel.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/bridge/panel.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/bridge/panel.c- Extension
.c- Size
- 16785 bytes
- Lines
- 552
- 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/export.hdrm/drm_atomic_helper.hdrm/drm_bridge.hdrm/drm_connector.hdrm/drm_encoder.hdrm/drm_managed.hdrm/drm_modeset_helper_vtables.hdrm/drm_of.hdrm/drm_panel.hdrm/drm_print.hdrm/drm_probe_helper.h
Detected Declarations
struct panel_bridgefunction drm_bridge_to_panel_bridgefunction drm_connector_to_panel_bridgefunction panel_bridge_connector_get_modesfunction panel_bridge_attachfunction panel_bridge_detachfunction panel_bridge_atomic_pre_enablefunction panel_bridge_atomic_enablefunction panel_bridge_atomic_disablefunction panel_bridge_atomic_post_disablefunction panel_bridge_get_modesfunction panel_bridge_debugfs_initfunction drm_bridge_is_panelfunction drm_of_find_panel_or_bridgefunction drm_panel_bridge_addfunction drm_panel_bridge_addfunction drm_panel_bridge_set_orientationfunction devm_drm_panel_bridge_releasefunction drm_panel_bridge_addfunction devm_drm_panel_bridge_addfunction drmm_drm_panel_bridge_releasefunction drm_panel_bridge_removeexport drm_bridge_is_panelexport drm_panel_bridge_addexport drm_panel_bridge_add_typedexport drm_panel_bridge_removeexport drm_panel_bridge_set_orientationexport devm_drm_panel_bridge_addexport devm_drm_panel_bridge_add_typedexport drmm_panel_bridge_addexport drm_panel_bridge_connectorexport devm_drm_of_get_bridgeexport drmm_of_get_bridge
Annotated Snippet
struct panel_bridge {
struct drm_bridge bridge;
struct drm_connector connector;
struct drm_panel *panel;
u32 connector_type;
};
static inline struct panel_bridge *
drm_bridge_to_panel_bridge(struct drm_bridge *bridge)
{
return container_of(bridge, struct panel_bridge, bridge);
}
static inline struct panel_bridge *
drm_connector_to_panel_bridge(struct drm_connector *connector)
{
return container_of(connector, struct panel_bridge, connector);
}
static int panel_bridge_connector_get_modes(struct drm_connector *connector)
{
struct panel_bridge *panel_bridge =
drm_connector_to_panel_bridge(connector);
return drm_panel_get_modes(panel_bridge->panel, connector);
}
static const struct drm_connector_helper_funcs
panel_bridge_connector_helper_funcs = {
.get_modes = panel_bridge_connector_get_modes,
};
static const struct drm_connector_funcs panel_bridge_connector_funcs = {
.reset = drm_atomic_helper_connector_reset,
.fill_modes = drm_helper_probe_single_connector_modes,
.destroy = drm_connector_cleanup,
.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
};
static int panel_bridge_attach(struct drm_bridge *bridge,
struct drm_encoder *encoder,
enum drm_bridge_attach_flags flags)
{
struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge);
struct drm_connector *connector = &panel_bridge->connector;
int ret;
if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)
return 0;
drm_connector_helper_add(connector,
&panel_bridge_connector_helper_funcs);
ret = drm_connector_init(bridge->dev, connector,
&panel_bridge_connector_funcs,
panel_bridge->connector_type);
if (ret) {
DRM_ERROR("Failed to initialize connector\n");
return ret;
}
drm_panel_bridge_set_orientation(connector, bridge);
drm_connector_attach_encoder(&panel_bridge->connector,
encoder);
if (bridge->dev->registered) {
if (connector->funcs->reset)
connector->funcs->reset(connector);
drm_connector_register(connector);
}
return 0;
}
static void panel_bridge_detach(struct drm_bridge *bridge)
{
struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge);
struct drm_connector *connector = &panel_bridge->connector;
/*
* Cleanup the connector if we know it was initialized.
*
* FIXME: This wouldn't be needed if the panel_bridge structure was
* allocated with drmm_kzalloc(). This might be tricky since the
* drm_device pointer can only be retrieved when the bridge is attached.
*/
if (connector->dev)
drm_connector_cleanup(connector);
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/export.h`, `drm/drm_atomic_helper.h`, `drm/drm_bridge.h`, `drm/drm_connector.h`, `drm/drm_encoder.h`, `drm/drm_managed.h`, `drm/drm_modeset_helper_vtables.h`.
- Detected declarations: `struct panel_bridge`, `function drm_bridge_to_panel_bridge`, `function drm_connector_to_panel_bridge`, `function panel_bridge_connector_get_modes`, `function panel_bridge_attach`, `function panel_bridge_detach`, `function panel_bridge_atomic_pre_enable`, `function panel_bridge_atomic_enable`, `function panel_bridge_atomic_disable`, `function panel_bridge_atomic_post_disable`.
- 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.