]> git.karo-electronics.de Git - linux-beck.git/commitdiff
OMAPDSS: add videomode conversion support
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 10 May 2013 10:02:32 +0000 (13:02 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Mon, 17 Jun 2013 11:00:47 +0000 (14:00 +0300)
Add helper functions to convert between omapdss specific video timings
and the common videomode.

Eventually omapdss will be changed to use only the common video timings,
and these helper functions will make the transition easier.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
drivers/video/omap2/dss/Kconfig
drivers/video/omap2/dss/display.c
include/video/omapdss.h

index cb0f145c7077897721dce128aa0369ce4f6953c8..8f70a8300b8492aa08707efbf52c3bf5fde23399 100644 (file)
@@ -1,5 +1,6 @@
 menuconfig OMAP2_DSS
         tristate "OMAP2+ Display Subsystem support"
+       select VIDEOMODE_HELPERS
         help
          OMAP2+ Display Subsystem support.
 
index 0aa8ad8f96679db07b11c6221f7a3eff9f150ffe..72ac058a56d3ca64617530db73c6ef88ffb9f00c 100644 (file)
@@ -219,3 +219,72 @@ void omap_dss_stop_device(struct omap_dss_device *dssdev)
 }
 EXPORT_SYMBOL(omap_dss_stop_device);
 
+void videomode_to_omap_video_timings(const struct videomode *vm,
+               struct omap_video_timings *ovt)
+{
+       memset(ovt, 0, sizeof(*ovt));
+
+       ovt->pixel_clock = vm->pixelclock / 1000;
+       ovt->x_res = vm->hactive;
+       ovt->hbp = vm->hback_porch;
+       ovt->hfp = vm->hfront_porch;
+       ovt->hsw = vm->hsync_len;
+       ovt->y_res = vm->vactive;
+       ovt->vbp = vm->vback_porch;
+       ovt->vfp = vm->vfront_porch;
+       ovt->vsw = vm->vsync_len;
+
+       ovt->vsync_level = vm->flags & DISPLAY_FLAGS_VSYNC_HIGH ?
+               OMAPDSS_SIG_ACTIVE_HIGH :
+               OMAPDSS_SIG_ACTIVE_LOW;
+       ovt->hsync_level = vm->flags & DISPLAY_FLAGS_HSYNC_HIGH ?
+               OMAPDSS_SIG_ACTIVE_HIGH :
+               OMAPDSS_SIG_ACTIVE_LOW;
+       ovt->de_level = vm->flags & DISPLAY_FLAGS_DE_HIGH ?
+               OMAPDSS_SIG_ACTIVE_HIGH :
+               OMAPDSS_SIG_ACTIVE_HIGH;
+       ovt->data_pclk_edge = vm->flags & DISPLAY_FLAGS_PIXDATA_POSEDGE ?
+               OMAPDSS_DRIVE_SIG_RISING_EDGE :
+               OMAPDSS_DRIVE_SIG_FALLING_EDGE;
+
+       ovt->sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES;
+}
+EXPORT_SYMBOL(videomode_to_omap_video_timings);
+
+void omap_video_timings_to_videomode(const struct omap_video_timings *ovt,
+               struct videomode *vm)
+{
+       memset(vm, 0, sizeof(*vm));
+
+       vm->pixelclock = ovt->pixel_clock * 1000;
+
+       vm->hactive = ovt->x_res;
+       vm->hback_porch = ovt->hbp;
+       vm->hfront_porch = ovt->hfp;
+       vm->hsync_len = ovt->hsw;
+       vm->vactive = ovt->y_res;
+       vm->vback_porch = ovt->vbp;
+       vm->vfront_porch = ovt->vfp;
+       vm->vsync_len = ovt->vsw;
+
+       if (ovt->hsync_level == OMAPDSS_SIG_ACTIVE_HIGH)
+               vm->flags |= DISPLAY_FLAGS_HSYNC_HIGH;
+       else
+               vm->flags |= DISPLAY_FLAGS_HSYNC_LOW;
+
+       if (ovt->vsync_level == OMAPDSS_SIG_ACTIVE_HIGH)
+               vm->flags |= DISPLAY_FLAGS_VSYNC_HIGH;
+       else
+               vm->flags |= DISPLAY_FLAGS_VSYNC_LOW;
+
+       if (ovt->de_level == OMAPDSS_SIG_ACTIVE_HIGH)
+               vm->flags |= DISPLAY_FLAGS_DE_HIGH;
+       else
+               vm->flags |= DISPLAY_FLAGS_DE_LOW;
+
+       if (ovt->data_pclk_edge == OMAPDSS_DRIVE_SIG_RISING_EDGE)
+               vm->flags |= DISPLAY_FLAGS_PIXDATA_POSEDGE;
+       else
+               vm->flags |= DISPLAY_FLAGS_PIXDATA_NEGEDGE;
+}
+EXPORT_SYMBOL(omap_video_timings_to_videomode);
index 4f52f523fba47139af7d9262f5c7d3b34ee2a4a3..0324c7b8a3e06a9d0950cd4e6588393aadbe77a4 100644 (file)
@@ -23,6 +23,8 @@
 #include <linux/device.h>
 #include <linux/interrupt.h>
 
+#include <video/videomode.h>
+
 #define DISPC_IRQ_FRAMEDONE            (1 << 0)
 #define DISPC_IRQ_VSYNC                        (1 << 1)
 #define DISPC_IRQ_EVSYNC_EVEN          (1 << 2)
@@ -768,6 +770,11 @@ const char *omapdss_get_default_display_name(void);
 int omap_dss_start_device(struct omap_dss_device *dssdev);
 void omap_dss_stop_device(struct omap_dss_device *dssdev);
 
+void videomode_to_omap_video_timings(const struct videomode *vm,
+               struct omap_video_timings *ovt);
+void omap_video_timings_to_videomode(const struct omap_video_timings *ovt,
+               struct videomode *vm);
+
 int dss_feat_get_num_mgrs(void);
 int dss_feat_get_num_ovls(void);
 enum omap_display_type dss_feat_get_supported_displays(enum omap_channel channel);