drivers/gpu/drm/armada/armada_crtc.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/armada/armada_crtc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/armada/armada_crtc.c- Extension
.c- Size
- 31512 bytes
- Lines
- 1096
- 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/module.hlinux/of.hlinux/platform_device.hlinux/property.hdrm/drm_atomic.hdrm/drm_atomic_helper.hdrm/drm_print.hdrm/drm_probe_helper.hdrm/drm_vblank.harmada_crtc.harmada_drm.harmada_fb.harmada_gem.harmada_hw.harmada_plane.harmada_trace.h
Detected Declarations
function Copyrightfunction armada_drm_crtc_update_regsfunction armada_drm_crtc_updatefunction armada_drm_crtc_queue_state_eventfunction armada_drm_update_gammafunction armada_drm_crtc_mode_validfunction armada_drm_crtc_mode_fixupfunction armada_drm_crtc_disable_irqfunction armada_drm_crtc_enable_irqfunction armada_drm_crtc_irqfunction armada_drm_irqfunction armada_drm_crtc_mode_set_nofbfunction armada_drm_crtc_atomic_checkfunction armada_drm_crtc_atomic_beginfunction armada_drm_crtc_atomic_flushfunction armada_drm_crtc_atomic_disablefunction armada_drm_crtc_atomic_enablefunction armada_load_cursor_argbfunction armada_drm_crtc_cursor_tranfunction armada_drm_crtc_cursor_updatefunction cursor_updatefunction armada_drm_crtc_cursor_setfunction armada_drm_crtc_cursor_movefunction armada_drm_crtc_destroyfunction armada_drm_crtc_late_registerfunction armada_drm_crtc_enable_vblankfunction armada_drm_crtc_disable_vblankfunction armada_crtc_select_clockfunction armada_drm_crtc_createfunction armada_lcd_bindfunction armada_lcd_unbindfunction armada_lcd_probefunction armada_lcd_remove
Annotated Snippet
* if (odd_frame) {
* vtotal = mode->crtc_vtotal + 1;
* vbackporch = mode->crtc_vsync_start - mode->crtc_vdisplay + 1;
* vhorizpos = mode->crtc_hsync_start - mode->crtc_htotal / 2
* } else {
* vtotal = mode->crtc_vtotal;
* vbackporch = mode->crtc_vsync_start - mode->crtc_vdisplay;
* vhorizpos = mode->crtc_hsync_start;
* }
* vfrontporch = mode->crtc_vtotal - mode->crtc_vsync_end;
*
* So, we need to reprogram these registers on each vsync event:
* LCD_SPU_V_PORCH, LCD_SPU_ADV_REG, LCD_SPUT_V_H_TOTAL
*
* Note: we do not use the frame done interrupts because these appear
* to happen too early, and lead to jitter on the display (presumably
* they occur at the end of the last active line, before the vsync back
* porch, which we're reprogramming.)
*/
void
armada_drm_crtc_update_regs(struct armada_crtc *dcrtc, struct armada_regs *regs)
{
while (regs->offset != ~0) {
void __iomem *reg = dcrtc->base + regs->offset;
uint32_t val;
val = regs->mask;
if (val != 0)
val &= readl_relaxed(reg);
writel_relaxed(val | regs->val, reg);
++regs;
}
}
static void armada_drm_crtc_update(struct armada_crtc *dcrtc, bool enable)
{
uint32_t dumb_ctrl;
dumb_ctrl = dcrtc->cfg_dumb_ctrl;
if (enable)
dumb_ctrl |= CFG_DUMB_ENA;
/*
* When the dumb interface isn't in DUMB24_RGB888_0 mode, it might
* be using SPI or GPIO. If we set this to DUMB_BLANK, we will
* force LCD_D[23:0] to output blank color, overriding the GPIO or
* SPI usage. So leave it as-is unless in DUMB24_RGB888_0 mode.
*/
if (!enable && (dumb_ctrl & DUMB_MASK) == DUMB24_RGB888_0) {
dumb_ctrl &= ~DUMB_MASK;
dumb_ctrl |= DUMB_BLANK;
}
armada_updatel(dumb_ctrl,
~(CFG_INV_CSYNC | CFG_INV_HSYNC | CFG_INV_VSYNC),
dcrtc->base + LCD_SPU_DUMB_CTRL);
}
static void armada_drm_crtc_queue_state_event(struct drm_crtc *crtc)
{
struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc);
struct drm_pending_vblank_event *event;
/* If we have an event, we need vblank events enabled */
event = xchg(&crtc->state->event, NULL);
if (event) {
WARN_ON(drm_crtc_vblank_get(crtc) != 0);
dcrtc->event = event;
}
}
static void armada_drm_update_gamma(struct drm_crtc *crtc)
{
struct drm_property_blob *blob = crtc->state->gamma_lut;
void __iomem *base = drm_to_armada_crtc(crtc)->base;
int i;
if (blob) {
struct drm_color_lut *lut = blob->data;
armada_updatel(CFG_CSB_256x8, CFG_CSB_256x8 | CFG_PDWN256x8,
base + LCD_SPU_SRAM_PARA1);
for (i = 0; i < 256; i++) {
writel_relaxed(drm_color_lut_extract(lut[i].red, 8),
base + LCD_SPU_SRAM_WRDAT);
writel_relaxed(i | SRAM_WRITE | SRAM_GAMMA_YR,
base + LCD_SPU_SRAM_CTRL);
Annotation
- Immediate include surface: `linux/clk.h`, `linux/component.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/property.h`, `drm/drm_atomic.h`, `drm/drm_atomic_helper.h`.
- Detected declarations: `function Copyright`, `function armada_drm_crtc_update_regs`, `function armada_drm_crtc_update`, `function armada_drm_crtc_queue_state_event`, `function armada_drm_update_gamma`, `function armada_drm_crtc_mode_valid`, `function armada_drm_crtc_mode_fixup`, `function armada_drm_crtc_disable_irq`, `function armada_drm_crtc_enable_irq`, `function armada_drm_crtc_irq`.
- 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.