drivers/media/platform/nxp/dw100/dw100.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/nxp/dw100/dw100.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/nxp/dw100/dw100.c- Extension
.c- Size
- 45837 bytes
- Lines
- 1738
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/clk.hlinux/debugfs.hlinux/interrupt.hlinux/io.hlinux/irqreturn.hlinux/minmax.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/pm_runtime.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-event.hmedia/v4l2-ioctl.hmedia/v4l2-mem2mem.hmedia/videobuf2-dma-contig.huapi/linux/dw100.hdw100_regs.h
Detected Declarations
struct dw100_devicestruct dw100_q_datastruct dw100_ctxfunction to_dw100_fmt_typefunction dw100_readfunction dw100_writefunction dw100_dump_regsfunction dw100_get_n_vertices_from_lengthfunction dw100_map_convert_to_uq12_4function dw100_map_format_coordinatesfunction dw100_update_mappingfunction dw100_create_mappingfunction dw100_destroy_mappingfunction dw100_s_ctrlfunction locationfunction dw100_queue_setupfunction dw100_buf_out_validatefunction dw100_buf_preparefunction dw100_buf_queuefunction dw100_buf_request_completefunction dw100_return_all_buffersfunction dw100_start_streamingfunction dw100_stop_streamingfunction dw100_m2m_queue_initfunction dw100_openfunction dw100_releasefunction dw100_querycapfunction dw100_enum_fmt_vidfunction dw100_enum_framesizesfunction dw100_g_fmt_vidfunction dw100_try_fmtfunction dw100_s_fmtfunction dw100_try_fmt_vid_capfunction dw100_s_fmt_vid_capfunction dw100_try_fmt_vid_outfunction dw100_s_fmt_vid_outfunction dw100_g_selectionfunction dw100_s_selectionfunction dw100_job_finishfunction dw100_hw_resetfunction _dw100_hw_set_master_bus_enablefunction dw100_hw_master_bus_enablefunction dw100_hw_master_bus_disablefunction dw100_hw_dewarp_startfunction dw100_hw_init_ctrlfunction dw100_hw_set_pixel_boundaryfunction dw100_hw_set_scalefunction dw100_hw_set_roi
Annotated Snippet
struct dw100_device {
struct platform_device *pdev;
struct v4l2_m2m_dev *m2m_dev;
struct v4l2_device v4l2_dev;
struct video_device vfd;
struct media_device mdev;
/* Video device lock */
struct mutex vfd_mutex;
void __iomem *mmio;
struct clk_bulk_data *clks;
int num_clks;
struct dentry *debugfs_root;
bool frame_failed;
};
struct dw100_q_data {
struct v4l2_pix_format_mplane pix_fmt;
unsigned int sequence;
const struct dw100_fmt *fmt;
struct v4l2_rect crop;
};
struct dw100_ctx {
struct v4l2_fh fh;
struct dw100_device *dw_dev;
struct v4l2_ctrl_handler hdl;
struct v4l2_ctrl *ctrls[DW100_MAX_CTRLS];
/* per context m2m queue lock */
struct mutex vq_mutex;
/* Look Up Table for pixel remapping */
unsigned int *map;
dma_addr_t map_dma;
size_t map_size;
unsigned int map_width;
unsigned int map_height;
bool user_map_is_set;
bool user_map_is_dirty;
/* Source and destination queue data */
struct dw100_q_data q_data[2];
};
static const struct v4l2_frmsize_stepwise dw100_frmsize_stepwise = {
.min_width = DW100_MIN_W,
.min_height = DW100_MIN_H,
.max_width = DW100_MAX_W,
.max_height = DW100_MAX_H,
.step_width = 1UL << DW100_ALIGN_W,
.step_height = 1UL << DW100_ALIGN_H,
};
static const struct dw100_fmt {
u32 fourcc;
u32 types;
u32 reg_format;
bool reg_swap_uv;
} formats[] = {
{
.fourcc = V4L2_PIX_FMT_NV16,
.types = DW100_FMT_OUTPUT | DW100_FMT_CAPTURE,
.reg_format = DW100_DEWARP_CTRL_FORMAT_YUV422_SP,
.reg_swap_uv = false,
}, {
.fourcc = V4L2_PIX_FMT_NV16M,
.types = DW100_FMT_OUTPUT | DW100_FMT_CAPTURE,
.reg_format = DW100_DEWARP_CTRL_FORMAT_YUV422_SP,
.reg_swap_uv = false,
}, {
.fourcc = V4L2_PIX_FMT_NV61,
.types = DW100_FMT_CAPTURE,
.reg_format = DW100_DEWARP_CTRL_FORMAT_YUV422_SP,
.reg_swap_uv = true,
}, {
.fourcc = V4L2_PIX_FMT_NV61M,
.types = DW100_FMT_CAPTURE,
.reg_format = DW100_DEWARP_CTRL_FORMAT_YUV422_SP,
.reg_swap_uv = true,
}, {
.fourcc = V4L2_PIX_FMT_YUYV,
.types = DW100_FMT_OUTPUT | DW100_FMT_CAPTURE,
.reg_format = DW100_DEWARP_CTRL_FORMAT_YUV422_PACKED,
.reg_swap_uv = false,
}, {
.fourcc = V4L2_PIX_FMT_UYVY,
.types = DW100_FMT_OUTPUT | DW100_FMT_CAPTURE,
.reg_format = DW100_DEWARP_CTRL_FORMAT_YUV422_PACKED,
.reg_swap_uv = true,
}, {
.fourcc = V4L2_PIX_FMT_NV12,
Annotation
- Immediate include surface: `linux/clk.h`, `linux/debugfs.h`, `linux/interrupt.h`, `linux/io.h`, `linux/irqreturn.h`, `linux/minmax.h`, `linux/module.h`, `linux/of.h`.
- Detected declarations: `struct dw100_device`, `struct dw100_q_data`, `struct dw100_ctx`, `function to_dw100_fmt_type`, `function dw100_read`, `function dw100_write`, `function dw100_dump_regs`, `function dw100_get_n_vertices_from_length`, `function dw100_map_convert_to_uq12_4`, `function dw100_map_format_coordinates`.
- 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.