OMAP: DSS2: OMAPFB: implement OMAPFB_GET_DISPLAY_INFO
authorTomi Valkeinen <tomi.valkeinen@nokia.com>
Thu, 14 Jan 2010 15:32:13 +0000 (17:32 +0200)
committerTomi Valkeinen <tomi.valkeinen@nokia.com>
Mon, 15 Feb 2010 13:14:34 +0000 (15:14 +0200)
Previously the only place to get the size of the display was from the
DSS's sysfs interface, making, for example, configuring overlays and doing
updates on manual displays more difficult.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
drivers/video/omap2/omapfb/omapfb-ioctl.c
include/linux/omapfb.h

index 4c4bafdfaa4386b4a03f174b2c7821aca5bb334d..33fc1459a7c9181874c2989d9e04b2e52b36e174 100644 (file)
@@ -483,6 +483,7 @@ int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg)
                struct omapfb_memory_read       memory_read;
                struct omapfb_vram_info         vram_info;
                struct omapfb_tearsync_info     tearsync_info;
+               struct omapfb_display_info      display_info;
        } p;
 
        int r = 0;
@@ -741,6 +742,29 @@ int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg)
                break;
        }
 
+       case OMAPFB_GET_DISPLAY_INFO: {
+               u16 xres, yres;
+
+               DBG("ioctl GET_DISPLAY_INFO\n");
+
+               if (display == NULL) {
+                       r = -ENODEV;
+                       break;
+               }
+
+               display->get_resolution(display, &xres, &yres);
+
+               p.display_info.xres = xres;
+               p.display_info.yres = yres;
+               p.display_info.width = 0;
+               p.display_info.height = 0;
+
+               if (copy_to_user((void __user *)arg, &p.display_info,
+                                       sizeof(p.display_info)))
+                       r = -EFAULT;
+               break;
+       }
+
        default:
                dev_err(fbdev->dev, "Unknown ioctl 0x%x\n", cmd);
                r = -EINVAL;
index f46c40ac6d45a6007e573ee6f30e2c99ee098b06..9bdd91486b49d94c42e9ac00efd29e1b282a53b5 100644 (file)
@@ -57,6 +57,7 @@
 #define OMAPFB_WAITFORGO       OMAP_IO(60)
 #define OMAPFB_GET_VRAM_INFO   OMAP_IOR(61, struct omapfb_vram_info)
 #define OMAPFB_SET_TEARSYNC    OMAP_IOW(62, struct omapfb_tearsync_info)
+#define OMAPFB_GET_DISPLAY_INFO        OMAP_IOR(63, struct omapfb_display_info)
 
 #define OMAPFB_CAPS_GENERIC_MASK       0x00000fff
 #define OMAPFB_CAPS_LCDC_MASK          0x00fff000
@@ -206,6 +207,14 @@ struct omapfb_tearsync_info {
        __u16 reserved2;
 };
 
+struct omapfb_display_info {
+       __u16 xres;
+       __u16 yres;
+       __u32 width;    /* phys width of the display in micrometers */
+       __u32 height;   /* phys height of the display in micrometers */
+       __u32 reserved[5];
+};
+
 #ifdef __KERNEL__
 
 #include <plat/board.h>