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 12 int pvr_watchdog_init(struct pvr_device *pvr_dev); 13 void pvr_watchdog_fini(struct pvr_device *pvr_dev); 14 15 void pvr_device_lost(struct pvr_device *pvr_dev); 16 17 bool pvr_power_is_idle(struct pvr_device *pvr_dev); 18 19 int pvr_power_device_suspend(struct device *dev); 20 int pvr_power_device_resume(struct device *dev); 21 int pvr_power_device_idle(struct device *dev); 22 23 int pvr_power_reset(struct pvr_device *pvr_dev, bool hard_reset); 24 25 static __always_inline int 26 pvr_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 33 static __always_inline int 34 pvr_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