drivers/gpu/drm/bridge/display-connector.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/bridge/display-connector.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/bridge/display-connector.c- Extension
.c- Size
- 12906 bytes
- Lines
- 448
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/gpio/consumer.hlinux/i2c.hlinux/interrupt.hlinux/media-bus-format.hlinux/module.hlinux/mutex.hlinux/of.hlinux/platform_device.hlinux/regulator/consumer.hdrm/drm_atomic_helper.hdrm/drm_bridge.hdrm/drm_edid.h
Detected Declarations
struct display_connectorfunction to_display_connectorfunction display_connector_attachfunction display_connector_detectfunction display_connector_bridge_detectfunction drm_atomic_bridge_chain_select_bus_fmtsfunction MEDIA_BUS_FMT_FIXEDfunction display_connector_hpd_irqfunction display_connector_get_supplyfunction display_connector_probefunction display_connector_remove
Annotated Snippet
struct display_connector {
struct drm_bridge bridge;
struct gpio_desc *hpd_gpio;
int hpd_irq;
struct regulator *supply;
struct gpio_desc *ddc_en;
};
static inline struct display_connector *
to_display_connector(struct drm_bridge *bridge)
{
return container_of(bridge, struct display_connector, bridge);
}
static int display_connector_attach(struct drm_bridge *bridge,
struct drm_encoder *encoder,
enum drm_bridge_attach_flags flags)
{
return flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR ? 0 : -EINVAL;
}
static enum drm_connector_status display_connector_detect(struct drm_bridge *bridge)
{
struct display_connector *conn = to_display_connector(bridge);
if (conn->hpd_gpio) {
if (gpiod_get_value_cansleep(conn->hpd_gpio))
return connector_status_connected;
else
return connector_status_disconnected;
}
if (conn->bridge.ddc && drm_probe_ddc(conn->bridge.ddc))
return connector_status_connected;
switch (conn->bridge.type) {
case DRM_MODE_CONNECTOR_DVIA:
case DRM_MODE_CONNECTOR_DVID:
case DRM_MODE_CONNECTOR_DVII:
case DRM_MODE_CONNECTOR_HDMIA:
case DRM_MODE_CONNECTOR_HDMIB:
/*
* For DVI and HDMI connectors a DDC probe failure indicates
* that no cable is connected.
*/
return connector_status_disconnected;
case DRM_MODE_CONNECTOR_Composite:
case DRM_MODE_CONNECTOR_SVIDEO:
case DRM_MODE_CONNECTOR_VGA:
default:
/*
* Composite and S-Video connectors have no other detection
* mean than the HPD GPIO. For VGA connectors, even if we have
* an I2C bus, we can't assume that the cable is disconnected
* if drm_probe_ddc fails, as some cables don't wire the DDC
* pins.
*/
return connector_status_unknown;
}
}
static enum drm_connector_status
display_connector_bridge_detect(struct drm_bridge *bridge, struct drm_connector *connector)
{
return display_connector_detect(bridge);
}
static const struct drm_edid *display_connector_edid_read(struct drm_bridge *bridge,
struct drm_connector *connector)
{
struct display_connector *conn = to_display_connector(bridge);
return drm_edid_read_ddc(connector, conn->bridge.ddc);
}
/*
* Since this bridge is tied to the connector, it acts like a passthrough,
* so concerning the output bus formats, either pass the bus formats from the
* previous bridge or return fallback data like done in the bridge function:
* drm_atomic_bridge_chain_select_bus_fmts().
* This supports negotiation if the bridge chain has all bits in place.
*/
static u32 *display_connector_get_output_bus_fmts(struct drm_bridge *bridge,
struct drm_bridge_state *bridge_state,
struct drm_crtc_state *crtc_state,
struct drm_connector_state *conn_state,
unsigned int *num_output_fmts)
Annotation
- Immediate include surface: `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/interrupt.h`, `linux/media-bus-format.h`, `linux/module.h`, `linux/mutex.h`, `linux/of.h`, `linux/platform_device.h`.
- Detected declarations: `struct display_connector`, `function to_display_connector`, `function display_connector_attach`, `function display_connector_detect`, `function display_connector_bridge_detect`, `function drm_atomic_bridge_chain_select_bus_fmts`, `function MEDIA_BUS_FMT_FIXED`, `function display_connector_hpd_irq`, `function display_connector_get_supply`, `function display_connector_probe`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.