1 /* SPDX-License-Identifier: GPL-2.0 or MIT */
3 /* Copyright 2019 Collabora ltd. */
5 #ifndef __PANTHOR_GPU_H__
6 #define __PANTHOR_GPU_H__
8 #include <linux/types.h>
10 struct panthor_device;
12 int panthor_gpu_init(struct panthor_device *ptdev);
13 void panthor_gpu_unplug(struct panthor_device *ptdev);
14 void panthor_gpu_suspend(struct panthor_device *ptdev);
15 void panthor_gpu_resume(struct panthor_device *ptdev);
17 int panthor_gpu_block_power_on(struct panthor_device *ptdev,
19 u32 pwron_reg, u32 pwrtrans_reg,
20 u32 rdy_reg, u64 mask, u32 timeout_us);
21 int panthor_gpu_block_power_off(struct panthor_device *ptdev,
23 u32 pwroff_reg, u32 pwrtrans_reg,
24 u64 mask, u32 timeout_us);
27 * panthor_gpu_power_on() - Power on the GPU block.
29 * Return: 0 on success, a negative error code otherwise.
31 #define panthor_gpu_power_on(ptdev, type, mask, timeout_us) \
32 panthor_gpu_block_power_on(ptdev, #type, \
34 type ## _PWRTRANS_LO, \
39 * panthor_gpu_power_off() - Power off the GPU block.
41 * Return: 0 on success, a negative error code otherwise.
43 #define panthor_gpu_power_off(ptdev, type, mask, timeout_us) \
44 panthor_gpu_block_power_off(ptdev, #type, \
46 type ## _PWRTRANS_LO, \
49 int panthor_gpu_l2_power_on(struct panthor_device *ptdev);
50 int panthor_gpu_flush_caches(struct panthor_device *ptdev,
51 u32 l2, u32 lsc, u32 other);
52 int panthor_gpu_soft_reset(struct panthor_device *ptdev);
53 u64 panthor_gpu_read_timestamp(struct panthor_device *ptdev);
54 u64 panthor_gpu_read_timestamp_offset(struct panthor_device *ptdev);