diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2016-03-29 19:02:34 -0400 |
---|---|---|
committer | Terje Bergstrom <tbergstrom@nvidia.com> | 2016-04-08 12:42:41 -0400 |
commit | e8bac374c0ed24f05bf389e1e8b5aca47f61bd3a (patch) | |
tree | 36b6e111f8706c0560ee552bc9d6e15b87fc9621 /drivers/gpu/nvgpu/gk20a/platform_gk20a.h | |
parent | 2382a8433fddaee3baecff6ae941944850787ab7 (diff) |
gpu: nvgpu: Use device instead of platform_device
Use struct device instead of struct platform_device wherever
possible. This allows adding other bus types later.
Change-Id: I1657287a68d85a542cdbdd8a00d1902c3d6e00ed
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/1120466
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/platform_gk20a.h')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/platform_gk20a.h | 63 |
1 files changed, 32 insertions, 31 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h index 6bffed9e..b2f3b870 100644 --- a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h | |||
@@ -1,9 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/video/tegra/host/gk20a/soc/platform_gk20a.h | ||
3 | * | ||
4 | * GK20A Platform (SoC) Interface | 2 | * GK20A Platform (SoC) Interface |
5 | * | 3 | * |
6 | * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved. |
7 | * | 5 | * |
8 | * This program is free software; you can redistribute it and/or modify it | 6 | * 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, | 7 | * under the terms and conditions of the GNU General Public License, |
@@ -18,7 +16,7 @@ | |||
18 | #ifndef _GK20A_PLATFORM_H_ | 16 | #ifndef _GK20A_PLATFORM_H_ |
19 | #define _GK20A_PLATFORM_H_ | 17 | #define _GK20A_PLATFORM_H_ |
20 | 18 | ||
21 | #include <linux/platform_device.h> | 19 | #include <linux/device.h> |
22 | #include <linux/pm_domain.h> | 20 | #include <linux/pm_domain.h> |
23 | #include <linux/dma-attrs.h> | 21 | #include <linux/dma-attrs.h> |
24 | 22 | ||
@@ -28,7 +26,7 @@ struct gr_ctx_buffer_desc; | |||
28 | struct gk20a_scale_profile; | 26 | struct gk20a_scale_profile; |
29 | 27 | ||
30 | struct secure_page_buffer { | 28 | struct secure_page_buffer { |
31 | void (*destroy)(struct platform_device *, struct secure_page_buffer *); | 29 | void (*destroy)(struct device *, struct secure_page_buffer *); |
32 | size_t size; | 30 | size_t size; |
33 | u64 iova; | 31 | u64 iova; |
34 | struct dma_attrs attrs; | 32 | struct dma_attrs attrs; |
@@ -114,28 +112,28 @@ struct gk20a_platform { | |||
114 | * After this function is finished, the driver will initialise | 112 | * After this function is finished, the driver will initialise |
115 | * pm runtime and genpd based on the platform configuration. | 113 | * pm runtime and genpd based on the platform configuration. |
116 | */ | 114 | */ |
117 | int (*probe)(struct platform_device *dev); | 115 | int (*probe)(struct device *dev); |
118 | 116 | ||
119 | /* Second stage initialisation - called once all power management | 117 | /* Second stage initialisation - called once all power management |
120 | * initialisations are done. | 118 | * initialisations are done. |
121 | */ | 119 | */ |
122 | int (*late_probe)(struct platform_device *dev); | 120 | int (*late_probe)(struct device *dev); |
123 | 121 | ||
124 | /* Remove device after power management has been done | 122 | /* Remove device after power management has been done |
125 | */ | 123 | */ |
126 | int (*remove)(struct platform_device *dev); | 124 | int (*remove)(struct device *dev); |
127 | 125 | ||
128 | /* Poweron platform dependencies */ | 126 | /* Poweron platform dependencies */ |
129 | int (*busy)(struct platform_device *dev); | 127 | int (*busy)(struct device *dev); |
130 | 128 | ||
131 | /* Powerdown platform dependencies */ | 129 | /* Powerdown platform dependencies */ |
132 | void (*idle)(struct platform_device *dev); | 130 | void (*idle)(struct device *dev); |
133 | 131 | ||
134 | /* This function is called to allocate secure memory (memory that the | 132 | /* This function is called to allocate secure memory (memory that the |
135 | * CPU cannot see). The function should fill the context buffer | 133 | * CPU cannot see). The function should fill the context buffer |
136 | * descriptor (especially fields destroy, sgt, size). | 134 | * descriptor (especially fields destroy, sgt, size). |
137 | */ | 135 | */ |
138 | int (*secure_alloc)(struct platform_device *dev, | 136 | int (*secure_alloc)(struct device *dev, |
139 | struct gr_ctx_buffer_desc *desc, | 137 | struct gr_ctx_buffer_desc *desc, |
140 | size_t size); | 138 | size_t size); |
141 | 139 | ||
@@ -143,7 +141,7 @@ struct gk20a_platform { | |||
143 | * This is also helpful to trigger secure memory resizing | 141 | * This is also helpful to trigger secure memory resizing |
144 | * while GPU is off | 142 | * while GPU is off |
145 | */ | 143 | */ |
146 | int (*secure_page_alloc)(struct platform_device *dev); | 144 | int (*secure_page_alloc)(struct device *dev); |
147 | struct secure_page_buffer secure_buffer; | 145 | struct secure_page_buffer secure_buffer; |
148 | bool secure_alloc_ready; | 146 | bool secure_alloc_ready; |
149 | 147 | ||
@@ -151,33 +149,33 @@ struct gk20a_platform { | |||
151 | int (*suspend)(struct device *); | 149 | int (*suspend)(struct device *); |
152 | 150 | ||
153 | /* Called to turn off the device */ | 151 | /* Called to turn off the device */ |
154 | int (*railgate)(struct platform_device *dev); | 152 | int (*railgate)(struct device *dev); |
155 | 153 | ||
156 | /* Called to turn on the device */ | 154 | /* Called to turn on the device */ |
157 | int (*unrailgate)(struct platform_device *dev); | 155 | int (*unrailgate)(struct device *dev); |
158 | struct mutex railgate_lock; | 156 | struct mutex railgate_lock; |
159 | 157 | ||
160 | /* Called to check state of device */ | 158 | /* Called to check state of device */ |
161 | bool (*is_railgated)(struct platform_device *dev); | 159 | bool (*is_railgated)(struct device *dev); |
162 | 160 | ||
163 | /* get supported frequency list */ | 161 | /* get supported frequency list */ |
164 | int (*get_clk_freqs)(struct platform_device *pdev, | 162 | int (*get_clk_freqs)(struct device *pdev, |
165 | unsigned long **freqs, int *num_freqs); | 163 | unsigned long **freqs, int *num_freqs); |
166 | 164 | ||
167 | /* clk related supported functions */ | 165 | /* clk related supported functions */ |
168 | unsigned long (*clk_get_rate)(struct platform_device *pdev); | 166 | unsigned long (*clk_get_rate)(struct device *dev); |
169 | long (*clk_round_rate)(struct platform_device *pdev, | 167 | long (*clk_round_rate)(struct device *dev, |
170 | unsigned long rate); | 168 | unsigned long rate); |
171 | int (*clk_set_rate)(struct platform_device *pdev, | 169 | int (*clk_set_rate)(struct device *dev, |
172 | unsigned long rate); | 170 | unsigned long rate); |
173 | 171 | ||
174 | 172 | ||
175 | /* Postscale callback is called after frequency change */ | 173 | /* Postscale callback is called after frequency change */ |
176 | void (*postscale)(struct platform_device *pdev, | 174 | void (*postscale)(struct device *dev, |
177 | unsigned long freq); | 175 | unsigned long freq); |
178 | 176 | ||
179 | /* Pre callback is called before frequency change */ | 177 | /* Pre callback is called before frequency change */ |
180 | void (*prescale)(struct platform_device *pdev); | 178 | void (*prescale)(struct device *dev); |
181 | 179 | ||
182 | /* Devfreq governor name. If scaling is enabled, we request | 180 | /* Devfreq governor name. If scaling is enabled, we request |
183 | * this governor to be used in scaling */ | 181 | * this governor to be used in scaling */ |
@@ -193,11 +191,11 @@ struct gk20a_platform { | |||
193 | * hw units which may interact with the gpu without direct supervision | 191 | * hw units which may interact with the gpu without direct supervision |
194 | * of the CPU. | 192 | * of the CPU. |
195 | */ | 193 | */ |
196 | void (*dump_platform_dependencies)(struct platform_device *dev); | 194 | void (*dump_platform_dependencies)(struct device *dev); |
197 | 195 | ||
198 | /* Callbacks to assert/deassert GPU reset */ | 196 | /* Callbacks to assert/deassert GPU reset */ |
199 | int (*reset_assert)(struct platform_device *pdev); | 197 | int (*reset_assert)(struct device *dev); |
200 | int (*reset_deassert)(struct platform_device *pdev); | 198 | int (*reset_deassert)(struct device *dev); |
201 | struct clk *clk_reset; | 199 | struct clk *clk_reset; |
202 | struct dvfs_rail *gpu_rail; | 200 | struct dvfs_rail *gpu_rail; |
203 | 201 | ||
@@ -210,12 +208,15 @@ struct gk20a_platform { | |||
210 | u32 ptimer_src_freq; | 208 | u32 ptimer_src_freq; |
211 | 209 | ||
212 | bool has_cde; | 210 | bool has_cde; |
211 | |||
212 | /* soc name for finding firmware files */ | ||
213 | const char *soc_name; | ||
213 | }; | 214 | }; |
214 | 215 | ||
215 | static inline struct gk20a_platform *gk20a_get_platform( | 216 | static inline struct gk20a_platform *gk20a_get_platform( |
216 | struct platform_device *dev) | 217 | struct device *dev) |
217 | { | 218 | { |
218 | return (struct gk20a_platform *)platform_get_drvdata(dev); | 219 | return (struct gk20a_platform *)dev_get_drvdata(dev); |
219 | } | 220 | } |
220 | 221 | ||
221 | extern struct gk20a_platform gk20a_generic_platform; | 222 | extern struct gk20a_platform gk20a_generic_platform; |
@@ -227,14 +228,14 @@ extern struct gk20a_platform vgpu_tegra_platform; | |||
227 | #endif | 228 | #endif |
228 | #endif | 229 | #endif |
229 | 230 | ||
230 | static inline bool gk20a_platform_has_syncpoints(struct platform_device *dev) | 231 | static inline bool gk20a_platform_has_syncpoints(struct device *dev) |
231 | { | 232 | { |
232 | struct gk20a_platform *p = gk20a_get_platform(dev); | 233 | struct gk20a_platform *p = dev_get_drvdata(dev); |
233 | return p->has_syncpoints; | 234 | return p->has_syncpoints; |
234 | } | 235 | } |
235 | 236 | ||
236 | int gk20a_tegra_busy(struct platform_device *dev); | 237 | int gk20a_tegra_busy(struct device *dev); |
237 | void gk20a_tegra_idle(struct platform_device *dev); | 238 | void gk20a_tegra_idle(struct device *dev); |
238 | void gk20a_tegra_debug_dump(struct platform_device *pdev); | 239 | void gk20a_tegra_debug_dump(struct device *pdev); |
239 | 240 | ||
240 | #endif | 241 | #endif |