diff options
author | Arto Merilainen <amerilainen@nvidia.com> | 2014-03-19 03:38:25 -0400 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-03-18 15:08:53 -0400 |
commit | a9785995d5f22aaeb659285f8aeb64d8b56982e0 (patch) | |
tree | cc75f75bcf43db316a002a7a240b81f299bf6d7f /drivers/gpu/nvgpu/gk20a/platform_gk20a.h | |
parent | 61efaf843c22b85424036ec98015121c08f5f16c (diff) |
gpu: nvgpu: Add NVIDIA GPU Driver
This patch moves the NVIDIA GPU driver to a new location.
Bug 1482562
Change-Id: I24293810b9d0f1504fd9be00135e21dad656ccb6
Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-on: http://git-master/r/383722
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/platform_gk20a.h')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/platform_gk20a.h | 160 |
1 files changed, 160 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h new file mode 100644 index 00000000..09f348cb --- /dev/null +++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h | |||
@@ -0,0 +1,160 @@ | |||
1 | /* | ||
2 | * drivers/video/tegra/host/gk20a/soc/platform_gk20a.h | ||
3 | * | ||
4 | * GK20A Platform (SoC) Interface | ||
5 | * | ||
6 | * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms and conditions of the GNU General Public License, | ||
10 | * version 2, as published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
15 | * more details. | ||
16 | */ | ||
17 | |||
18 | #ifndef _GK20A_PLATFORM_H_ | ||
19 | #define _GK20A_PLATFORM_H_ | ||
20 | |||
21 | #include <linux/platform_device.h> | ||
22 | #include <linux/pm_domain.h> | ||
23 | |||
24 | struct gk20a; | ||
25 | struct channel_gk20a; | ||
26 | struct gr_ctx_buffer_desc; | ||
27 | struct gk20a_scale_profile; | ||
28 | |||
29 | struct gk20a_platform { | ||
30 | #ifdef CONFIG_TEGRA_GK20A | ||
31 | u32 syncpt_base; | ||
32 | #endif | ||
33 | /* Populated by the gk20a driver before probing the platform. */ | ||
34 | struct gk20a *g; | ||
35 | |||
36 | /* Should be populated at probe. */ | ||
37 | bool can_railgate; | ||
38 | |||
39 | /* Should be populated at probe. */ | ||
40 | bool has_syncpoints; | ||
41 | |||
42 | /* Should be populated by probe. */ | ||
43 | struct dentry *debugfs; | ||
44 | |||
45 | /* Clock configuration is stored here. Platform probe is responsible | ||
46 | * for filling this data. */ | ||
47 | struct clk *clk[3]; | ||
48 | int num_clks; | ||
49 | |||
50 | /* Delay before rail gated */ | ||
51 | int railgate_delay; | ||
52 | |||
53 | /* Delay before clock gated */ | ||
54 | int clockgate_delay; | ||
55 | |||
56 | /* Initialize the platform interface of the gk20a driver. | ||
57 | * | ||
58 | * The platform implementation of this function must | ||
59 | * - set the power and clocks of the gk20a device to a known | ||
60 | * state, and | ||
61 | * - populate the gk20a_platform structure (a pointer to the | ||
62 | * structure can be obtained by calling gk20a_get_platform). | ||
63 | * | ||
64 | * After this function is finished, the driver will initialise | ||
65 | * pm runtime and genpd based on the platform configuration. | ||
66 | */ | ||
67 | int (*probe)(struct platform_device *dev); | ||
68 | |||
69 | /* Second stage initialisation - called once all power management | ||
70 | * initialisations are done. | ||
71 | */ | ||
72 | int (*late_probe)(struct platform_device *dev); | ||
73 | |||
74 | /* Called before submitting work to the gpu. The platform may use this | ||
75 | * hook to ensure that any other hw modules that the gpu depends on are | ||
76 | * powered. The platform implementation must count refs to this call. */ | ||
77 | int (*channel_busy)(struct platform_device *dev); | ||
78 | |||
79 | /* Called after the work on the gpu is completed. The platform may use | ||
80 | * this hook to release power refs to any other hw modules that the gpu | ||
81 | * depends on. The platform implementation must count refs to this | ||
82 | * call. */ | ||
83 | void (*channel_idle)(struct platform_device *dev); | ||
84 | |||
85 | /* This function is called to allocate secure memory (memory that the | ||
86 | * CPU cannot see). The function should fill the context buffer | ||
87 | * descriptor (especially fields destroy, sgt, size). | ||
88 | */ | ||
89 | int (*secure_alloc)(struct platform_device *dev, | ||
90 | struct gr_ctx_buffer_desc *desc, | ||
91 | size_t size); | ||
92 | |||
93 | /* Device is going to be suspended */ | ||
94 | int (*suspend)(struct device *); | ||
95 | |||
96 | /* Called to turn off the device */ | ||
97 | int (*railgate)(struct platform_device *dev); | ||
98 | |||
99 | /* Called to turn on the device */ | ||
100 | int (*unrailgate)(struct platform_device *dev); | ||
101 | |||
102 | /* Postscale callback is called after frequency change */ | ||
103 | void (*postscale)(struct platform_device *pdev, | ||
104 | unsigned long freq); | ||
105 | |||
106 | /* Pre callback is called before frequency change */ | ||
107 | void (*prescale)(struct platform_device *pdev); | ||
108 | |||
109 | /* Devfreq governor name. If scaling is enabled, we request | ||
110 | * this governor to be used in scaling */ | ||
111 | const char *devfreq_governor; | ||
112 | |||
113 | /* Quality of service id. If this is set, the scaling routines | ||
114 | * will register a callback to id. Each time we receive a new value, | ||
115 | * the postscale callback gets called. */ | ||
116 | int qos_id; | ||
117 | |||
118 | /* Called as part of debug dump. If the gpu gets hung, this function | ||
119 | * is responsible for delivering all necessary debug data of other | ||
120 | * hw units which may interact with the gpu without direct supervision | ||
121 | * of the CPU. | ||
122 | */ | ||
123 | void (*dump_platform_dependencies)(struct platform_device *dev); | ||
124 | }; | ||
125 | |||
126 | static inline struct gk20a_platform *gk20a_get_platform( | ||
127 | struct platform_device *dev) | ||
128 | { | ||
129 | return (struct gk20a_platform *)platform_get_drvdata(dev); | ||
130 | } | ||
131 | |||
132 | extern struct gk20a_platform gk20a_generic_platform; | ||
133 | #ifdef CONFIG_TEGRA_GK20A | ||
134 | extern struct gk20a_platform gk20a_tegra_platform; | ||
135 | #endif | ||
136 | |||
137 | static inline int gk20a_platform_channel_busy(struct platform_device *dev) | ||
138 | { | ||
139 | struct gk20a_platform *p = gk20a_get_platform(dev); | ||
140 | int ret = 0; | ||
141 | if (p->channel_busy) | ||
142 | ret = p->channel_busy(dev); | ||
143 | |||
144 | return ret; | ||
145 | } | ||
146 | |||
147 | static inline void gk20a_platform_channel_idle(struct platform_device *dev) | ||
148 | { | ||
149 | struct gk20a_platform *p = gk20a_get_platform(dev); | ||
150 | if (p->channel_idle) | ||
151 | p->channel_idle(dev); | ||
152 | } | ||
153 | |||
154 | static inline bool gk20a_platform_has_syncpoints(struct platform_device *dev) | ||
155 | { | ||
156 | struct gk20a_platform *p = gk20a_get_platform(dev); | ||
157 | return p->has_syncpoints; | ||
158 | } | ||
159 | |||
160 | #endif | ||