]> nv-tegra.nvidia Code Review - linux-3.10.git/blob - arch/arm/mach-tegra/include/mach/isomgr.h
ARM: tegra12: set CPU rate to 2.2GHz for sku 0x87
[linux-3.10.git] / arch / arm / mach-tegra / include / mach / isomgr.h
1 /*
2  * include/mach/isomgr.h
3  *
4  * Copyright (c) 2012-2013, NVIDIA CORPORATION.  All rights reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18  */
19
20 #ifndef _INCLUDE_MACH_ISOMGR_H
21 #define _INCLUDE_MACH_ISOMGR_H
22
23 enum tegra_iso_client {
24         TEGRA_ISO_CLIENT_DISP_0,
25         TEGRA_ISO_CLIENT_DISP_1,
26         TEGRA_ISO_CLIENT_VI_0,
27         TEGRA_ISO_CLIENT_VI_1,
28         TEGRA_ISO_CLIENT_ISP_A,
29         TEGRA_ISO_CLIENT_ISP_B,
30         TEGRA_ISO_CLIENT_BBC_0,
31         TEGRA_ISO_CLIENT_COUNT
32 };
33
34 /* handle to identify registered client */
35 #define tegra_isomgr_handle void *
36
37 /* callback to client to renegotiate ISO BW allocation */
38 typedef void (*tegra_isomgr_renegotiate)(void *priv,
39                                          u32 avail_bw); /* KB/sec */
40
41 #if defined(CONFIG_TEGRA_ISOMGR)
42 /* Register an ISO BW client */
43 tegra_isomgr_handle tegra_isomgr_register(enum tegra_iso_client client,
44                                           u32 dedicated_bw,     /* KB/sec */
45                                           tegra_isomgr_renegotiate renegotiate,
46                                           void *priv);
47
48 /* Unregister an ISO BW client */
49 void tegra_isomgr_unregister(tegra_isomgr_handle handle);
50
51 /* Reserve ISO BW on behalf of client - don't apply, rval is dvfs thresh usec */
52 u32 tegra_isomgr_reserve(tegra_isomgr_handle handle,
53                          u32 bw,        /* KB/sec */
54                          u32 lt);       /* usec */
55
56 /* Realize client reservation - apply settings, rval is dvfs thresh usec */
57 u32 tegra_isomgr_realize(tegra_isomgr_handle handle);
58
59 /* This sets bw aside for the client specified. */
60 int tegra_isomgr_set_margin(enum tegra_iso_client client, u32 bw, bool wait);
61
62 int tegra_isomgr_get_imp_time(enum tegra_iso_client, u32 bw);
63
64 /* returns available in iso bw in KB/sec */
65 u32 tegra_isomgr_get_available_iso_bw(void);
66
67 /* returns total iso bw in KB/sec */
68 u32 tegra_isomgr_get_total_iso_bw(void);
69
70 /* Initialize isomgr.
71  * This api would be called by .init_machine during boot.
72  * isomgr clients, don't call this api.
73  */
74 int __init isomgr_init(void);
75 #else
76 static inline tegra_isomgr_handle tegra_isomgr_register(
77                                           enum tegra_iso_client client,
78                                           u32 dedicated_bw,
79                                           tegra_isomgr_renegotiate renegotiate,
80                                           void *priv)
81 {
82         static tegra_isomgr_handle h;
83         /* return a dummy handle to allow client function
84          * as if isomgr were enabled.
85          */
86         return h;
87 }
88
89 static inline void tegra_isomgr_unregister(tegra_isomgr_handle handle) {}
90
91 static inline u32 tegra_isomgr_reserve(tegra_isomgr_handle handle,
92                          u32 bw, u32 lt)
93 {
94         return 1;
95 }
96
97 static inline u32 tegra_isomgr_realize(tegra_isomgr_handle handle)
98 {
99         return 1;
100 }
101
102 static inline int tegra_isomgr_set_margin(enum tegra_iso_client client, u32 bw)
103 {
104         return 0;
105 }
106
107 static inline int tegra_isomgr_get_imp_time(enum tegra_iso_client client,
108         u32 bw)
109 {
110         return 0;
111 }
112
113 static inline u32 tegra_isomgr_get_available_iso_bw(void)
114 {
115         return UINT_MAX;
116 }
117
118 static inline u32 tegra_isomgr_get_total_iso_bw(void)
119 {
120         return UINT_MAX;
121 }
122
123 static inline int isomgr_init(void)
124 {
125         return 0;
126 }
127 #endif
128 #endif /* _INCLUDE_MACH_ISOMGR_H */