drivers/gpu/drm/arm/hdlcd_crtc.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/arm/hdlcd_crtc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/arm/hdlcd_crtc.c- Extension
.c- Size
- 10658 bytes
- Lines
- 345
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/clk.hlinux/of_graph.hvideo/pixel_format.hvideo/videomode.hdrm/drm_atomic.hdrm/drm_atomic_helper.hdrm/drm_crtc.hdrm/drm_fb_dma_helper.hdrm/drm_framebuffer.hdrm/drm_gem_dma_helper.hdrm/drm_of.hdrm/drm_print.hdrm/drm_probe_helper.hdrm/drm_vblank.hhdlcd_drv.hhdlcd_regs.h
Detected Declarations
function Copyrightfunction hdlcd_crtc_enable_vblankfunction hdlcd_crtc_disable_vblankfunction hdlcd_set_pxl_fmtfunction hdlcd_crtc_mode_set_nofbfunction hdlcd_crtc_atomic_enablefunction hdlcd_crtc_atomic_disablefunction hdlcd_crtc_mode_validfunction hdlcd_crtc_atomic_beginfunction hdlcd_plane_atomic_checkfunction for_each_new_crtc_in_statefunction hdlcd_plane_atomic_updatefunction hdlcd_setup_crtc
Annotated Snippet
#include <linux/clk.h>
#include <linux/of_graph.h>
#include <video/pixel_format.h>
#include <video/videomode.h>
#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc.h>
#include <drm/drm_fb_dma_helper.h>
#include <drm/drm_framebuffer.h>
#include <drm/drm_gem_dma_helper.h>
#include <drm/drm_of.h>
#include <drm/drm_print.h>
#include <drm/drm_probe_helper.h>
#include <drm/drm_vblank.h>
#include "hdlcd_drv.h"
#include "hdlcd_regs.h"
/*
* The HDLCD controller is a dumb RGB streamer that gets connected to
* a single HDMI transmitter or in the case of the ARM Models it gets
* emulated by the software that does the actual rendering.
*
*/
static void hdlcd_crtc_cleanup(struct drm_crtc *crtc)
{
struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc);
/* stop the controller on cleanup */
hdlcd_write(hdlcd, HDLCD_REG_COMMAND, 0);
drm_crtc_cleanup(crtc);
}
static int hdlcd_crtc_enable_vblank(struct drm_crtc *crtc)
{
struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc);
unsigned int mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, mask | HDLCD_INTERRUPT_VSYNC);
return 0;
}
static void hdlcd_crtc_disable_vblank(struct drm_crtc *crtc)
{
struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc);
unsigned int mask = hdlcd_read(hdlcd, HDLCD_REG_INT_MASK);
hdlcd_write(hdlcd, HDLCD_REG_INT_MASK, mask & ~HDLCD_INTERRUPT_VSYNC);
}
static const struct drm_crtc_funcs hdlcd_crtc_funcs = {
.destroy = hdlcd_crtc_cleanup,
.set_config = drm_atomic_helper_set_config,
.page_flip = drm_atomic_helper_page_flip,
.reset = drm_atomic_helper_crtc_reset,
.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
.enable_vblank = hdlcd_crtc_enable_vblank,
.disable_vblank = hdlcd_crtc_disable_vblank,
};
static const struct {
u32 fourcc;
struct pixel_format pixel;
} supported_formats[] = {
{ DRM_FORMAT_RGB565, PIXEL_FORMAT_RGB565 },
{ DRM_FORMAT_XRGB1555, PIXEL_FORMAT_XRGB1555 },
{ DRM_FORMAT_RGB888, PIXEL_FORMAT_RGB888 },
{ DRM_FORMAT_XRGB8888, PIXEL_FORMAT_XRGB8888 },
{ DRM_FORMAT_XBGR8888, PIXEL_FORMAT_XBGR8888 },
{ DRM_FORMAT_XRGB2101010, PIXEL_FORMAT_XRGB2101010},
};
/*
* Setup the HDLCD registers for decoding the pixels out of the framebuffer
*/
static int hdlcd_set_pxl_fmt(struct drm_crtc *crtc)
{
unsigned int btpp;
struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc);
const struct drm_framebuffer *fb = crtc->primary->state->fb;
const struct pixel_format *format = NULL;
int i;
for (i = 0; i < ARRAY_SIZE(supported_formats); i++) {
if (supported_formats[i].fourcc == fb->format->format)
Annotation
- Immediate include surface: `linux/clk.h`, `linux/of_graph.h`, `video/pixel_format.h`, `video/videomode.h`, `drm/drm_atomic.h`, `drm/drm_atomic_helper.h`, `drm/drm_crtc.h`, `drm/drm_fb_dma_helper.h`.
- Detected declarations: `function Copyright`, `function hdlcd_crtc_enable_vblank`, `function hdlcd_crtc_disable_vblank`, `function hdlcd_set_pxl_fmt`, `function hdlcd_crtc_mode_set_nofb`, `function hdlcd_crtc_atomic_enable`, `function hdlcd_crtc_atomic_disable`, `function hdlcd_crtc_mode_valid`, `function hdlcd_crtc_atomic_begin`, `function hdlcd_plane_atomic_check`.
- 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.