aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorSteffen Trumtrar <s.trumtrar@pengutronix.de>2012-11-14 05:12:38 -0500
committerSteffen Trumtrar <s.trumtrar@pengutronix.de>2013-01-24 03:04:04 -0500
commit790890444f591145d3a00623af461c9006e17d51 (patch)
tree03b288ca5c98d9cb72b37db4640dc8988017ca06 /drivers/video
parent2db54c72395298a58f29c75ae880be9e478fdbbd (diff)
fbmon: add of_videomode helpers
Add helper to get fb_videomode from devicetree. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Reviewed-by: Thierry Reding <thierry.reding@avionic-design.de> Acked-by: Thierry Reding <thierry.reding@avionic-design.de> Tested-by: Thierry Reding <thierry.reding@avionic-design.de> Tested-by: Philipp Zabel <p.zabel@pengutronix.de> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Afzal Mohammed <Afzal@ti.com> Tested-by: Rob Clark <robclark@gmail.com> Tested-by: Leela Krishna Amudala <leelakrishna.a@gmail.com>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/fbmon.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c
index 17ce135a18fd..94ad0f71383c 100644
--- a/drivers/video/fbmon.c
+++ b/drivers/video/fbmon.c
@@ -31,6 +31,7 @@
31#include <linux/pci.h> 31#include <linux/pci.h>
32#include <linux/slab.h> 32#include <linux/slab.h>
33#include <video/edid.h> 33#include <video/edid.h>
34#include <video/of_videomode.h>
34#include <video/videomode.h> 35#include <video/videomode.h>
35#ifdef CONFIG_PPC_OF 36#ifdef CONFIG_PPC_OF
36#include <asm/prom.h> 37#include <asm/prom.h>
@@ -1425,6 +1426,47 @@ int fb_videomode_from_videomode(const struct videomode *vm,
1425EXPORT_SYMBOL_GPL(fb_videomode_from_videomode); 1426EXPORT_SYMBOL_GPL(fb_videomode_from_videomode);
1426#endif 1427#endif
1427 1428
1429#if IS_ENABLED(CONFIG_OF_VIDEOMODE)
1430static inline void dump_fb_videomode(const struct fb_videomode *m)
1431{
1432 pr_debug("fb_videomode = %ux%u@%uHz (%ukHz) %u %u %u %u %u %u %u %u %u\n",
1433 m->xres, m->yres, m->refresh, m->pixclock, m->left_margin,
1434 m->right_margin, m->upper_margin, m->lower_margin,
1435 m->hsync_len, m->vsync_len, m->sync, m->vmode, m->flag);
1436}
1437
1438/**
1439 * of_get_fb_videomode - get a fb_videomode from devicetree
1440 * @np: device_node with the timing specification
1441 * @fb: will be set to the return value
1442 * @index: index into the list of display timings in devicetree
1443 *
1444 * DESCRIPTION:
1445 * This function is expensive and should only be used, if only one mode is to be
1446 * read from DT. To get multiple modes start with of_get_display_timings ond
1447 * work with that instead.
1448 */
1449int of_get_fb_videomode(struct device_node *np, struct fb_videomode *fb,
1450 int index)
1451{
1452 struct videomode vm;
1453 int ret;
1454
1455 ret = of_get_videomode(np, &vm, index);
1456 if (ret)
1457 return ret;
1458
1459 fb_videomode_from_videomode(&vm, fb);
1460
1461 pr_debug("%s: got %dx%d display mode from %s\n",
1462 of_node_full_name(np), vm.hactive, vm.vactive, np->name);
1463 dump_fb_videomode(fb);
1464
1465 return 0;
1466}
1467EXPORT_SYMBOL_GPL(of_get_fb_videomode);
1468#endif
1469
1428#else 1470#else
1429int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var) 1471int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var)
1430{ 1472{