xref: /linux/drivers/accel/ivpu/ivpu_pm.h (revision 9557b4376d02088a33e5f4116bcc324d35a3b64c)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (C) 2020-2024 Intel Corporation
4  */
5 
6 #ifndef __IVPU_PM_H__
7 #define __IVPU_PM_H__
8 
9 #include <linux/rwsem.h>
10 #include <linux/types.h>
11 
12 struct ivpu_device;
13 
14 struct ivpu_pm_info {
15 	struct ivpu_device *vdev;
16 	struct delayed_work job_timeout_work;
17 	struct work_struct recovery_work;
18 	struct rw_semaphore reset_lock;
19 	atomic_t reset_counter;
20 	atomic_t reset_pending;
21 	bool is_warmboot;
22 	u8 dct_active_percent;
23 };
24 
25 void ivpu_pm_init(struct ivpu_device *vdev);
26 void ivpu_pm_enable(struct ivpu_device *vdev);
27 void ivpu_pm_disable(struct ivpu_device *vdev);
28 void ivpu_pm_cancel_recovery(struct ivpu_device *vdev);
29 
30 int ivpu_pm_suspend_cb(struct device *dev);
31 int ivpu_pm_resume_cb(struct device *dev);
32 int ivpu_pm_runtime_suspend_cb(struct device *dev);
33 int ivpu_pm_runtime_resume_cb(struct device *dev);
34 
35 void ivpu_pm_reset_prepare_cb(struct pci_dev *pdev);
36 void ivpu_pm_reset_done_cb(struct pci_dev *pdev);
37 
38 int __must_check ivpu_rpm_get(struct ivpu_device *vdev);
39 void ivpu_rpm_put(struct ivpu_device *vdev);
40 
41 void ivpu_pm_trigger_recovery(struct ivpu_device *vdev, const char *reason);
42 void ivpu_start_job_timeout_detection(struct ivpu_device *vdev);
43 void ivpu_stop_job_timeout_detection(struct ivpu_device *vdev);
44 
45 int ivpu_pm_dct_init(struct ivpu_device *vdev);
46 int ivpu_pm_dct_enable(struct ivpu_device *vdev, u8 active_percent);
47 int ivpu_pm_dct_disable(struct ivpu_device *vdev);
48 void ivpu_pm_dct_irq_thread_handler(struct ivpu_device *vdev);
49 
50 #endif /* __IVPU_PM_H__ */
51