From 62630ade2fd8ba74fe5b30fffa99cce4c7614c5d Mon Sep 17 00:00:00 2001 From: Jung Zhao Date: Tue, 10 Jan 2017 14:53:40 +0800 Subject: [PATCH] video: rockchip: vcodec: fix reboot crash when playing shutdown function need wait last irq finish and then continue its work. Change-Id: I12bed04f6eeac1f12eedf55a09699be49fb4ac35 Signed-off-by: Jung Zhao --- drivers/video/rockchip/vcodec/vcodec_service.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/video/rockchip/vcodec/vcodec_service.c b/drivers/video/rockchip/vcodec/vcodec_service.c index 69e04b84df8b..8426bd94294b 100644 --- a/drivers/video/rockchip/vcodec/vcodec_service.c +++ b/drivers/video/rockchip/vcodec/vcodec_service.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -2636,6 +2637,8 @@ static void vcodec_shutdown(struct platform_device *pdev) { struct vpu_subdev_data *data = platform_get_drvdata(pdev); struct vpu_service_info *pservice = data->pservice; + int val; + int ret; dev_info(&pdev->dev, "vcodec shutdown"); @@ -2643,6 +2646,12 @@ static void vcodec_shutdown(struct platform_device *pdev) atomic_set(&pservice->service_on, 0); mutex_unlock(&pservice->shutdown_lock); + ret = readx_poll_timeout(atomic_read, + &pservice->total_running, + val, val == 0, 20000, 200000); + if (ret == -ETIMEDOUT) + dev_err(&pdev->dev, "wait total running time out\n"); + vcodec_exit_mode(data); vpu_service_power_on(data, pservice); -- 2.34.1