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