blob: 1e580d37ef462428124a8d8d564701a83d3f172d [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
24struct device;
25
26int kgsl_devfreq_add_notifier(struct device *device,
27 struct notifier_block *block);
28
29int kgsl_devfreq_del_notifier(struct device *device,
30 struct notifier_block *block);
31
32/* same as KGSL_MAX_PWRLEVELS */
33#define MSM_ADRENO_MAX_PWRLEVELS 10
34
35struct xstats {
36 u64 ram_time;
37 u64 ram_wait;
38 int mod;
39};
40
41struct devfreq_msm_adreno_tz_data {
42 struct notifier_block nb;
43 struct {
44 s64 total_time;
45 s64 busy_time;
46 u32 ctxt_aware_target_pwrlevel;
47 u32 ctxt_aware_busy_penalty;
48 } bin;
49 struct {
50 u64 total_time;
51 u64 ram_time;
52 u64 ram_wait;
53 u64 gpu_time;
54 u32 num;
55 u32 max;
56 u32 width;
57 u32 *up;
58 u32 *down;
59 u32 *p_up;
60 u32 *p_down;
61 unsigned int *index;
62 uint64_t *ib;
63 } bus;
64 unsigned int device_id;
65 bool is_64;
66 bool disable_busy_time_burst;
67 bool ctxt_aware_enable;
68};
69
70struct msm_adreno_extended_profile {
71 struct devfreq_msm_adreno_tz_data *private_data;
72 struct devfreq *bus_devfreq;
73 struct workqueue_struct *partner_wq;
74 struct work_struct partner_start_event_ws;
75 struct work_struct partner_stop_event_ws;
76 struct work_struct partner_suspend_event_ws;
77 struct work_struct partner_resume_event_ws;
78 struct devfreq_dev_profile profile;
79};
80
81struct msm_busmon_extended_profile {
82 u32 flag;
83 unsigned long percent_ab;
84 unsigned long ab_mbytes;
85 struct devfreq_msm_adreno_tz_data *private_data;
86 struct devfreq_dev_profile profile;
87};
88
89#ifdef CONFIG_DEVFREQ_GOV_QCOM_GPUBW_MON
90int devfreq_vbif_update_bw(unsigned long ib, unsigned long ab);
91int devfreq_vbif_register_callback(void *callback);
92#endif
93
94#endif