2 * include/mach/isomgr.h
4 * Copyright (c) 2012-2013, NVIDIA CORPORATION. All rights reserved.
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.
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
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.
20 #ifndef _INCLUDE_MACH_ISOMGR_H
21 #define _INCLUDE_MACH_ISOMGR_H
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
34 /* handle to identify registered client */
35 #define tegra_isomgr_handle void *
37 /* callback to client to renegotiate ISO BW allocation */
38 typedef void (*tegra_isomgr_renegotiate)(void *priv,
39 u32 avail_bw); /* KB/sec */
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,
48 /* Unregister an ISO BW client */
49 void tegra_isomgr_unregister(tegra_isomgr_handle handle);
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,
56 /* Realize client reservation - apply settings, rval is dvfs thresh usec */
57 u32 tegra_isomgr_realize(tegra_isomgr_handle handle);
59 /* This sets bw aside for the client specified. */
60 int tegra_isomgr_set_margin(enum tegra_iso_client client, u32 bw, bool wait);
62 int tegra_isomgr_get_imp_time(enum tegra_iso_client, u32 bw);
64 /* returns available in iso bw in KB/sec */
65 u32 tegra_isomgr_get_available_iso_bw(void);
67 /* returns total iso bw in KB/sec */
68 u32 tegra_isomgr_get_total_iso_bw(void);
71 * This api would be called by .init_machine during boot.
72 * isomgr clients, don't call this api.
74 int __init isomgr_init(void);
76 static inline tegra_isomgr_handle tegra_isomgr_register(
77 enum tegra_iso_client client,
79 tegra_isomgr_renegotiate renegotiate,
82 static tegra_isomgr_handle h;
83 /* return a dummy handle to allow client function
84 * as if isomgr were enabled.
89 static inline void tegra_isomgr_unregister(tegra_isomgr_handle handle) {}
91 static inline u32 tegra_isomgr_reserve(tegra_isomgr_handle handle,
97 static inline u32 tegra_isomgr_realize(tegra_isomgr_handle handle)
102 static inline int tegra_isomgr_set_margin(enum tegra_iso_client client, u32 bw)
107 static inline int tegra_isomgr_get_imp_time(enum tegra_iso_client client,
113 static inline u32 tegra_isomgr_get_available_iso_bw(void)
118 static inline u32 tegra_isomgr_get_total_iso_bw(void)
123 static inline int isomgr_init(void)
128 #endif /* _INCLUDE_MACH_ISOMGR_H */