drivers/gpu/drm/drm_of.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/drm_of.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/drm_of.c- Extension
.c- Size
- 19081 bytes
- Lines
- 644
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/component.hlinux/export.hlinux/list.hlinux/media-bus-format.hlinux/of.hlinux/of_graph.hdrm/drm_bridge.hdrm/drm_crtc.hdrm/drm_device.hdrm/drm_encoder.hdrm/drm_mipi_dsi.hdrm/drm_of.hdrm/drm_panel.h
Detected Declarations
enum drm_of_lvds_pixelsfunction drm_of_crtc_port_maskfunction drm_for_each_crtcfunction drm_of_find_possible_crtcsfunction for_each_endpoint_of_nodefunction drm_of_component_match_addfunction drm_of_component_probefunction for_each_child_of_nodefunction drm_of_encoder_active_endpointfunction for_each_endpoint_of_nodefunction of_drm_get_bridge_by_endpointfunction drm_of_lvds_get_port_pixels_typefunction drm_of_lvds_get_remote_pixels_typefunction for_each_child_of_nodefunction drm_of_lvds_get_dual_link_pixel_orderfunction __drm_of_lvds_get_dual_link_pixel_orderfunction drm_of_lvds_get_dual_link_pixel_orderfunction drm_of_lvds_get_dual_link_pixel_order_sinkfunction drm_of_lvds_get_data_mappingfunction drm_of_get_data_lanes_countfunction drm_of_get_data_lanes_count_epfunction drm_of_get_data_lanes_count_remoteexport drm_of_crtc_port_maskexport drm_of_find_possible_crtcsexport drm_of_component_match_addexport drm_of_component_probeexport drm_of_encoder_active_endpointexport drm_of_find_panel_or_bridgeexport drm_of_lvds_get_dual_link_pixel_orderexport drm_of_lvds_get_dual_link_pixel_order_sinkexport drm_of_lvds_get_data_mappingexport drm_of_get_data_lanes_countexport drm_of_get_data_lanes_count_epexport drm_of_get_data_lanes_count_remoteexport drm_of_get_dsi_bus
Annotated Snippet
if (!remote_port) {
of_node_put(ep);
return 0;
}
possible_crtcs |= drm_of_crtc_port_mask(dev, remote_port);
of_node_put(remote_port);
}
return possible_crtcs;
}
EXPORT_SYMBOL(drm_of_find_possible_crtcs);
/**
* drm_of_component_match_add - Add a component helper OF node match rule
* @master: master device
* @matchptr: component match pointer
* @compare: compare function used for matching component
* @node: of_node
*/
void drm_of_component_match_add(struct device *master,
struct component_match **matchptr,
int (*compare)(struct device *, void *),
struct device_node *node)
{
of_node_get(node);
component_match_add_release(master, matchptr, component_release_of,
compare, node);
}
EXPORT_SYMBOL_GPL(drm_of_component_match_add);
/**
* drm_of_component_probe - Generic probe function for a component based master
* @dev: master device containing the OF node
* @compare_of: compare function used for matching components
* @m_ops: component master ops to be used
*
* Parse the platform device OF node and bind all the components associated
* with the master. Interface ports are added before the encoders in order to
* satisfy their .bind requirements
*
* See https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/graph.yaml
* for the bindings.
*
* Returns zero if successful, or one of the standard error codes if it fails.
*/
int drm_of_component_probe(struct device *dev,
int (*compare_of)(struct device *, void *),
const struct component_master_ops *m_ops)
{
struct device_node *ep, *port, *remote;
struct component_match *match = NULL;
int i;
if (!dev->of_node)
return -EINVAL;
/*
* Bind the crtc's ports first, so that drm_of_find_possible_crtcs()
* called from encoder's .bind callbacks works as expected
*/
for (i = 0; ; i++) {
port = of_parse_phandle(dev->of_node, "ports", i);
if (!port)
break;
if (of_device_is_available(port->parent))
drm_of_component_match_add(dev, &match, compare_of,
port);
of_node_put(port);
}
if (i == 0) {
dev_err(dev, "missing 'ports' property\n");
return -ENODEV;
}
if (!match) {
dev_err(dev, "no available port\n");
return -ENODEV;
}
/*
* For bound crtcs, bind the encoders attached to their remote endpoint
*/
for (i = 0; ; i++) {
port = of_parse_phandle(dev->of_node, "ports", i);
if (!port)
Annotation
- Immediate include surface: `linux/component.h`, `linux/export.h`, `linux/list.h`, `linux/media-bus-format.h`, `linux/of.h`, `linux/of_graph.h`, `drm/drm_bridge.h`, `drm/drm_crtc.h`.
- Detected declarations: `enum drm_of_lvds_pixels`, `function drm_of_crtc_port_mask`, `function drm_for_each_crtc`, `function drm_of_find_possible_crtcs`, `function for_each_endpoint_of_node`, `function drm_of_component_match_add`, `function drm_of_component_probe`, `function for_each_child_of_node`, `function drm_of_encoder_active_endpoint`, `function for_each_endpoint_of_node`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: integration implementation candidate.
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.