diff options
author | archit taneja <archit@ti.com> | 2011-06-14 02:54:45 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-07-27 16:56:05 -0400 |
commit | a137ac870ba7df53e0c68cf2af2c79a71a2050c0 (patch) | |
tree | 6a5eb70143928deaaa4aa0a7fa4137e4a19ad4f8 /drivers/media/video/omap/omap_voutlib.c | |
parent | e213e438ce2a7451572f1c00ed87893ca25d3ea9 (diff) |
[media] OMAP_VOUT: CLEANUP: Move generic functions and macros to common files
Move the inline functions rotate_90_or_270(), rotation_enabled(), and
calc_rotation() from omap_vout.c to omap_voutdef.h.
Move the independent functions omap_vout_alloc_buffer() and
omap_vout_free_buffer() to omap_voutlib.c.
Remove extern identifier from function definitions in omap_voutlib.h
Add static identifier to functions that are used locally in omap_vout.c
Signed-off-by: Archit Taneja <archit@ti.com>
Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/omap/omap_voutlib.c')
-rw-r--r-- | drivers/media/video/omap/omap_voutlib.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/drivers/media/video/omap/omap_voutlib.c b/drivers/media/video/omap/omap_voutlib.c index 8ae74817a110..115408b9274f 100644 --- a/drivers/media/video/omap/omap_voutlib.c +++ b/drivers/media/video/omap/omap_voutlib.c | |||
@@ -24,8 +24,12 @@ | |||
24 | #include <linux/types.h> | 24 | #include <linux/types.h> |
25 | #include <linux/videodev2.h> | 25 | #include <linux/videodev2.h> |
26 | 26 | ||
27 | #include <linux/dma-mapping.h> | ||
28 | |||
27 | #include <plat/cpu.h> | 29 | #include <plat/cpu.h> |
28 | 30 | ||
31 | #include "omap_voutlib.h" | ||
32 | |||
29 | MODULE_AUTHOR("Texas Instruments"); | 33 | MODULE_AUTHOR("Texas Instruments"); |
30 | MODULE_DESCRIPTION("OMAP Video library"); | 34 | MODULE_DESCRIPTION("OMAP Video library"); |
31 | MODULE_LICENSE("GPL"); | 35 | MODULE_LICENSE("GPL"); |
@@ -291,3 +295,45 @@ void omap_vout_new_format(struct v4l2_pix_format *pix, | |||
291 | } | 295 | } |
292 | EXPORT_SYMBOL_GPL(omap_vout_new_format); | 296 | EXPORT_SYMBOL_GPL(omap_vout_new_format); |
293 | 297 | ||
298 | /* | ||
299 | * Allocate buffers | ||
300 | */ | ||
301 | unsigned long omap_vout_alloc_buffer(u32 buf_size, u32 *phys_addr) | ||
302 | { | ||
303 | u32 order, size; | ||
304 | unsigned long virt_addr, addr; | ||
305 | |||
306 | size = PAGE_ALIGN(buf_size); | ||
307 | order = get_order(size); | ||
308 | virt_addr = __get_free_pages(GFP_KERNEL, order); | ||
309 | addr = virt_addr; | ||
310 | |||
311 | if (virt_addr) { | ||
312 | while (size > 0) { | ||
313 | SetPageReserved(virt_to_page(addr)); | ||
314 | addr += PAGE_SIZE; | ||
315 | size -= PAGE_SIZE; | ||
316 | } | ||
317 | } | ||
318 | *phys_addr = (u32) virt_to_phys((void *) virt_addr); | ||
319 | return virt_addr; | ||
320 | } | ||
321 | |||
322 | /* | ||
323 | * Free buffers | ||
324 | */ | ||
325 | void omap_vout_free_buffer(unsigned long virtaddr, u32 buf_size) | ||
326 | { | ||
327 | u32 order, size; | ||
328 | unsigned long addr = virtaddr; | ||
329 | |||
330 | size = PAGE_ALIGN(buf_size); | ||
331 | order = get_order(size); | ||
332 | |||
333 | while (size > 0) { | ||
334 | ClearPageReserved(virt_to_page(addr)); | ||
335 | addr += PAGE_SIZE; | ||
336 | size -= PAGE_SIZE; | ||
337 | } | ||
338 | free_pages((unsigned long) virtaddr, order); | ||
339 | } | ||