OMAP: DSS2: move timing functions
authorTomi Valkeinen <tomi.valkeinen@nokia.com>
Wed, 20 Jan 2010 10:11:25 +0000 (12:11 +0200)
committerTomi Valkeinen <tomi.valkeinen@nokia.com>
Wed, 24 Feb 2010 12:31:28 +0000 (14:31 +0200)
Move check/set/get_timings() from omap_dss_device to omap_dss_driver.

This is part of a larger patch-set, which moves the control from omapdss
driver to the display driver.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
arch/arm/plat-omap/include/plat/display.h
drivers/video/omap2/displays/panel-taal.c
drivers/video/omap2/dss/display.c
drivers/video/omap2/dss/dpi.c
drivers/video/omap2/dss/sdi.c
drivers/video/omap2/dss/venc.c
drivers/video/omap2/omapfb/omapfb-main.c

index 3f7b20990086ac85ad95638148cf02aa54a8cbfb..23bc94fc51fa619091024416dea5dcd4478557f3 100644 (file)
@@ -462,13 +462,6 @@ struct omap_dss_device {
 
        enum omap_dss_display_state state;
 
-       int (*check_timings)(struct omap_dss_device *dssdev,
-                       struct omap_video_timings *timings);
-       void (*set_timings)(struct omap_dss_device *dssdev,
-                       struct omap_video_timings *timings);
-       void (*get_timings)(struct omap_dss_device *dssdev,
-                       struct omap_video_timings *timings);
-
        /* platform specific  */
        int (*platform_enable)(struct omap_dss_device *dssdev);
        void (*platform_disable)(struct omap_dss_device *dssdev);
@@ -514,6 +507,13 @@ struct omap_dss_driver {
                        u16 *xres, u16 *yres);
        int (*get_recommended_bpp)(struct omap_dss_device *dssdev);
 
+       int (*check_timings)(struct omap_dss_device *dssdev,
+                       struct omap_video_timings *timings);
+       void (*set_timings)(struct omap_dss_device *dssdev,
+                       struct omap_video_timings *timings);
+       void (*get_timings)(struct omap_dss_device *dssdev,
+                       struct omap_video_timings *timings);
+
        int (*set_wss)(struct omap_dss_device *dssdev, u32 wss);
        u32 (*get_wss)(struct omap_dss_device *dssdev);
 };
@@ -570,6 +570,10 @@ void omapdss_dsi_display_disable(struct omap_dss_device *dssdev);
 
 int omapdss_dpi_display_enable(struct omap_dss_device *dssdev);
 void omapdss_dpi_display_disable(struct omap_dss_device *dssdev);
+void dpi_set_timings(struct omap_dss_device *dssdev,
+                       struct omap_video_timings *timings);
+int dpi_check_timings(struct omap_dss_device *dssdev,
+                       struct omap_video_timings *timings);
 
 int omapdss_sdi_display_enable(struct omap_dss_device *dssdev);
 void omapdss_sdi_display_disable(struct omap_dss_device *dssdev);
index 484a6184476353d195d2d90b049453d402f02822..a722733106b1723bbfc829dec34f9fb7beb7ba1d 100644 (file)
@@ -516,8 +516,6 @@ static int taal_probe(struct omap_dss_device *dssdev)
 
        dev_set_drvdata(&dssdev->dev, td);
 
-       dssdev->get_timings = taal_get_timings;
-
        /* if no platform set_backlight() defined, presume DSI backlight
         * control */
        if (!dssdev->set_backlight)
@@ -1118,6 +1116,8 @@ static struct omap_dss_driver taal_driver = {
        .run_test       = taal_run_test,
        .memory_read    = taal_memory_read,
 
+       .get_timings    = taal_get_timings,
+
        .driver         = {
                .name   = "taal",
                .owner  = THIS_MODULE,
index 351c8abae0b2237f7d9b7b1a15520443b5ecff56..6a74ea116d29b031e8fcb80f82a610e95bec5fe3 100644 (file)
@@ -135,10 +135,10 @@ static ssize_t display_timings_show(struct device *dev,
        struct omap_dss_device *dssdev = to_dss_device(dev);
        struct omap_video_timings t;
 
-       if (!dssdev->get_timings)
+       if (!dssdev->driver->get_timings)
                return -ENOENT;
 
-       dssdev->get_timings(dssdev, &t);
+       dssdev->driver->get_timings(dssdev, &t);
 
        return snprintf(buf, PAGE_SIZE, "%u,%u/%u/%u/%u,%u/%u/%u/%u\n",
                        t.pixel_clock,
@@ -153,7 +153,7 @@ static ssize_t display_timings_store(struct device *dev,
        struct omap_video_timings t;
        int r, found;
 
-       if (!dssdev->set_timings || !dssdev->check_timings)
+       if (!dssdev->driver->set_timings || !dssdev->driver->check_timings)
                return -ENOENT;
 
        found = 0;
@@ -172,11 +172,11 @@ static ssize_t display_timings_store(struct device *dev,
                                &t.y_res, &t.vfp, &t.vbp, &t.vsw) != 9)
                return -EINVAL;
 
-       r = dssdev->check_timings(dssdev, &t);
+       r = dssdev->driver->check_timings(dssdev, &t);
        if (r)
                return r;
 
-       dssdev->set_timings(dssdev, &t);
+       dssdev->driver->set_timings(dssdev, &t);
 
        return size;
 }
index 1eef8b72dbb9d94694ed242bb521991070c09d07..960e977a8bf0f39ff8dce42c0893fc9604ea8081 100644 (file)
@@ -227,7 +227,7 @@ void omapdss_dpi_display_disable(struct omap_dss_device *dssdev)
 }
 EXPORT_SYMBOL(omapdss_dpi_display_disable);
 
-static void dpi_set_timings(struct omap_dss_device *dssdev,
+void dpi_set_timings(struct omap_dss_device *dssdev,
                        struct omap_video_timings *timings)
 {
        DSSDBG("dpi_set_timings\n");
@@ -237,8 +237,9 @@ static void dpi_set_timings(struct omap_dss_device *dssdev,
                dispc_go(OMAP_DSS_CHANNEL_LCD);
        }
 }
+EXPORT_SYMBOL(dpi_set_timings);
 
-static int dpi_check_timings(struct omap_dss_device *dssdev,
+int dpi_check_timings(struct omap_dss_device *dssdev,
                        struct omap_video_timings *timings)
 {
        bool is_tft;
@@ -292,21 +293,12 @@ static int dpi_check_timings(struct omap_dss_device *dssdev,
 
        return 0;
 }
-
-static void dpi_get_timings(struct omap_dss_device *dssdev,
-                       struct omap_video_timings *timings)
-{
-       *timings = dssdev->panel.timings;
-}
+EXPORT_SYMBOL(dpi_check_timings);
 
 int dpi_init_display(struct omap_dss_device *dssdev)
 {
        DSSDBG("init_display\n");
 
-       dssdev->set_timings = dpi_set_timings;
-       dssdev->check_timings = dpi_check_timings;
-       dssdev->get_timings = dpi_get_timings;
-
        return 0;
 }
 
index 929ceb3ddd9d5657385dad02e29b8158f9b2e16f..12eb4042dd8255825b4d6fb6fd6e5a87432be804 100644 (file)
@@ -150,18 +150,10 @@ void omapdss_sdi_display_disable(struct omap_dss_device *dssdev)
 }
 EXPORT_SYMBOL(omapdss_sdi_display_disable);
 
-static void sdi_get_timings(struct omap_dss_device *dssdev,
-                       struct omap_video_timings *timings)
-{
-       *timings = dssdev->panel.timings;
-}
-
 int sdi_init_display(struct omap_dss_device *dssdev)
 {
        DSSDBG("SDI init\n");
 
-       dssdev->get_timings = sdi_get_timings;
-
        return 0;
 }
 
index 5c6e98bbb663c95cc10caddd3125c5dffbdc20a1..f0ba5732d84a133ea4c94052dd762f1664ee94bb 100644 (file)
@@ -557,6 +557,43 @@ static int venc_set_update_mode(struct omap_dss_device *dssdev,
        return 0;
 }
 
+static void venc_get_timings(struct omap_dss_device *dssdev,
+                       struct omap_video_timings *timings)
+{
+       *timings = dssdev->panel.timings;
+}
+
+static void venc_set_timings(struct omap_dss_device *dssdev,
+                       struct omap_video_timings *timings)
+{
+       DSSDBG("venc_set_timings\n");
+
+       /* Reset WSS data when the TV standard changes. */
+       if (memcmp(&dssdev->panel.timings, timings, sizeof(*timings)))
+               venc.wss_data = 0;
+
+       dssdev->panel.timings = *timings;
+       if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) {
+               /* turn the venc off and on to get new timings to use */
+               venc_panel_disable(dssdev);
+               venc_panel_enable(dssdev);
+       }
+}
+
+static int venc_check_timings(struct omap_dss_device *dssdev,
+                       struct omap_video_timings *timings)
+{
+       DSSDBG("venc_check_timings\n");
+
+       if (memcmp(&omap_dss_pal_timings, timings, sizeof(*timings)) == 0)
+               return 0;
+
+       if (memcmp(&omap_dss_ntsc_timings, timings, sizeof(*timings)) == 0)
+               return 0;
+
+       return -EINVAL;
+}
+
 static u32 venc_get_wss(struct omap_dss_device *dssdev)
 {
        /* Invert due to VENC_L21_WC_CTL:INV=1 */
@@ -603,6 +640,10 @@ static struct omap_dss_driver venc_driver = {
        .set_update_mode = venc_set_update_mode,
        .get_update_mode = venc_get_update_mode,
 
+       .get_timings    = venc_get_timings,
+       .set_timings    = venc_set_timings,
+       .check_timings  = venc_check_timings,
+
        .get_wss        = venc_get_wss,
        .set_wss        = venc_set_wss,
 
@@ -653,51 +694,10 @@ void venc_exit(void)
        iounmap(venc.base);
 }
 
-static void venc_get_timings(struct omap_dss_device *dssdev,
-                       struct omap_video_timings *timings)
-{
-       *timings = dssdev->panel.timings;
-}
-
-static void venc_set_timings(struct omap_dss_device *dssdev,
-                       struct omap_video_timings *timings)
-{
-       DSSDBG("venc_set_timings\n");
-
-       /* Reset WSS data when the TV standard changes. */
-       if (memcmp(&dssdev->panel.timings, timings, sizeof(*timings)))
-               venc.wss_data = 0;
-
-       dssdev->panel.timings = *timings;
-       if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) {
-               /* turn the venc off and on to get new timings to use */
-               venc_panel_disable(dssdev);
-               venc_panel_enable(dssdev);
-       }
-}
-
-static int venc_check_timings(struct omap_dss_device *dssdev,
-                       struct omap_video_timings *timings)
-{
-       DSSDBG("venc_check_timings\n");
-
-       if (memcmp(&omap_dss_pal_timings, timings, sizeof(*timings)) == 0)
-               return 0;
-
-       if (memcmp(&omap_dss_ntsc_timings, timings, sizeof(*timings)) == 0)
-               return 0;
-
-       return -EINVAL;
-}
-
 int venc_init_display(struct omap_dss_device *dssdev)
 {
        DSSDBG("init_display\n");
 
-       dssdev->get_timings = venc_get_timings;
-       dssdev->set_timings = venc_set_timings;
-       dssdev->check_timings = venc_check_timings;
-
        return 0;
 }
 
index b327ee0e60d524c7beab4e122bdfdd51d725fc51..8aed12a1ce2ffc2c8acf6c19947a4f75fd032c92 100644 (file)
@@ -705,9 +705,9 @@ int check_fb_var(struct fb_info *fbi, struct fb_var_screeninfo *var)
        var->width              = -1;
        var->grayscale          = 0;
 
-       if (display && display->get_timings) {
+       if (display && display->driver->get_timings) {
                struct omap_video_timings timings;
-               display->get_timings(display, &timings);
+               display->driver->get_timings(display, &timings);
 
                /* pixclock in ps, the rest in pixclock */
                var->pixclock = timings.pixel_clock != 0 ?
@@ -2029,14 +2029,14 @@ static int omapfb_set_def_mode(struct omapfb2_device *fbdev,
        fbdev->bpp_overrides[fbdev->num_bpp_overrides].bpp = bpp;
        ++fbdev->num_bpp_overrides;
 
-       if (!display->check_timings || !display->set_timings)
+       if (!display->driver->check_timings || !display->driver->set_timings)
                return -EINVAL;
 
-       r = display->check_timings(display, &timings);
+       r = display->driver->check_timings(display, &timings);
        if (r)
                return r;
 
-       display->set_timings(display, &timings);
+       display->driver->set_timings(display, &timings);
 
        return 0;
 }