summaryrefslogtreecommitdiff
path: root/mali_kbase/backend/gpu/mali_kbase_devfreq.h
blob: d75157cfe0433f61415dc09481d95cd690b0a932 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
 *
 * (C) COPYRIGHT 2014-2023 ARM Limited. All rights reserved.
 *
 * This program is free software and is provided to you under the terms of the
 * GNU General Public License version 2 as published by the Free Software
 * Foundation, and any use by you of this program is subject to the terms
 * of such GNU license.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, you can access it online at
 * http://www.gnu.org/licenses/gpl-2.0.html.
 *
 */

#ifndef _BASE_DEVFREQ_H_
#define _BASE_DEVFREQ_H_

/**
 * kbase_devfreq_init - Initialize kbase device for DevFreq.
 * @kbdev:      Device pointer
 *
 * This function must be called only when a kbase device is initialized.
 *
 * Return: 0 on success.
 */
int kbase_devfreq_init(struct kbase_device *kbdev);

void kbase_devfreq_term(struct kbase_device *kbdev);

/**
 * kbase_devfreq_force_freq - Set GPU frequency on L2 power on/off.
 * @kbdev:      Device pointer
 * @freq:       GPU frequency in HZ to be set when
 *              MALI_HW_ERRATA_1485982_USE_CLOCK_ALTERNATIVE is enabled
 */
void kbase_devfreq_force_freq(struct kbase_device *kbdev, unsigned long freq);

/**
 * kbase_devfreq_enqueue_work - Enqueue a work item for suspend/resume devfreq.
 * @kbdev:      Device pointer
 * @work_type:  The type of the devfreq work item, i.e. suspend or resume
 */
void kbase_devfreq_enqueue_work(struct kbase_device *kbdev, enum kbase_devfreq_work_type work_type);

/**
 * kbase_devfreq_opp_translate - Translate nominal OPP frequency from devicetree
 *                               into real frequency & voltage pair, along with
 *                               core mask
 * @kbdev:     Device pointer
 * @freq:      Nominal frequency
 * @core_mask: Pointer to u64 to store core mask to
 * @freqs:     Pointer to array of frequencies
 * @volts:     Pointer to array of voltages
 *
 * This function will only perform translation if an operating-points-v2-mali
 * table is present in devicetree. If one is not present then it will return an
 * untranslated frequency (and corresponding voltage) and all cores enabled.
 * The voltages returned are in micro Volts (uV).
 */
void kbase_devfreq_opp_translate(struct kbase_device *kbdev, unsigned long freq, u64 *core_mask,
				 unsigned long *freqs, unsigned long *volts);
#endif /* _BASE_DEVFREQ_H_ */