drivers/media/platform/qcom/camss/camss-vfe-340.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/qcom/camss/camss-vfe-340.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/qcom/camss/camss-vfe-340.c- Extension
.c- Size
- 11821 bytes
- Lines
- 385
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/bitfield.hlinux/interrupt.hlinux/io.hlinux/iopoll.hcamss.hcamss-vfe.h
Detected Declarations
enum tfe_clientenum tfe_ifaceenum tfe_subgroupsfunction __line_to_ifacefunction __iface_to_linefunction __subgroup_to_linefunction vfe_global_resetfunction vfe_isrfunction vfe_haltfunction vfe_enable_irqfunction vfe_wm_updatefunction vfe_packer_formatfunction vfe_wm_startfunction vfe_wm_stopfunction vfe_subdev_initfunction vfe_reg_updatefunction vfe_reg_update_clear
Annotated Snippet
if (fmt->formats[i].pixelformat == pixelformat) {
bpp = fmt->formats[i].mbus_bpp;
break;
}
}
switch (bpp) {
case 10:
return TFE_BUS_PACKER_CFG_FMT_MIPI10;
case 12:
return TFE_BUS_PACKER_CFG_FMT_MIPI12;
default:
return TFE_BUS_PACKER_CFG_FMT_PLAIN8;
}
}
static void vfe_wm_start(struct vfe_device *vfe, u8 wm, struct vfe_line *line)
{
struct v4l2_pix_format_mplane *pix = &line->video_out.active_fmt.fmt.pix_mp;
u32 stride = pix->plane_fmt[0].bytesperline;
u8 client = tfe_wm_client_map[wm];
u32 cfg = TFE_BUS_CLIENT_CFG_EN;
if (client == TFE_CLI_BAYER) { /* PIX - Line based */
struct v4l2_rect *crop = &line->crop;
/* Cropping */
writel_relaxed(TFE_PP_CROP_CFG_EN, vfe->base + TFE_PP_CROP_CFG);
writel_relaxed(FIELD_PREP(TFE_PP_CROP_FIRST, crop->top) |
FIELD_PREP(TFE_PP_CROP_LAST, crop->top + crop->height - 1),
vfe->base + TFE_PP_CROP_LINE_CFG);
writel_relaxed(FIELD_PREP(TFE_PP_CROP_FIRST, crop->left) |
FIELD_PREP(TFE_PP_CROP_LAST, crop->left + crop->width - 1),
vfe->base + TFE_PP_CROP_PIX_CFG);
/* Write Engine */
writel_relaxed(pix->width | (pix->height << 16),
vfe->base + TFE_BUS_IMAGE_CFG_0(client));
writel_relaxed(0u, vfe->base + TFE_BUS_IMAGE_CFG_1(client));
writel_relaxed(stride, vfe->base + TFE_BUS_IMAGE_CFG_2(client));
writel_relaxed(stride * pix->height, vfe->base + TFE_BUS_FRAME_INCR(client));
writel_relaxed(vfe_packer_format(vfe, pix->pixelformat),
vfe->base + TFE_BUS_PACKER_CFG(client));
cfg |= TFE_BUS_CLIENT_CFG_AUTORECOVER;
} else { /* RDI - Frame based */
writel_relaxed(TFE_BUS_IMAGE_CFG_0_DEFAULT,
vfe->base + TFE_BUS_IMAGE_CFG_0(client));
writel_relaxed(0u, vfe->base + TFE_BUS_IMAGE_CFG_1(client));
writel_relaxed(TFE_BUS_IMAGE_CFG_2_DEFAULT,
vfe->base + TFE_BUS_IMAGE_CFG_2(client));
writel_relaxed(stride * pix->height, vfe->base + TFE_BUS_FRAME_INCR(client));
writel_relaxed(TFE_BUS_PACKER_CFG_FMT_PLAIN64,
vfe->base + TFE_BUS_PACKER_CFG(client));
cfg |= TFE_BUS_CLIENT_CFG_MODE_FRAME;
}
/* No dropped frames, one irq per frame */
writel_relaxed(0, vfe->base + TFE_BUS_FRAMEDROP_CFG_0(client));
writel_relaxed(1, vfe->base + TFE_BUS_FRAMEDROP_CFG_1(client));
writel_relaxed(0, vfe->base + TFE_BUS_IRQ_SUBSAMPLE_CFG_0(client));
writel_relaxed(1, vfe->base + TFE_BUS_IRQ_SUBSAMPLE_CFG_1(client));
vfe_enable_irq(vfe);
writel(cfg, vfe->base + TFE_BUS_CLIENT_CFG(client));
dev_dbg(vfe->camss->dev, "VFE%u: Started client %u width %u height %u stride %u\n",
vfe->id, client, pix->width, pix->height, stride);
}
static void vfe_wm_stop(struct vfe_device *vfe, u8 wm)
{
u8 client = tfe_wm_client_map[wm];
writel(0, vfe->base + TFE_BUS_CLIENT_CFG(client));
dev_dbg(vfe->camss->dev, "VFE%u: Stopped client %u\n", vfe->id, client);
}
static const struct camss_video_ops vfe_video_ops_520 = {
.queue_buffer = vfe_queue_buffer_v2,
.flush_buffers = vfe_flush_buffers,
};
static void vfe_subdev_init(struct device *dev, struct vfe_device *vfe)
{
vfe->video_ops = vfe_video_ops_520;
}
Annotation
- Immediate include surface: `linux/delay.h`, `linux/bitfield.h`, `linux/interrupt.h`, `linux/io.h`, `linux/iopoll.h`, `camss.h`, `camss-vfe.h`.
- Detected declarations: `enum tfe_client`, `enum tfe_iface`, `enum tfe_subgroups`, `function __line_to_iface`, `function __iface_to_line`, `function __subgroup_to_line`, `function vfe_global_reset`, `function vfe_isr`, `function vfe_halt`, `function vfe_enable_irq`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.