Skip to content

Commit aa1e49a

Browse files
committed
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>
1 parent 8c05a41 commit aa1e49a

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

‎drivers/video/omap2/vrfb.c‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ static void __iomem *vrfb_base;
7777
static int num_ctxs;
7878
static struct vrfb_ctx *ctxs;
7979

80+
static bool vrfb_loaded;
81+
8082
static void omap2_sms_write_rot_control(u32 val, unsigned ctx)
8183
{
8284
__raw_writel(val, vrfb_base + SMS_ROT_CONTROL(ctx));
@@ -336,6 +338,12 @@ int omap_vrfb_request_ctx(struct vrfb *vrfb)
336338
}
337339
EXPORT_SYMBOL(omap_vrfb_request_ctx);
338340

341+
bool omap_vrfb_supported(void)
342+
{
343+
return vrfb_loaded;
344+
}
345+
EXPORT_SYMBOL(omap_vrfb_supported);
346+
339347
static int __init vrfb_probe(struct platform_device *pdev)
340348
{
341349
struct resource *mem;
@@ -375,11 +383,19 @@ static int __init vrfb_probe(struct platform_device *pdev)
375383
ctxs[i].base = mem->start;
376384
}
377385

386+
vrfb_loaded = true;
387+
378388
return 0;
379389
}
380390

391+
static void __exit vrfb_remove(struct platform_device *pdev)
392+
{
393+
vrfb_loaded = false;
394+
}
395+
381396
static struct platform_driver vrfb_driver = {
382397
.driver.name = "omapvrfb",
398+
.remove = __exit_p(vrfb_remove),
383399
};
384400

385401
static int __init vrfb_init(void)

‎include/video/omapvrfb.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ struct vrfb {
3636
};
3737

3838
#ifdef CONFIG_OMAP2_VRFB
39+
extern bool omap_vrfb_supported(void);
3940
extern int omap_vrfb_request_ctx(struct vrfb *vrfb);
4041
extern void omap_vrfb_release_ctx(struct vrfb *vrfb);
4142
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);
4950
extern void omap_vrfb_restore_context(void);
5051

5152
#else
53+
static inline bool omap_vrfb_supported(void) { return false; }
5254
static inline int omap_vrfb_request_ctx(struct vrfb *vrfb) { return 0; }
5355
static inline void omap_vrfb_release_ctx(struct vrfb *vrfb) {}
5456
static inline void omap_vrfb_adjust_size(u16 *width, u16 *height,

0 commit comments

Comments
 (0)