drivers/gpu/drm/lima/lima_pmu.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/lima/lima_pmu.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/lima/lima_pmu.c- Extension
.c- Size
- 2680 bytes
- Lines
- 133
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/iopoll.hlinux/device.hlima_device.hlima_pmu.hlima_regs.h
Detected Declarations
function lima_pmu_wait_cmdfunction lima_pmu_get_ip_maskfunction lima_pmu_hw_initfunction lima_pmu_hw_finifunction lima_pmu_resumefunction lima_pmu_suspendfunction lima_pmu_initfunction lima_pmu_fini
Annotated Snippet
if (dev->ip[i].present) {
ret |= LIMA450_PMU_POWER_PP13_MASK;
break;
}
}
for (i = lima_ip_pp4; i <= lima_ip_pp7; i++) {
if (dev->ip[i].present) {
ret |= LIMA450_PMU_POWER_PP47_MASK;
break;
}
}
}
return ret;
}
static int lima_pmu_hw_init(struct lima_ip *ip)
{
int err;
u32 stat;
pmu_write(LIMA_PMU_INT_MASK, 0);
/* If this value is too low, when in high GPU clk freq,
* GPU will be in unstable state.
*/
pmu_write(LIMA_PMU_SW_DELAY, 0xffff);
/* status reg 1=off 0=on */
stat = pmu_read(LIMA_PMU_STATUS);
/* power up all ip */
if (stat) {
pmu_write(LIMA_PMU_POWER_UP, stat);
err = lima_pmu_wait_cmd(ip);
if (err)
return err;
}
return 0;
}
static void lima_pmu_hw_fini(struct lima_ip *ip)
{
u32 stat;
if (!ip->data.mask)
ip->data.mask = lima_pmu_get_ip_mask(ip);
stat = ~pmu_read(LIMA_PMU_STATUS) & ip->data.mask;
if (stat) {
pmu_write(LIMA_PMU_POWER_DOWN, stat);
/* Don't wait for interrupt on Mali400 if all domains are
* powered off because the HW won't generate an interrupt
* in this case.
*/
if (ip->dev->id == lima_gpu_mali400)
pmu_write(LIMA_PMU_INT_CLEAR, LIMA_PMU_INT_CMD_MASK);
else
lima_pmu_wait_cmd(ip);
}
}
int lima_pmu_resume(struct lima_ip *ip)
{
return lima_pmu_hw_init(ip);
}
void lima_pmu_suspend(struct lima_ip *ip)
{
lima_pmu_hw_fini(ip);
}
int lima_pmu_init(struct lima_ip *ip)
{
return lima_pmu_hw_init(ip);
}
void lima_pmu_fini(struct lima_ip *ip)
{
lima_pmu_hw_fini(ip);
}
Annotation
- Immediate include surface: `linux/iopoll.h`, `linux/device.h`, `lima_device.h`, `lima_pmu.h`, `lima_regs.h`.
- Detected declarations: `function lima_pmu_wait_cmd`, `function lima_pmu_get_ip_mask`, `function lima_pmu_hw_init`, `function lima_pmu_hw_fini`, `function lima_pmu_resume`, `function lima_pmu_suspend`, `function lima_pmu_init`, `function lima_pmu_fini`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
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.