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