panthor_gpu.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* SPDX-License-Identifier: GPL-2.0 or MIT */
  2. /* Copyright 2018 Marty E. Plummer <hanetzer@startmail.com> */
  3. /* Copyright 2019 Collabora ltd. */
  4. #ifndef __PANTHOR_GPU_H__
  5. #define __PANTHOR_GPU_H__
  6. #include <linux/types.h>
  7. struct panthor_device;
  8. int panthor_gpu_init(struct panthor_device *ptdev);
  9. void panthor_gpu_unplug(struct panthor_device *ptdev);
  10. void panthor_gpu_suspend(struct panthor_device *ptdev);
  11. void panthor_gpu_resume(struct panthor_device *ptdev);
  12. int panthor_gpu_block_power_on(struct panthor_device *ptdev,
  13. const char *blk_name,
  14. u32 pwron_reg, u32 pwrtrans_reg,
  15. u32 rdy_reg, u64 mask, u32 timeout_us);
  16. int panthor_gpu_block_power_off(struct panthor_device *ptdev,
  17. const char *blk_name,
  18. u32 pwroff_reg, u32 pwrtrans_reg,
  19. u64 mask, u32 timeout_us);
  20. /**
  21. * panthor_gpu_power_on() - Power on the GPU block.
  22. *
  23. * Return: 0 on success, a negative error code otherwise.
  24. */
  25. #define panthor_gpu_power_on(ptdev, type, mask, timeout_us) \
  26. panthor_gpu_block_power_on(ptdev, #type, \
  27. type ## _PWRON, \
  28. type ## _PWRTRANS, \
  29. type ## _READY, \
  30. mask, timeout_us)
  31. /**
  32. * panthor_gpu_power_off() - Power off the GPU block.
  33. *
  34. * Return: 0 on success, a negative error code otherwise.
  35. */
  36. #define panthor_gpu_power_off(ptdev, type, mask, timeout_us) \
  37. panthor_gpu_block_power_off(ptdev, #type, \
  38. type ## _PWROFF, \
  39. type ## _PWRTRANS, \
  40. mask, timeout_us)
  41. void panthor_gpu_l2_power_off(struct panthor_device *ptdev);
  42. int panthor_gpu_l2_power_on(struct panthor_device *ptdev);
  43. int panthor_gpu_flush_caches(struct panthor_device *ptdev,
  44. u32 l2, u32 lsc, u32 other);
  45. int panthor_gpu_soft_reset(struct panthor_device *ptdev);
  46. #endif