Lines Matching full:pm

115 	struct ivpu_pm_info *pm = container_of(work, struct ivpu_pm_info, recovery_work);  in ivpu_pm_recovery_work()  local
116 struct ivpu_device *vdev = pm->vdev; in ivpu_pm_recovery_work()
120 ivpu_err(vdev, "Recovering the NPU (reset #%d)\n", atomic_read(&vdev->pm->reset_counter)); in ivpu_pm_recovery_work()
128 atomic_inc(&vdev->pm->reset_counter); in ivpu_pm_recovery_work()
129 atomic_set(&vdev->pm->reset_pending, 1); in ivpu_pm_recovery_work()
130 down_write(&vdev->pm->reset_lock); in ivpu_pm_recovery_work()
141 up_write(&vdev->pm->reset_lock); in ivpu_pm_recovery_work()
142 atomic_set(&vdev->pm->reset_pending, 0); in ivpu_pm_recovery_work()
164 if (atomic_cmpxchg(&vdev->pm->reset_pending, 0, 1) == 0) { in ivpu_pm_trigger_recovery()
167 queue_work(system_long_wq, &vdev->pm->recovery_work); in ivpu_pm_trigger_recovery()
173 struct ivpu_pm_info *pm = container_of(work, struct ivpu_pm_info, job_timeout_work.work); in ivpu_job_timeout_work() local
174 struct ivpu_device *vdev = pm->vdev; in ivpu_job_timeout_work()
184 queue_delayed_work(system_wq, &vdev->pm->job_timeout_work, msecs_to_jiffies(timeout_ms)); in ivpu_start_job_timeout_detection()
189 cancel_delayed_work_sync(&vdev->pm->job_timeout_work); in ivpu_stop_job_timeout_detection()
198 ivpu_dbg(vdev, PM, "Suspend..\n"); in ivpu_pm_suspend_cb()
214 ivpu_dbg(vdev, PM, "Suspend done.\n"); in ivpu_pm_suspend_cb()
225 ivpu_dbg(vdev, PM, "Resume..\n"); in ivpu_pm_resume_cb()
231 ivpu_dbg(vdev, PM, "Resume done.\n"); in ivpu_pm_resume_cb()
244 drm_WARN_ON(&vdev->drm, work_pending(&vdev->pm->recovery_work)); in ivpu_pm_runtime_suspend_cb()
246 ivpu_dbg(vdev, PM, "Runtime suspend..\n"); in ivpu_pm_runtime_suspend_cb()
250 is_idle = ivpu_hw_is_idle(vdev) || vdev->pm->dct_active_percent; in ivpu_pm_runtime_suspend_cb()
264 atomic_inc(&vdev->pm->reset_counter); in ivpu_pm_runtime_suspend_cb()
271 ivpu_dbg(vdev, PM, "Runtime suspend done.\n"); in ivpu_pm_runtime_suspend_cb()
282 ivpu_dbg(vdev, PM, "Runtime resume..\n"); in ivpu_pm_runtime_resume_cb()
288 ivpu_dbg(vdev, PM, "Runtime resume done.\n"); in ivpu_pm_runtime_resume_cb()
313 ivpu_dbg(vdev, PM, "Pre-reset..\n"); in ivpu_pm_reset_prepare_cb()
314 atomic_inc(&vdev->pm->reset_counter); in ivpu_pm_reset_prepare_cb()
315 atomic_set(&vdev->pm->reset_pending, 1); in ivpu_pm_reset_prepare_cb()
318 down_write(&vdev->pm->reset_lock); in ivpu_pm_reset_prepare_cb()
325 ivpu_dbg(vdev, PM, "Pre-reset done.\n"); in ivpu_pm_reset_prepare_cb()
333 ivpu_dbg(vdev, PM, "Post-reset..\n"); in ivpu_pm_reset_done_cb()
337 up_write(&vdev->pm->reset_lock); in ivpu_pm_reset_done_cb()
338 atomic_set(&vdev->pm->reset_pending, 0); in ivpu_pm_reset_done_cb()
339 ivpu_dbg(vdev, PM, "Post-reset done.\n"); in ivpu_pm_reset_done_cb()
348 struct ivpu_pm_info *pm = vdev->pm; in ivpu_pm_init() local
351 pm->vdev = vdev; in ivpu_pm_init()
353 init_rwsem(&pm->reset_lock); in ivpu_pm_init()
354 atomic_set(&pm->reset_pending, 0); in ivpu_pm_init()
355 atomic_set(&pm->reset_counter, 0); in ivpu_pm_init()
357 INIT_WORK(&pm->recovery_work, ivpu_pm_recovery_work); in ivpu_pm_init()
358 INIT_DELAYED_WORK(&pm->job_timeout_work, ivpu_job_timeout_work); in ivpu_pm_init()
368 ivpu_dbg(vdev, PM, "Autosuspend delay = %d\n", delay); in ivpu_pm_init()
373 drm_WARN_ON(&vdev->drm, delayed_work_pending(&vdev->pm->job_timeout_work)); in ivpu_pm_cancel_recovery()
374 cancel_work_sync(&vdev->pm->recovery_work); in ivpu_pm_cancel_recovery()
395 if (vdev->pm->dct_active_percent) in ivpu_pm_dct_init()
396 return ivpu_pm_dct_enable(vdev, vdev->pm->dct_active_percent); in ivpu_pm_dct_init()
418 vdev->pm->dct_active_percent = active_percent; in ivpu_pm_dct_enable()
420 ivpu_dbg(vdev, PM, "DCT set to %u%% (D0: %uus, D0i2: %uus)\n", in ivpu_pm_dct_enable()
435 vdev->pm->dct_active_percent = 0; in ivpu_pm_dct_disable()
437 ivpu_dbg(vdev, PM, "DCT disabled\n"); in ivpu_pm_dct_disable()
449 if (vdev->pm->dct_active_percent) in ivpu_pm_dct_irq_thread_handler()
455 ivpu_hw_btrs_dct_set_status(vdev, enable, vdev->pm->dct_active_percent); in ivpu_pm_dct_irq_thread_handler()