1/* SPDX-License-Identifier: GPL-2.0-only OR MIT */ 2/* Copyright (c) 2023 Imagination Technologies Ltd. */ 3 4#ifndef PVR_POWER_H 5#define PVR_POWER_H 6 7#include "pvr_device.h" 8 9#include <linux/mutex.h> 10#include <linux/pm_runtime.h> 11 12int pvr_watchdog_init(struct pvr_device *pvr_dev); 13void pvr_watchdog_fini(struct pvr_device *pvr_dev); 14 15void pvr_device_lost(struct pvr_device *pvr_dev); 16 17bool pvr_power_is_idle(struct pvr_device *pvr_dev); 18 19int pvr_power_device_suspend(struct device *dev); 20int pvr_power_device_resume(struct device *dev); 21int pvr_power_device_idle(struct device *dev); 22 23int pvr_power_reset(struct pvr_device *pvr_dev, bool hard_reset); 24 25static __always_inline int 26pvr_power_get(struct pvr_device *pvr_dev) 27{ 28 struct drm_device *drm_dev = from_pvr_device(pvr_dev); 29 30 return pm_runtime_resume_and_get(drm_dev->dev); 31} 32 33static __always_inline int 34pvr_power_put(struct pvr_device *pvr_dev) 35{ 36 struct drm_device *drm_dev = from_pvr_device(pvr_dev); 37 38 return pm_runtime_put(drm_dev->dev); 39} 40 41#endif /* PVR_POWER_H */ 42