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 <tomi.valkeinen@ti.com>
This commit is contained in:
Tomi Valkeinen 2012-10-17 12:15:31 +03:00
parent 8c05a41224
commit aa1e49a375
2 changed files with 18 additions and 0 deletions

View file

@ -77,6 +77,8 @@ static void __iomem *vrfb_base;
static int num_ctxs; static int num_ctxs;
static struct vrfb_ctx *ctxs; static struct vrfb_ctx *ctxs;
static bool vrfb_loaded;
static void omap2_sms_write_rot_control(u32 val, unsigned ctx) static void omap2_sms_write_rot_control(u32 val, unsigned ctx)
{ {
__raw_writel(val, vrfb_base + SMS_ROT_CONTROL(ctx)); __raw_writel(val, vrfb_base + SMS_ROT_CONTROL(ctx));
@ -336,6 +338,12 @@ int omap_vrfb_request_ctx(struct vrfb *vrfb)
} }
EXPORT_SYMBOL(omap_vrfb_request_ctx); 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) static int __init vrfb_probe(struct platform_device *pdev)
{ {
struct resource *mem; struct resource *mem;
@ -375,11 +383,19 @@ static int __init vrfb_probe(struct platform_device *pdev)
ctxs[i].base = mem->start; ctxs[i].base = mem->start;
} }
vrfb_loaded = true;
return 0; return 0;
} }
static void __exit vrfb_remove(struct platform_device *pdev)
{
vrfb_loaded = false;
}
static struct platform_driver vrfb_driver = { static struct platform_driver vrfb_driver = {
.driver.name = "omapvrfb", .driver.name = "omapvrfb",
.remove = __exit_p(vrfb_remove),
}; };
static int __init vrfb_init(void) static int __init vrfb_init(void)

View file

@ -36,6 +36,7 @@ struct vrfb {
}; };
#ifdef CONFIG_OMAP2_VRFB #ifdef CONFIG_OMAP2_VRFB
extern bool omap_vrfb_supported(void);
extern int omap_vrfb_request_ctx(struct vrfb *vrfb); extern int omap_vrfb_request_ctx(struct vrfb *vrfb);
extern void omap_vrfb_release_ctx(struct vrfb *vrfb); extern void omap_vrfb_release_ctx(struct vrfb *vrfb);
extern void omap_vrfb_adjust_size(u16 *width, u16 *height, 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); extern void omap_vrfb_restore_context(void);
#else #else
static inline bool omap_vrfb_supported(void) { return false; }
static inline int omap_vrfb_request_ctx(struct vrfb *vrfb) { return 0; } 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_release_ctx(struct vrfb *vrfb) {}
static inline void omap_vrfb_adjust_size(u16 *width, u16 *height, static inline void omap_vrfb_adjust_size(u16 *width, u16 *height,