xref: /linux/drivers/accel/ivpu/ivpu_pm.h (revision e7b2b108cdeab76a7e7324459e50b0c1214c0386)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (C) 2020-2023 Intel Corporation
4  */
5 
6 #ifndef __IVPU_PM_H__
7 #define __IVPU_PM_H__
8 
9 #include <linux/types.h>
10 
11 struct ivpu_device;
12 
13 struct ivpu_pm_info {
14 	struct ivpu_device *vdev;
15 	struct delayed_work job_timeout_work;
16 	struct work_struct recovery_work;
17 	atomic_t in_reset;
18 	atomic_t reset_counter;
19 	bool is_warmboot;
20 	u32 suspend_reschedule_counter;
21 };
22 
23 void ivpu_pm_init(struct ivpu_device *vdev);
24 void ivpu_pm_enable(struct ivpu_device *vdev);
25 void ivpu_pm_disable(struct ivpu_device *vdev);
26 void ivpu_pm_cancel_recovery(struct ivpu_device *vdev);
27 
28 int ivpu_pm_suspend_cb(struct device *dev);
29 int ivpu_pm_resume_cb(struct device *dev);
30 int ivpu_pm_runtime_suspend_cb(struct device *dev);
31 int ivpu_pm_runtime_resume_cb(struct device *dev);
32 
33 void ivpu_pm_reset_prepare_cb(struct pci_dev *pdev);
34 void ivpu_pm_reset_done_cb(struct pci_dev *pdev);
35 
36 int __must_check ivpu_rpm_get(struct ivpu_device *vdev);
37 int __must_check ivpu_rpm_get_if_active(struct ivpu_device *vdev);
38 void ivpu_rpm_put(struct ivpu_device *vdev);
39 
40 void ivpu_pm_schedule_recovery(struct ivpu_device *vdev);
41 void ivpu_start_job_timeout_detection(struct ivpu_device *vdev);
42 void ivpu_stop_job_timeout_detection(struct ivpu_device *vdev);
43 
44 #endif /* __IVPU_PM_H__ */
45