drivers/media/platform/xilinx/xilinx-vtc.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/xilinx/xilinx-vtc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/xilinx/xilinx-vtc.c- Extension
.c- Size
- 11036 bytes
- Lines
- 376
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/module.hlinux/of.hlinux/platform_device.hlinux/slab.hxilinx-vip.hxilinx-vtc.h
Detected Declarations
struct xvtc_devicefunction xvtc_gen_writefunction xvtc_generator_startfunction xvtc_generator_stopfunction xvtc_putfunction xvtc_register_devicefunction xvtc_unregister_devicefunction xvtc_parse_offunction xvtc_probefunction xvtc_removeexport xvtc_generator_startexport xvtc_generator_stopexport xvtc_of_getexport xvtc_put
Annotated Snippet
struct xvtc_device {
struct xvip_device xvip;
struct list_head list;
bool has_detector;
bool has_generator;
struct xvtc_config config;
};
static LIST_HEAD(xvtc_list);
static DEFINE_MUTEX(xvtc_lock);
static inline void xvtc_gen_write(struct xvtc_device *xvtc, u32 addr, u32 value)
{
xvip_write(&xvtc->xvip, XVTC_GENERATOR_OFFSET + addr, value);
}
/* -----------------------------------------------------------------------------
* Generator Operations
*/
int xvtc_generator_start(struct xvtc_device *xvtc,
const struct xvtc_config *config)
{
int ret;
if (!xvtc->has_generator)
return -ENXIO;
ret = clk_prepare_enable(xvtc->xvip.clk);
if (ret < 0)
return ret;
/* We don't care about the chroma active signal, encoding parameters are
* not important for now.
*/
xvtc_gen_write(xvtc, XVTC_POLARITY,
XVTC_POLARITY_ACTIVE_CHROMA_POL |
XVTC_POLARITY_ACTIVE_VIDEO_POL |
XVTC_POLARITY_HSYNC_POL | XVTC_POLARITY_VSYNC_POL |
XVTC_POLARITY_HBLANK_POL | XVTC_POLARITY_VBLANK_POL);
/* Hardcode the polarity to active high, as required by the video in to
* AXI4-stream core.
*/
xvtc_gen_write(xvtc, XVTC_ENCODING, 0);
/* Configure the timings. The VBLANK and VSYNC signals assertion and
* deassertion are hardcoded to the first pixel of the line.
*/
xvtc_gen_write(xvtc, XVTC_ACTIVE_SIZE,
(config->vblank_start << XVTC_ACTIVE_VSIZE_SHIFT) |
(config->hblank_start << XVTC_ACTIVE_HSIZE_SHIFT));
xvtc_gen_write(xvtc, XVTC_HSIZE, config->hsize);
xvtc_gen_write(xvtc, XVTC_VSIZE, config->vsize);
xvtc_gen_write(xvtc, XVTC_HSYNC,
(config->hsync_end << XVTC_HSYNC_END_SHIFT) |
(config->hsync_start << XVTC_HSYNC_START_SHIFT));
xvtc_gen_write(xvtc, XVTC_F0_VBLANK_H, 0);
xvtc_gen_write(xvtc, XVTC_F0_VSYNC_V,
(config->vsync_end << XVTC_F0_VSYNC_VEND_SHIFT) |
(config->vsync_start << XVTC_F0_VSYNC_VSTART_SHIFT));
xvtc_gen_write(xvtc, XVTC_F0_VSYNC_H, 0);
/* Enable the generator. Set the source of all generator parameters to
* generator registers.
*/
xvip_write(&xvtc->xvip, XVIP_CTRL_CONTROL,
XVTC_CONTROL_ACTIVE_CHROMA_POL_SRC |
XVTC_CONTROL_ACTIVE_VIDEO_POL_SRC |
XVTC_CONTROL_HSYNC_POL_SRC | XVTC_CONTROL_VSYNC_POL_SRC |
XVTC_CONTROL_HBLANK_POL_SRC | XVTC_CONTROL_VBLANK_POL_SRC |
XVTC_CONTROL_CHROMA_SRC | XVTC_CONTROL_VBLANK_HOFF_SRC |
XVTC_CONTROL_VSYNC_END_SRC | XVTC_CONTROL_VSYNC_START_SRC |
XVTC_CONTROL_ACTIVE_VSIZE_SRC |
XVTC_CONTROL_FRAME_VSIZE_SRC | XVTC_CONTROL_HSYNC_END_SRC |
XVTC_CONTROL_HSYNC_START_SRC |
XVTC_CONTROL_ACTIVE_HSIZE_SRC |
XVTC_CONTROL_FRAME_HSIZE_SRC | XVTC_CONTROL_GEN_ENABLE |
XVIP_CTRL_CONTROL_REG_UPDATE);
return 0;
}
EXPORT_SYMBOL_GPL(xvtc_generator_start);
int xvtc_generator_stop(struct xvtc_device *xvtc)
{
if (!xvtc->has_generator)
return -ENXIO;
Annotation
- Immediate include surface: `linux/clk.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/slab.h`, `xilinx-vip.h`, `xilinx-vtc.h`.
- Detected declarations: `struct xvtc_device`, `function xvtc_gen_write`, `function xvtc_generator_start`, `function xvtc_generator_stop`, `function xvtc_put`, `function xvtc_register_device`, `function xvtc_unregister_device`, `function xvtc_parse_of`, `function xvtc_probe`, `function xvtc_remove`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: integration 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.