drivers/gpu/drm/lima/lima_pp.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/lima/lima_pp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/lima/lima_pp.c- Extension
.c- Size
- 11446 bytes
- Lines
- 504
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/interrupt.hlinux/io.hlinux/device.hlinux/slab.hdrm/lima_drm.hlima_device.hlima_pp.hlima_dlbu.hlima_bcast.hlima_vm.hlima_regs.h
Detected Declarations
function lima_pp_handle_irqfunction lima_pp_irq_handlerfunction lima_pp_bcast_irq_handlerfunction lima_pp_soft_reset_asyncfunction lima_pp_soft_reset_pollfunction lima_pp_soft_reset_async_wait_onefunction lima_pp_soft_reset_async_waitfunction lima_pp_write_framefunction lima_pp_bus_stop_pollfunction lima_pp_hard_reset_pollfunction lima_pp_hard_resetfunction lima_pp_print_versionfunction lima_pp_hw_initfunction lima_pp_resumefunction lima_pp_suspendfunction lima_pp_finifunction lima_pp_bcast_resumefunction lima_pp_bcast_suspendfunction lima_pp_bcast_finifunction lima_pp_task_validatefunction lima_pp_task_runfunction lima_pp_task_finifunction lima_pp_task_errorfunction lima_pp_task_mmu_errorfunction lima_pp_task_mask_irqfunction lima_pp_pipe_initfunction lima_pp_pipe_fini
Annotated Snippet
if (state) {
lima_pp_handle_irq(ip, state);
ret = IRQ_HANDLED;
} else {
if (status & LIMA_PP_STATUS_RENDERING_ACTIVE)
continue;
}
pipe->done |= (1 << i);
if (atomic_dec_and_test(&pipe->task))
lima_sched_pipe_task_done(pipe);
}
return ret;
}
static void lima_pp_soft_reset_async(struct lima_ip *ip)
{
if (ip->data.async_reset)
return;
pp_write(LIMA_PP_INT_MASK, 0);
pp_write(LIMA_PP_INT_RAWSTAT, LIMA_PP_IRQ_MASK_ALL);
pp_write(LIMA_PP_CTRL, LIMA_PP_CTRL_SOFT_RESET);
ip->data.async_reset = true;
}
static int lima_pp_soft_reset_poll(struct lima_ip *ip)
{
return !(pp_read(LIMA_PP_STATUS) & LIMA_PP_STATUS_RENDERING_ACTIVE) &&
pp_read(LIMA_PP_INT_RAWSTAT) == LIMA_PP_IRQ_RESET_COMPLETED;
}
static int lima_pp_soft_reset_async_wait_one(struct lima_ip *ip)
{
struct lima_device *dev = ip->dev;
int ret;
ret = lima_poll_timeout(ip, lima_pp_soft_reset_poll, 0, 100);
if (ret) {
dev_err(dev->dev, "%s reset time out\n", lima_ip_name(ip));
return ret;
}
pp_write(LIMA_PP_INT_CLEAR, LIMA_PP_IRQ_MASK_ALL);
pp_write(LIMA_PP_INT_MASK, LIMA_PP_IRQ_MASK_USED);
return 0;
}
static int lima_pp_soft_reset_async_wait(struct lima_ip *ip)
{
int i, err = 0;
if (!ip->data.async_reset)
return 0;
if (ip->id == lima_ip_pp_bcast) {
struct lima_device *dev = ip->dev;
struct lima_sched_pipe *pipe = dev->pipe + lima_pipe_pp;
struct drm_lima_m450_pp_frame *frame = pipe->current_task->frame;
for (i = 0; i < frame->num_pp; i++)
err |= lima_pp_soft_reset_async_wait_one(pipe->processor[i]);
} else
err = lima_pp_soft_reset_async_wait_one(ip);
ip->data.async_reset = false;
return err;
}
static void lima_pp_write_frame(struct lima_ip *ip, u32 *frame, u32 *wb)
{
int i, j, n = 0;
for (i = 0; i < LIMA_PP_FRAME_REG_NUM; i++)
writel(frame[i], ip->iomem + LIMA_PP_FRAME + i * 4);
for (i = 0; i < 3; i++) {
for (j = 0; j < LIMA_PP_WB_REG_NUM; j++)
writel(wb[n++], ip->iomem + LIMA_PP_WB(i) + j * 4);
}
}
static int lima_pp_bus_stop_poll(struct lima_ip *ip)
{
return !!(pp_read(LIMA_PP_STATUS) & LIMA_PP_STATUS_BUS_STOPPED);
}
static int lima_pp_hard_reset_poll(struct lima_ip *ip)
{
Annotation
- Immediate include surface: `linux/interrupt.h`, `linux/io.h`, `linux/device.h`, `linux/slab.h`, `drm/lima_drm.h`, `lima_device.h`, `lima_pp.h`, `lima_dlbu.h`.
- Detected declarations: `function lima_pp_handle_irq`, `function lima_pp_irq_handler`, `function lima_pp_bcast_irq_handler`, `function lima_pp_soft_reset_async`, `function lima_pp_soft_reset_poll`, `function lima_pp_soft_reset_async_wait_one`, `function lima_pp_soft_reset_async_wait`, `function lima_pp_write_frame`, `function lima_pp_bus_stop_poll`, `function lima_pp_hard_reset_poll`.
- 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.