Merge branch 'lazytime' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / drm / exynos / exynos_drm_drv.h
index 2e5063488c5026ccd99e717d7e132289ca187dee..9afd390d4674d81ff28fb6e7ab5adcba2b8d8b37 100644 (file)
@@ -23,6 +23,9 @@
 #define MAX_FB_BUFFER  4
 #define DEFAULT_ZPOS   -1
 
+#define to_exynos_crtc(x)      container_of(x, struct exynos_drm_crtc, base)
+#define to_exynos_plane(x)     container_of(x, struct exynos_drm_plane, base)
+
 /* This enumerates device type. */
 enum exynos_drm_device_type {
        EXYNOS_DEVICE_TYPE_NONE,
@@ -44,6 +47,7 @@ enum exynos_drm_output_type {
 /*
  * Exynos drm common overlay structure.
  *
+ * @base: plane object
  * @fb_x: offset x on a framebuffer to be displayed.
  *     - the unit is screen coordinates.
  * @fb_y: offset y on a framebuffer to be displayed.
@@ -73,11 +77,14 @@ enum exynos_drm_output_type {
  * @local_path: in case of lcd type, local path mode on or off.
  * @transparency: transparency on or off.
  * @activated: activated or not.
+ * @enabled: enabled or not.
  *
  * this structure is common to exynos SoC and its contents would be copied
  * to hardware specific overlay info.
  */
-struct exynos_drm_overlay {
+
+struct exynos_drm_plane {
+       struct drm_plane base;
        unsigned int fb_x;
        unsigned int fb_y;
        unsigned int fb_width;
@@ -104,6 +111,7 @@ struct exynos_drm_overlay {
        bool local_path:1;
        bool transparency:1;
        bool activated:1;
+       bool enabled:1;
 };
 
 /*
@@ -155,11 +163,10 @@ struct exynos_drm_display {
 };
 
 /*
- * Exynos drm manager ops
+ * Exynos drm crtc ops
  *
  * @dpms: control device power.
  * @mode_fixup: fix mode data before applying it
- * @mode_set: set the given mode to the manager
  * @commit: set current hw specific display mode to hw.
  * @enable_vblank: specific driver callback for enabling vblank interrupt.
  * @disable_vblank: specific driver callback for disabling vblank interrupt.
@@ -172,44 +179,49 @@ struct exynos_drm_display {
  * @te_handler: trigger to transfer video image at the tearing effect
  *     synchronization signal if there is a page flip request.
  */
-struct exynos_drm_manager;
-struct exynos_drm_manager_ops {
-       void (*dpms)(struct exynos_drm_manager *mgr, int mode);
-       bool (*mode_fixup)(struct exynos_drm_manager *mgr,
+struct exynos_drm_crtc;
+struct exynos_drm_crtc_ops {
+       void (*dpms)(struct exynos_drm_crtc *crtc, int mode);
+       bool (*mode_fixup)(struct exynos_drm_crtc *crtc,
                                const struct drm_display_mode *mode,
                                struct drm_display_mode *adjusted_mode);
-       void (*mode_set)(struct exynos_drm_manager *mgr,
-                               const struct drm_display_mode *mode);
-       void (*commit)(struct exynos_drm_manager *mgr);
-       int (*enable_vblank)(struct exynos_drm_manager *mgr);
-       void (*disable_vblank)(struct exynos_drm_manager *mgr);
-       void (*wait_for_vblank)(struct exynos_drm_manager *mgr);
-       void (*win_mode_set)(struct exynos_drm_manager *mgr,
-                               struct exynos_drm_overlay *overlay);
-       void (*win_commit)(struct exynos_drm_manager *mgr, int zpos);
-       void (*win_enable)(struct exynos_drm_manager *mgr, int zpos);
-       void (*win_disable)(struct exynos_drm_manager *mgr, int zpos);
-       void (*te_handler)(struct exynos_drm_manager *mgr);
+       void (*commit)(struct exynos_drm_crtc *crtc);
+       int (*enable_vblank)(struct exynos_drm_crtc *crtc);
+       void (*disable_vblank)(struct exynos_drm_crtc *crtc);
+       void (*wait_for_vblank)(struct exynos_drm_crtc *crtc);
+       void (*win_mode_set)(struct exynos_drm_crtc *crtc,
+                               struct exynos_drm_plane *plane);
+       void (*win_commit)(struct exynos_drm_crtc *crtc, int zpos);
+       void (*win_enable)(struct exynos_drm_crtc *crtc, int zpos);
+       void (*win_disable)(struct exynos_drm_crtc *crtc, int zpos);
+       void (*te_handler)(struct exynos_drm_crtc *crtc);
 };
 
 /*
- * Exynos drm common manager structure, maps 1:1 with a crtc
+ * Exynos specific crtc structure.
  *
- * @list: the list entry for this manager
+ * @base: crtc object.
  * @type: one of EXYNOS_DISPLAY_TYPE_LCD and HDMI.
- * @drm_dev: pointer to the drm device
- * @crtc: crtc object.
- * @pipe: the pipe number for this crtc/manager
+ * @pipe: a crtc index created at load() with a new crtc object creation
+ *     and the crtc object would be set to private->crtc array
+ *     to get a crtc object corresponding to this pipe from private->crtc
+ *     array when irq interrupt occurred. the reason of using this pipe is that
+ *     drm framework doesn't support multiple irq yet.
+ *     we can refer to the crtc to current hardware interrupt occurred through
+ *     this pipe value.
+ * @dpms: store the crtc dpms value
  * @ops: pointer to callbacks for exynos drm specific functionality
- * @ctx: A pointer to the manager's implementation specific context
+ * @ctx: A pointer to the crtc's implementation specific context
  */
-struct exynos_drm_manager {
-       struct list_head list;
-       enum exynos_drm_output_type type;
-       struct drm_device *drm_dev;
-       struct drm_crtc *crtc;
-       int pipe;
-       struct exynos_drm_manager_ops *ops;
+struct exynos_drm_crtc {
+       struct drm_crtc                 base;
+       enum exynos_drm_output_type     type;
+       unsigned int                    pipe;
+       unsigned int                    dpms;
+       wait_queue_head_t               pending_flip_queue;
+       atomic_t                        pending_flip;
+       struct exynos_drm_crtc_ops      *ops;
+       void                            *ctx;
 };
 
 struct exynos_drm_g2d_private {
@@ -246,7 +258,6 @@ struct exynos_drm_private {
         */
        struct drm_crtc *crtc[MAX_CRTC];
        struct drm_property *plane_zpos_property;
-       struct drm_property *crtc_mode_property;
 
        unsigned long da_start;
        unsigned long da_space_size;
@@ -333,6 +344,7 @@ void exynos_drm_component_del(struct device *dev,
                                enum exynos_drm_device_type dev_type);
 
 extern struct platform_driver fimd_driver;
+extern struct platform_driver decon_driver;
 extern struct platform_driver dp_driver;
 extern struct platform_driver dsi_driver;
 extern struct platform_driver mixer_driver;