pvr_power.h 1.0 KB

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