drm/gma500/cdv: Add and hook up chip op for disabling sr
[deliverable/linux.git] / drivers / gpu / drm / gma500 / cdv_intel_display.c
index b84912ff17118a9cbfb17372f08ae5b805f48bf7..8fbfa06da62d867d8b70d944a7e195388ab36848 100644 (file)
@@ -19,7 +19,6 @@
  */
 
 #include <linux/i2c.h>
-#include <linux/pm_runtime.h>
 
 #include <drm/drmP.h>
 #include "framebuffer.h"
@@ -223,8 +222,8 @@ static int
 cdv_dpll_set_clock_cdv(struct drm_device *dev, struct drm_crtc *crtc,
                       struct gma_clock_t *clock, bool is_lvds, u32 ddi_select)
 {
-       struct psb_intel_crtc *psb_crtc = to_psb_intel_crtc(crtc);
-       int pipe = psb_crtc->pipe;
+       struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
+       int pipe = gma_crtc->pipe;
        u32 m, n_vco, p;
        int ret = 0;
        int dpll_reg = (pipe == 0) ? DPLL_A : DPLL_B;
@@ -459,12 +458,12 @@ static bool cdv_intel_pipe_enabled(struct drm_device *dev, int pipe)
 {
        struct drm_crtc *crtc;
        struct drm_psb_private *dev_priv = dev->dev_private;
-       struct psb_intel_crtc *psb_intel_crtc = NULL;
+       struct gma_crtc *gma_crtc = NULL;
 
        crtc = dev_priv->pipe_to_crtc_mapping[pipe];
-       psb_intel_crtc = to_psb_intel_crtc(crtc);
+       gma_crtc = to_gma_crtc(crtc);
 
-       if (crtc->fb == NULL || !psb_intel_crtc->active)
+       if (crtc->fb == NULL || !gma_crtc->active)
                return false;
        return true;
 }
@@ -490,29 +489,29 @@ static bool cdv_intel_single_pipe_active (struct drm_device *dev)
 
 static bool is_pipeb_lvds(struct drm_device *dev, struct drm_crtc *crtc)
 {
-       struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc);
+       struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
        struct drm_mode_config *mode_config = &dev->mode_config;
        struct drm_connector *connector;
 
-       if (psb_intel_crtc->pipe != 1)
+       if (gma_crtc->pipe != 1)
                return false;
 
        list_for_each_entry(connector, &mode_config->connector_list, head) {
-               struct psb_intel_encoder *psb_intel_encoder =
+               struct gma_encoder *gma_encoder =
                                        gma_attached_encoder(connector);
 
                if (!connector->encoder
                    || connector->encoder->crtc != crtc)
                        continue;
 
-               if (psb_intel_encoder->type == INTEL_OUTPUT_LVDS)
+               if (gma_encoder->type == INTEL_OUTPUT_LVDS)
                        return true;
        }
 
        return false;
 }
 
-void cdv_intel_disable_self_refresh(struct drm_device *dev)
+void cdv_disable_sr(struct drm_device *dev)
 {
        if (REG_READ(FW_BLC_SELF) & FW_BLC_SELF_EN) {
 
@@ -533,8 +532,9 @@ void cdv_intel_disable_self_refresh(struct drm_device *dev)
 
 }
 
-void cdv_intel_update_watermark(struct drm_device *dev, struct drm_crtc *crtc)
+void cdv_update_wm(struct drm_device *dev, struct drm_crtc *crtc)
 {
+       struct drm_psb_private *dev_priv = dev->dev_private;
 
        if (cdv_intel_single_pipe_active(dev)) {
                u32 fw;
@@ -588,8 +588,7 @@ void cdv_intel_update_watermark(struct drm_device *dev, struct drm_crtc *crtc)
 
                gma_wait_for_vblank(dev);
 
-               cdv_intel_disable_self_refresh(dev);
-       
+               dev_priv->ops->disable_sr(dev);
        }
 }
 
@@ -617,8 +616,8 @@ static int cdv_intel_crtc_mode_set(struct drm_crtc *crtc,
 {
        struct drm_device *dev = crtc->dev;
        struct drm_psb_private *dev_priv = dev->dev_private;
-       struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc);
-       int pipe = psb_intel_crtc->pipe;
+       struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
+       int pipe = gma_crtc->pipe;
        const struct psb_offset *map = &dev_priv->regmap[pipe];
        int refclk;
        struct gma_clock_t clock;
@@ -633,15 +632,15 @@ static int cdv_intel_crtc_mode_set(struct drm_crtc *crtc,
        bool is_edp = false;
 
        list_for_each_entry(connector, &mode_config->connector_list, head) {
-               struct psb_intel_encoder *psb_intel_encoder =
+               struct gma_encoder *gma_encoder =
                                        gma_attached_encoder(connector);
 
                if (!connector->encoder
                    || connector->encoder->crtc != crtc)
                        continue;
 
-               ddi_select = psb_intel_encoder->ddi_select;
-               switch (psb_intel_encoder->type) {
+               ddi_select = gma_encoder->ddi_select;
+               switch (gma_encoder->type) {
                case INTEL_OUTPUT_LVDS:
                        is_lvds = true;
                        break;
@@ -694,7 +693,7 @@ static int cdv_intel_crtc_mode_set(struct drm_crtc *crtc,
 
        drm_mode_debug_printmodeline(adjusted_mode);
        
-       limit = psb_intel_crtc->clock_funcs->limit(crtc, refclk);
+       limit = gma_crtc->clock_funcs->limit(crtc, refclk);
 
        ok = limit->find_pll(limit, crtc, adjusted_mode->clock, refclk,
                                 &clock);
@@ -867,24 +866,6 @@ static int cdv_intel_crtc_mode_set(struct drm_crtc *crtc,
        return 0;
 }
 
-static int cdv_crtc_set_config(struct drm_mode_set *set)
-{
-       int ret = 0;
-       struct drm_device *dev = set->crtc->dev;
-       struct drm_psb_private *dev_priv = dev->dev_private;
-
-       if (!dev_priv->rpm_enabled)
-               return drm_crtc_helper_set_config(set);
-
-       pm_runtime_forbid(&dev->pdev->dev);
-
-       ret = drm_crtc_helper_set_config(set);
-
-       pm_runtime_allow(&dev->pdev->dev);
-
-       return ret;
-}
-
 /** Derive the pixel clock for the given refclk and divisors for 8xx chips. */
 
 /* FIXME: why are we using this, should it be cdv_ in this tree ? */
@@ -902,8 +883,8 @@ static int cdv_intel_crtc_clock_get(struct drm_device *dev,
                                struct drm_crtc *crtc)
 {
        struct drm_psb_private *dev_priv = dev->dev_private;
-       struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc);
-       int pipe = psb_intel_crtc->pipe;
+       struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
+       int pipe = gma_crtc->pipe;
        const struct psb_offset *map = &dev_priv->regmap[pipe];
        u32 dpll;
        u32 fp;
@@ -980,8 +961,8 @@ static int cdv_intel_crtc_clock_get(struct drm_device *dev,
 struct drm_display_mode *cdv_intel_crtc_mode_get(struct drm_device *dev,
                                             struct drm_crtc *crtc)
 {
-       struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc);
-       int pipe = psb_intel_crtc->pipe;
+       struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
+       int pipe = gma_crtc->pipe;
        struct drm_psb_private *dev_priv = dev->dev_private;
        struct psb_pipe *p = &dev_priv->regs.pipe[pipe];
        const struct psb_offset *map = &dev_priv->regmap[pipe];
@@ -1040,7 +1021,7 @@ const struct drm_crtc_funcs cdv_intel_crtc_funcs = {
        .cursor_set = gma_crtc_cursor_set,
        .cursor_move = gma_crtc_cursor_move,
        .gamma_set = gma_crtc_gamma_set,
-       .set_config = cdv_crtc_set_config,
+       .set_config = gma_crtc_set_config,
        .destroy = gma_crtc_destroy,
 };
 
This page took 0.048741 seconds and 5 git commands to generate.