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

Nas Chung nas.chung at chipsnmedia.com
Fri Nov 20 00:35:58 PST 2026


Hi, Frank.

>-----Original Message-----
>From: Frank Li <Frank.li at oss.nxp.com>
>Sent: Friday, November 20, 2026 5:38 AM
>To: Nas Chung <nas.chung at chipsnmedia.com>
>Cc: mchehab at kernel.org; hverkuil at kernel.org; robh at kernel.org;
>krzk+dt at kernel.org; conor+dt at kernel.org; Frank.Li at nxp.com;
>s.hauer at pengutronix.de; linux-media at vger.kernel.org;
>devicetree at vger.kernel.org; linux-kernel at vger.kernel.org;
>imx at lists.linux.dev; linux-arm-kernel at lists.infradead.org;
>festevam at gmail.com; kernel at pengutronix.de; nicolas.dufresne at collabora.com;
>ming.qian at oss.nxp.com; marek.vasut at mailbox.org; jackson.lee
><jackson.lee at chipsnmedia.com>; lafley.kim <lafley.kim at chipsnmedia.com>
>Subject: Re: [PATCH v8 04/11] media: chips-media: wave6: Add Wave6 decoder
>firmware interface
>
>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() ...
>	...
>

Right. I will move this common pattern into a single helper function in v9.

Thanks.
Nas.

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



More information about the linux-arm-kernel mailing list