drivers/gpu/drm/rockchip/rockchip_drm_drv.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/rockchip/rockchip_drm_drv.c- Extension
.c- Size
- 13983 bytes
- Lines
- 580
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/dma-mapping.hlinux/platform_device.hlinux/pm_runtime.hlinux/module.hlinux/of_graph.hlinux/of_platform.hlinux/component.hlinux/console.hlinux/iommu.hdrm/clients/drm_client_setup.hdrm/drm_drv.hdrm/drm_fbdev_dma.hdrm/drm_gem_dma_helper.hdrm/drm_of.hdrm/drm_print.hdrm/drm_probe_helper.hdrm/drm_vblank.hasm/dma-iommu.hrockchip_drm_drv.hrockchip_drm_fb.hrockchip_drm_gem.h
Detected Declarations
function afunction rockchip_drm_dma_detach_devicefunction rockchip_drm_dma_init_devicefunction rockchip_drm_init_iommufunction rockchip_iommu_cleanupfunction rockchip_drm_bindfunction rockchip_drm_unbindfunction rockchip_drm_sys_suspendfunction rockchip_drm_sys_resumefunction rockchip_drm_encoder_set_crtc_endpoint_idfunction rockchip_drm_endpoint_is_subdriverfunction rockchip_drm_match_removefunction rockchip_drm_platform_of_probefunction rockchip_drm_platform_probefunction rockchip_drm_platform_removefunction rockchip_drm_platform_shutdownfunction rockchip_drm_initfunction rockchip_drm_finimodule init rockchip_drm_init
Annotated Snippet
struct device_driver *drv;
int i;
if (!node)
return -ENODEV;
/* status disabled will prevent creation of platform-devices */
if (!of_device_is_available(node)) {
of_node_put(node);
return -ENODEV;
}
pdev = of_find_device_by_node(node);
of_node_put(node);
/* enabled non-platform-devices can immediately return here */
if (!pdev)
return false;
/*
* All rockchip subdrivers have probed at this point, so
* any device not having a driver now is an external bridge.
*/
drv = pdev->dev.driver;
if (!drv) {
platform_device_put(pdev);
return false;
}
for (i = 0; i < num_rockchip_sub_drivers; i++) {
if (rockchip_sub_drivers[i] == to_platform_driver(drv)) {
platform_device_put(pdev);
return true;
}
}
platform_device_put(pdev);
return false;
}
static void rockchip_drm_match_remove(struct device *dev)
{
struct device_link *link;
list_for_each_entry(link, &dev->links.consumers, s_node)
device_link_del(link);
}
/* list of preferred vop devices */
static const char *const rockchip_drm_match_preferred[] = {
"rockchip,rk3399-vop-big",
NULL,
};
static struct component_match *rockchip_drm_match_add(struct device *dev)
{
struct component_match *match = NULL;
struct device_node *port;
int i;
/* add preferred vop device match before adding driver device matches */
for (i = 0; ; i++) {
port = of_parse_phandle(dev->of_node, "ports", i);
if (!port)
break;
if (of_device_is_available(port->parent) &&
of_device_compatible_match(port->parent,
rockchip_drm_match_preferred))
drm_of_component_match_add(dev, &match,
component_compare_of,
port->parent);
of_node_put(port);
}
for (i = 0; i < num_rockchip_sub_drivers; i++) {
struct platform_driver *drv = rockchip_sub_drivers[i];
struct device *p = NULL, *d;
do {
d = platform_find_device_by_driver(p, &drv->driver);
put_device(p);
p = d;
if (!d)
break;
device_link_add(dev, d, DL_FLAG_STATELESS);
component_match_add(dev, &match, component_compare_dev, d);
Annotation
- Immediate include surface: `linux/aperture.h`, `linux/dma-mapping.h`, `linux/platform_device.h`, `linux/pm_runtime.h`, `linux/module.h`, `linux/of_graph.h`, `linux/of_platform.h`, `linux/component.h`.
- Detected declarations: `function a`, `function rockchip_drm_dma_detach_device`, `function rockchip_drm_dma_init_device`, `function rockchip_drm_init_iommu`, `function rockchip_iommu_cleanup`, `function rockchip_drm_bind`, `function rockchip_drm_unbind`, `function rockchip_drm_sys_suspend`, `function rockchip_drm_sys_resume`, `function rockchip_drm_encoder_set_crtc_endpoint_id`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: pattern 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.