From: Jung Zhao Date: Tue, 10 Jan 2017 06:53:40 +0000 (+0800) Subject: video: rockchip: vcodec: fix reboot crash when playing X-Git-Tag: firefly_0821_release~723 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=62630ade2fd8ba74fe5b30fffa99cce4c7614c5d;p=firefly-linux-kernel-4.4.55.git 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 --- 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);