drivers/media/platform/verisilicon/hantro.h
Source file repositories/reference/linux-study-clean/drivers/media/platform/verisilicon/hantro.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/verisilicon/hantro.h- Extension
.h- Size
- 15245 bytes
- Lines
- 511
- 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/platform_device.hlinux/videodev2.hlinux/wait.hlinux/clk.hlinux/reset.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-ioctl.hmedia/v4l2-mem2mem.hmedia/videobuf2-core.hmedia/videobuf2-dma-contig.hhantro_hw.h
Detected Declarations
struct hantro_ctxstruct hantro_codec_opsstruct hantro_postproc_opsstruct hantro_irqstruct hantro_variantstruct hantro_ctrlstruct hantro_funcstruct hantro_devstruct hantro_ctxstruct hantro_fmtstruct hantro_regstruct hantro_postproc_regsstruct hantro_vp9_decoded_buffer_infostruct hantro_av1_decoded_buffer_infostruct hantro_decoded_bufferenum hantro_codec_modefunction hantro_vdev_to_funcfunction vepu_write_relaxedfunction vepu_writefunction vepu_readfunction vdpu_write_relaxedfunction vdpu_writefunction hantro_write_addrfunction vdpu_readfunction vdpu_read_maskfunction hantro_reg_writefunction hantro_reg_write_relaxedfunction hantro_get_src_buffunction hantro_get_dst_buffunction hantro_get_dec_buf_addrfunction vb2_to_hantro_decoded_buf
Annotated Snippet
struct hantro_irq {
const char *name;
irqreturn_t (*handler)(int irq, void *priv);
};
/**
* struct hantro_variant - information about VPU hardware variant
*
* @enc_offset: Offset from VPU base to encoder registers.
* @dec_offset: Offset from VPU base to decoder registers.
* @enc_fmts: Encoder formats.
* @num_enc_fmts: Number of encoder formats.
* @dec_fmts: Decoder formats.
* @num_dec_fmts: Number of decoder formats.
* @postproc_fmts: Post-processor formats.
* @num_postproc_fmts: Number of post-processor formats.
* @postproc_ops: Post-processor ops.
* @codec: Supported codecs
* @codec_ops: Codec ops.
* @init: Initialize hardware, optional.
* @runtime_resume: reenable hardware after power gating, optional.
* @irqs: array of irq names and interrupt handlers
* @num_irqs: number of irqs in the array
* @clk_names: array of clock names
* @num_clocks: number of clocks in the array
* @reg_names: array of register range names
* @num_regs: number of register range names in the array
* @double_buffer: core needs double buffering
* @legacy_regs: core uses legacy register set
* @late_postproc: postproc must be set up at the end of the job
* @shared_devices: an array of device ids that cannot run concurrently
*/
struct hantro_variant {
unsigned int enc_offset;
unsigned int dec_offset;
const struct hantro_fmt *enc_fmts;
unsigned int num_enc_fmts;
const struct hantro_fmt *dec_fmts;
unsigned int num_dec_fmts;
const struct hantro_fmt *postproc_fmts;
unsigned int num_postproc_fmts;
const struct hantro_postproc_ops *postproc_ops;
unsigned int codec;
const struct hantro_codec_ops *codec_ops;
int (*init)(struct hantro_dev *vpu);
int (*runtime_resume)(struct hantro_dev *vpu);
const struct hantro_irq *irqs;
int num_irqs;
const char * const *clk_names;
int num_clocks;
const char * const *reg_names;
int num_regs;
unsigned int double_buffer : 1;
unsigned int legacy_regs : 1;
unsigned int late_postproc : 1;
const struct of_device_id *shared_devices;
};
/**
* enum hantro_codec_mode - codec operating mode.
* @HANTRO_MODE_NONE: No operating mode. Used for RAW video formats.
* @HANTRO_MODE_JPEG_ENC: JPEG encoder.
* @HANTRO_MODE_H264_DEC: H264 decoder.
* @HANTRO_MODE_MPEG2_DEC: MPEG-2 decoder.
* @HANTRO_MODE_VP8_DEC: VP8 decoder.
* @HANTRO_MODE_HEVC_DEC: HEVC decoder.
* @HANTRO_MODE_VP9_DEC: VP9 decoder.
* @HANTRO_MODE_AV1_DEC: AV1 decoder
*/
enum hantro_codec_mode {
HANTRO_MODE_NONE = -1,
HANTRO_MODE_JPEG_ENC,
HANTRO_MODE_H264_DEC,
HANTRO_MODE_MPEG2_DEC,
HANTRO_MODE_VP8_DEC,
HANTRO_MODE_HEVC_DEC,
HANTRO_MODE_VP9_DEC,
HANTRO_MODE_AV1_DEC,
};
/*
* struct hantro_ctrl - helper type to declare supported controls
* @codec: codec id this control belong to (HANTRO_JPEG_ENCODER, etc.)
* @cfg: control configuration
*/
struct hantro_ctrl {
unsigned int codec;
struct v4l2_ctrl_config cfg;
};
Annotation
- Immediate include surface: `linux/platform_device.h`, `linux/videodev2.h`, `linux/wait.h`, `linux/clk.h`, `linux/reset.h`, `media/v4l2-ctrls.h`, `media/v4l2-device.h`, `media/v4l2-ioctl.h`.
- Detected declarations: `struct hantro_ctx`, `struct hantro_codec_ops`, `struct hantro_postproc_ops`, `struct hantro_irq`, `struct hantro_variant`, `struct hantro_ctrl`, `struct hantro_func`, `struct hantro_dev`, `struct hantro_ctx`, `struct hantro_fmt`.
- 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.