drivers/gpu/drm/tiny/arcpgu.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/tiny/arcpgu.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/tiny/arcpgu.c- Extension
.c- Size
- 11877 bytes
- Lines
- 436
- 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.hdrm/clients/drm_client_setup.hdrm/drm_atomic_helper.hdrm/drm_debugfs.hdrm/drm_device.hdrm/drm_drv.hdrm/drm_edid.hdrm/drm_fb_dma_helper.hdrm/drm_fbdev_dma.hdrm/drm_fourcc.hdrm/drm_framebuffer.hdrm/drm_gem_dma_helper.hdrm/drm_gem_framebuffer_helper.hdrm/drm_module.hdrm/drm_of.hdrm/drm_probe_helper.hdrm/drm_simple_kms_helper.hlinux/dma-mapping.hlinux/module.hlinux/of_reserved_mem.hlinux/platform_device.h
Detected Declarations
struct arcpgu_drm_privatefunction arc_pgu_writefunction arc_pgu_readfunction arcpgu_drm_connector_get_modesfunction arcpgu_drm_sim_initfunction arc_pgu_set_pxl_fmtfunction arc_pgu_mode_validfunction arc_pgu_mode_setfunction arc_pgu_enablefunction arc_pgu_disablefunction arc_pgu_updatefunction arcpgu_loadfunction arcpgu_unloadfunction arcpgu_show_pxlclockfunction arcpgu_debugfs_initfunction arcpgu_probefunction arcpgu_remove
Annotated Snippet
struct arcpgu_drm_private {
struct drm_device drm;
void __iomem *regs;
struct clk *clk;
struct drm_simple_display_pipe pipe;
struct drm_connector sim_conn;
};
#define dev_to_arcpgu(x) container_of(x, struct arcpgu_drm_private, drm)
#define pipe_to_arcpgu_priv(x) container_of(x, struct arcpgu_drm_private, pipe)
static inline void arc_pgu_write(struct arcpgu_drm_private *arcpgu,
unsigned int reg, u32 value)
{
iowrite32(value, arcpgu->regs + reg);
}
static inline u32 arc_pgu_read(struct arcpgu_drm_private *arcpgu,
unsigned int reg)
{
return ioread32(arcpgu->regs + reg);
}
#define XRES_DEF 640
#define YRES_DEF 480
#define XRES_MAX 8192
#define YRES_MAX 8192
static int arcpgu_drm_connector_get_modes(struct drm_connector *connector)
{
int count;
count = drm_add_modes_noedid(connector, XRES_MAX, YRES_MAX);
drm_set_preferred_mode(connector, XRES_DEF, YRES_DEF);
return count;
}
static const struct drm_connector_helper_funcs
arcpgu_drm_connector_helper_funcs = {
.get_modes = arcpgu_drm_connector_get_modes,
};
static const struct drm_connector_funcs arcpgu_drm_connector_funcs = {
.reset = drm_atomic_helper_connector_reset,
.fill_modes = drm_helper_probe_single_connector_modes,
.destroy = drm_connector_cleanup,
.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
};
static int arcpgu_drm_sim_init(struct drm_device *drm, struct drm_connector *connector)
{
drm_connector_helper_add(connector, &arcpgu_drm_connector_helper_funcs);
return drm_connector_init(drm, connector, &arcpgu_drm_connector_funcs,
DRM_MODE_CONNECTOR_VIRTUAL);
}
#define ENCODE_PGU_XY(x, y) ((((x) - 1) << 16) | ((y) - 1))
static const u32 arc_pgu_supported_formats[] = {
DRM_FORMAT_RGB565,
DRM_FORMAT_XRGB8888,
DRM_FORMAT_ARGB8888,
};
static void arc_pgu_set_pxl_fmt(struct arcpgu_drm_private *arcpgu)
{
const struct drm_framebuffer *fb = arcpgu->pipe.plane.state->fb;
uint32_t pixel_format = fb->format->format;
u32 format = DRM_FORMAT_INVALID;
int i;
u32 reg_ctrl;
for (i = 0; i < ARRAY_SIZE(arc_pgu_supported_formats); i++) {
if (arc_pgu_supported_formats[i] == pixel_format)
format = arc_pgu_supported_formats[i];
}
if (WARN_ON(format == DRM_FORMAT_INVALID))
return;
reg_ctrl = arc_pgu_read(arcpgu, ARCPGU_REG_CTRL);
if (format == DRM_FORMAT_RGB565)
reg_ctrl &= ~ARCPGU_MODE_XRGB8888;
else
reg_ctrl |= ARCPGU_MODE_XRGB8888;
arc_pgu_write(arcpgu, ARCPGU_REG_CTRL, reg_ctrl);
}
Annotation
- Immediate include surface: `linux/clk.h`, `drm/clients/drm_client_setup.h`, `drm/drm_atomic_helper.h`, `drm/drm_debugfs.h`, `drm/drm_device.h`, `drm/drm_drv.h`, `drm/drm_edid.h`, `drm/drm_fb_dma_helper.h`.
- Detected declarations: `struct arcpgu_drm_private`, `function arc_pgu_write`, `function arc_pgu_read`, `function arcpgu_drm_connector_get_modes`, `function arcpgu_drm_sim_init`, `function arc_pgu_set_pxl_fmt`, `function arc_pgu_mode_valid`, `function arc_pgu_mode_set`, `function arc_pgu_enable`, `function arc_pgu_disable`.
- 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.