From 4e6f3ce8523c532114866c57bd62d92a867bcdbd Mon Sep 17 00:00:00 2001 From: Alpha Lin Date: Fri, 6 May 2016 09:18:13 +0800 Subject: [PATCH] rockchip/vcodec: seperate power-on timer for independent hw Seperate power-on timer for rkvdec and vpu when they are not in combo mode (definitly independence). Before this patch, h/w power off schedule will be interrupted by the other h/w, and power off will be triggered when h/w still running a task. Change-Id: I29124e90afccc727d2e7a04098727aa4a2c3e8bb Signed-off-by: Alpha Lin --- drivers/video/rockchip/vcodec/vcodec_service.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/video/rockchip/vcodec/vcodec_service.c b/drivers/video/rockchip/vcodec/vcodec_service.c index 6c684b412c2c..68aeeee8d732 100644 --- a/drivers/video/rockchip/vcodec/vcodec_service.c +++ b/drivers/video/rockchip/vcodec/vcodec_service.c @@ -338,6 +338,7 @@ struct vpu_subdev_data { struct vpu_service_info { struct wake_lock wake_lock; struct delayed_work power_off_work; + ktime_t last; /* record previous power-on time */ /* vpu service structure global lock */ struct mutex lock; /* link to link_reg in struct vpu_reg */ @@ -790,13 +791,12 @@ static void vpu_power_off_work(struct work_struct *work_s) static void vpu_service_power_on(struct vpu_service_info *pservice) { int ret; - static ktime_t last; ktime_t now = ktime_get(); - if (ktime_to_ns(ktime_sub(now, last)) > NSEC_PER_SEC) { + if (ktime_to_ns(ktime_sub(now, pservice->last)) > NSEC_PER_SEC) { cancel_delayed_work_sync(&pservice->power_off_work); vpu_queue_power_off_work(pservice); - last = now; + pservice->last = now; } ret = atomic_add_unless(&pservice->enabled, 1, 1); if (!ret) @@ -2461,6 +2461,7 @@ static void vcodec_init_drvdata(struct vpu_service_info *pservice) atomic_set(&pservice->reset_request, 0); INIT_DELAYED_WORK(&pservice->power_off_work, vpu_power_off_work); + pservice->last.tv64 = 0; pservice->ion_client = rockchip_ion_client_create("vpu"); if (IS_ERR(pservice->ion_client)) { -- 2.34.1