diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/platform_gk20a.h')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/platform_gk20a.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h index 5dc55b18..4208816f 100644 --- a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h | |||
@@ -21,6 +21,8 @@ | |||
21 | 21 | ||
22 | #include <nvgpu/lock.h> | 22 | #include <nvgpu/lock.h> |
23 | 23 | ||
24 | #include "gk20a.h" | ||
25 | |||
24 | #define GK20A_CLKS_MAX 4 | 26 | #define GK20A_CLKS_MAX 4 |
25 | 27 | ||
26 | struct gk20a; | 28 | struct gk20a; |
@@ -252,4 +254,36 @@ int gk20a_tegra_busy(struct device *dev); | |||
252 | void gk20a_tegra_idle(struct device *dev); | 254 | void gk20a_tegra_idle(struct device *dev); |
253 | void gk20a_tegra_debug_dump(struct device *pdev); | 255 | void gk20a_tegra_debug_dump(struct device *pdev); |
254 | 256 | ||
257 | static inline struct gk20a *get_gk20a(struct device *dev) | ||
258 | { | ||
259 | return gk20a_get_platform(dev)->g; | ||
260 | } | ||
261 | static inline struct device *dev_from_gk20a(struct gk20a *g) | ||
262 | { | ||
263 | return g->dev; | ||
264 | } | ||
265 | static inline struct gk20a *gk20a_from_dev(struct device *dev) | ||
266 | { | ||
267 | if (!dev) | ||
268 | return NULL; | ||
269 | |||
270 | return ((struct gk20a_platform *)dev_get_drvdata(dev))->g; | ||
271 | } | ||
272 | static inline bool gk20a_gpu_is_virtual(struct device *dev) | ||
273 | { | ||
274 | struct gk20a_platform *platform = dev_get_drvdata(dev); | ||
275 | |||
276 | return platform->virtual_dev; | ||
277 | } | ||
278 | |||
279 | static inline int support_gk20a_pmu(struct device *dev) | ||
280 | { | ||
281 | if (IS_ENABLED(CONFIG_GK20A_PMU)) { | ||
282 | /* gPMU is not supported for vgpu */ | ||
283 | return !gk20a_gpu_is_virtual(dev); | ||
284 | } | ||
285 | |||
286 | return 0; | ||
287 | } | ||
288 | |||
255 | #endif | 289 | #endif |