drivers/media/platform/chips-media/wave5/wave5-hw.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/chips-media/wave5/wave5-hw.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/chips-media/wave5/wave5-hw.c- Extension
.c- Size
- 88917 bytes
- Lines
- 2768
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/iopoll.hlinux/bitfield.hwave5-vpu.hwave5.hwave5-regdefine.h
Detected Declarations
function _wave5_print_reg_errfunction wave5_wait_fio_readlfunction wave5_fio_writelfunction wave5_wait_bus_busyfunction wave5_wait_vpu_busyfunction wave5_wait_vcpu_bus_busyfunction wave5_vpu_is_initfunction wave5_vpu_get_product_idfunction wave5_bit_issue_commandfunction wave5_vpu_firmware_command_queue_error_checkfunction send_firmware_commandfunction wave5_send_queryfunction setup_wave5_interruptsfunction setup_wave5_propertiesfunction wave5_vpu_get_versionfunction remap_pagefunction wave5_vpu_initfunction wave5_vpu_build_up_dec_paramfunction wave5_vpu_hw_flush_instancefunction get_bitstream_optionsfunction wave5_vpu_dec_init_seqfunction wave5_get_dec_seq_resultfunction wave5_vpu_dec_get_seq_infofunction wave5_vpu_dec_register_framebufferfunction wave5_vpu_dec_validate_sec_axifunction wave5_vpu_decodefunction wave5_vpu_dec_get_resultfunction wave5_vpu_re_initfunction wave5_vpu_sleep_wakefunction wave5_vpu_resetfunction wave5_vpu_dec_finish_seqfunction wave5_vpu_dec_set_bitstream_flagfunction wave5_dec_clr_disp_flagfunction wave5_dec_set_disp_flagfunction wave5_vpu_clear_interruptfunction wave5_dec_get_rd_ptrfunction wave5_dec_set_rd_ptrfunction wave5_vpu_build_up_enc_paramfunction wave5_set_enc_crop_infofunction wave5_vpu_enc_init_seqfunction wave5_vpu_enc_get_seq_infofunction calculate_luma_stridefunction calculate_chroma_stridefunction wave5_vpu_enc_register_framebufferfunction wave5_vpu_enc_validate_sec_axifunction wave5_vpu_encodefunction wave5_vpu_enc_get_resultfunction wave5_vpu_enc_finish_seq
Annotated Snippet
if (!info->profile) {
if ((profile_compatibility_flag & 0x06) == 0x06)
info->profile = HEVC_PROFILE_MAIN; /* main profile */
else if (profile_compatibility_flag & 0x04)
info->profile = HEVC_PROFILE_MAIN10; /* main10 profile */
else if (profile_compatibility_flag & 0x08)
/* main still picture profile */
info->profile = HEVC_PROFILE_STILLPICTURE;
else
info->profile = HEVC_PROFILE_MAIN; /* for old version HM */
}
} else if (inst->std == W_AVC_DEC) {
info->profile = FIELD_GET(SEQ_PARAM_PROFILE_MASK, reg_val);
}
if (inst->dev->product_code != WAVE515_CODE) {
info->vlc_buf_size = vpu_read_reg(inst->dev, W5_RET_VLC_BUF_SIZE);
info->param_buf_size = vpu_read_reg(inst->dev, W5_RET_PARAM_BUF_SIZE);
p_dec_info->vlc_buf_size = info->vlc_buf_size;
p_dec_info->param_buf_size = info->param_buf_size;
}
}
int wave5_vpu_dec_get_seq_info(struct vpu_instance *inst, struct dec_initial_info *info)
{
int ret;
u32 reg_val;
struct dec_info *p_dec_info = &inst->codec_info->dec_info;
vpu_write_reg(inst->dev, W5_CMD_DEC_ADDR_REPORT_BASE, p_dec_info->user_data_buf_addr);
vpu_write_reg(inst->dev, W5_CMD_DEC_REPORT_SIZE, p_dec_info->user_data_buf_size);
vpu_write_reg(inst->dev, W5_CMD_DEC_REPORT_PARAM, REPORT_PARAM_ENDIANNESS_BIG_ENDIAN);
/* send QUERY cmd */
ret = wave5_send_query(inst->dev, inst, GET_RESULT);
if (ret)
return ret;
reg_val = vpu_read_reg(inst->dev, W5_RET_QUEUE_STATUS);
p_dec_info->instance_queue_count = (reg_val >> 16) & 0xff;
p_dec_info->report_queue_count = (reg_val & QUEUE_REPORT_MASK);
dev_dbg(inst->dev->dev, "%s: init seq complete (queue %u : %u)\n", __func__,
p_dec_info->instance_queue_count, p_dec_info->report_queue_count);
/* this is not a fatal error, set ret to -EIO but don't return immediately */
if (vpu_read_reg(inst->dev, W5_RET_DEC_DECODING_SUCCESS) != 1) {
info->seq_init_err_reason = vpu_read_reg(inst->dev, W5_RET_DEC_ERR_INFO);
ret = -EIO;
}
wave5_get_dec_seq_result(inst, info);
return ret;
}
int wave5_vpu_dec_register_framebuffer(struct vpu_instance *inst, struct frame_buffer *fb_arr,
enum tiled_map_type map_type, unsigned int count)
{
int ret;
struct dec_info *p_dec_info = &inst->codec_info->dec_info;
struct dec_initial_info *init_info = &p_dec_info->initial_info;
size_t remain, idx, j, i, cnt_8_chunk, size;
u32 start_no, end_no;
u32 reg_val, cbcr_interleave, nv21, pic_size;
u32 addr_y, addr_cb, addr_cr;
u32 mv_col_size, frame_width, frame_height, fbc_y_tbl_size, fbc_c_tbl_size;
struct vpu_buf vb_buf;
bool justified = WTL_RIGHT_JUSTIFIED;
u32 format_no = WTL_PIXEL_8BIT;
u32 color_format = 0;
u32 pixel_order = 1;
u32 bwb_flag = (map_type == LINEAR_FRAME_MAP) ? 1 : 0;
cbcr_interleave = inst->cbcr_interleave;
nv21 = inst->nv21;
mv_col_size = 0;
fbc_y_tbl_size = 0;
fbc_c_tbl_size = 0;
if (map_type >= COMPRESSED_FRAME_MAP) {
cbcr_interleave = 0;
nv21 = 0;
switch (inst->std) {
case W_HEVC_DEC:
mv_col_size = WAVE5_DEC_HEVC_BUF_SIZE(init_info->pic_width,
init_info->pic_height);
break;
Annotation
- Immediate include surface: `linux/iopoll.h`, `linux/bitfield.h`, `wave5-vpu.h`, `wave5.h`, `wave5-regdefine.h`.
- Detected declarations: `function _wave5_print_reg_err`, `function wave5_wait_fio_readl`, `function wave5_fio_writel`, `function wave5_wait_bus_busy`, `function wave5_wait_vpu_busy`, `function wave5_wait_vcpu_bus_busy`, `function wave5_vpu_is_init`, `function wave5_vpu_get_product_id`, `function wave5_bit_issue_command`, `function wave5_vpu_firmware_command_queue_error_check`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
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.