drivers/gpu/drm/sprd/sprd_dpu.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/sprd/sprd_dpu.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/sprd/sprd_dpu.c- Extension
.c- Size
- 22585 bytes
- Lines
- 873
- 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/component.hlinux/delay.hlinux/dma-buf.hlinux/io.hlinux/module.hlinux/of.hlinux/of_graph.hlinux/platform_device.hlinux/wait.hlinux/workqueue.hdrm/drm_atomic_helper.hdrm/drm_blend.hdrm/drm_fb_dma_helper.hdrm/drm_framebuffer.hdrm/drm_gem_dma_helper.hdrm/drm_gem_framebuffer_helper.hsprd_drm.hsprd_dpu.hsprd_dsi.h
Detected Declarations
struct sprd_planefunction dpu_wait_stop_donefunction dpu_wait_update_donefunction drm_format_to_dpufunction drm_rotation_to_dpufunction drm_blend_to_dpufunction sprd_dpu_layerfunction sprd_dpu_flipfunction sprd_dpu_initfunction sprd_dpu_finifunction sprd_dpi_initfunction sprd_dpu_runfunction sprd_dpu_stopfunction sprd_plane_atomic_checkfunction sprd_plane_atomic_updatefunction sprd_plane_atomic_disablefunction sprd_plane_create_propertiesfunction sprd_crtc_mode_set_nofbfunction drm_for_each_encoder_maskfunction sprd_crtc_atomic_enablefunction sprd_crtc_atomic_disablefunction sprd_crtc_atomic_flushfunction sprd_crtc_enable_vblankfunction sprd_crtc_disable_vblankfunction sprd_dpu_isrfunction sprd_dpu_context_initfunction sprd_dpu_bindfunction sprd_dpu_probefunction sprd_dpu_remove
Annotated Snippet
struct sprd_plane {
struct drm_plane base;
};
static int dpu_wait_stop_done(struct sprd_dpu *dpu)
{
struct dpu_context *ctx = &dpu->ctx;
int rc;
if (ctx->stopped)
return 0;
rc = wait_event_interruptible_timeout(ctx->wait_queue, ctx->evt_stop,
msecs_to_jiffies(500));
ctx->evt_stop = false;
ctx->stopped = true;
if (!rc) {
drm_err(dpu->drm, "dpu wait for stop done time out!\n");
return -ETIMEDOUT;
}
return 0;
}
static int dpu_wait_update_done(struct sprd_dpu *dpu)
{
struct dpu_context *ctx = &dpu->ctx;
int rc;
ctx->evt_update = false;
rc = wait_event_interruptible_timeout(ctx->wait_queue, ctx->evt_update,
msecs_to_jiffies(500));
if (!rc) {
drm_err(dpu->drm, "dpu wait for reg update done time out!\n");
return -ETIMEDOUT;
}
return 0;
}
static u32 drm_format_to_dpu(struct drm_framebuffer *fb)
{
u32 format = 0;
switch (fb->format->format) {
case DRM_FORMAT_BGRA8888:
/* BGRA8888 -> ARGB8888 */
format |= BIT_DPU_LAY_DATA_ENDIAN_B3B2B1B0;
format |= BIT_DPU_LAY_FORMAT_ARGB8888;
break;
case DRM_FORMAT_RGBX8888:
case DRM_FORMAT_RGBA8888:
/* RGBA8888 -> ABGR8888 */
format |= BIT_DPU_LAY_DATA_ENDIAN_B3B2B1B0;
fallthrough;
case DRM_FORMAT_ABGR8888:
/* RB switch */
format |= BIT_DPU_LAY_RB_OR_UV_SWITCH;
fallthrough;
case DRM_FORMAT_ARGB8888:
format |= BIT_DPU_LAY_FORMAT_ARGB8888;
break;
case DRM_FORMAT_XBGR8888:
/* RB switch */
format |= BIT_DPU_LAY_RB_OR_UV_SWITCH;
fallthrough;
case DRM_FORMAT_XRGB8888:
format |= BIT_DPU_LAY_FORMAT_ARGB8888;
break;
case DRM_FORMAT_BGR565:
/* RB switch */
format |= BIT_DPU_LAY_RB_OR_UV_SWITCH;
fallthrough;
case DRM_FORMAT_RGB565:
format |= BIT_DPU_LAY_FORMAT_RGB565;
break;
case DRM_FORMAT_NV12:
/* 2-Lane: Yuv420 */
format |= BIT_DPU_LAY_FORMAT_YUV420_2PLANE;
/* Y endian */
format |= BIT_DPU_LAY_DATA_ENDIAN_B0B1B2B3;
/* UV endian */
format |= BIT_DPU_LAY_NO_SWITCH;
break;
case DRM_FORMAT_NV21:
/* 2-Lane: Yuv420 */
Annotation
- Immediate include surface: `linux/component.h`, `linux/delay.h`, `linux/dma-buf.h`, `linux/io.h`, `linux/module.h`, `linux/of.h`, `linux/of_graph.h`, `linux/platform_device.h`.
- Detected declarations: `struct sprd_plane`, `function dpu_wait_stop_done`, `function dpu_wait_update_done`, `function drm_format_to_dpu`, `function drm_rotation_to_dpu`, `function drm_blend_to_dpu`, `function sprd_dpu_layer`, `function sprd_dpu_flip`, `function sprd_dpu_init`, `function sprd_dpu_fini`.
- 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.