drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c- Extension
.c- Size
- 41692 bytes
- Lines
- 1541
- 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/debugfs.hlinux/dma-buf.hlinux/of_irq.hlinux/pm_opp.hdrm/drm_crtc.hdrm/drm_file.hdrm/drm_framebuffer.hdrm/drm_vblank.hdrm/drm_writeback.hlinux/soc/qcom/ubwc.hmsm_drv.hmsm_mmu.hmsm_gem.hdisp/msm_disp_snapshot.hdpu_core_irq.hdpu_crtc.hdpu_encoder.hdpu_formats.hdpu_hw_vbif.hdpu_kms.hdpu_plane.hdpu_vbif.hdpu_writeback.hdpu_trace.h
Detected Declarations
struct dpu_debugfs_regset32function _dpu_danger_signal_statusfunction dpu_debugfs_danger_stats_showfunction dpu_debugfs_safe_stats_showfunction _dpu_plane_danger_readfunction _dpu_plane_set_danger_statefunction drm_for_each_planefunction _dpu_plane_danger_writefunction dpu_debugfs_danger_initfunction dpu_regset32_showfunction debugfs_create_regset32function dpu_debugfs_sspp_initfunction dpu_kms_debugfs_initfunction dpu_kms_get_existing_global_statefunction dpu_kms_global_duplicate_statefunction dpu_kms_global_destroy_statefunction dpu_kms_global_create_statefunction dpu_kms_global_print_statefunction dpu_kms_global_obj_finifunction dpu_kms_parse_data_bus_icc_pathfunction dpu_kms_enable_vblankfunction dpu_kms_disable_vblankfunction dpu_kms_enable_commitfunction dpu_kms_disable_commitfunction dpu_kms_check_mode_changedfunction dpu_kms_flush_commitfunction for_each_crtc_maskfunction dpu_kms_complete_commitfunction dpu_kms_wait_for_commit_donefunction list_for_each_entryfunction dpu_kms_wait_flushfunction dpu_kms_dsi_set_te_sourcefunction _dpu_kms_initialize_dsifunction _dpu_kms_initialize_displayportfunction _dpu_kms_initialize_hdmifunction _dpu_kms_initialize_writebackfunction _dpu_kms_setup_displaysfunction _dpu_kms_drm_obj_initfunction _dpu_kms_hw_destroyfunction dpu_kms_destroyfunction dpu_irq_postinstallfunction dpu_kms_mdp_snapshotfunction _dpu_kms_mmu_destroyfunction _dpu_kms_mmu_initfunction dpu_kms_get_clk_ratefunction dpu_kms_hw_initfunction dpu_kms_initfunction dpu_kms_mmap_mdp5
Annotated Snippet
static const struct file_operations dpu_plane_danger_enable = {
.open = simple_open,
.read = _dpu_plane_danger_read,
.write = _dpu_plane_danger_write,
};
static void dpu_debugfs_danger_init(struct dpu_kms *dpu_kms,
struct dentry *parent)
{
struct dentry *entry = debugfs_create_dir("danger", parent);
debugfs_create_file("danger_status", 0600, entry,
dpu_kms, &dpu_debugfs_danger_stats_fops);
debugfs_create_file("safe_status", 0600, entry,
dpu_kms, &dpu_debugfs_safe_stats_fops);
debugfs_create_file("disable_danger", 0600, entry,
dpu_kms, &dpu_plane_danger_enable);
}
/*
* Companion structure for dpu_debugfs_create_regset32.
*/
struct dpu_debugfs_regset32 {
uint32_t offset;
uint32_t blk_len;
struct dpu_kms *dpu_kms;
};
static int dpu_regset32_show(struct seq_file *s, void *data)
{
struct dpu_debugfs_regset32 *regset = s->private;
struct dpu_kms *dpu_kms = regset->dpu_kms;
void __iomem *base;
uint32_t i, addr;
if (!dpu_kms->mmio)
return 0;
base = dpu_kms->mmio + regset->offset;
/* insert padding spaces, if needed */
if (regset->offset & 0xF) {
seq_printf(s, "[%x]", regset->offset & ~0xF);
for (i = 0; i < (regset->offset & 0xF); i += 4)
seq_puts(s, " ");
}
pm_runtime_get_sync(&dpu_kms->pdev->dev);
/* main register output */
for (i = 0; i < regset->blk_len; i += 4) {
addr = regset->offset + i;
if ((addr & 0xF) == 0x0)
seq_printf(s, i ? "\n[%x]" : "[%x]", addr);
seq_printf(s, " %08x", readl_relaxed(base + i));
}
seq_puts(s, "\n");
pm_runtime_put_sync(&dpu_kms->pdev->dev);
return 0;
}
DEFINE_SHOW_ATTRIBUTE(dpu_regset32);
/**
* dpu_debugfs_create_regset32 - Create register read back file for debugfs
*
* This function is almost identical to the standard debugfs_create_regset32()
* function, with the main difference being that a list of register
* names/offsets do not need to be provided. The 'read' function simply outputs
* sequential register values over a specified range.
*
* @name: File name within debugfs
* @mode: File mode within debugfs
* @parent: Parent directory entry within debugfs, can be NULL
* @offset: sub-block offset
* @length: sub-block length, in bytes
* @dpu_kms: pointer to dpu kms structure
*/
void dpu_debugfs_create_regset32(const char *name, umode_t mode,
void *parent,
uint32_t offset, uint32_t length, struct dpu_kms *dpu_kms)
{
struct dpu_debugfs_regset32 *regset;
if (WARN_ON(!name || !dpu_kms || !length))
return;
regset = devm_kzalloc(&dpu_kms->pdev->dev, sizeof(*regset), GFP_KERNEL);
if (!regset)
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/dma-buf.h`, `linux/of_irq.h`, `linux/pm_opp.h`, `drm/drm_crtc.h`, `drm/drm_file.h`, `drm/drm_framebuffer.h`, `drm/drm_vblank.h`.
- Detected declarations: `struct dpu_debugfs_regset32`, `function _dpu_danger_signal_status`, `function dpu_debugfs_danger_stats_show`, `function dpu_debugfs_safe_stats_show`, `function _dpu_plane_danger_read`, `function _dpu_plane_set_danger_state`, `function drm_for_each_plane`, `function _dpu_plane_danger_write`, `function dpu_debugfs_danger_init`, `function dpu_regset32_show`.
- 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.