drivers/gpu/drm/drm_connector.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/drm_connector.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/drm_connector.c- Extension
.c- Size
- 123052 bytes
- Lines
- 3657
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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
drm/drm_auth.hdrm/drm_connector.hdrm/drm_drv.hdrm/drm_edid.hdrm/drm_encoder.hdrm/drm_file.hdrm/drm_managed.hdrm/drm_panel.hdrm/drm_print.hdrm/drm_privacy_screen_consumer.hdrm/drm_sysfs.hdrm/drm_utils.hlinux/export.hlinux/platform_device.hlinux/property.hlinux/uaccess.hvideo/cmdline.hdrm_crtc_internal.hdrm_internal.h
Detected Declarations
struct drm_conn_prop_enum_listfunction drm_connector_ida_initfunction drm_connector_ida_destroyfunction drm_connector_get_cmdline_modefunction drm_connector_freefunction drm_connector_free_work_fnfunction llist_for_each_entry_safefunction drm_connector_init_onlyfunction drm_connector_addfunction drm_connector_removefunction drm_connector_init_and_addfunction drm_connector_cleanupfunction devm_kzallocfunction drm_connector_cleanupfunction drm_connector_cleanup_actionfunction drm_connector_cleanupfunction drm_connector_cleanupfunction drm_connector_attach_edid_propertyfunction drm_connector_attach_encoderfunction drm_connector_has_possible_encoderfunction drm_mode_removefunction drm_connector_cec_phys_addr_invalidatefunction drm_connector_cec_phys_addr_setfunction drm_connector_cleanupfunction drm_dev_registerfunction drm_connector_dynamic_initfunction connectorsfunction drm_connector_unregister_allfunction drm_connector_register_allfunction drm_connector_list_iter_endfunction __drm_connector_put_safefunction drm_connector_list_iter_nextfunction drm_connector_list_iter_endfunction drm_display_info_set_bus_formatsfunction drm_get_tv_mode_from_namefunction drm_hdmi_connector_get_broadcast_rgb_namefunction drm_hdmi_connector_get_output_format_namefunction drm_mode_create_tv_margin_propertiesfunction drm_mode_create_dvi_i_propertiesfunction drm_connector_attach_dp_subconnector_propertyfunction RGBfunction drm_connector_attach_tv_margin_propertiesfunction drm_mode_create_tv_properties_legacyfunction modefunction drm_mode_create_tv_propertiesfunction drm_connector_attach_scaling_mode_propertyfunction drm_connector_attach_vrr_capable_propertyfunction drm_mode_create_scaling_mode_property
Annotated Snippet
struct drm_conn_prop_enum_list {
int type;
const char *name;
struct ida ida;
};
/*
* Connector and encoder types.
*/
static struct drm_conn_prop_enum_list drm_connector_enum_list[] = {
{ DRM_MODE_CONNECTOR_Unknown, "Unknown" },
{ DRM_MODE_CONNECTOR_VGA, "VGA" },
{ DRM_MODE_CONNECTOR_DVII, "DVI-I" },
{ DRM_MODE_CONNECTOR_DVID, "DVI-D" },
{ DRM_MODE_CONNECTOR_DVIA, "DVI-A" },
{ DRM_MODE_CONNECTOR_Composite, "Composite" },
{ DRM_MODE_CONNECTOR_SVIDEO, "SVIDEO" },
{ DRM_MODE_CONNECTOR_LVDS, "LVDS" },
{ DRM_MODE_CONNECTOR_Component, "Component" },
{ DRM_MODE_CONNECTOR_9PinDIN, "DIN" },
{ DRM_MODE_CONNECTOR_DisplayPort, "DP" },
{ DRM_MODE_CONNECTOR_HDMIA, "HDMI-A" },
{ DRM_MODE_CONNECTOR_HDMIB, "HDMI-B" },
{ DRM_MODE_CONNECTOR_TV, "TV" },
{ DRM_MODE_CONNECTOR_eDP, "eDP" },
{ DRM_MODE_CONNECTOR_VIRTUAL, "Virtual" },
{ DRM_MODE_CONNECTOR_DSI, "DSI" },
{ DRM_MODE_CONNECTOR_DPI, "DPI" },
{ DRM_MODE_CONNECTOR_WRITEBACK, "Writeback" },
{ DRM_MODE_CONNECTOR_SPI, "SPI" },
{ DRM_MODE_CONNECTOR_USB, "USB" },
};
void drm_connector_ida_init(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(drm_connector_enum_list); i++)
ida_init(&drm_connector_enum_list[i].ida);
}
void drm_connector_ida_destroy(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(drm_connector_enum_list); i++)
ida_destroy(&drm_connector_enum_list[i].ida);
}
/**
* drm_get_connector_type_name - return a string for connector type
* @type: The connector type (DRM_MODE_CONNECTOR_*)
*
* Returns: the name of the connector type, or NULL if the type is not valid.
*/
const char *drm_get_connector_type_name(unsigned int type)
{
if (type < ARRAY_SIZE(drm_connector_enum_list))
return drm_connector_enum_list[type].name;
return NULL;
}
EXPORT_SYMBOL(drm_get_connector_type_name);
/**
* drm_connector_get_cmdline_mode - reads the user's cmdline mode
* @connector: connector to query
*
* The kernel supports per-connector configuration of its consoles through
* use of the video= parameter. This function parses that option and
* extracts the user's specified mode (or enable/disable status) for a
* particular connector. This is typically only used during the early fbdev
* setup.
*/
static void drm_connector_get_cmdline_mode(struct drm_connector *connector)
{
struct drm_cmdline_mode *mode = &connector->cmdline_mode;
const char *option;
option = video_get_options(connector->name);
if (!option)
return;
if (!drm_mode_parse_command_line_for_connector(option,
connector,
mode))
return;
if (mode->force) {
DRM_INFO("forcing %s connector %s\n", connector->name,
Annotation
- Immediate include surface: `drm/drm_auth.h`, `drm/drm_connector.h`, `drm/drm_drv.h`, `drm/drm_edid.h`, `drm/drm_encoder.h`, `drm/drm_file.h`, `drm/drm_managed.h`, `drm/drm_panel.h`.
- Detected declarations: `struct drm_conn_prop_enum_list`, `function drm_connector_ida_init`, `function drm_connector_ida_destroy`, `function drm_connector_get_cmdline_mode`, `function drm_connector_free`, `function drm_connector_free_work_fn`, `function llist_for_each_entry_safe`, `function drm_connector_init_only`, `function drm_connector_add`, `function drm_connector_remove`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: integration implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.