drivers/gpu/drm/imx/ipuv3/ipuv3-crtc.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/imx/ipuv3/ipuv3-crtc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/imx/ipuv3/ipuv3-crtc.c- Extension
.c- Size
- 12030 bytes
- Lines
- 454
- 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
linux/clk.hlinux/component.hlinux/device.hlinux/dma-mapping.hlinux/errno.hlinux/export.hlinux/module.hlinux/platform_device.hvideo/imx-ipu-v3.hdrm/drm_atomic.hdrm/drm_atomic_helper.hdrm/drm_gem_dma_helper.hdrm/drm_managed.hdrm/drm_probe_helper.hdrm/drm_vblank.himx-drm.hipuv3-plane.h
Detected Declarations
struct ipu_crtcfunction ipu_crtc_atomic_enablefunction ipu_crtc_disable_planesfunction drm_atomic_crtc_state_for_each_planefunction ipu_crtc_atomic_disablefunction imx_drm_crtc_resetfunction imx_drm_crtc_destroy_statefunction ipu_enable_vblankfunction ipu_disable_vblankfunction ipu_irq_handlerfunction ipu_crtc_mode_fixupfunction ipu_crtc_atomic_checkfunction ipu_crtc_atomic_beginfunction ipu_crtc_atomic_flushfunction ipu_crtc_mode_set_nofbfunction list_for_each_entryfunction ipu_put_resourcesfunction ipu_get_resourcesfunction ipu_drm_bindfunction ipu_drm_probefunction ipu_drm_remove
Annotated Snippet
struct ipu_crtc {
struct device *dev;
struct drm_crtc base;
/* plane[0] is the full plane, plane[1] is the partial plane */
struct ipu_plane *plane[2];
struct ipu_dc *dc;
struct ipu_di *di;
int irq;
struct drm_pending_vblank_event *event;
};
static inline struct ipu_crtc *to_ipu_crtc(struct drm_crtc *crtc)
{
return container_of(crtc, struct ipu_crtc, base);
}
static void ipu_crtc_atomic_enable(struct drm_crtc *crtc,
struct drm_atomic_commit *state)
{
struct ipu_crtc *ipu_crtc = to_ipu_crtc(crtc);
struct ipu_soc *ipu = dev_get_drvdata(ipu_crtc->dev->parent);
ipu_prg_enable(ipu);
ipu_dc_enable(ipu);
ipu_dc_enable_channel(ipu_crtc->dc);
ipu_di_enable(ipu_crtc->di);
}
static void ipu_crtc_disable_planes(struct ipu_crtc *ipu_crtc,
struct drm_crtc_state *old_crtc_state)
{
bool disable_partial = false;
bool disable_full = false;
struct drm_plane *plane;
drm_atomic_crtc_state_for_each_plane(plane, old_crtc_state) {
if (plane == &ipu_crtc->plane[0]->base)
disable_full = true;
if (ipu_crtc->plane[1] && plane == &ipu_crtc->plane[1]->base)
disable_partial = true;
}
if (disable_partial)
ipu_plane_disable(ipu_crtc->plane[1], true);
if (disable_full)
ipu_plane_disable(ipu_crtc->plane[0], true);
}
static void ipu_crtc_atomic_disable(struct drm_crtc *crtc,
struct drm_atomic_commit *state)
{
struct drm_crtc_state *old_crtc_state = drm_atomic_get_old_crtc_state(state,
crtc);
struct ipu_crtc *ipu_crtc = to_ipu_crtc(crtc);
struct ipu_soc *ipu = dev_get_drvdata(ipu_crtc->dev->parent);
ipu_dc_disable_channel(ipu_crtc->dc);
ipu_di_disable(ipu_crtc->di);
/*
* Planes must be disabled before DC clock is removed, as otherwise the
* attached IDMACs will be left in undefined state, possibly hanging
* the IPU or even system.
*/
ipu_crtc_disable_planes(ipu_crtc, old_crtc_state);
ipu_dc_disable(ipu);
ipu_prg_disable(ipu);
drm_crtc_vblank_off(crtc);
spin_lock_irq(&crtc->dev->event_lock);
if (crtc->state->event && !crtc->state->active) {
drm_crtc_send_vblank_event(crtc, crtc->state->event);
crtc->state->event = NULL;
}
spin_unlock_irq(&crtc->dev->event_lock);
}
static void imx_drm_crtc_reset(struct drm_crtc *crtc)
{
struct imx_crtc_state *state;
if (crtc->state)
__drm_atomic_helper_crtc_destroy_state(crtc->state);
kfree(to_imx_crtc_state(crtc->state));
crtc->state = NULL;
state = kzalloc_obj(*state);
Annotation
- Immediate include surface: `linux/clk.h`, `linux/component.h`, `linux/device.h`, `linux/dma-mapping.h`, `linux/errno.h`, `linux/export.h`, `linux/module.h`, `linux/platform_device.h`.
- Detected declarations: `struct ipu_crtc`, `function ipu_crtc_atomic_enable`, `function ipu_crtc_disable_planes`, `function drm_atomic_crtc_state_for_each_plane`, `function ipu_crtc_atomic_disable`, `function imx_drm_crtc_reset`, `function imx_drm_crtc_destroy_state`, `function ipu_enable_vblank`, `function ipu_disable_vblank`, `function ipu_irq_handler`.
- 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.