From e31b48f2899ec5566f49843e7a869933b461e4f3 Mon Sep 17 00:00:00 2001 From: Jung Zhao Date: Fri, 26 Jan 2018 17:10:00 +0800 Subject: [PATCH] video: rockchip: vpu: fix dead lock of reset_lock we cannot do vpu_reset when translate address. that is the only situation we need to protect. so remove extra reset_lock place. Change-Id: Ibb23909788e9a3c7ef1c455cdeacdf6c964a5868 Signed-off-by: Jung Zhao --- drivers/video/rockchip/vcodec/vcodec_service.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/video/rockchip/vcodec/vcodec_service.c b/drivers/video/rockchip/vcodec/vcodec_service.c index 0746b84edd7c..004a1a809e23 100644 --- a/drivers/video/rockchip/vcodec/vcodec_service.c +++ b/drivers/video/rockchip/vcodec/vcodec_service.c @@ -535,7 +535,6 @@ static void vcodec_enter_mode(struct vpu_subdev_data *data) struct vpu_service_info *pservice = data->pservice; struct vpu_subdev_data *subdata, *n; - mutex_lock(&pservice->reset_lock); /* * For the RK3228H, it is not necessary to write a register to * switch vpu combo mode, it is unsafe to write the grf. @@ -588,15 +587,12 @@ static void vcodec_enter_mode(struct vpu_subdev_data *data) static void vcodec_exit_mode(struct vpu_subdev_data *data) { - struct vpu_service_info *pservice = data->pservice; - /* * In case of VPU Combo, it require HW switch its running mode * before the other HW component start work. set current HW running * mode to none, can ensure HW switch to its reqired mode properly. */ data->pservice->curr_mode = VCODEC_RUNNING_MODE_NONE; - mutex_unlock(&pservice->reset_lock); } static int vpu_get_clk(struct vpu_service_info *pservice) @@ -1563,7 +1559,6 @@ static void reg_copy_to_hw(struct vpu_subdev_data *data, struct vpu_reg *reg) default: { vpu_err("error: unsupport session type %d", reg->type); - vcodec_exit_mode(data); atomic_sub(1, &pservice->total_running); atomic_sub(1, ®->session->task_running); } break; @@ -1813,7 +1808,11 @@ static long vpu_service_ioctl(struct file *filp, unsigned int cmd, if (ret < 0) { int task_running = atomic_read(&session->task_running); - mutex_lock(&pservice->reset_lock); + /* + * if reaching here, no irq return, and need to do + * vpu_reset immediately. there is no need to care + * reset_lock at this situation. + */ mutex_lock(&pservice->lock); if (task_running) { atomic_set(&session->task_running, 0); @@ -1826,7 +1825,6 @@ static long vpu_service_ioctl(struct file *filp, unsigned int cmd, } vpu_service_session_clear(data, session); mutex_unlock(&pservice->lock); - mutex_unlock(&pservice->reset_lock); return ret; }