drivers/gpu/drm/renesas/rz-du/rzg2l_du_crtc.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/renesas/rz-du/rzg2l_du_crtc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/renesas/rz-du/rzg2l_du_crtc.c- Extension
.c- Size
- 10958 bytes
- Lines
- 428
- 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.
- 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/mutex.hlinux/platform_device.hlinux/reset.hdrm/drm_atomic.hdrm/drm_atomic_helper.hdrm/drm_bridge.hdrm/drm_crtc.hdrm/drm_device.hdrm/drm_framebuffer.hdrm/drm_gem_dma_helper.hdrm/drm_vblank.hrzg2l_du_crtc.hrzg2l_du_drv.hrzg2l_du_encoder.hrzg2l_du_kms.hrzg2l_du_vsp.h
Detected Declarations
function Copyrightfunction rzg2l_du_crtc_finish_page_flipfunction rzg2l_du_crtc_page_flip_pendingfunction rzg2l_du_crtc_wait_page_flipfunction rzg2l_du_crtc_setupfunction rzg2l_du_crtc_getfunction rzg2l_du_crtc_putfunction rzg2l_du_start_stopfunction rzg2l_du_crtc_startfunction rzg2l_du_crtc_stopfunction rzg2l_du_crtc_atomic_enablefunction rzg2l_du_crtc_atomic_disablefunction rzg2l_du_crtc_atomic_flushfunction rzg2l_du_crtc_atomic_duplicate_statefunction rzg2l_du_crtc_atomic_destroy_statefunction rzg2l_du_crtc_resetfunction rzg2l_du_crtc_enable_vblankfunction rzg2l_du_crtc_disable_vblankfunction rzg2l_du_crtc_create
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
/*
* RZ/G2L Display Unit CRTCs
*
* Copyright (C) 2023 Renesas Electronics Corporation
*
* Based on rcar_du_crtc.c
*/
#include <linux/clk.h>
#include <linux/mutex.h>
#include <linux/platform_device.h>
#include <linux/reset.h>
#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_bridge.h>
#include <drm/drm_crtc.h>
#include <drm/drm_device.h>
#include <drm/drm_framebuffer.h>
#include <drm/drm_gem_dma_helper.h>
#include <drm/drm_vblank.h>
#include "rzg2l_du_crtc.h"
#include "rzg2l_du_drv.h"
#include "rzg2l_du_encoder.h"
#include "rzg2l_du_kms.h"
#include "rzg2l_du_vsp.h"
#define DU_MCR0 0x00
#define DU_MCR0_DPI_EN BIT(0)
#define DU_MCR0_DI_EN BIT(8)
#define DU_DITR0 0x10
#define DU_DITR0_DEMD_HIGH (BIT(8) | BIT(9))
#define DU_DITR0_VSPOL BIT(16)
#define DU_DITR0_HSPOL BIT(17)
#define DU_DITR1 0x14
#define DU_DITR1_VSA(x) ((x) << 0)
#define DU_DITR1_VACTIVE(x) ((x) << 16)
#define DU_DITR2 0x18
#define DU_DITR2_VBP(x) ((x) << 0)
#define DU_DITR2_VFP(x) ((x) << 16)
#define DU_DITR3 0x1c
#define DU_DITR3_HSA(x) ((x) << 0)
#define DU_DITR3_HACTIVE(x) ((x) << 16)
#define DU_DITR4 0x20
#define DU_DITR4_HBP(x) ((x) << 0)
#define DU_DITR4_HFP(x) ((x) << 16)
#define DU_MCR1 0x40
#define DU_MCR1_PB_AUTOCLR BIT(16)
#define DU_PBCR0 0x4c
#define DU_PBCR0_PB_DEP(x) ((x) << 0)
/* -----------------------------------------------------------------------------
* Hardware Setup
*/
static void rzg2l_du_crtc_set_display_timing(struct rzg2l_du_crtc *rcrtc)
{
const struct drm_display_mode *mode = &rcrtc->crtc.state->adjusted_mode;
unsigned long mode_clock = mode->clock * 1000;
u32 ditr0, ditr1, ditr2, ditr3, ditr4, pbcr0;
struct rzg2l_du_device *rcdu = rcrtc->dev;
clk_prepare_enable(rcrtc->rzg2l_clocks.dclk);
clk_set_rate(rcrtc->rzg2l_clocks.dclk, mode_clock);
ditr0 = (DU_DITR0_DEMD_HIGH
| ((mode->flags & DRM_MODE_FLAG_PVSYNC) ? DU_DITR0_VSPOL : 0)
| ((mode->flags & DRM_MODE_FLAG_PHSYNC) ? DU_DITR0_HSPOL : 0));
ditr1 = DU_DITR1_VSA(mode->vsync_end - mode->vsync_start)
| DU_DITR1_VACTIVE(mode->vdisplay);
ditr2 = DU_DITR2_VBP(mode->vtotal - mode->vsync_end)
| DU_DITR2_VFP(mode->vsync_start - mode->vdisplay);
ditr3 = DU_DITR3_HSA(mode->hsync_end - mode->hsync_start)
| DU_DITR3_HACTIVE(mode->hdisplay);
ditr4 = DU_DITR4_HBP(mode->htotal - mode->hsync_end)
| DU_DITR4_HFP(mode->hsync_start - mode->hdisplay);
Annotation
- Immediate include surface: `linux/clk.h`, `linux/mutex.h`, `linux/platform_device.h`, `linux/reset.h`, `drm/drm_atomic.h`, `drm/drm_atomic_helper.h`, `drm/drm_bridge.h`, `drm/drm_crtc.h`.
- Detected declarations: `function Copyright`, `function rzg2l_du_crtc_finish_page_flip`, `function rzg2l_du_crtc_page_flip_pending`, `function rzg2l_du_crtc_wait_page_flip`, `function rzg2l_du_crtc_setup`, `function rzg2l_du_crtc_get`, `function rzg2l_du_crtc_put`, `function rzg2l_du_start_stop`, `function rzg2l_du_crtc_start`, `function rzg2l_du_crtc_stop`.
- 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.
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.