drivers/media/platform/samsung/s5p-g2d/g2d-hw.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/samsung/s5p-g2d/g2d-hw.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/samsung/s5p-g2d/g2d-hw.c- Extension
.c- Size
- 2129 bytes
- Lines
- 114
- Domain
- Driver Families
- Bucket
- drivers/media
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/io.hg2d.hg2d-regs.h
Detected Declarations
function Copyrightfunction g2d_set_src_sizefunction g2d_set_src_addrfunction g2d_set_dst_sizefunction g2d_set_dst_addrfunction g2d_set_rop4function g2d_set_flipfunction g2d_set_v41_stretchfunction g2d_set_cmdfunction g2d_startfunction g2d_clear_int
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Samsung S5P G2D - 2D Graphics Accelerator Driver
*
* Copyright (c) 2011 Samsung Electronics Co., Ltd.
* Kamil Debski, <k.debski@samsung.com>
*/
#include <linux/io.h>
#include "g2d.h"
#include "g2d-regs.h"
#define w(x, a) writel((x), d->regs + (a))
#define r(a) readl(d->regs + (a))
/* g2d_reset clears all g2d registers */
void g2d_reset(struct g2d_dev *d)
{
w(1, SOFT_RESET_REG);
}
void g2d_set_src_size(struct g2d_dev *d, struct g2d_frame *f)
{
u32 n;
w(0, SRC_SELECT_REG);
w(f->stride & 0xFFFF, SRC_STRIDE_REG);
n = f->o_height & 0xFFF;
n <<= 16;
n |= f->o_width & 0xFFF;
w(n, SRC_LEFT_TOP_REG);
n = f->bottom & 0xFFF;
n <<= 16;
n |= f->right & 0xFFF;
w(n, SRC_RIGHT_BOTTOM_REG);
w(f->fmt->hw, SRC_COLOR_MODE_REG);
}
void g2d_set_src_addr(struct g2d_dev *d, dma_addr_t a)
{
w(a, SRC_BASE_ADDR_REG);
}
void g2d_set_dst_size(struct g2d_dev *d, struct g2d_frame *f)
{
u32 n;
w(0, DST_SELECT_REG);
w(f->stride & 0xFFFF, DST_STRIDE_REG);
n = f->o_height & 0xFFF;
n <<= 16;
n |= f->o_width & 0xFFF;
w(n, DST_LEFT_TOP_REG);
n = f->bottom & 0xFFF;
n <<= 16;
n |= f->right & 0xFFF;
w(n, DST_RIGHT_BOTTOM_REG);
w(f->fmt->hw, DST_COLOR_MODE_REG);
}
void g2d_set_dst_addr(struct g2d_dev *d, dma_addr_t a)
{
w(a, DST_BASE_ADDR_REG);
}
void g2d_set_rop4(struct g2d_dev *d, u32 r)
{
w(r, ROP4_REG);
}
void g2d_set_flip(struct g2d_dev *d, u32 r)
{
w(r, SRC_MSK_DIRECT_REG);
}
void g2d_set_v41_stretch(struct g2d_dev *d, struct g2d_frame *src,
struct g2d_frame *dst)
{
w(DEFAULT_SCALE_MODE, SRC_SCALE_CTRL_REG);
/* inversed scaling factor: src is numerator */
w((src->c_width << 16) / dst->c_width, SRC_XSCALE_REG);
w((src->c_height << 16) / dst->c_height, SRC_YSCALE_REG);
Annotation
- Immediate include surface: `linux/io.h`, `g2d.h`, `g2d-regs.h`.
- Detected declarations: `function Copyright`, `function g2d_set_src_size`, `function g2d_set_src_addr`, `function g2d_set_dst_size`, `function g2d_set_dst_addr`, `function g2d_set_rop4`, `function g2d_set_flip`, `function g2d_set_v41_stretch`, `function g2d_set_cmd`, `function g2d_start`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
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.