drivers/media/platform/samsung/exynos4-is/fimc-reg.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/samsung/exynos4-is/fimc-reg.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/samsung/exynos4-is/fimc-reg.c- Extension
.c- Size
- 22912 bytes
- Lines
- 847
- 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/delay.hlinux/io.hlinux/regmap.hmedia/drv-intf/exynos-fimc.hmedia-dev.hfimc-reg.hfimc-core.h
Detected Declarations
struct mbus_pixfmt_descfunction Interfacefunction fimc_hw_get_in_flipfunction fimc_hw_get_target_flipfunction fimc_hw_set_rotationfunction fimc_hw_set_target_formatfunction fimc_hw_set_out_dma_sizefunction fimc_hw_set_out_dmafunction fimc_hw_en_autoloadfunction fimc_hw_en_lastirqfunction fimc_hw_set_prescalerfunction fimc_hw_set_scalerfunction fimc_hw_set_mainscalerfunction fimc_hw_enable_capturefunction fimc_hw_disable_capturefunction fimc_hw_set_effectfunction fimc_hw_set_rgb_alphafunction fimc_hw_set_in_dma_sizefunction fimc_hw_set_in_dmafunction fimc_hw_set_input_pathfunction fimc_hw_set_output_pathfunction fimc_hw_set_input_addrfunction fimc_hw_set_output_addrfunction fimc_hw_set_camera_polarityfunction fimc_hw_set_camera_sourcefunction fimc_hw_set_camera_offsetfunction fimc_hw_set_camera_typefunction fimc_hw_clear_irqfunction fimc_hw_enable_scalerfunction fimc_hw_activate_input_dmafunction fimc_hw_get_frame_indexfunction fimc_hw_get_prev_frame_indexfunction fimc_activate_capturefunction fimc_deactivate_capturefunction fimc_hw_camblk_cfg_writeback
Annotated Snippet
struct mbus_pixfmt_desc {
u32 pixelcode;
u32 cisrcfmt;
u16 bus_width;
};
static const struct mbus_pixfmt_desc pix_desc[] = {
{ MEDIA_BUS_FMT_YUYV8_2X8, FIMC_REG_CISRCFMT_ORDER422_YCBYCR, 8 },
{ MEDIA_BUS_FMT_YVYU8_2X8, FIMC_REG_CISRCFMT_ORDER422_YCRYCB, 8 },
{ MEDIA_BUS_FMT_VYUY8_2X8, FIMC_REG_CISRCFMT_ORDER422_CRYCBY, 8 },
{ MEDIA_BUS_FMT_UYVY8_2X8, FIMC_REG_CISRCFMT_ORDER422_CBYCRY, 8 },
};
int fimc_hw_set_camera_source(struct fimc_dev *fimc,
struct fimc_source_info *source)
{
const struct fimc_vid_cap *vc = &fimc->vid_cap;
const struct fimc_frame *f = &vc->ctx->s_frame;
u32 bus_width, cfg = 0;
int i;
switch (source->fimc_bus_type) {
case FIMC_BUS_TYPE_ITU_601:
case FIMC_BUS_TYPE_ITU_656:
if (fimc_fmt_is_user_defined(f->fmt->color)) {
cfg |= FIMC_REG_CISRCFMT_ITU601_8BIT;
break;
}
for (i = 0; i < ARRAY_SIZE(pix_desc); i++) {
if (vc->ci_fmt.code == pix_desc[i].pixelcode) {
cfg = pix_desc[i].cisrcfmt;
bus_width = pix_desc[i].bus_width;
break;
}
}
if (i == ARRAY_SIZE(pix_desc)) {
v4l2_err(&vc->ve.vdev,
"Camera color format not supported: %d\n",
vc->ci_fmt.code);
return -EINVAL;
}
if (source->fimc_bus_type == FIMC_BUS_TYPE_ITU_601) {
if (bus_width == 8)
cfg |= FIMC_REG_CISRCFMT_ITU601_8BIT;
else if (bus_width == 16)
cfg |= FIMC_REG_CISRCFMT_ITU601_16BIT;
} /* else defaults to ITU-R BT.656 8-bit */
break;
case FIMC_BUS_TYPE_MIPI_CSI2:
if (fimc_fmt_is_user_defined(f->fmt->color))
cfg |= FIMC_REG_CISRCFMT_ITU601_8BIT;
break;
default:
case FIMC_BUS_TYPE_ISP_WRITEBACK:
/* Anything to do here ? */
break;
}
cfg |= (f->o_width << 16) | f->o_height;
writel(cfg, fimc->regs + FIMC_REG_CISRCFMT);
return 0;
}
void fimc_hw_set_camera_offset(struct fimc_dev *fimc, const struct fimc_frame *f)
{
u32 hoff2, voff2;
u32 cfg = readl(fimc->regs + FIMC_REG_CIWDOFST);
cfg &= ~(FIMC_REG_CIWDOFST_HOROFF_MASK | FIMC_REG_CIWDOFST_VEROFF_MASK);
cfg |= FIMC_REG_CIWDOFST_OFF_EN |
(f->offs_h << 16) | f->offs_v;
writel(cfg, fimc->regs + FIMC_REG_CIWDOFST);
/* See CIWDOFSTn register description in the datasheet for details. */
hoff2 = f->o_width - f->width - f->offs_h;
voff2 = f->o_height - f->height - f->offs_v;
cfg = (hoff2 << 16) | voff2;
writel(cfg, fimc->regs + FIMC_REG_CIWDOFST2);
}
int fimc_hw_set_camera_type(struct fimc_dev *fimc,
const struct fimc_source_info *source)
{
const struct fimc_vid_cap *vid_cap = &fimc->vid_cap;
u32 csis_data_alignment = 32;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/io.h`, `linux/regmap.h`, `media/drv-intf/exynos-fimc.h`, `media-dev.h`, `fimc-reg.h`, `fimc-core.h`.
- Detected declarations: `struct mbus_pixfmt_desc`, `function Interface`, `function fimc_hw_get_in_flip`, `function fimc_hw_get_target_flip`, `function fimc_hw_set_rotation`, `function fimc_hw_set_target_format`, `function fimc_hw_set_out_dma_size`, `function fimc_hw_set_out_dma`, `function fimc_hw_en_autoload`, `function fimc_hw_en_lastirq`.
- 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.