Merge tag 'mmc-v4.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
[cascardo/linux.git] / drivers / gpu / drm / sti / sti_hqvdp.c
index b5ee783..f88130f 100644 (file)
@@ -17,6 +17,7 @@
 #include "sti_hqvdp_lut.h"
 #include "sti_plane.h"
 #include "sti_vtg.h"
+#include "sti_drv.h"
 
 /* Firmware name */
 #define HQVDP_FMW_NAME          "hqvdp-stih407.bin"
@@ -770,6 +771,7 @@ static void sti_hqvdp_disable(struct sti_hqvdp *hqvdp)
                DRM_ERROR("XP70 could not revert to idle\n");
 
        hqvdp->plane.status = STI_PLANE_DISABLED;
+       hqvdp->xp70_initialized = false;
 }
 
 /**
@@ -783,7 +785,7 @@ static void sti_hqvdp_disable(struct sti_hqvdp *hqvdp)
  * RETURNS:
  * 0 on success.
  */
-int sti_hqvdp_vtg_cb(struct notifier_block *nb, unsigned long evt, void *data)
+static int sti_hqvdp_vtg_cb(struct notifier_block *nb, unsigned long evt, void *data)
 {
        struct sti_hqvdp *hqvdp = container_of(nb, struct sti_hqvdp, vtg_nb);
        int btm_cmd_offset, top_cmd_offest;
@@ -1012,7 +1014,6 @@ static int sti_hqvdp_atomic_check(struct drm_plane *drm_plane,
        struct sti_hqvdp *hqvdp = to_sti_hqvdp(plane);
        struct drm_crtc *crtc = state->crtc;
        struct drm_framebuffer *fb = state->fb;
-       bool first_prepare = plane->status == STI_PLANE_DISABLED ? true : false;
        struct drm_crtc_state *crtc_state;
        struct drm_display_mode *mode;
        int dst_x, dst_y, dst_w, dst_h;
@@ -1026,8 +1027,8 @@ static int sti_hqvdp_atomic_check(struct drm_plane *drm_plane,
        mode = &crtc_state->mode;
        dst_x = state->crtc_x;
        dst_y = state->crtc_y;
-       dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x);
-       dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y);
+       dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
+       dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
        /* src_x are in 16.16 format */
        src_x = state->src_x >> 16;
        src_y = state->src_y >> 16;
@@ -1063,7 +1064,7 @@ static int sti_hqvdp_atomic_check(struct drm_plane *drm_plane,
                return -EINVAL;
        }
 
-       if (first_prepare) {
+       if (!hqvdp->xp70_initialized) {
                /* Start HQVDP XP70 coprocessor */
                sti_hqvdp_start_xp70(hqvdp);
 
@@ -1115,8 +1116,8 @@ static void sti_hqvdp_atomic_update(struct drm_plane *drm_plane,
        mode = &crtc->mode;
        dst_x = state->crtc_x;
        dst_y = state->crtc_y;
-       dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x);
-       dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y);
+       dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
+       dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
        /* src_x are in 16.16 format */
        src_x = state->src_x >> 16;
        src_y = state->src_y >> 16;
@@ -1214,15 +1215,15 @@ static void sti_hqvdp_atomic_disable(struct drm_plane *drm_plane,
 {
        struct sti_plane *plane = to_sti_plane(drm_plane);
 
-       if (!drm_plane->crtc) {
+       if (!oldstate->crtc) {
                DRM_DEBUG_DRIVER("drm plane:%d not enabled\n",
                                 drm_plane->base.id);
                return;
        }
 
        DRM_DEBUG_DRIVER("CRTC:%d (%s) drm plane:%d (%s)\n",
-                        drm_plane->crtc->base.id,
-                        sti_mixer_to_str(to_sti_mixer(drm_plane->crtc)),
+                        oldstate->crtc->base.id,
+                        sti_mixer_to_str(to_sti_mixer(oldstate->crtc)),
                         drm_plane->base.id, sti_plane_to_str(plane));
 
        plane->status = STI_PLANE_DISABLING;
@@ -1250,7 +1251,7 @@ static int sti_hqvdp_late_register(struct drm_plane *drm_plane)
        return hqvdp_debugfs_init(hqvdp, drm_plane->dev->primary);
 }
 
-struct drm_plane_funcs sti_hqvdp_plane_helpers_funcs = {
+static const struct drm_plane_funcs sti_hqvdp_plane_helpers_funcs = {
        .update_plane = drm_atomic_helper_update_plane,
        .disable_plane = drm_atomic_helper_disable_plane,
        .destroy = sti_hqvdp_destroy,
@@ -1289,7 +1290,7 @@ static struct drm_plane *sti_hqvdp_create(struct drm_device *drm_dev,
        return &hqvdp->plane.drm_plane;
 }
 
-int sti_hqvdp_bind(struct device *dev, struct device *master, void *data)
+static int sti_hqvdp_bind(struct device *dev, struct device *master, void *data)
 {
        struct sti_hqvdp *hqvdp = dev_get_drvdata(dev);
        struct drm_device *drm_dev = data;