1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  *
4  * (C) COPYRIGHT 2021 ARM Limited. All rights reserved.
5  *
6  * This program is free software and is provided to you under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation, and any use by you of this program is subject to the terms
9  * of such GNU license.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you can access it online at
18  * http://www.gnu.org/licenses/gpl-2.0.html.
19  *
20  */
21 
22 #ifndef _KBASE_PBHA_H
23 #define _KBASE_PBHA_H
24 
25 #include <mali_kbase.h>
26 
27 /**
28  * kbasep_pbha_supported - check whether PBHA registers are
29  * available
30  *
31  * Should only be used in mali_kbase_pbha* files - thus the
32  * kbase[p] prefix.
33  *
34  * @kbdev: Device pointer
35  *
36  * Return: True if pbha is supported, false otherwise
37  */
38 bool kbasep_pbha_supported(struct kbase_device *kbdev);
39 
40 /**
41  * kbase_pbha_record_settings - record PBHA settings to be applied when
42  * L2 is powered down
43  *
44  * @kbdev: Device pointer
45  * @runtime: true if it's called at runtime and false if it's called on init.
46  * @id: memory access source ID
47  * @read_setting: Read setting
48  * @write_setting: Write setting
49  *
50  * Return: 0 on success, otherwise error code.
51  */
52 int kbase_pbha_record_settings(struct kbase_device *kbdev, bool runtime,
53 			       unsigned int id, unsigned int read_setting,
54 			       unsigned int write_setting);
55 
56 /**
57  * kbase_pbha_write_settings - write recorded PBHA settings to GPU
58  * registers
59  *
60  * Only valid to call this function when L2 is powered down, otherwise
61  * this will not affect PBHA settings.
62  *
63  * @kbdev: Device pointer
64  */
65 void kbase_pbha_write_settings(struct kbase_device *kbdev);
66 
67 /**
68  * kbase_pbha_read_dtb - read PBHA settings from DTB and record it to be
69  * applied when L2 is powered down
70  *
71  * @kbdev: Device pointer
72  *
73  * Return: 0 on success, otherwise error code.
74  */
75 int kbase_pbha_read_dtb(struct kbase_device *kbdev);
76 
77 #endif /* _KBASE_PBHA_H */
78