drm/panfrost: Simplify devfreq utilisation tracking
[linux-2.6-microblaze.git] / drivers / gpu / drm / panfrost / panfrost_job.c
index 33bf25b..d411eb6 100644 (file)
@@ -155,8 +155,7 @@ static void panfrost_job_hw_submit(struct panfrost_job *job, int js)
        }
 
        cfg = panfrost_mmu_as_get(pfdev, &job->file_priv->mmu);
-
-       panfrost_devfreq_record_transition(pfdev, js);
+       panfrost_devfreq_record_busy(pfdev);
 
        job_write(pfdev, JS_HEAD_NEXT_LO(js), jc_head & 0xFFFFFFFF);
        job_write(pfdev, JS_HEAD_NEXT_HI(js), jc_head >> 32);
@@ -404,7 +403,7 @@ static void panfrost_job_timedout(struct drm_sched_job *sched_job)
        }
        spin_unlock_irqrestore(&pfdev->js->job_lock, flags);
 
-       panfrost_devfreq_record_transition(pfdev, js);
+       panfrost_devfreq_record_idle(pfdev);
        panfrost_device_reset(pfdev);
 
        for (i = 0; i < NUM_JOB_SLOTS; i++)
@@ -467,7 +466,7 @@ static irqreturn_t panfrost_job_irq_handler(int irq, void *data)
                                pfdev->jobs[j] = NULL;
 
                                panfrost_mmu_as_put(pfdev, &job->file_priv->mmu);
-                               panfrost_devfreq_record_transition(pfdev, j);
+                               panfrost_devfreq_record_idle(pfdev);
 
                                dma_fence_signal_locked(job->done_fence);
                                pm_runtime_put_autosuspend(pfdev->dev);
@@ -568,14 +567,14 @@ int panfrost_job_is_idle(struct panfrost_device *pfdev)
        struct panfrost_job_slot *js = pfdev->js;
        int i;
 
+       /* Check whether the hardware is idle */
+       if (atomic_read(&pfdev->devfreq.busy_count))
+               return false;
+
        for (i = 0; i < NUM_JOB_SLOTS; i++) {
                /* If there are any jobs in the HW queue, we're not idle */
                if (atomic_read(&js->queue[i].sched.hw_rq_count))
                        return false;
-
-               /* Check whether the hardware is idle */
-               if (pfdev->devfreq.slot[i].busy)
-                       return false;
        }
 
        return true;