drivers/gpu/drm/adp/adp_drv.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/adp/adp_drv.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/adp/adp_drv.c- Extension
.c- Size
- 16758 bytes
- Lines
- 613
- 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.
- 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/iopoll.hlinux/of.hlinux/platform_device.hdrm/drm_atomic.hdrm/drm_atomic_helper.hdrm/drm_bridge.hdrm/drm_bridge_connector.hdrm/drm_drv.hdrm/drm_fb_dma_helper.hdrm/drm_framebuffer.hdrm/drm_gem_atomic_helper.hdrm/drm_gem_dma_helper.hdrm/drm_gem_framebuffer_helper.hdrm/drm_of.hdrm/drm_print.hdrm/drm_probe_helper.hdrm/drm_vblank.h
Detected Declarations
struct adp_drv_privatefunction adp_openfunction adp_drm_gem_dumb_createfunction adp_plane_atomic_checkfunction adp_plane_atomic_updatefunction adp_plane_atomic_disablefunction adp_enable_vblankfunction adp_crtc_enable_vblankfunction adp_disable_vblankfunction adp_crtc_disable_vblankfunction adp_crtc_atomic_enablefunction adp_crtc_atomic_disablefunction adp_crtc_atomic_flushfunction adp_setup_crtcfunction adp_setup_mode_configfunction adp_parse_offunction adp_fe_irqfunction adp_drm_bindfunction adp_drm_unbindfunction compare_devfunction adp_probefunction adp_remove
Annotated Snippet
static const struct file_operations adp_fops = {
.owner = THIS_MODULE,
.open = adp_open,
.release = drm_release,
.unlocked_ioctl = drm_ioctl,
.compat_ioctl = drm_compat_ioctl,
.poll = drm_poll,
.read = drm_read,
.llseek = noop_llseek,
.mmap = drm_gem_mmap,
.fop_flags = FOP_UNSIGNED_OFFSET,
DRM_GEM_DMA_UNMAPPED_AREA_FOPS
};
static int adp_drm_gem_dumb_create(struct drm_file *file_priv,
struct drm_device *drm,
struct drm_mode_create_dumb *args)
{
args->height = ALIGN(args->height, 64);
args->size = args->pitch * args->height;
return drm_gem_dma_dumb_create_internal(file_priv, drm, args);
}
static const struct drm_driver adp_driver = {
.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
.fops = &adp_fops,
DRM_GEM_DMA_DRIVER_OPS_VMAP_WITH_DUMB_CREATE(adp_drm_gem_dumb_create),
.name = "adp",
.desc = "Apple Display Pipe DRM Driver",
.major = 0,
.minor = 1,
};
struct adp_drv_private {
struct drm_device drm;
struct drm_crtc crtc;
struct drm_encoder *encoder;
struct drm_connector *connector;
struct drm_bridge *next_bridge;
void __iomem *be;
void __iomem *fe;
u32 *mask_buf;
u64 mask_buf_size;
dma_addr_t mask_iova;
int be_irq;
int fe_irq;
struct drm_pending_vblank_event *event;
};
#define to_adp(x) container_of(x, struct adp_drv_private, drm)
#define crtc_to_adp(x) container_of(x, struct adp_drv_private, crtc)
static int adp_plane_atomic_check(struct drm_plane *plane,
struct drm_atomic_commit *state)
{
struct drm_plane_state *new_plane_state;
struct drm_crtc_state *crtc_state;
new_plane_state = drm_atomic_get_new_plane_state(state, plane);
if (!new_plane_state->crtc)
return 0;
crtc_state = drm_atomic_get_crtc_state(state, new_plane_state->crtc);
if (IS_ERR(crtc_state))
return PTR_ERR(crtc_state);
return drm_atomic_helper_check_plane_state(new_plane_state,
crtc_state,
DRM_PLANE_NO_SCALING,
DRM_PLANE_NO_SCALING,
true, true);
}
static void adp_plane_atomic_update(struct drm_plane *plane,
struct drm_atomic_commit *state)
{
struct adp_drv_private *adp;
struct drm_rect src_rect;
struct drm_gem_dma_object *obj;
struct drm_framebuffer *fb;
struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state, plane);
u32 src_pos, src_size, dst_pos, dst_size;
if (!plane || !new_state)
return;
fb = new_state->fb;
if (!fb)
Annotation
- Immediate include surface: `linux/component.h`, `linux/iopoll.h`, `linux/of.h`, `linux/platform_device.h`, `drm/drm_atomic.h`, `drm/drm_atomic_helper.h`, `drm/drm_bridge.h`, `drm/drm_bridge_connector.h`.
- Detected declarations: `struct adp_drv_private`, `function adp_open`, `function adp_drm_gem_dumb_create`, `function adp_plane_atomic_check`, `function adp_plane_atomic_update`, `function adp_plane_atomic_disable`, `function adp_enable_vblank`, `function adp_crtc_enable_vblank`, `function adp_disable_vblank`, `function adp_crtc_disable_vblank`.
- 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.
- 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.