drivers/gpu/drm/arm/malidp_drv.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/arm/malidp_drv.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/arm/malidp_drv.c- Extension
.c- Size
- 27762 bytes
- Lines
- 1006
- 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/module.hlinux/clk.hlinux/component.hlinux/of_device.hlinux/of_graph.hlinux/of_reserved_mem.hlinux/platform_device.hlinux/pm_runtime.hlinux/debugfs.hdrm/clients/drm_client_setup.hdrm/drm_atomic.hdrm/drm_atomic_helper.hdrm/drm_crtc.hdrm/drm_drv.hdrm/drm_fbdev_dma.hdrm/drm_fourcc.hdrm/drm_gem_dma_helper.hdrm/drm_gem_framebuffer_helper.hdrm/drm_managed.hdrm/drm_modeset_helper.hdrm/drm_module.hdrm/drm_of.hdrm/drm_print.hdrm/drm_probe_helper.hdrm/drm_vblank.hmalidp_drv.hmalidp_mw.hmalidp_regs.hmalidp_hw.h
Detected Declarations
function malidp_write_gamma_tablefunction malidp_atomic_commit_update_gammafunction malidp_atomic_commit_update_coloradjfunction malidp_atomic_commit_se_configfunction malidp_set_and_wait_config_validfunction malidp_atomic_commit_hw_donefunction malidp_atomic_commit_tailfunction for_each_old_crtc_in_statefunction malidp_verify_afbc_framebuffer_capsfunction malidp_verify_afbc_framebuffer_sizefunction malidp_verify_afbc_framebufferfunction malidp_fb_createfunction malidp_initfunction malidp_irq_initfunction malidp_dumb_createfunction malidp_error_stats_initfunction malidp_errorfunction malidp_error_stats_dumpfunction malidp_show_statsfunction malidp_debugfs_openfunction malidp_debugfs_writefunction malidp_debugfs_initfunction malidp_is_compatible_hw_idfunction malidp_has_sufficient_address_spacefunction core_id_showfunction malidp_runtime_pm_suspendfunction malidp_runtime_pm_resumefunction malidp_bindfunction malidp_unbindfunction malidp_compare_devfunction malidp_platform_probefunction malidp_platform_removefunction malidp_platform_shutdownfunction malidp_pm_suspendfunction malidp_pm_resumefunction malidp_pm_suspend_latefunction malidp_pm_resume_early
Annotated Snippet
static const struct file_operations malidp_debugfs_fops = {
.owner = THIS_MODULE,
.open = malidp_debugfs_open,
.read = seq_read,
.write = malidp_debugfs_write,
.llseek = seq_lseek,
.release = single_release,
};
static void malidp_debugfs_init(struct drm_minor *minor)
{
struct malidp_drm *malidp = drm_to_malidp(minor->dev);
malidp_error_stats_init(&malidp->de_errors);
malidp_error_stats_init(&malidp->se_errors);
spin_lock_init(&malidp->errors_lock);
debugfs_create_file("debug", S_IRUGO | S_IWUSR, minor->debugfs_root,
minor->dev, &malidp_debugfs_fops);
}
#endif //CONFIG_DEBUG_FS
static const struct drm_driver malidp_driver = {
.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
DRM_GEM_DMA_DRIVER_OPS_WITH_DUMB_CREATE(malidp_dumb_create),
DRM_FBDEV_DMA_DRIVER_OPS,
#ifdef CONFIG_DEBUG_FS
.debugfs_init = malidp_debugfs_init,
#endif
.fops = &fops,
.name = "mali-dp",
.desc = "ARM Mali Display Processor driver",
.major = 1,
.minor = 0,
};
static const struct of_device_id malidp_drm_of_match[] = {
{
.compatible = "arm,mali-dp500",
.data = &malidp_device[MALIDP_500]
},
{
.compatible = "arm,mali-dp550",
.data = &malidp_device[MALIDP_550]
},
{
.compatible = "arm,mali-dp650",
.data = &malidp_device[MALIDP_650]
},
{},
};
MODULE_DEVICE_TABLE(of, malidp_drm_of_match);
static bool malidp_is_compatible_hw_id(struct malidp_hw_device *hwdev,
const struct of_device_id *dev_id)
{
u32 core_id;
const char *compatstr_dp500 = "arm,mali-dp500";
bool is_dp500;
bool dt_is_dp500;
/*
* The DP500 CORE_ID register is in a different location, so check it
* first. If the product id field matches, then this is DP500, otherwise
* check the DP550/650 CORE_ID register.
*/
core_id = malidp_hw_read(hwdev, MALIDP500_DC_BASE + MALIDP_DE_CORE_ID);
/* Offset 0x18 will never read 0x500 on products other than DP500. */
is_dp500 = (MALIDP_PRODUCT_ID(core_id) == 0x500);
dt_is_dp500 = strnstr(dev_id->compatible, compatstr_dp500,
sizeof(dev_id->compatible)) != NULL;
if (is_dp500 != dt_is_dp500) {
DRM_ERROR("Device-tree expects %s, but hardware %s DP500.\n",
dev_id->compatible, is_dp500 ? "is" : "is not");
return false;
} else if (!dt_is_dp500) {
u16 product_id;
char buf[32];
core_id = malidp_hw_read(hwdev,
MALIDP550_DC_BASE + MALIDP_DE_CORE_ID);
product_id = MALIDP_PRODUCT_ID(core_id);
snprintf(buf, sizeof(buf), "arm,mali-dp%X", product_id);
if (!strnstr(dev_id->compatible, buf,
sizeof(dev_id->compatible))) {
DRM_ERROR("Device-tree expects %s, but hardware is DP%03X.\n",
dev_id->compatible, product_id);
return false;
}
}
Annotation
- Immediate include surface: `linux/module.h`, `linux/clk.h`, `linux/component.h`, `linux/of_device.h`, `linux/of_graph.h`, `linux/of_reserved_mem.h`, `linux/platform_device.h`, `linux/pm_runtime.h`.
- Detected declarations: `function malidp_write_gamma_table`, `function malidp_atomic_commit_update_gamma`, `function malidp_atomic_commit_update_coloradj`, `function malidp_atomic_commit_se_config`, `function malidp_set_and_wait_config_valid`, `function malidp_atomic_commit_hw_done`, `function malidp_atomic_commit_tail`, `function for_each_old_crtc_in_state`, `function malidp_verify_afbc_framebuffer_caps`, `function malidp_verify_afbc_framebuffer_size`.
- 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.