diff options
Diffstat (limited to 'drivers/gpu/ion/omap/omap_ion.c')
-rwxr-xr-x | drivers/gpu/ion/omap/omap_ion.c | 47 |
1 files changed, 39 insertions, 8 deletions
diff --git a/drivers/gpu/ion/omap/omap_ion.c b/drivers/gpu/ion/omap/omap_ion.c index e9b91f0787d..df8f3818653 100755 --- a/drivers/gpu/ion/omap/omap_ion.c +++ b/drivers/gpu/ion/omap/omap_ion.c | |||
@@ -124,19 +124,26 @@ static int omap_ion_probe(struct platform_device *pdev) | |||
124 | uint omap_ion_heap_tiler_size = 0; | 124 | uint omap_ion_heap_tiler_size = 0; |
125 | uint omap_ion_heap_nonsecure_tiler_size = 0; | 125 | uint omap_ion_heap_nonsecure_tiler_size = 0; |
126 | 126 | ||
127 | omap_ion_device = ion_device_create(omap_ion_ioctl); | ||
128 | if (IS_ERR_OR_NULL(omap_ion_device)) { | ||
129 | kfree(heaps); | ||
130 | return PTR_ERR(omap_ion_device); | ||
131 | } | ||
132 | |||
133 | if (node) { | 127 | if (node) { |
134 | of_property_read_u32(node, "ti,omap_ion_heap_secure_input_base", | 128 | of_property_read_u32(node, "ti,omap_ion_heap_secure_input_base", |
135 | &omap_ion_heap_secure_input_base); | 129 | &omap_ion_heap_secure_input_base); |
136 | of_property_read_u32(node, "ti,omap_ion_heap_tiler_base", | 130 | of_property_read_u32(node, "ti,omap_ion_heap_tiler_base", |
137 | &omap_ion_heap_tiler_size); | 131 | &omap_ion_heap_tiler_base); |
138 | of_property_read_u32(node, "ti,omap_ion_heap_nonsecure_tiler_base", | 132 | of_property_read_u32(node, "ti,omap_ion_heap_nonsecure_tiler_base", |
139 | &omap_ion_heap_nonsecure_tiler_base); | 133 | &omap_ion_heap_nonsecure_tiler_base); |
134 | if (omap_ion_heap_secure_input_base == 0 | ||
135 | || omap_ion_heap_tiler_base == 0 | ||
136 | || omap_ion_heap_nonsecure_tiler_base == 0) { | ||
137 | pr_err("%s: carveout memory address is null. please check dts file\n" | ||
138 | "omap_ion_heap_secure_input_base = 0x%x\n" | ||
139 | "omap_ion_heap_tiler_base = 0x%x\n" | ||
140 | "omap_ion_heap_nonsecure_tiler_base = 0x%x\n" | ||
141 | , __func__ | ||
142 | , omap_ion_heap_secure_input_base | ||
143 | , omap_ion_heap_tiler_base | ||
144 | , omap_ion_heap_tiler_base); | ||
145 | return -EFAULT; | ||
146 | } | ||
140 | 147 | ||
141 | of_property_read_u32(node, "ti,omap_ion_heap_secure_input_size", | 148 | of_property_read_u32(node, "ti,omap_ion_heap_secure_input_size", |
142 | &omap_ion_heap_secure_input_size); | 149 | &omap_ion_heap_secure_input_size); |
@@ -144,8 +151,30 @@ static int omap_ion_probe(struct platform_device *pdev) | |||
144 | &omap_ion_heap_tiler_size); | 151 | &omap_ion_heap_tiler_size); |
145 | of_property_read_u32(node, "ti,omap_ion_heap_nonsecure_tiler_size", | 152 | of_property_read_u32(node, "ti,omap_ion_heap_nonsecure_tiler_size", |
146 | &omap_ion_heap_nonsecure_tiler_size); | 153 | &omap_ion_heap_nonsecure_tiler_size); |
154 | if (omap_ion_heap_secure_input_size == 0 | ||
155 | || omap_ion_heap_tiler_size == 0 | ||
156 | || omap_ion_heap_nonsecure_tiler_size == 0) { | ||
157 | pr_err("%s: carveout memory address is null. please check dts file\n" | ||
158 | "omap_ion_heap_secure_input_size = 0x%x\n" | ||
159 | "omap_ion_heap_tiler_size = 0x%x\n" | ||
160 | "omap_ion_heap_nonsecure_tiler_size = 0x%x\n" | ||
161 | , __func__ | ||
162 | , omap_ion_heap_secure_input_size | ||
163 | , omap_ion_heap_tiler_size | ||
164 | , omap_ion_heap_nonsecure_tiler_size); | ||
165 | return -EINVAL; | ||
166 | } | ||
167 | |||
168 | } else { | ||
169 | pr_err("%s: no matching device tree node\n", __func__); | ||
170 | return -ENODEV; | ||
147 | } | 171 | } |
148 | 172 | ||
173 | omap_ion_device = ion_device_create(omap_ion_ioctl); | ||
174 | if (IS_ERR_OR_NULL(omap_ion_device)) | ||
175 | return PTR_ERR(omap_ion_device); | ||
176 | |||
177 | |||
149 | num_heaps = omap_ion_data.nr; | 178 | num_heaps = omap_ion_data.nr; |
150 | 179 | ||
151 | heaps = kzalloc(sizeof(struct ion_heap *)*num_heaps, GFP_KERNEL); | 180 | heaps = kzalloc(sizeof(struct ion_heap *)*num_heaps, GFP_KERNEL); |
@@ -242,6 +271,7 @@ int omap_ion_share_fd_to_buffers(int fd, struct ion_buffer **buffers, | |||
242 | struct ion_handle **handles; | 271 | struct ion_handle **handles; |
243 | struct ion_client *client; | 272 | struct ion_client *client; |
244 | int i = 0, ret = 0; | 273 | int i = 0, ret = 0; |
274 | int share_fd; | ||
245 | 275 | ||
246 | handles = kzalloc(*num_handles * sizeof(struct ion_handle *), | 276 | handles = kzalloc(*num_handles * sizeof(struct ion_handle *), |
247 | GFP_KERNEL); | 277 | GFP_KERNEL); |
@@ -262,7 +292,8 @@ int omap_ion_share_fd_to_buffers(int fd, struct ion_buffer **buffers, | |||
262 | 292 | ||
263 | for (i = 0; i < *num_handles; i++) { | 293 | for (i = 0; i < *num_handles; i++) { |
264 | if (handles[i]) | 294 | if (handles[i]) |
265 | buffers[i] = ion_share_dma_buf(client, handles[i]); | 295 | share_fd = ion_share_dma_buf(client, handles[i]); |
296 | buffers[i] = ion_handle_buffer(handles[i]); | ||
266 | } | 297 | } |
267 | 298 | ||
268 | exit: | 299 | exit: |