xref: /openbmc/linux/drivers/accel/ivpu/ivpu_pm.h (revision c900529f3d9161bfde5cca0754f83b4d3c3e0220)
1852be13fSJacek Lawrynowicz /* SPDX-License-Identifier: GPL-2.0-only */
2852be13fSJacek Lawrynowicz /*
3852be13fSJacek Lawrynowicz  * Copyright (C) 2020-2023 Intel Corporation
4852be13fSJacek Lawrynowicz  */
5852be13fSJacek Lawrynowicz 
6852be13fSJacek Lawrynowicz #ifndef __IVPU_PM_H__
7852be13fSJacek Lawrynowicz #define __IVPU_PM_H__
8852be13fSJacek Lawrynowicz 
9852be13fSJacek Lawrynowicz #include <linux/types.h>
10852be13fSJacek Lawrynowicz 
11852be13fSJacek Lawrynowicz struct ivpu_device;
12852be13fSJacek Lawrynowicz 
13852be13fSJacek Lawrynowicz struct ivpu_pm_info {
14852be13fSJacek Lawrynowicz 	struct ivpu_device *vdev;
15852be13fSJacek Lawrynowicz 	struct work_struct recovery_work;
16852be13fSJacek Lawrynowicz 	atomic_t in_reset;
17*8f7fb1e2SStanislaw Gruszka 	atomic_t reset_counter;
18852be13fSJacek Lawrynowicz 	bool is_warmboot;
19852be13fSJacek Lawrynowicz 	u32 suspend_reschedule_counter;
20852be13fSJacek Lawrynowicz };
21852be13fSJacek Lawrynowicz 
22852be13fSJacek Lawrynowicz int ivpu_pm_init(struct ivpu_device *vdev);
23852be13fSJacek Lawrynowicz void ivpu_pm_enable(struct ivpu_device *vdev);
24852be13fSJacek Lawrynowicz void ivpu_pm_disable(struct ivpu_device *vdev);
256013aa84SStanislaw Gruszka void ivpu_pm_cancel_recovery(struct ivpu_device *vdev);
26852be13fSJacek Lawrynowicz 
27852be13fSJacek Lawrynowicz int ivpu_pm_suspend_cb(struct device *dev);
28852be13fSJacek Lawrynowicz int ivpu_pm_resume_cb(struct device *dev);
29852be13fSJacek Lawrynowicz int ivpu_pm_runtime_suspend_cb(struct device *dev);
30852be13fSJacek Lawrynowicz int ivpu_pm_runtime_resume_cb(struct device *dev);
31852be13fSJacek Lawrynowicz 
32852be13fSJacek Lawrynowicz void ivpu_pm_reset_prepare_cb(struct pci_dev *pdev);
33852be13fSJacek Lawrynowicz void ivpu_pm_reset_done_cb(struct pci_dev *pdev);
34852be13fSJacek Lawrynowicz 
35852be13fSJacek Lawrynowicz int __must_check ivpu_rpm_get(struct ivpu_device *vdev);
36852be13fSJacek Lawrynowicz void ivpu_rpm_put(struct ivpu_device *vdev);
37852be13fSJacek Lawrynowicz 
38852be13fSJacek Lawrynowicz void ivpu_pm_schedule_recovery(struct ivpu_device *vdev);
39852be13fSJacek Lawrynowicz 
40852be13fSJacek Lawrynowicz #endif /* __IVPU_PM_H__ */
41