2023-01-17 02:27:23 -07:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
|
|
/*
|
2024-06-11 05:04:20 -07:00
|
|
|
* Copyright (C) 2020-2024 Intel Corporation
|
2023-01-17 02:27:23 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __IVPU_PM_H__
|
|
|
|
#define __IVPU_PM_H__
|
|
|
|
|
2024-01-22 05:09:45 -07:00
|
|
|
#include <linux/rwsem.h>
|
2023-01-17 02:27:23 -07:00
|
|
|
#include <linux/types.h>
|
|
|
|
|
|
|
|
struct ivpu_device;
|
|
|
|
|
|
|
|
struct ivpu_pm_info {
|
|
|
|
struct ivpu_device *vdev;
|
2023-11-13 10:02:51 -07:00
|
|
|
struct delayed_work job_timeout_work;
|
2023-01-17 02:27:23 -07:00
|
|
|
struct work_struct recovery_work;
|
2024-01-22 05:09:45 -07:00
|
|
|
struct rw_semaphore reset_lock;
|
2023-05-24 00:48:45 -07:00
|
|
|
atomic_t reset_counter;
|
2024-01-22 05:09:45 -07:00
|
|
|
atomic_t reset_pending;
|
2023-01-17 02:27:23 -07:00
|
|
|
bool is_warmboot;
|
2024-06-11 05:04:23 -07:00
|
|
|
u8 dct_active_percent;
|
2023-01-17 02:27:23 -07:00
|
|
|
};
|
|
|
|
|
2023-09-01 02:49:49 -07:00
|
|
|
void ivpu_pm_init(struct ivpu_device *vdev);
|
2023-01-17 02:27:23 -07:00
|
|
|
void ivpu_pm_enable(struct ivpu_device *vdev);
|
|
|
|
void ivpu_pm_disable(struct ivpu_device *vdev);
|
2023-03-23 05:54:58 -07:00
|
|
|
void ivpu_pm_cancel_recovery(struct ivpu_device *vdev);
|
2023-01-17 02:27:23 -07:00
|
|
|
|
|
|
|
int ivpu_pm_suspend_cb(struct device *dev);
|
|
|
|
int ivpu_pm_resume_cb(struct device *dev);
|
|
|
|
int ivpu_pm_runtime_suspend_cb(struct device *dev);
|
|
|
|
int ivpu_pm_runtime_resume_cb(struct device *dev);
|
|
|
|
|
|
|
|
void ivpu_pm_reset_prepare_cb(struct pci_dev *pdev);
|
|
|
|
void ivpu_pm_reset_done_cb(struct pci_dev *pdev);
|
|
|
|
|
|
|
|
int __must_check ivpu_rpm_get(struct ivpu_device *vdev);
|
|
|
|
void ivpu_rpm_put(struct ivpu_device *vdev);
|
|
|
|
|
2024-01-22 05:09:45 -07:00
|
|
|
void ivpu_pm_trigger_recovery(struct ivpu_device *vdev, const char *reason);
|
2023-11-13 10:02:51 -07:00
|
|
|
void ivpu_start_job_timeout_detection(struct ivpu_device *vdev);
|
|
|
|
void ivpu_stop_job_timeout_detection(struct ivpu_device *vdev);
|
2023-01-17 02:27:23 -07:00
|
|
|
|
2024-06-11 05:04:23 -07:00
|
|
|
int ivpu_pm_dct_init(struct ivpu_device *vdev);
|
|
|
|
int ivpu_pm_dct_enable(struct ivpu_device *vdev, u8 active_percent);
|
|
|
|
int ivpu_pm_dct_disable(struct ivpu_device *vdev);
|
|
|
|
void ivpu_pm_dct_irq_thread_handler(struct ivpu_device *vdev);
|
|
|
|
|
2023-01-17 02:27:23 -07:00
|
|
|
#endif /* __IVPU_PM_H__ */
|