drivers/gpu/drm/msm/msm_gpu.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/msm/msm_gpu.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/msm/msm_gpu.c- Extension
.c- Size
- 25139 bytes
- Lines
- 1066
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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
drm/drm_drv.hmsm_gpu.hmsm_gem.hmsm_mmu.hmsm_fence.hmsm_gpu_trace.hlinux/string_helpers.hlinux/devcoredump.hlinux/sched/task.hlinux/sched/mm.hlinux/utsname.h
Detected Declarations
function Copyrightfunction disable_pwrrailfunction enable_clkfunction disable_clkfunction enable_axifunction disable_axifunction msm_gpu_pm_resumefunction msm_gpu_pm_suspendfunction msm_gpu_show_fdinfofunction msm_gpu_hw_initfunction msm_gpu_devcoredump_readfunction msm_gpu_devcoredump_freefunction msm_gpu_crashstate_get_bofunction crashstate_get_bosfunction drm_exec_until_all_lockedfunction drm_gpuvm_for_each_vafunction crashstate_get_vm_logsfunction msm_gpu_crashstate_capturefunction msm_gpu_crashstate_capturefunction get_comm_cmdlinefunction recover_workerfunction list_for_each_entryfunction msm_gpu_fault_crashstate_capturefunction hangcheck_timer_resetfunction made_progressfunction hangcheck_handlerfunction retire_submitfunction retire_submitsfunction retire_workerfunction msm_gpu_retirefunction msm_gpu_submitfunction irq_handlerfunction get_clocksfunction msm_gpu_create_private_vmfunction msm_gpu_initfunction msm_gpu_cleanup
Annotated Snippet
if (ret) {
DRM_DEV_ERROR(dev->dev, "failed to enable 'gpu_reg': %d\n", ret);
return ret;
}
}
if (gpu->gpu_cx) {
ret = regulator_enable(gpu->gpu_cx);
if (ret) {
DRM_DEV_ERROR(dev->dev, "failed to enable 'gpu_cx': %d\n", ret);
return ret;
}
}
return 0;
}
static int disable_pwrrail(struct msm_gpu *gpu)
{
if (gpu->gpu_cx)
regulator_disable(gpu->gpu_cx);
if (gpu->gpu_reg)
regulator_disable(gpu->gpu_reg);
return 0;
}
static int enable_clk(struct msm_gpu *gpu)
{
if (gpu->core_clk && gpu->fast_rate)
dev_pm_opp_set_rate(&gpu->pdev->dev, gpu->fast_rate);
/* Set the RBBM timer rate to 19.2Mhz */
if (gpu->rbbmtimer_clk)
clk_set_rate(gpu->rbbmtimer_clk, 19200000);
return clk_bulk_prepare_enable(gpu->nr_clocks, gpu->grp_clks);
}
static int disable_clk(struct msm_gpu *gpu)
{
clk_bulk_disable_unprepare(gpu->nr_clocks, gpu->grp_clks);
/*
* Set the clock to a deliberately low rate. On older targets the clock
* speed had to be non zero to avoid problems. On newer targets this
* will be rounded down to zero anyway so it all works out.
*/
if (gpu->core_clk)
dev_pm_opp_set_rate(&gpu->pdev->dev, 27000000);
if (gpu->rbbmtimer_clk)
clk_set_rate(gpu->rbbmtimer_clk, 0);
return 0;
}
static int enable_axi(struct msm_gpu *gpu)
{
return clk_prepare_enable(gpu->ebi1_clk);
}
static int disable_axi(struct msm_gpu *gpu)
{
clk_disable_unprepare(gpu->ebi1_clk);
return 0;
}
int msm_gpu_pm_resume(struct msm_gpu *gpu)
{
int ret;
DBG("%s", gpu->name);
trace_msm_gpu_resume(0);
ret = enable_pwrrail(gpu);
if (ret)
return ret;
ret = enable_clk(gpu);
if (ret)
return ret;
ret = enable_axi(gpu);
if (ret)
return ret;
msm_devfreq_resume(gpu);
gpu->needs_hw_init = true;
Annotation
- Immediate include surface: `drm/drm_drv.h`, `msm_gpu.h`, `msm_gem.h`, `msm_mmu.h`, `msm_fence.h`, `msm_gpu_trace.h`, `linux/string_helpers.h`, `linux/devcoredump.h`.
- Detected declarations: `function Copyright`, `function disable_pwrrail`, `function enable_clk`, `function disable_clk`, `function enable_axi`, `function disable_axi`, `function msm_gpu_pm_resume`, `function msm_gpu_pm_suspend`, `function msm_gpu_show_fdinfo`, `function msm_gpu_hw_init`.
- 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.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.