From 6a1c9f6d19180cdbb603e5b77bd7b57d01260664 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Mon, 8 Oct 2012 14:52:24 +0300 Subject: OMAP: move arch/arm/plat-omap/include/plat/vrfb.h Now that vrfb driver is not omap dependent anymore, we can move vrfb.h from arch/arm/plat-omap/include/plat to include/video/omapvrfb.h. Signed-off-by: Tomi Valkeinen Cc: Tony Lindgren Cc: Vaibhav Hiremath --- include/video/omapvrfb.h | 66 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 include/video/omapvrfb.h (limited to 'include/video') diff --git a/include/video/omapvrfb.h b/include/video/omapvrfb.h new file mode 100644 index 000000000000..3792bdea2f6d --- /dev/null +++ b/include/video/omapvrfb.h @@ -0,0 +1,66 @@ +/* + * VRFB Rotation Engine + * + * Copyright (C) 2009 Nokia Corporation + * Author: Tomi Valkeinen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __OMAP_VRFB_H__ +#define __OMAP_VRFB_H__ + +#define OMAP_VRFB_LINE_LEN 2048 + +struct vrfb { + u8 context; + void __iomem *vaddr[4]; + unsigned long paddr[4]; + u16 xres; + u16 yres; + u16 xoffset; + u16 yoffset; + u8 bytespp; + bool yuv_mode; +}; + +#ifdef CONFIG_OMAP2_VRFB +extern int omap_vrfb_request_ctx(struct vrfb *vrfb); +extern void omap_vrfb_release_ctx(struct vrfb *vrfb); +extern void omap_vrfb_adjust_size(u16 *width, u16 *height, + u8 bytespp); +extern u32 omap_vrfb_min_phys_size(u16 width, u16 height, u8 bytespp); +extern u16 omap_vrfb_max_height(u32 phys_size, u16 width, u8 bytespp); +extern void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr, + u16 width, u16 height, + unsigned bytespp, bool yuv_mode); +extern int omap_vrfb_map_angle(struct vrfb *vrfb, u16 height, u8 rot); +extern void omap_vrfb_restore_context(void); + +#else +static inline int omap_vrfb_request_ctx(struct vrfb *vrfb) { return 0; } +static inline void omap_vrfb_release_ctx(struct vrfb *vrfb) {} +static inline void omap_vrfb_adjust_size(u16 *width, u16 *height, + u8 bytespp) {} +static inline u32 omap_vrfb_min_phys_size(u16 width, u16 height, u8 bytespp) + { return 0; } +static inline u16 omap_vrfb_max_height(u32 phys_size, u16 width, u8 bytespp) + { return 0; } +static inline void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr, + u16 width, u16 height, unsigned bytespp, bool yuv_mode) {} +static inline int omap_vrfb_map_angle(struct vrfb *vrfb, u16 height, u8 rot) + { return 0; } +static inline void omap_vrfb_restore_context(void) {} +#endif +#endif /* __VRFB_H */ -- cgit v1.2.3 From aa1e49a3752f09b3d2ab706f6d48916a04acf557 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Wed, 17 Oct 2012 12:15:31 +0300 Subject: OMAPDSS: VRFB: add omap_vrfb_supported() Add an exported function omap_vrfb_supported() which returns true if the vrfb driver has been loaded succesfully. This can be used to decide if VRFB can be used or not. Signed-off-by: Tomi Valkeinen --- drivers/video/omap2/vrfb.c | 16 ++++++++++++++++ include/video/omapvrfb.h | 2 ++ 2 files changed, 18 insertions(+) (limited to 'include/video') diff --git a/drivers/video/omap2/vrfb.c b/drivers/video/omap2/vrfb.c index e4a0450a39a1..5d8fdac3b800 100644 --- a/drivers/video/omap2/vrfb.c +++ b/drivers/video/omap2/vrfb.c @@ -77,6 +77,8 @@ static void __iomem *vrfb_base; static int num_ctxs; static struct vrfb_ctx *ctxs; +static bool vrfb_loaded; + static void omap2_sms_write_rot_control(u32 val, unsigned ctx) { __raw_writel(val, vrfb_base + SMS_ROT_CONTROL(ctx)); @@ -336,6 +338,12 @@ out: } EXPORT_SYMBOL(omap_vrfb_request_ctx); +bool omap_vrfb_supported(void) +{ + return vrfb_loaded; +} +EXPORT_SYMBOL(omap_vrfb_supported); + static int __init vrfb_probe(struct platform_device *pdev) { struct resource *mem; @@ -375,11 +383,19 @@ static int __init vrfb_probe(struct platform_device *pdev) ctxs[i].base = mem->start; } + vrfb_loaded = true; + return 0; } +static void __exit vrfb_remove(struct platform_device *pdev) +{ + vrfb_loaded = false; +} + static struct platform_driver vrfb_driver = { .driver.name = "omapvrfb", + .remove = __exit_p(vrfb_remove), }; static int __init vrfb_init(void) diff --git a/include/video/omapvrfb.h b/include/video/omapvrfb.h index 3792bdea2f6d..bb0bd89f8bc6 100644 --- a/include/video/omapvrfb.h +++ b/include/video/omapvrfb.h @@ -36,6 +36,7 @@ struct vrfb { }; #ifdef CONFIG_OMAP2_VRFB +extern bool omap_vrfb_supported(void); extern int omap_vrfb_request_ctx(struct vrfb *vrfb); extern void omap_vrfb_release_ctx(struct vrfb *vrfb); extern void omap_vrfb_adjust_size(u16 *width, u16 *height, @@ -49,6 +50,7 @@ extern int omap_vrfb_map_angle(struct vrfb *vrfb, u16 height, u8 rot); extern void omap_vrfb_restore_context(void); #else +static inline bool omap_vrfb_supported(void) { return false; } static inline int omap_vrfb_request_ctx(struct vrfb *vrfb) { return 0; } static inline void omap_vrfb_release_ctx(struct vrfb *vrfb) {} static inline void omap_vrfb_adjust_size(u16 *width, u16 *height, -- cgit v1.2.3