rockchip/vcodec: seperate power-on timer for independent hw
authorAlpha Lin <alpha.lin@rock-chips.com>
Fri, 6 May 2016 01:18:13 +0000 (09:18 +0800)
committerAlpha Lin <alpha.lin@rock-chips.com>
Fri, 6 May 2016 01:29:46 +0000 (09:29 +0800)
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 <alpha.lin@rock-chips.com>
drivers/video/rockchip/vcodec/vcodec_service.c

index 6c684b412c2c23af7bc2824c1d2cf6190c3aef61..68aeeee8d7326aa4514b8757d2f41046488f8b49 100644 (file)
@@ -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)) {