OMAP: DSS2: Add method for querying display dimensions from DSS drivers
authorJani Nikula <ext-jani.1.nikula@nokia.com>
Wed, 16 Jun 2010 12:26:36 +0000 (15:26 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Wed, 11 May 2011 11:19:24 +0000 (14:19 +0300)
Add get_dimensions() to struct omap_dss_driver. Use the call, if supported
by the driver, in OMAPFB.

Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
drivers/video/omap2/omapfb/omapfb-ioctl.c
drivers/video/omap2/omapfb/omapfb-main.c
include/video/omapdss.h

index 3e4ee4dc2fb5fce08b434bf97ce0417b58e34fd5..cff450392b797053ac7aff3acd5d5bc7a51d0030 100644 (file)
@@ -895,8 +895,16 @@ int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg)
 
                p.display_info.xres = xres;
                p.display_info.yres = yres;
-               p.display_info.width = 0;
-               p.display_info.height = 0;
+
+               if (display->driver->get_dimensions) {
+                       u32 w, h;
+                       display->driver->get_dimensions(display, &w, &h);
+                       p.display_info.width = w;
+                       p.display_info.height = h;
+               } else {
+                       p.display_info.width = 0;
+                       p.display_info.height = 0;
+               }
 
                if (copy_to_user((void __user *)arg, &p.display_info,
                                        sizeof(p.display_info)))
index 606f6eec4e17c6730b202510b72d720cd33d5b3d..c0c846c8f2315c6e7c8b4f850ff74515af3df94a 100644 (file)
@@ -702,8 +702,16 @@ int check_fb_var(struct fb_info *fbi, struct fb_var_screeninfo *var)
                        var->xres, var->yres,
                        var->xres_virtual, var->yres_virtual);
 
-       var->height             = -1;
-       var->width              = -1;
+       if (display && display->driver->get_dimensions) {
+               u32 w, h;
+               display->driver->get_dimensions(display, &w, &h);
+               var->width = DIV_ROUND_CLOSEST(w, 1000);
+               var->height = DIV_ROUND_CLOSEST(h, 1000);
+       } else {
+               var->height = -1;
+               var->width = -1;
+       }
+
        var->grayscale          = 0;
 
        if (display && display->driver->get_timings) {
index 53ca97c9793ce93c822b252daf58abfd010fa877..f0789292c7c2934e04ed9d95c70dae3d781d7585 100644 (file)
@@ -505,6 +505,8 @@ struct omap_dss_driver {
 
        void (*get_resolution)(struct omap_dss_device *dssdev,
                        u16 *xres, u16 *yres);
+       void (*get_dimensions)(struct omap_dss_device *dssdev,
+                       u32 *width, u32 *height);
        int (*get_recommended_bpp)(struct omap_dss_device *dssdev);
 
        int (*check_timings)(struct omap_dss_device *dssdev,