blob: 2b94289153f3907c5c531493c5aa6392b23ad9ed [file] [log] [blame]
Oleg Pereletb906a192017-01-04 09:50:02 -08001/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13
14#ifndef MSM_ADRENO_DEVFREQ_H
15#define MSM_ADRENO_DEVFREQ_H
16
17#include <linux/devfreq.h>
18#include <linux/notifier.h>
19
20#define ADRENO_DEVFREQ_NOTIFY_SUBMIT 1
21#define ADRENO_DEVFREQ_NOTIFY_RETIRE 2
22#define ADRENO_DEVFREQ_NOTIFY_IDLE 3
23
Oleg Perelet5d612102017-04-05 11:03:38 -070024#define DEVFREQ_FLAG_WAKEUP_MAXFREQ 0x2
25#define DEVFREQ_FLAG_FAST_HINT 0x4
26#define DEVFREQ_FLAG_SLOW_HINT 0x8
27
Oleg Pereletb906a192017-01-04 09:50:02 -080028struct device;
29
30int kgsl_devfreq_add_notifier(struct device *device,
31 struct notifier_block *block);
32
33int kgsl_devfreq_del_notifier(struct device *device,
34 struct notifier_block *block);
35
36/* same as KGSL_MAX_PWRLEVELS */
37#define MSM_ADRENO_MAX_PWRLEVELS 10
38
39struct xstats {
40 u64 ram_time;
41 u64 ram_wait;
42 int mod;
43};
44
45struct devfreq_msm_adreno_tz_data {
46 struct notifier_block nb;
47 struct {
48 s64 total_time;
49 s64 busy_time;
50 u32 ctxt_aware_target_pwrlevel;
51 u32 ctxt_aware_busy_penalty;
52 } bin;
53 struct {
54 u64 total_time;
55 u64 ram_time;
56 u64 ram_wait;
57 u64 gpu_time;
58 u32 num;
59 u32 max;
60 u32 width;
61 u32 *up;
62 u32 *down;
63 u32 *p_up;
64 u32 *p_down;
65 unsigned int *index;
66 uint64_t *ib;
67 } bus;
68 unsigned int device_id;
69 bool is_64;
70 bool disable_busy_time_burst;
71 bool ctxt_aware_enable;
72};
73
74struct msm_adreno_extended_profile {
75 struct devfreq_msm_adreno_tz_data *private_data;
76 struct devfreq *bus_devfreq;
77 struct workqueue_struct *partner_wq;
78 struct work_struct partner_start_event_ws;
79 struct work_struct partner_stop_event_ws;
80 struct work_struct partner_suspend_event_ws;
81 struct work_struct partner_resume_event_ws;
82 struct devfreq_dev_profile profile;
83};
84
85struct msm_busmon_extended_profile {
86 u32 flag;
87 unsigned long percent_ab;
88 unsigned long ab_mbytes;
89 struct devfreq_msm_adreno_tz_data *private_data;
90 struct devfreq_dev_profile profile;
91};
92
93#ifdef CONFIG_DEVFREQ_GOV_QCOM_GPUBW_MON
94int devfreq_vbif_update_bw(unsigned long ib, unsigned long ab);
95int devfreq_vbif_register_callback(void *callback);
96#endif
97
98#endif