Merge tag 'topic/drm-misc-2015-03-31' of git://anongit.freedesktop.org/drm-intel...
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / drm / exynos / exynos_drm_crtc.c
index 9e8ed5fd60aeab8924539fd1d5b1bf5773904a98..48ccab7fdf63e51888b422d7dd8175c66bda440d 100644 (file)
@@ -66,8 +66,6 @@ static void exynos_drm_crtc_commit(struct drm_crtc *crtc)
 
        if (exynos_crtc->ops->commit)
                exynos_crtc->ops->commit(exynos_crtc);
-
-       exynos_plane_dpms(crtc->primary, DRM_MODE_DPMS_ON);
 }
 
 static bool
@@ -89,10 +87,10 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
                          struct drm_display_mode *adjusted_mode, int x, int y,
                          struct drm_framebuffer *old_fb)
 {
-       struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
        struct drm_framebuffer *fb = crtc->primary->fb;
        unsigned int crtc_w;
        unsigned int crtc_h;
+       int ret;
 
        /*
         * copy the mode data adjusted by mode_fixup() into crtc->mode
@@ -100,14 +98,16 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
         */
        memcpy(&crtc->mode, adjusted_mode, sizeof(*adjusted_mode));
 
+       ret = exynos_check_plane(crtc->primary, fb);
+       if (ret < 0)
+               return ret;
+
        crtc_w = fb->width - x;
        crtc_h = fb->height - y;
+       exynos_plane_mode_set(crtc->primary, crtc, fb, 0, 0,
+                             crtc_w, crtc_h, x, y, crtc_w, crtc_h);
 
-       if (exynos_crtc->ops->mode_set)
-               exynos_crtc->ops->mode_set(exynos_crtc, &crtc->mode);
-
-       return exynos_plane_mode_set(crtc->primary, crtc, fb, 0, 0,
-                                    crtc_w, crtc_h, x, y, crtc_w, crtc_h);
+       return 0;
 }
 
 static int exynos_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
@@ -232,70 +232,12 @@ static void exynos_drm_crtc_destroy(struct drm_crtc *crtc)
        kfree(exynos_crtc);
 }
 
-static int exynos_drm_crtc_set_property(struct drm_crtc *crtc,
-                                       struct drm_property *property,
-                                       uint64_t val)
-{
-       struct drm_device *dev = crtc->dev;
-       struct exynos_drm_private *dev_priv = dev->dev_private;
-       struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-
-       if (property == dev_priv->crtc_mode_property) {
-               enum exynos_crtc_mode mode = val;
-
-               if (mode == exynos_crtc->mode)
-                       return 0;
-
-               exynos_crtc->mode = mode;
-
-               switch (mode) {
-               case CRTC_MODE_NORMAL:
-                       exynos_drm_crtc_commit(crtc);
-                       break;
-               case CRTC_MODE_BLANK:
-                       exynos_plane_dpms(crtc->primary, DRM_MODE_DPMS_OFF);
-                       break;
-               default:
-                       break;
-               }
-
-               return 0;
-       }
-
-       return -EINVAL;
-}
-
 static struct drm_crtc_funcs exynos_crtc_funcs = {
        .set_config     = drm_crtc_helper_set_config,
        .page_flip      = exynos_drm_crtc_page_flip,
        .destroy        = exynos_drm_crtc_destroy,
-       .set_property   = exynos_drm_crtc_set_property,
 };
 
-static const struct drm_prop_enum_list mode_names[] = {
-       { CRTC_MODE_NORMAL, "normal" },
-       { CRTC_MODE_BLANK, "blank" },
-};
-
-static void exynos_drm_crtc_attach_mode_property(struct drm_crtc *crtc)
-{
-       struct drm_device *dev = crtc->dev;
-       struct exynos_drm_private *dev_priv = dev->dev_private;
-       struct drm_property *prop;
-
-       prop = dev_priv->crtc_mode_property;
-       if (!prop) {
-               prop = drm_property_create_enum(dev, 0, "mode", mode_names,
-                                               ARRAY_SIZE(mode_names));
-               if (!prop)
-                       return;
-
-               dev_priv->crtc_mode_property = prop;
-       }
-
-       drm_object_attach_property(&crtc->base, prop, 0);
-}
-
 struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
                                               int pipe,
                                               enum exynos_drm_output_type type,
@@ -338,8 +280,6 @@ struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
 
        drm_crtc_helper_add(crtc, &exynos_crtc_helper_funcs);
 
-       exynos_drm_crtc_attach_mode_property(crtc);
-
        return exynos_crtc;
 
 err_crtc: