drivers/gpu/drm/sun4i/sun4i_drv.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/sun4i/sun4i_drv.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/sun4i/sun4i_drv.c- Extension
.c- Size
- 12795 bytes
- Lines
- 460
- 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.
- 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/aperture.hlinux/component.hlinux/dma-mapping.hlinux/kfifo.hlinux/module.hlinux/of_graph.hlinux/of_reserved_mem.hlinux/platform_device.hdrm/clients/drm_client_setup.hdrm/drm_atomic_helper.hdrm/drm_drv.hdrm/drm_fbdev_dma.hdrm/drm_gem_dma_helper.hdrm/drm_module.hdrm/drm_of.hdrm/drm_print.hdrm/drm_probe_helper.hdrm/drm_vblank.hsun4i_drv.hsun4i_frontend.hsun4i_framebuffer.hsun4i_tcon.hsun8i_tcon_top.h
Detected Declarations
struct endpoint_listfunction Copyrightfunction sun4i_drv_bindfunction sun4i_drv_unbindfunction sun4i_drv_node_is_connectorfunction sun4i_drv_node_is_frontendfunction sun4i_drv_node_is_deufunction sun4i_drv_node_is_supported_frontendfunction sun4i_drv_node_is_tconfunction sun4i_drv_node_is_tcon_with_ch0function sun4i_drv_node_is_tcon_topfunction sun4i_drv_traverse_endpointsfunction for_each_available_child_of_nodefunction sun4i_drv_add_endpointsfunction sun4i_drv_node_is_deufunction sun4i_drv_drm_sys_suspendfunction sun4i_drv_drm_sys_resumefunction sun4i_drv_probefunction sun4i_drv_removefunction sun4i_drv_shutdown
Annotated Snippet
struct endpoint_list {
DECLARE_KFIFO(fifo, struct device_node *, 16);
};
static void sun4i_drv_traverse_endpoints(struct endpoint_list *list,
struct device_node *node,
int port_id)
{
struct device_node *ep, *remote, *port;
port = of_graph_get_port_by_id(node, port_id);
if (!port) {
DRM_DEBUG_DRIVER("No output to bind on port %d\n", port_id);
return;
}
for_each_available_child_of_node(port, ep) {
remote = of_graph_get_remote_port_parent(ep);
if (!remote) {
DRM_DEBUG_DRIVER("Error retrieving the output node\n");
continue;
}
if (sun4i_drv_node_is_tcon(node)) {
/*
* TCON TOP is always probed before TCON. However, TCON
* points back to TCON TOP when it is source for HDMI.
* We have to skip it here to prevent infinite looping
* between TCON TOP and TCON.
*/
if (sun4i_drv_node_is_tcon_top(remote)) {
DRM_DEBUG_DRIVER("TCON output endpoint is TCON TOP... skipping\n");
of_node_put(remote);
continue;
}
/*
* If the node is our TCON with channel 0, the first
* port is used for panel or bridges, and will not be
* part of the component framework.
*/
if (sun4i_drv_node_is_tcon_with_ch0(node)) {
struct of_endpoint endpoint;
if (of_graph_parse_endpoint(ep, &endpoint)) {
DRM_DEBUG_DRIVER("Couldn't parse endpoint\n");
of_node_put(remote);
continue;
}
if (!endpoint.id) {
DRM_DEBUG_DRIVER("Endpoint is our panel... skipping\n");
of_node_put(remote);
continue;
}
}
}
kfifo_put(&list->fifo, remote);
}
}
static int sun4i_drv_add_endpoints(struct device *dev,
struct endpoint_list *list,
struct component_match **match,
struct device_node *node)
{
int count = 0;
/*
* The frontend has been disabled in some of our old device
* trees. If we find a node that is the frontend and is
* disabled, we should just follow through and parse its
* child, but without adding it to the component list.
* Otherwise, we obviously want to add it to the list.
*/
if (!sun4i_drv_node_is_frontend(node) &&
!of_device_is_available(node))
return 0;
/*
* The connectors will be the last nodes in our pipeline, we
* can just bail out.
*/
if (sun4i_drv_node_is_connector(node))
return 0;
/*
* If the device is either just a regular device, or an
* enabled frontend supported by the driver, we add it to our
Annotation
- Immediate include surface: `linux/aperture.h`, `linux/component.h`, `linux/dma-mapping.h`, `linux/kfifo.h`, `linux/module.h`, `linux/of_graph.h`, `linux/of_reserved_mem.h`, `linux/platform_device.h`.
- Detected declarations: `struct endpoint_list`, `function Copyright`, `function sun4i_drv_bind`, `function sun4i_drv_unbind`, `function sun4i_drv_node_is_connector`, `function sun4i_drv_node_is_frontend`, `function sun4i_drv_node_is_deu`, `function sun4i_drv_node_is_supported_frontend`, `function sun4i_drv_node_is_tcon`, `function sun4i_drv_node_is_tcon_with_ch0`.
- 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.
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.