summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/panthor/panthor_gpu.h
blob: bba7555dd3c649f4727b521c24d7ce35e8b5c3bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* SPDX-License-Identifier: GPL-2.0 or MIT */
/* Copyright 2018 Marty E. Plummer <hanetzer@startmail.com> */
/* Copyright 2019 Collabora ltd. */

#ifndef __PANTHOR_GPU_H__
#define __PANTHOR_GPU_H__

struct panthor_device;

int panthor_gpu_init(struct panthor_device *ptdev);
void panthor_gpu_unplug(struct panthor_device *ptdev);
void panthor_gpu_suspend(struct panthor_device *ptdev);
void panthor_gpu_resume(struct panthor_device *ptdev);

int panthor_gpu_block_power_on(struct panthor_device *ptdev,
			       const char *blk_name,
			       u32 pwron_reg, u32 pwrtrans_reg,
			       u32 rdy_reg, u64 mask, u32 timeout_us);
int panthor_gpu_block_power_off(struct panthor_device *ptdev,
				const char *blk_name,
				u32 pwroff_reg, u32 pwrtrans_reg,
				u64 mask, u32 timeout_us);

/**
 * panthor_gpu_power_on() - Power on the GPU block.
 *
 * Return: 0 on success, a negative error code otherwise.
 */
#define panthor_gpu_power_on(ptdev, type, mask, timeout_us) \
	panthor_gpu_block_power_on(ptdev, #type, \
				  type ## _PWRON_LO, \
				  type ## _PWRTRANS_LO, \
				  type ## _READY_LO, \
				  mask, timeout_us)

/**
 * panthor_gpu_power_off() - Power off the GPU block.
 *
 * Return: 0 on success, a negative error code otherwise.
 */
#define panthor_gpu_power_off(ptdev, type, mask, timeout_us) \
	panthor_gpu_block_power_off(ptdev, #type, \
				   type ## _PWROFF_LO, \
				   type ## _PWRTRANS_LO, \
				   mask, timeout_us)

int panthor_gpu_l2_power_on(struct panthor_device *ptdev);
int panthor_gpu_flush_caches(struct panthor_device *ptdev,
			     u32 l2, u32 lsc, u32 other);
int panthor_gpu_soft_reset(struct panthor_device *ptdev);

#endif