drm/gma500: Convert to generic gamma funcs
authorPatrik Jakobsson <patrik.r.jakobsson@gmail.com>
Wed, 10 Jul 2013 16:39:58 +0000 (18:39 +0200)
committerPatrik Jakobsson <patrik.r.jakobsson@gmail.com>
Tue, 23 Jul 2013 23:47:24 +0000 (01:47 +0200)
This takes care of the remaining chips using the old generic code.
We don't check if the pipe number is valid but the old code peeked in
the register map before checking anyways so just ignore it.

Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
drivers/gpu/drm/gma500/mdfld_intel_display.c
drivers/gpu/drm/gma500/oaktrail_crtc.c
drivers/gpu/drm/gma500/oaktrail_hdmi.c
drivers/gpu/drm/gma500/psb_drv.c
drivers/gpu/drm/gma500/psb_intel_display.c
drivers/gpu/drm/gma500/psb_intel_drv.h

index da83fddbc9a8c69b3383e531a8fceaf55f80d0fe..2862cdb8920a87431da784372f31354b8d74fbf0 100644 (file)
@@ -436,7 +436,7 @@ static void mdfld_crtc_dpms(struct drm_crtc *crtc, int mode)
                        }
                }
 
-               psb_intel_crtc_load_lut(crtc);
+               gma_crtc_load_lut(crtc);
 
                /* Give the overlay scaler a chance to enable
                   if it's on this pipe */
index 8af461f3a72d6e514b59d66a30ac3436e314a323..5cd007e82e59abf1763261f50b260f6cdeb68667 100644 (file)
@@ -212,7 +212,7 @@ static void oaktrail_crtc_dpms(struct drm_crtc *crtc, int mode)
                        REG_WRITE(map->base, REG_READ(map->base));
                }
 
-               psb_intel_crtc_load_lut(crtc);
+               gma_crtc_load_lut(crtc);
 
                /* Give the overlay scaler a chance to enable
                   if it's on this pipe */
index d9013f70b0193493c2aadc613d330dd987fff4c3..7d9a5ee52814e63e5153a8ced617fd6395c9f80b 100644 (file)
@@ -464,7 +464,7 @@ void oaktrail_crtc_hdmi_dpms(struct drm_crtc *crtc, int mode)
                        REG_READ(DSPBSURF);
                }
 
-               psb_intel_crtc_load_lut(crtc);
+               gma_crtc_load_lut(crtc);
        }
 
        /* DSPARB */
index bddea5807442d6faf2b94565a6c42baf3b230d92..b4d13261f762edd4c671b790f1f9cc11a3c2b0b3 100644 (file)
@@ -459,7 +459,7 @@ static int psb_gamma_ioctl(struct drm_device *dev, void *data,
        for (i = 0; i < 256; i++)
                psb_intel_crtc->lut_adj[i] = lut_arg->lut[i];
 
-       psb_intel_crtc_load_lut(crtc);
+       gma_crtc_load_lut(crtc);
 
        return 0;
 }
index ca041c6aba4a256e854170112d0f800b54262809..940c6f2fb8ee2696ecb5544ee4e16f3270375c57 100644 (file)
@@ -135,7 +135,7 @@ static void psb_intel_crtc_dpms(struct drm_crtc *crtc, int mode)
                        REG_WRITE(map->base, REG_READ(map->base));
                }
 
-               psb_intel_crtc_load_lut(crtc);
+               gma_crtc_load_lut(crtc);
 
                /* Give the overlay scaler a chance to enable
                 * if it's on this pipe */
@@ -431,54 +431,6 @@ static int psb_intel_crtc_mode_set(struct drm_crtc *crtc,
        return 0;
 }
 
-/** Loads the palette/gamma unit for the CRTC with the prepared values */
-void psb_intel_crtc_load_lut(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);
-       const struct psb_offset *map = &dev_priv->regmap[psb_intel_crtc->pipe];
-       int palreg = map->palette;
-       int i;
-
-       /* The clocks have to be on to load the palette. */
-       if (!crtc->enabled)
-               return;
-
-       switch (psb_intel_crtc->pipe) {
-       case 0:
-       case 1:
-               break;
-       default:
-               dev_err(dev->dev, "Illegal Pipe Number.\n");
-               return;
-       }
-
-       if (gma_power_begin(dev, false)) {
-               for (i = 0; i < 256; i++) {
-                       REG_WRITE(palreg + 4 * i,
-                                 ((psb_intel_crtc->lut_r[i] +
-                                 psb_intel_crtc->lut_adj[i]) << 16) |
-                                 ((psb_intel_crtc->lut_g[i] +
-                                 psb_intel_crtc->lut_adj[i]) << 8) |
-                                 (psb_intel_crtc->lut_b[i] +
-                                 psb_intel_crtc->lut_adj[i]));
-               }
-               gma_power_end(dev);
-       } else {
-               for (i = 0; i < 256; i++) {
-                       dev_priv->regs.pipe[0].palette[i] =
-                                 ((psb_intel_crtc->lut_r[i] +
-                                 psb_intel_crtc->lut_adj[i]) << 16) |
-                                 ((psb_intel_crtc->lut_g[i] +
-                                 psb_intel_crtc->lut_adj[i]) << 8) |
-                                 (psb_intel_crtc->lut_b[i] +
-                                 psb_intel_crtc->lut_adj[i]);
-               }
-
-       }
-}
-
 /**
  * Save HW states of giving crtc
  */
@@ -737,24 +689,6 @@ static int psb_intel_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
        return 0;
 }
 
-static void psb_intel_crtc_gamma_set(struct drm_crtc *crtc, u16 *red,
-                        u16 *green, u16 *blue, uint32_t type, uint32_t size)
-{
-       struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc);
-       int i;
-
-       if (size != 256)
-               return;
-
-       for (i = 0; i < 256; i++) {
-               psb_intel_crtc->lut_r[i] = red[i] >> 8;
-               psb_intel_crtc->lut_g[i] = green[i] >> 8;
-               psb_intel_crtc->lut_b[i] = blue[i] >> 8;
-       }
-
-       psb_intel_crtc_load_lut(crtc);
-}
-
 static int psb_crtc_set_config(struct drm_mode_set *set)
 {
        int ret;
@@ -930,7 +864,7 @@ const struct drm_crtc_funcs psb_intel_crtc_funcs = {
        .restore = psb_intel_crtc_restore,
        .cursor_set = psb_intel_crtc_cursor_set,
        .cursor_move = psb_intel_crtc_cursor_move,
-       .gamma_set = psb_intel_crtc_gamma_set,
+       .gamma_set = gma_crtc_gamma_set,
        .set_config = psb_crtc_set_config,
        .destroy = psb_intel_crtc_destroy,
 };
index 596850210a513272449f747aa91483f770fdc262..c8cd9bee7a8909b317cba6748dadfcd17602aa44 100644 (file)
@@ -226,7 +226,6 @@ extern void oaktrail_dsi_init(struct drm_device *dev,
 extern void mid_dsi_init(struct drm_device *dev,
                    struct psb_intel_mode_device *mode_dev, int dsi_num);
 
-extern void psb_intel_crtc_load_lut(struct drm_crtc *crtc);
 extern void psb_intel_encoder_prepare(struct drm_encoder *encoder);
 extern void psb_intel_encoder_commit(struct drm_encoder *encoder);
 extern void psb_intel_encoder_destroy(struct drm_encoder *encoder);