RE: [PATCH v8 04/11] media: chips-media: wave6: Add Wave6 decoder firmware interface
From: Nas Chung
Date: Fri Nov 20 2026 - 03:36:11 EST
Hi, Frank.
>-----Original Message-----
>From: Frank Li <Frank.li@xxxxxxxxxxx>
>Sent: Friday, November 20, 2026 5:38 AM
>To: Nas Chung <nas.chung@xxxxxxxxxxxxxxx>
>Cc: mchehab@xxxxxxxxxx; hverkuil@xxxxxxxxxx; robh@xxxxxxxxxx;
>krzk+dt@xxxxxxxxxx; conor+dt@xxxxxxxxxx; Frank.Li@xxxxxxx;
>s.hauer@xxxxxxxxxxxxxx; linux-media@xxxxxxxxxxxxxxx;
>devicetree@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx;
>imx@xxxxxxxxxxxxxxx; linux-arm-kernel@xxxxxxxxxxxxxxxxxxx;
>festevam@xxxxxxxxx; kernel@xxxxxxxxxxxxxx; nicolas.dufresne@xxxxxxxxxxxxx;
>ming.qian@xxxxxxxxxxx; marek.vasut@xxxxxxxxxxx; jackson.lee
><jackson.lee@xxxxxxxxxxxxxxx>; lafley.kim <lafley.kim@xxxxxxxxxxxxxxx>
>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@xxxxxxxxxxx>
>> Tested-by: Marek Vasut <marek.vasut@xxxxxxxxxxx>
>> Signed-off-by: Nas Chung <nas.chung@xxxxxxxxxxxxxxx>
>> ---
>...
>> +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
>>
>>