[PATCH v8 04/11] media: chips-media: wave6: Add Wave6 decoder firmware interface

Frank Li Frank.li at oss.nxp.com
Thu Nov 19 12:37:53 PST 2026


On Thu, Nov 19, 2026 at 05:59:58PM +0900, Nas Chung wrote:
> Add an interface layer to manage hardware register configuration
> and communication with the Chips&Media Wave6 video codec IP for
> video decoding.
>
> The interface provides low-level helper functions used by the
> Wave6 core driver to implement video decoding operations.
> It handles command submission to the firmware via MMIO registers,
> and waits for a response by polling the firmware busy flag.
>
> The decoder commands cover instance creation, flush and destruction,
> sequence initialization, frame buffer and display buffer registration,
> and picture decoding.
>
> Sequence initialization and picture decoding complete asynchronously:
> the interface interrupt reports completion and a query command reads
> back the result.
>
> Tested-by: Ming Qian <ming.qian at oss.nxp.com>
> Tested-by: Marek Vasut <marek.vasut at mailbox.org>
> Signed-off-by: Nas Chung <nas.chung at chipsnmedia.com>
> ---
...
> +int wave6_vpu_dec_issue_seq_init(struct vpu_instance *inst)
> +{
> +	struct dec_info *p_dec_info;
> +	u32 reg_val;
> +	int ret;
> +
> +	guard(mutex)(&inst->dev->hw_lock);
> +
> +	p_dec_info = &inst->codec_info->dec_info;
> +
> +	vpu_write_reg_relaxed(inst->dev, W6_CMD_DEC_INIT_SEQ_BS_RD_PTR, p_dec_info->stream_rd_ptr);
> +	vpu_write_reg_relaxed(inst->dev, W6_CMD_DEC_INIT_SEQ_BS_WR_PTR, p_dec_info->stream_wr_ptr);
> +
> +	reg_val = DEC_PIC_BS_OPTION_STREAM_END(p_dec_info->stream_end) |
> +		  DEC_PIC_BS_OPTION_EXPLICIT_END_ON;
> +	vpu_write_reg_relaxed(inst->dev, W6_CMD_DEC_INIT_SEQ_BS_OPTION, reg_val);
> +	reg_val = INIT_SEQ_OPTION_MODE(W6_INIT_SEQ_OPT_NORMAL);
> +	vpu_write_reg_relaxed(inst->dev, W6_CMD_DEC_INIT_SEQ_OPTION, reg_val);
> +
> +	wave6_send_command(inst->dev, inst->id, inst->std, W6_CMD_INIT_SEQ);
> +	ret = wave6_wait_vpu_busy(inst->dev, W6_VPU_BUSY_STATUS);
> +	if (ret) {
> +		dev_err(inst->dev->dev, "%s: timeout\n", __func__);
> +		return ret;
> +	}
> +
> +	if (!vpu_read_reg_relaxed(inst->dev, W6_RET_SUCCESS)) {
> +		u32 reason_code = vpu_read_reg_relaxed(inst->dev, W6_RET_FAIL_REASON);
> +
> +		wave6_print_reg_err(inst->dev, reason_code);
> +		return -EIO;
> +	}

I see many place use the same pattern. Can you move to help function to
macro like

#define wave6_send_command_sync(...) \
	wave6_send_command() ...
	wave6_wait_vpu_busy() ...
	...


Frank

> +
> +	return 0;
> +}
> 2.41.0.windows.3
>
>



More information about the linux-arm-kernel mailing list