summaryrefslogtreecommitdiff
path: root/drivers/mxc
diff options
context:
space:
mode:
authorGuoRui <rui.guo_4@nxp.com>2018-06-01 19:01:39 +0800
committerLeonard Crestez <leonard.crestez@nxp.com>2018-08-24 12:41:33 +0300
commit591f86f531870bc2636cd6c05c12b3bf368bc0d6 (patch)
treec26f83a1c582ac9280b17c019016d46b78467dd9 /drivers/mxc
parentb6d98e1039e369fffd335f620fdb134d8a76a3c7 (diff)
MLK-18481: encoder multi-instance, wait_timeout, suspend & resume
fix encoder multi-instance bug modify wait to wait_timeout complete encoder suspend and resume Signed-off-by: GuoRui <rui.guo_4@nxp.com>
Diffstat (limited to 'drivers/mxc')
-rw-r--r--drivers/mxc/vpu-encoder-b0/vpu_encoder_b0.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/drivers/mxc/vpu-encoder-b0/vpu_encoder_b0.c b/drivers/mxc/vpu-encoder-b0/vpu_encoder_b0.c
index 1768a61f464c..2ba0b3d13e40 100644
--- a/drivers/mxc/vpu-encoder-b0/vpu_encoder_b0.c
+++ b/drivers/mxc/vpu-encoder-b0/vpu_encoder_b0.c
@@ -810,9 +810,14 @@ static bool update_yuv_addr(struct vpu_ctx *ctx, u_int32 uStrIdx)
pParamYuvBuffDesc = (pMEDIAIP_ENC_YUV_BUFFER_DESC)phy_to_virt(pEncCtrlInterface->pEncYUVBufferDesc,
ctx->dev->shared_mem.base_offset);
- wait_event_interruptible(ctx->buffer_wq_input,
- !list_empty(&This->drv_q) || ctx->forceStop
- );
+ while (1) {
+ if (!wait_event_interruptible_timeout(ctx->buffer_wq_input,
+ (!list_empty(&This->drv_q)) || ctx->forceStop,
+ msecs_to_jiffies(5000)))
+ vpu_dbg(LVL_ERR, " warn: wait_event_interruptible_timeout wait 5s timeout\n");
+ else
+ break;
+ }
down(&This->drv_q_lock);
if (!list_empty(&This->drv_q)) {
@@ -880,9 +885,14 @@ static void report_stream_done(struct vpu_ctx *ctx, MEDIAIP_ENC_PIC_INFO *pEncP
rptr_virt = ctx->encoder_stream.virt_addr + rptr - start;
vpu_dbg(LVL_INFO, "report_stream_done eptr=%x, rptr=%x, start=%x, end=%x\n", wptr, rptr, start, end);
- wait_event_interruptible(ctx->buffer_wq_output,
- !list_empty(&This->drv_q) || ctx->forceStop
- );
+ while (1) {
+ if (!wait_event_interruptible_timeout(ctx->buffer_wq_output,
+ (!list_empty(&This->drv_q)) || ctx->forceStop,
+ msecs_to_jiffies(5000)))
+ vpu_dbg(LVL_ERR, " warn: wait_event_interruptible_timeout wait 5s timeout\n");
+ else
+ break;
+ }
if (ctx->forceStop)
return;
@@ -1036,7 +1046,7 @@ static void vpu_api_event_handler(struct vpu_ctx *ctx, u_int32 uStrIdx, u_int32
if (uStrIdx < VID_API_NUM_STREAMS) {
switch (uEvent) {
case VID_API_ENC_EVENT_START_DONE: {
- update_yuv_addr(ctx, 0);
+ update_yuv_addr(ctx, uStrIdx);
v4l2_vpu_send_cmd(ctx, uStrIdx, GTB_ENC_CMD_FRAME_ENCODE, 0, NULL);
} break;
case VID_API_ENC_EVENT_MEM_REQUEST: {
@@ -1124,6 +1134,9 @@ static irqreturn_t fsl_vpu_mu_isr(int irq, void *This)
} else if (msg == 0x55) {
dev->firmware_started = true;
complete(&dev->start_cmp);
+ } else if (msg == 0xA5) {
+ /*receive snapshot done msg and wakeup complete to suspend*/
+ complete(&dev->snap_done_cmp);
} else
schedule_work(&dev->msg_work);
return IRQ_HANDLED;
@@ -1991,6 +2004,7 @@ static int vpu_probe(struct platform_device *pdev)
mutex_init(&dev->dev_mutex);
mutex_init(&dev->cmd_mutex);
init_completion(&dev->start_cmp);
+ init_completion(&dev->snap_done_cmp);
dev->firmware_started = false;
dev->fw_is_ready = false;