drivers/media/pci/tw68/tw68-video.c
Source file repositories/reference/linux-study-clean/drivers/media/pci/tw68/tw68-video.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/pci/tw68/tw68-video.c- Extension
.c- Size
- 28381 bytes
- Lines
- 1018
- 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.
- 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/module.hmedia/v4l2-common.hmedia/v4l2-event.hmedia/videobuf2-dma-sg.htw68.htw68-reg.h
Detected Declarations
function set_tvnormfunction FIFOfunction tw68_video_start_dmafunction tw68_buffer_countfunction tw68_queue_setupfunction tw68_buf_queuefunction codefunction tw68_buf_finishfunction tw68_start_streamingfunction tw68_stop_streamingfunction tw68_s_ctrlfunction tw68_g_fmt_vid_capfunction tw68_try_fmt_vid_capfunction tw68_s_fmt_vid_capfunction tw68_enum_inputfunction tw68_g_inputfunction tw68_s_inputfunction tw68_querycapfunction tw68_s_stdfunction tw68_g_stdfunction tw68_enum_fmt_vid_capfunction tw68_dump_regsfunction vidioc_log_statusfunction vidioc_g_registerfunction vidioc_s_registerfunction tw68_set_tvnorm_hwfunction tw68_video_init1function tw68_video_init2function tw68_irq_video_done
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* tw68 functions to handle video data
*
* Much of this code is derived from the cx88 and sa7134 drivers, which
* were in turn derived from the bt87x driver. The original work was by
* Gerd Knorr; more recently the code was enhanced by Mauro Carvalho Chehab,
* Hans Verkuil, Andy Walls and many others. Their work is gratefully
* acknowledged. Full credit goes to them - any problems within this code
* are mine.
*
* Copyright (C) 2009 William M. Brack
*
* Refactored and updated to the latest v4l core frameworks:
*
* Copyright (C) 2014 Hans Verkuil <hverkuil@kernel.org>
*/
#include <linux/module.h>
#include <media/v4l2-common.h>
#include <media/v4l2-event.h>
#include <media/videobuf2-dma-sg.h>
#include "tw68.h"
#include "tw68-reg.h"
/* ------------------------------------------------------------------ */
/* data structs for video */
/*
* FIXME -
* Note that the saa7134 has formats, e.g. YUV420, which are classified
* as "planar". These affect overlay mode, and are flagged with a field
* ".planar" in the format. Do we need to implement this in this driver?
*/
static const struct tw68_format formats[] = {
{
.fourcc = V4L2_PIX_FMT_RGB555,
.depth = 16,
.twformat = ColorFormatRGB15,
}, {
.fourcc = V4L2_PIX_FMT_RGB555X,
.depth = 16,
.twformat = ColorFormatRGB15 | ColorFormatBSWAP,
}, {
.fourcc = V4L2_PIX_FMT_RGB565,
.depth = 16,
.twformat = ColorFormatRGB16,
}, {
.fourcc = V4L2_PIX_FMT_RGB565X,
.depth = 16,
.twformat = ColorFormatRGB16 | ColorFormatBSWAP,
}, {
.fourcc = V4L2_PIX_FMT_BGR24,
.depth = 24,
.twformat = ColorFormatRGB24,
}, {
.fourcc = V4L2_PIX_FMT_RGB24,
.depth = 24,
.twformat = ColorFormatRGB24 | ColorFormatBSWAP,
}, {
.fourcc = V4L2_PIX_FMT_BGR32,
.depth = 32,
.twformat = ColorFormatRGB32,
}, {
.fourcc = V4L2_PIX_FMT_RGB32,
.depth = 32,
.twformat = ColorFormatRGB32 | ColorFormatBSWAP |
ColorFormatWSWAP,
}, {
.fourcc = V4L2_PIX_FMT_YUYV,
.depth = 16,
.twformat = ColorFormatYUY2,
}, {
.fourcc = V4L2_PIX_FMT_UYVY,
.depth = 16,
.twformat = ColorFormatYUY2 | ColorFormatBSWAP,
}
};
#define FORMATS ARRAY_SIZE(formats)
#define NORM_625_50 \
.h_delay = 3, \
.h_delay0 = 133, \
.h_start = 0, \
.h_stop = 719, \
.v_delay = 24, \
.vbi_v_start_0 = 7, \
.vbi_v_stop_0 = 22, \
.video_v_start = 24, \
.video_v_stop = 311, \
Annotation
- Immediate include surface: `linux/module.h`, `media/v4l2-common.h`, `media/v4l2-event.h`, `media/videobuf2-dma-sg.h`, `tw68.h`, `tw68-reg.h`.
- Detected declarations: `function set_tvnorm`, `function FIFO`, `function tw68_video_start_dma`, `function tw68_buffer_count`, `function tw68_queue_setup`, `function tw68_buf_queue`, `function code`, `function tw68_buf_finish`, `function tw68_start_streaming`, `function tw68_stop_streaming`.
- Atlas domain: Driver Families / drivers/media.
- 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.