[PATCH v1 3/7] media: chips-media: wave5: Fix not to be closed

From: Jackson.lee
Date: Wed Apr 09 2025 - 21:09:46 EST


From: Jackson Lee <jackson.lee@xxxxxxxxxxxxxxx>

The current code was to wait interrupt if queue or report queue is not 0,
but since applying the performance patch, input and output is not any
more synchronized.
So even if queue count is not 0, an interrupt could not be triggered.

Fixes: 15a4f7492acc ("media: chips-media: wave5: Improve performance of decoder")
Signed-off-by: Jackson Lee <jackson.lee@xxxxxxxxxxxxxxx>
Signed-off-by: Nas Chung <nas.chung@xxxxxxxxxxxxxxx>
---
drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c | 6 +++---
drivers/media/platform/chips-media/wave5/wave5-vpuconfig.h | 1 +
2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c b/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c
index 192556b91aaa..e0f4b11ee464 100644
--- a/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c
+++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c
@@ -1481,11 +1481,11 @@ static void wave5_vpu_dec_stop_streaming(struct vb2_queue *q)

wave5_vpu_dec_give_command(inst, DEC_GET_QUEUE_STATUS, &q_status);

- if (q_status.report_queue_count == 0)
+ if ((inst->state == VPU_INST_STATE_STOP || q_status.instance_queue_count == 0) &&
+ q_status.report_queue_count == 0)
break;

- if (wave5_vpu_wait_interrupt(inst, VPU_DEC_TIMEOUT) < 0)
- break;
+ wave5_vpu_wait_interrupt(inst, VPU_DEC_STOP_TIMEOUT);

if (wave5_vpu_dec_get_output_info(inst, &dec_output_info))
dev_dbg(inst->dev->dev, "there is no output info\n");
diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpuconfig.h b/drivers/media/platform/chips-media/wave5/wave5-vpuconfig.h
index 1ea9f5f31499..4ebd48d5550e 100644
--- a/drivers/media/platform/chips-media/wave5/wave5-vpuconfig.h
+++ b/drivers/media/platform/chips-media/wave5/wave5-vpuconfig.h
@@ -59,6 +59,7 @@
// application specific configuration
#define VPU_ENC_TIMEOUT 60000
#define VPU_DEC_TIMEOUT 60000
+#define VPU_DEC_STOP_TIMEOUT 10

// for WAVE encoder
#define USE_SRC_PRP_AXI 0
--
2.43.0