aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrik Jakobsson <patrik.r.jakobsson@gmail.com>2013-07-21 19:31:23 -0400
committerPatrik Jakobsson <patrik.r.jakobsson@gmail.com>2013-07-23 19:47:33 -0400
commit6306865daf0283d1b13adea8be8d1ad4dd0ea1c3 (patch)
tree891ac48786f85357a052ede877b92b8156e6ee97
parentc5c81f4e1bc9c8ee1c3637de51ee180efbbf629c (diff)
drm/gma500: Rename psb_intel_crtc to gma_crtc
The psb_intel_crtc is generic and should be named appropriately Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
-rw-r--r--drivers/gpu/drm/gma500/cdv_intel_crt.c7
-rw-r--r--drivers/gpu/drm/gma500/cdv_intel_display.c28
-rw-r--r--drivers/gpu/drm/gma500/cdv_intel_dp.c10
-rw-r--r--drivers/gpu/drm/gma500/cdv_intel_hdmi.c6
-rw-r--r--drivers/gpu/drm/gma500/cdv_intel_lvds.c8
-rw-r--r--drivers/gpu/drm/gma500/framebuffer.c16
-rw-r--r--drivers/gpu/drm/gma500/gma_display.c105
-rw-r--r--drivers/gpu/drm/gma500/mdfld_dsi_output.c15
-rw-r--r--drivers/gpu/drm/gma500/mdfld_intel_display.c16
-rw-r--r--drivers/gpu/drm/gma500/oaktrail_crtc.c16
-rw-r--r--drivers/gpu/drm/gma500/psb_drv.c6
-rw-r--r--drivers/gpu/drm/gma500/psb_intel_display.c98
-rw-r--r--drivers/gpu/drm/gma500/psb_intel_drv.h6
-rw-r--r--drivers/gpu/drm/gma500/psb_intel_lvds.c10
-rw-r--r--drivers/gpu/drm/gma500/psb_intel_sdvo.c4
15 files changed, 170 insertions, 181 deletions
diff --git a/drivers/gpu/drm/gma500/cdv_intel_crt.c b/drivers/gpu/drm/gma500/cdv_intel_crt.c
index 0cfcb26fb2a1..79ad19696f71 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_crt.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_crt.c
@@ -95,13 +95,12 @@ static void cdv_intel_crt_mode_set(struct drm_encoder *encoder,
95 95
96 struct drm_device *dev = encoder->dev; 96 struct drm_device *dev = encoder->dev;
97 struct drm_crtc *crtc = encoder->crtc; 97 struct drm_crtc *crtc = encoder->crtc;
98 struct psb_intel_crtc *psb_intel_crtc = 98 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
99 to_psb_intel_crtc(crtc);
100 int dpll_md_reg; 99 int dpll_md_reg;
101 u32 adpa, dpll_md; 100 u32 adpa, dpll_md;
102 u32 adpa_reg; 101 u32 adpa_reg;
103 102
104 if (psb_intel_crtc->pipe == 0) 103 if (gma_crtc->pipe == 0)
105 dpll_md_reg = DPLL_A_MD; 104 dpll_md_reg = DPLL_A_MD;
106 else 105 else
107 dpll_md_reg = DPLL_B_MD; 106 dpll_md_reg = DPLL_B_MD;
@@ -124,7 +123,7 @@ static void cdv_intel_crt_mode_set(struct drm_encoder *encoder,
124 if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) 123 if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
125 adpa |= ADPA_VSYNC_ACTIVE_HIGH; 124 adpa |= ADPA_VSYNC_ACTIVE_HIGH;
126 125
127 if (psb_intel_crtc->pipe == 0) 126 if (gma_crtc->pipe == 0)
128 adpa |= ADPA_PIPE_A_SELECT; 127 adpa |= ADPA_PIPE_A_SELECT;
129 else 128 else
130 adpa |= ADPA_PIPE_B_SELECT; 129 adpa |= ADPA_PIPE_B_SELECT;
diff --git a/drivers/gpu/drm/gma500/cdv_intel_display.c b/drivers/gpu/drm/gma500/cdv_intel_display.c
index 6bca1fe470ab..e18c3b9fd07f 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_display.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_display.c
@@ -222,8 +222,8 @@ static int
222cdv_dpll_set_clock_cdv(struct drm_device *dev, struct drm_crtc *crtc, 222cdv_dpll_set_clock_cdv(struct drm_device *dev, struct drm_crtc *crtc,
223 struct gma_clock_t *clock, bool is_lvds, u32 ddi_select) 223 struct gma_clock_t *clock, bool is_lvds, u32 ddi_select)
224{ 224{
225 struct psb_intel_crtc *psb_crtc = to_psb_intel_crtc(crtc); 225 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
226 int pipe = psb_crtc->pipe; 226 int pipe = gma_crtc->pipe;
227 u32 m, n_vco, p; 227 u32 m, n_vco, p;
228 int ret = 0; 228 int ret = 0;
229 int dpll_reg = (pipe == 0) ? DPLL_A : DPLL_B; 229 int dpll_reg = (pipe == 0) ? DPLL_A : DPLL_B;
@@ -458,12 +458,12 @@ static bool cdv_intel_pipe_enabled(struct drm_device *dev, int pipe)
458{ 458{
459 struct drm_crtc *crtc; 459 struct drm_crtc *crtc;
460 struct drm_psb_private *dev_priv = dev->dev_private; 460 struct drm_psb_private *dev_priv = dev->dev_private;
461 struct psb_intel_crtc *psb_intel_crtc = NULL; 461 struct gma_crtc *gma_crtc = NULL;
462 462
463 crtc = dev_priv->pipe_to_crtc_mapping[pipe]; 463 crtc = dev_priv->pipe_to_crtc_mapping[pipe];
464 psb_intel_crtc = to_psb_intel_crtc(crtc); 464 gma_crtc = to_gma_crtc(crtc);
465 465
466 if (crtc->fb == NULL || !psb_intel_crtc->active) 466 if (crtc->fb == NULL || !gma_crtc->active)
467 return false; 467 return false;
468 return true; 468 return true;
469} 469}
@@ -489,11 +489,11 @@ static bool cdv_intel_single_pipe_active (struct drm_device *dev)
489 489
490static bool is_pipeb_lvds(struct drm_device *dev, struct drm_crtc *crtc) 490static bool is_pipeb_lvds(struct drm_device *dev, struct drm_crtc *crtc)
491{ 491{
492 struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); 492 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
493 struct drm_mode_config *mode_config = &dev->mode_config; 493 struct drm_mode_config *mode_config = &dev->mode_config;
494 struct drm_connector *connector; 494 struct drm_connector *connector;
495 495
496 if (psb_intel_crtc->pipe != 1) 496 if (gma_crtc->pipe != 1)
497 return false; 497 return false;
498 498
499 list_for_each_entry(connector, &mode_config->connector_list, head) { 499 list_for_each_entry(connector, &mode_config->connector_list, head) {
@@ -616,8 +616,8 @@ static int cdv_intel_crtc_mode_set(struct drm_crtc *crtc,
616{ 616{
617 struct drm_device *dev = crtc->dev; 617 struct drm_device *dev = crtc->dev;
618 struct drm_psb_private *dev_priv = dev->dev_private; 618 struct drm_psb_private *dev_priv = dev->dev_private;
619 struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); 619 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
620 int pipe = psb_intel_crtc->pipe; 620 int pipe = gma_crtc->pipe;
621 const struct psb_offset *map = &dev_priv->regmap[pipe]; 621 const struct psb_offset *map = &dev_priv->regmap[pipe];
622 int refclk; 622 int refclk;
623 struct gma_clock_t clock; 623 struct gma_clock_t clock;
@@ -693,7 +693,7 @@ static int cdv_intel_crtc_mode_set(struct drm_crtc *crtc,
693 693
694 drm_mode_debug_printmodeline(adjusted_mode); 694 drm_mode_debug_printmodeline(adjusted_mode);
695 695
696 limit = psb_intel_crtc->clock_funcs->limit(crtc, refclk); 696 limit = gma_crtc->clock_funcs->limit(crtc, refclk);
697 697
698 ok = limit->find_pll(limit, crtc, adjusted_mode->clock, refclk, 698 ok = limit->find_pll(limit, crtc, adjusted_mode->clock, refclk,
699 &clock); 699 &clock);
@@ -883,8 +883,8 @@ static int cdv_intel_crtc_clock_get(struct drm_device *dev,
883 struct drm_crtc *crtc) 883 struct drm_crtc *crtc)
884{ 884{
885 struct drm_psb_private *dev_priv = dev->dev_private; 885 struct drm_psb_private *dev_priv = dev->dev_private;
886 struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); 886 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
887 int pipe = psb_intel_crtc->pipe; 887 int pipe = gma_crtc->pipe;
888 const struct psb_offset *map = &dev_priv->regmap[pipe]; 888 const struct psb_offset *map = &dev_priv->regmap[pipe];
889 u32 dpll; 889 u32 dpll;
890 u32 fp; 890 u32 fp;
@@ -961,8 +961,8 @@ static int cdv_intel_crtc_clock_get(struct drm_device *dev,
961struct drm_display_mode *cdv_intel_crtc_mode_get(struct drm_device *dev, 961struct drm_display_mode *cdv_intel_crtc_mode_get(struct drm_device *dev,
962 struct drm_crtc *crtc) 962 struct drm_crtc *crtc)
963{ 963{
964 struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); 964 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
965 int pipe = psb_intel_crtc->pipe; 965 int pipe = gma_crtc->pipe;
966 struct drm_psb_private *dev_priv = dev->dev_private; 966 struct drm_psb_private *dev_priv = dev->dev_private;
967 struct psb_pipe *p = &dev_priv->regs.pipe[pipe]; 967 struct psb_pipe *p = &dev_priv->regs.pipe[pipe];
968 const struct psb_offset *map = &dev_priv->regmap[pipe]; 968 const struct psb_offset *map = &dev_priv->regmap[pipe];
diff --git a/drivers/gpu/drm/gma500/cdv_intel_dp.c b/drivers/gpu/drm/gma500/cdv_intel_dp.c
index e3907becf8c9..a90adf629925 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_dp.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_dp.c
@@ -793,10 +793,10 @@ cdv_intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,
793 struct drm_psb_private *dev_priv = dev->dev_private; 793 struct drm_psb_private *dev_priv = dev->dev_private;
794 struct drm_mode_config *mode_config = &dev->mode_config; 794 struct drm_mode_config *mode_config = &dev->mode_config;
795 struct drm_encoder *encoder; 795 struct drm_encoder *encoder;
796 struct psb_intel_crtc *intel_crtc = to_psb_intel_crtc(crtc); 796 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
797 int lane_count = 4, bpp = 24; 797 int lane_count = 4, bpp = 24;
798 struct cdv_intel_dp_m_n m_n; 798 struct cdv_intel_dp_m_n m_n;
799 int pipe = intel_crtc->pipe; 799 int pipe = gma_crtc->pipe;
800 800
801 /* 801 /*
802 * Find the lane count in the intel_encoder private 802 * Find the lane count in the intel_encoder private
@@ -844,7 +844,7 @@ cdv_intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode
844{ 844{
845 struct psb_intel_encoder *intel_encoder = to_psb_intel_encoder(encoder); 845 struct psb_intel_encoder *intel_encoder = to_psb_intel_encoder(encoder);
846 struct drm_crtc *crtc = encoder->crtc; 846 struct drm_crtc *crtc = encoder->crtc;
847 struct psb_intel_crtc *intel_crtc = to_psb_intel_crtc(crtc); 847 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
848 struct cdv_intel_dp *intel_dp = intel_encoder->dev_priv; 848 struct cdv_intel_dp *intel_dp = intel_encoder->dev_priv;
849 struct drm_device *dev = encoder->dev; 849 struct drm_device *dev = encoder->dev;
850 850
@@ -886,7 +886,7 @@ cdv_intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode
886 } 886 }
887 887
888 /* CPT DP's pipe select is decided in TRANS_DP_CTL */ 888 /* CPT DP's pipe select is decided in TRANS_DP_CTL */
889 if (intel_crtc->pipe == 1) 889 if (gma_crtc->pipe == 1)
890 intel_dp->DP |= DP_PIPEB_SELECT; 890 intel_dp->DP |= DP_PIPEB_SELECT;
891 891
892 REG_WRITE(intel_dp->output_reg, (intel_dp->DP | DP_PORT_EN)); 892 REG_WRITE(intel_dp->output_reg, (intel_dp->DP | DP_PORT_EN));
@@ -901,7 +901,7 @@ cdv_intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode
901 else 901 else
902 pfit_control = 0; 902 pfit_control = 0;
903 903
904 pfit_control |= intel_crtc->pipe << PFIT_PIPE_SHIFT; 904 pfit_control |= gma_crtc->pipe << PFIT_PIPE_SHIFT;
905 905
906 REG_WRITE(PFIT_CONTROL, pfit_control); 906 REG_WRITE(PFIT_CONTROL, pfit_control);
907 } 907 }
diff --git a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
index a849e912f30a..5c3b3eabb5e9 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
@@ -68,7 +68,7 @@ static void cdv_hdmi_mode_set(struct drm_encoder *encoder,
68 struct mid_intel_hdmi_priv *hdmi_priv = psb_intel_encoder->dev_priv; 68 struct mid_intel_hdmi_priv *hdmi_priv = psb_intel_encoder->dev_priv;
69 u32 hdmib; 69 u32 hdmib;
70 struct drm_crtc *crtc = encoder->crtc; 70 struct drm_crtc *crtc = encoder->crtc;
71 struct psb_intel_crtc *intel_crtc = to_psb_intel_crtc(crtc); 71 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
72 72
73 hdmib = (2 << 10); 73 hdmib = (2 << 10);
74 74
@@ -77,7 +77,7 @@ static void cdv_hdmi_mode_set(struct drm_encoder *encoder,
77 if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) 77 if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
78 hdmib |= HDMI_HSYNC_ACTIVE_HIGH; 78 hdmib |= HDMI_HSYNC_ACTIVE_HIGH;
79 79
80 if (intel_crtc->pipe == 1) 80 if (gma_crtc->pipe == 1)
81 hdmib |= HDMIB_PIPE_B_SELECT; 81 hdmib |= HDMIB_PIPE_B_SELECT;
82 82
83 if (hdmi_priv->has_hdmi_audio) { 83 if (hdmi_priv->has_hdmi_audio) {
@@ -167,7 +167,7 @@ static int cdv_hdmi_set_property(struct drm_connector *connector,
167 struct drm_encoder *encoder = connector->encoder; 167 struct drm_encoder *encoder = connector->encoder;
168 168
169 if (!strcmp(property->name, "scaling mode") && encoder) { 169 if (!strcmp(property->name, "scaling mode") && encoder) {
170 struct psb_intel_crtc *crtc = to_psb_intel_crtc(encoder->crtc); 170 struct gma_crtc *crtc = to_gma_crtc(encoder->crtc);
171 bool centre; 171 bool centre;
172 uint64_t curValue; 172 uint64_t curValue;
173 173
diff --git a/drivers/gpu/drm/gma500/cdv_intel_lvds.c b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
index e461dce1d088..53f1d8f5e9cd 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_lvds.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
@@ -356,8 +356,7 @@ static void cdv_intel_lvds_mode_set(struct drm_encoder *encoder,
356{ 356{
357 struct drm_device *dev = encoder->dev; 357 struct drm_device *dev = encoder->dev;
358 struct drm_psb_private *dev_priv = dev->dev_private; 358 struct drm_psb_private *dev_priv = dev->dev_private;
359 struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc( 359 struct gma_crtc *gma_crtc = to_gma_crtc(encoder->crtc);
360 encoder->crtc);
361 u32 pfit_control; 360 u32 pfit_control;
362 361
363 /* 362 /*
@@ -379,7 +378,7 @@ static void cdv_intel_lvds_mode_set(struct drm_encoder *encoder,
379 else 378 else
380 pfit_control = 0; 379 pfit_control = 0;
381 380
382 pfit_control |= psb_intel_crtc->pipe << PFIT_PIPE_SHIFT; 381 pfit_control |= gma_crtc->pipe << PFIT_PIPE_SHIFT;
383 382
384 if (dev_priv->lvds_dither) 383 if (dev_priv->lvds_dither)
385 pfit_control |= PANEL_8TO6_DITHER_ENABLE; 384 pfit_control |= PANEL_8TO6_DITHER_ENABLE;
@@ -461,8 +460,7 @@ static int cdv_intel_lvds_set_property(struct drm_connector *connector,
461 struct drm_encoder *encoder = connector->encoder; 460 struct drm_encoder *encoder = connector->encoder;
462 461
463 if (!strcmp(property->name, "scaling mode") && encoder) { 462 if (!strcmp(property->name, "scaling mode") && encoder) {
464 struct psb_intel_crtc *crtc = 463 struct gma_crtc *crtc = to_gma_crtc(encoder->crtc);
465 to_psb_intel_crtc(encoder->crtc);
466 uint64_t curValue; 464 uint64_t curValue;
467 465
468 if (!crtc) 466 if (!crtc)
diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c
index e0e7eb0680e6..6ebabb5ca3c2 100644
--- a/drivers/gpu/drm/gma500/framebuffer.c
+++ b/drivers/gpu/drm/gma500/framebuffer.c
@@ -520,21 +520,21 @@ static struct drm_framebuffer *psb_user_framebuffer_create
520static void psbfb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, 520static void psbfb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
521 u16 blue, int regno) 521 u16 blue, int regno)
522{ 522{
523 struct psb_intel_crtc *intel_crtc = to_psb_intel_crtc(crtc); 523 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
524 524
525 intel_crtc->lut_r[regno] = red >> 8; 525 gma_crtc->lut_r[regno] = red >> 8;
526 intel_crtc->lut_g[regno] = green >> 8; 526 gma_crtc->lut_g[regno] = green >> 8;
527 intel_crtc->lut_b[regno] = blue >> 8; 527 gma_crtc->lut_b[regno] = blue >> 8;
528} 528}
529 529
530static void psbfb_gamma_get(struct drm_crtc *crtc, u16 *red, 530static void psbfb_gamma_get(struct drm_crtc *crtc, u16 *red,
531 u16 *green, u16 *blue, int regno) 531 u16 *green, u16 *blue, int regno)
532{ 532{
533 struct psb_intel_crtc *intel_crtc = to_psb_intel_crtc(crtc); 533 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
534 534
535 *red = intel_crtc->lut_r[regno] << 8; 535 *red = gma_crtc->lut_r[regno] << 8;
536 *green = intel_crtc->lut_g[regno] << 8; 536 *green = gma_crtc->lut_g[regno] << 8;
537 *blue = intel_crtc->lut_b[regno] << 8; 537 *blue = gma_crtc->lut_b[regno] << 8;
538} 538}
539 539
540static int psbfb_probe(struct drm_fb_helper *helper, 540static int psbfb_probe(struct drm_fb_helper *helper,
diff --git a/drivers/gpu/drm/gma500/gma_display.c b/drivers/gpu/drm/gma500/gma_display.c
index 2a3e9254e651..b87180344ad6 100644
--- a/drivers/gpu/drm/gma500/gma_display.c
+++ b/drivers/gpu/drm/gma500/gma_display.c
@@ -58,9 +58,9 @@ int gma_pipe_set_base(struct drm_crtc *crtc, int x, int y,
58{ 58{
59 struct drm_device *dev = crtc->dev; 59 struct drm_device *dev = crtc->dev;
60 struct drm_psb_private *dev_priv = dev->dev_private; 60 struct drm_psb_private *dev_priv = dev->dev_private;
61 struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); 61 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
62 struct psb_framebuffer *psbfb = to_psb_fb(crtc->fb); 62 struct psb_framebuffer *psbfb = to_psb_fb(crtc->fb);
63 int pipe = psb_intel_crtc->pipe; 63 int pipe = gma_crtc->pipe;
64 const struct psb_offset *map = &dev_priv->regmap[pipe]; 64 const struct psb_offset *map = &dev_priv->regmap[pipe];
65 unsigned long start, offset; 65 unsigned long start, offset;
66 u32 dspcntr; 66 u32 dspcntr;
@@ -140,8 +140,8 @@ void gma_crtc_load_lut(struct drm_crtc *crtc)
140{ 140{
141 struct drm_device *dev = crtc->dev; 141 struct drm_device *dev = crtc->dev;
142 struct drm_psb_private *dev_priv = dev->dev_private; 142 struct drm_psb_private *dev_priv = dev->dev_private;
143 struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); 143 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
144 const struct psb_offset *map = &dev_priv->regmap[psb_intel_crtc->pipe]; 144 const struct psb_offset *map = &dev_priv->regmap[gma_crtc->pipe];
145 int palreg = map->palette; 145 int palreg = map->palette;
146 int i; 146 int i;
147 147
@@ -152,24 +152,24 @@ void gma_crtc_load_lut(struct drm_crtc *crtc)
152 if (gma_power_begin(dev, false)) { 152 if (gma_power_begin(dev, false)) {
153 for (i = 0; i < 256; i++) { 153 for (i = 0; i < 256; i++) {
154 REG_WRITE(palreg + 4 * i, 154 REG_WRITE(palreg + 4 * i,
155 ((psb_intel_crtc->lut_r[i] + 155 ((gma_crtc->lut_r[i] +
156 psb_intel_crtc->lut_adj[i]) << 16) | 156 gma_crtc->lut_adj[i]) << 16) |
157 ((psb_intel_crtc->lut_g[i] + 157 ((gma_crtc->lut_g[i] +
158 psb_intel_crtc->lut_adj[i]) << 8) | 158 gma_crtc->lut_adj[i]) << 8) |
159 (psb_intel_crtc->lut_b[i] + 159 (gma_crtc->lut_b[i] +
160 psb_intel_crtc->lut_adj[i])); 160 gma_crtc->lut_adj[i]));
161 } 161 }
162 gma_power_end(dev); 162 gma_power_end(dev);
163 } else { 163 } else {
164 for (i = 0; i < 256; i++) { 164 for (i = 0; i < 256; i++) {
165 /* FIXME: Why pipe[0] and not pipe[..._crtc->pipe]? */ 165 /* FIXME: Why pipe[0] and not pipe[..._crtc->pipe]? */
166 dev_priv->regs.pipe[0].palette[i] = 166 dev_priv->regs.pipe[0].palette[i] =
167 ((psb_intel_crtc->lut_r[i] + 167 ((gma_crtc->lut_r[i] +
168 psb_intel_crtc->lut_adj[i]) << 16) | 168 gma_crtc->lut_adj[i]) << 16) |
169 ((psb_intel_crtc->lut_g[i] + 169 ((gma_crtc->lut_g[i] +
170 psb_intel_crtc->lut_adj[i]) << 8) | 170 gma_crtc->lut_adj[i]) << 8) |
171 (psb_intel_crtc->lut_b[i] + 171 (gma_crtc->lut_b[i] +
172 psb_intel_crtc->lut_adj[i]); 172 gma_crtc->lut_adj[i]);
173 } 173 }
174 174
175 } 175 }
@@ -178,14 +178,14 @@ void gma_crtc_load_lut(struct drm_crtc *crtc)
178void gma_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, u16 *blue, 178void gma_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, u16 *blue,
179 u32 start, u32 size) 179 u32 start, u32 size)
180{ 180{
181 struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); 181 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
182 int i; 182 int i;
183 int end = (start + size > 256) ? 256 : start + size; 183 int end = (start + size > 256) ? 256 : start + size;
184 184
185 for (i = start; i < end; i++) { 185 for (i = start; i < end; i++) {
186 psb_intel_crtc->lut_r[i] = red[i] >> 8; 186 gma_crtc->lut_r[i] = red[i] >> 8;
187 psb_intel_crtc->lut_g[i] = green[i] >> 8; 187 gma_crtc->lut_g[i] = green[i] >> 8;
188 psb_intel_crtc->lut_b[i] = blue[i] >> 8; 188 gma_crtc->lut_b[i] = blue[i] >> 8;
189 } 189 }
190 190
191 gma_crtc_load_lut(crtc); 191 gma_crtc_load_lut(crtc);
@@ -201,8 +201,8 @@ void gma_crtc_dpms(struct drm_crtc *crtc, int mode)
201{ 201{
202 struct drm_device *dev = crtc->dev; 202 struct drm_device *dev = crtc->dev;
203 struct drm_psb_private *dev_priv = dev->dev_private; 203 struct drm_psb_private *dev_priv = dev->dev_private;
204 struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); 204 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
205 int pipe = psb_intel_crtc->pipe; 205 int pipe = gma_crtc->pipe;
206 const struct psb_offset *map = &dev_priv->regmap[pipe]; 206 const struct psb_offset *map = &dev_priv->regmap[pipe];
207 u32 temp; 207 u32 temp;
208 208
@@ -217,10 +217,10 @@ void gma_crtc_dpms(struct drm_crtc *crtc, int mode)
217 case DRM_MODE_DPMS_ON: 217 case DRM_MODE_DPMS_ON:
218 case DRM_MODE_DPMS_STANDBY: 218 case DRM_MODE_DPMS_STANDBY:
219 case DRM_MODE_DPMS_SUSPEND: 219 case DRM_MODE_DPMS_SUSPEND:
220 if (psb_intel_crtc->active) 220 if (gma_crtc->active)
221 break; 221 break;
222 222
223 psb_intel_crtc->active = true; 223 gma_crtc->active = true;
224 224
225 /* Enable the DPLL */ 225 /* Enable the DPLL */
226 temp = REG_READ(map->dpll); 226 temp = REG_READ(map->dpll);
@@ -268,10 +268,10 @@ void gma_crtc_dpms(struct drm_crtc *crtc, int mode)
268 /* psb_intel_crtc_dpms_video(crtc, true); TODO */ 268 /* psb_intel_crtc_dpms_video(crtc, true); TODO */
269 break; 269 break;
270 case DRM_MODE_DPMS_OFF: 270 case DRM_MODE_DPMS_OFF:
271 if (!psb_intel_crtc->active) 271 if (!gma_crtc->active)
272 break; 272 break;
273 273
274 psb_intel_crtc->active = false; 274 gma_crtc->active = false;
275 275
276 /* Give the overlay scaler a chance to disable 276 /* Give the overlay scaler a chance to disable
277 * if it's on this pipe */ 277 * if it's on this pipe */
@@ -334,14 +334,14 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc,
334{ 334{
335 struct drm_device *dev = crtc->dev; 335 struct drm_device *dev = crtc->dev;
336 struct drm_psb_private *dev_priv = dev->dev_private; 336 struct drm_psb_private *dev_priv = dev->dev_private;
337 struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); 337 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
338 int pipe = psb_intel_crtc->pipe; 338 int pipe = gma_crtc->pipe;
339 uint32_t control = (pipe == 0) ? CURACNTR : CURBCNTR; 339 uint32_t control = (pipe == 0) ? CURACNTR : CURBCNTR;
340 uint32_t base = (pipe == 0) ? CURABASE : CURBBASE; 340 uint32_t base = (pipe == 0) ? CURABASE : CURBBASE;
341 uint32_t temp; 341 uint32_t temp;
342 size_t addr = 0; 342 size_t addr = 0;
343 struct gtt_range *gt; 343 struct gtt_range *gt;
344 struct gtt_range *cursor_gt = psb_intel_crtc->cursor_gt; 344 struct gtt_range *cursor_gt = gma_crtc->cursor_gt;
345 struct drm_gem_object *obj; 345 struct drm_gem_object *obj;
346 void *tmp_dst, *tmp_src; 346 void *tmp_dst, *tmp_src;
347 int ret = 0, i, cursor_pages; 347 int ret = 0, i, cursor_pages;
@@ -357,12 +357,12 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc,
357 } 357 }
358 358
359 /* Unpin the old GEM object */ 359 /* Unpin the old GEM object */
360 if (psb_intel_crtc->cursor_obj) { 360 if (gma_crtc->cursor_obj) {
361 gt = container_of(psb_intel_crtc->cursor_obj, 361 gt = container_of(gma_crtc->cursor_obj,
362 struct gtt_range, gem); 362 struct gtt_range, gem);
363 psb_gtt_unpin(gt); 363 psb_gtt_unpin(gt);
364 drm_gem_object_unreference(psb_intel_crtc->cursor_obj); 364 drm_gem_object_unreference(gma_crtc->cursor_obj);
365 psb_intel_crtc->cursor_obj = NULL; 365 gma_crtc->cursor_obj = NULL;
366 } 366 }
367 367
368 return 0; 368 return 0;
@@ -415,10 +415,10 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc,
415 tmp_dst += PAGE_SIZE; 415 tmp_dst += PAGE_SIZE;
416 } 416 }
417 417
418 addr = psb_intel_crtc->cursor_addr; 418 addr = gma_crtc->cursor_addr;
419 } else { 419 } else {
420 addr = gt->offset; 420 addr = gt->offset;
421 psb_intel_crtc->cursor_addr = addr; 421 gma_crtc->cursor_addr = addr;
422 } 422 }
423 423
424 temp = 0; 424 temp = 0;
@@ -433,14 +433,13 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc,
433 } 433 }
434 434
435 /* unpin the old bo */ 435 /* unpin the old bo */
436 if (psb_intel_crtc->cursor_obj) { 436 if (gma_crtc->cursor_obj) {
437 gt = container_of(psb_intel_crtc->cursor_obj, 437 gt = container_of(gma_crtc->cursor_obj, struct gtt_range, gem);
438 struct gtt_range, gem);
439 psb_gtt_unpin(gt); 438 psb_gtt_unpin(gt);
440 drm_gem_object_unreference(psb_intel_crtc->cursor_obj); 439 drm_gem_object_unreference(gma_crtc->cursor_obj);
441 } 440 }
442 441
443 psb_intel_crtc->cursor_obj = obj; 442 gma_crtc->cursor_obj = obj;
444 return ret; 443 return ret;
445 444
446unref_cursor: 445unref_cursor:
@@ -451,8 +450,8 @@ unref_cursor:
451int gma_crtc_cursor_move(struct drm_crtc *crtc, int x, int y) 450int gma_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
452{ 451{
453 struct drm_device *dev = crtc->dev; 452 struct drm_device *dev = crtc->dev;
454 struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); 453 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
455 int pipe = psb_intel_crtc->pipe; 454 int pipe = gma_crtc->pipe;
456 uint32_t temp = 0; 455 uint32_t temp = 0;
457 uint32_t addr; 456 uint32_t addr;
458 457
@@ -468,7 +467,7 @@ int gma_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
468 temp |= ((x & CURSOR_POS_MASK) << CURSOR_X_SHIFT); 467 temp |= ((x & CURSOR_POS_MASK) << CURSOR_X_SHIFT);
469 temp |= ((y & CURSOR_POS_MASK) << CURSOR_Y_SHIFT); 468 temp |= ((y & CURSOR_POS_MASK) << CURSOR_Y_SHIFT);
470 469
471 addr = psb_intel_crtc->cursor_addr; 470 addr = gma_crtc->cursor_addr;
472 471
473 if (gma_power_begin(dev, false)) { 472 if (gma_power_begin(dev, false)) {
474 REG_WRITE((pipe == 0) ? CURAPOS : CURBPOS, temp); 473 REG_WRITE((pipe == 0) ? CURAPOS : CURBPOS, temp);
@@ -512,11 +511,11 @@ void gma_crtc_disable(struct drm_crtc *crtc)
512 511
513void gma_crtc_destroy(struct drm_crtc *crtc) 512void gma_crtc_destroy(struct drm_crtc *crtc)
514{ 513{
515 struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); 514 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
516 515
517 kfree(psb_intel_crtc->crtc_state); 516 kfree(gma_crtc->crtc_state);
518 drm_crtc_cleanup(crtc); 517 drm_crtc_cleanup(crtc);
519 kfree(psb_intel_crtc); 518 kfree(gma_crtc);
520} 519}
521 520
522int gma_crtc_set_config(struct drm_mode_set *set) 521int gma_crtc_set_config(struct drm_mode_set *set)
@@ -542,9 +541,9 @@ void gma_crtc_save(struct drm_crtc *crtc)
542{ 541{
543 struct drm_device *dev = crtc->dev; 542 struct drm_device *dev = crtc->dev;
544 struct drm_psb_private *dev_priv = dev->dev_private; 543 struct drm_psb_private *dev_priv = dev->dev_private;
545 struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); 544 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
546 struct psb_intel_crtc_state *crtc_state = psb_intel_crtc->crtc_state; 545 struct psb_intel_crtc_state *crtc_state = gma_crtc->crtc_state;
547 const struct psb_offset *map = &dev_priv->regmap[psb_intel_crtc->pipe]; 546 const struct psb_offset *map = &dev_priv->regmap[gma_crtc->pipe];
548 uint32_t palette_reg; 547 uint32_t palette_reg;
549 int i; 548 int i;
550 549
@@ -585,9 +584,9 @@ void gma_crtc_restore(struct drm_crtc *crtc)
585{ 584{
586 struct drm_device *dev = crtc->dev; 585 struct drm_device *dev = crtc->dev;
587 struct drm_psb_private *dev_priv = dev->dev_private; 586 struct drm_psb_private *dev_priv = dev->dev_private;
588 struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); 587 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
589 struct psb_intel_crtc_state *crtc_state = psb_intel_crtc->crtc_state; 588 struct psb_intel_crtc_state *crtc_state = gma_crtc->crtc_state;
590 const struct psb_offset *map = &dev_priv->regmap[psb_intel_crtc->pipe]; 589 const struct psb_offset *map = &dev_priv->regmap[gma_crtc->pipe];
591 uint32_t palette_reg; 590 uint32_t palette_reg;
592 int i; 591 int i;
593 592
@@ -720,7 +719,7 @@ bool gma_find_best_pll(const struct gma_limit_t *limit,
720{ 719{
721 struct drm_device *dev = crtc->dev; 720 struct drm_device *dev = crtc->dev;
722 const struct gma_clock_funcs *clock_funcs = 721 const struct gma_clock_funcs *clock_funcs =
723 to_psb_intel_crtc(crtc)->clock_funcs; 722 to_gma_crtc(crtc)->clock_funcs;
724 struct gma_clock_t clock; 723 struct gma_clock_t clock;
725 int err = target; 724 int err = target;
726 725
diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_output.c b/drivers/gpu/drm/gma500/mdfld_dsi_output.c
index 3abf8315f57c..860a4ee9baaf 100644
--- a/drivers/gpu/drm/gma500/mdfld_dsi_output.c
+++ b/drivers/gpu/drm/gma500/mdfld_dsi_output.c
@@ -249,12 +249,11 @@ static int mdfld_dsi_connector_set_property(struct drm_connector *connector,
249 struct drm_encoder *encoder = connector->encoder; 249 struct drm_encoder *encoder = connector->encoder;
250 250
251 if (!strcmp(property->name, "scaling mode") && encoder) { 251 if (!strcmp(property->name, "scaling mode") && encoder) {
252 struct psb_intel_crtc *psb_crtc = 252 struct gma_crtc *gma_crtc = to_gma_crtc(encoder->crtc);
253 to_psb_intel_crtc(encoder->crtc);
254 bool centerechange; 253 bool centerechange;
255 uint64_t val; 254 uint64_t val;
256 255
257 if (!psb_crtc) 256 if (!gma_crtc)
258 goto set_prop_error; 257 goto set_prop_error;
259 258
260 switch (value) { 259 switch (value) {
@@ -281,11 +280,11 @@ static int mdfld_dsi_connector_set_property(struct drm_connector *connector,
281 centerechange = (val == DRM_MODE_SCALE_NO_SCALE) || 280 centerechange = (val == DRM_MODE_SCALE_NO_SCALE) ||
282 (value == DRM_MODE_SCALE_NO_SCALE); 281 (value == DRM_MODE_SCALE_NO_SCALE);
283 282
284 if (psb_crtc->saved_mode.hdisplay != 0 && 283 if (gma_crtc->saved_mode.hdisplay != 0 &&
285 psb_crtc->saved_mode.vdisplay != 0) { 284 gma_crtc->saved_mode.vdisplay != 0) {
286 if (centerechange) { 285 if (centerechange) {
287 if (!drm_crtc_helper_set_mode(encoder->crtc, 286 if (!drm_crtc_helper_set_mode(encoder->crtc,
288 &psb_crtc->saved_mode, 287 &gma_crtc->saved_mode,
289 encoder->crtc->x, 288 encoder->crtc->x,
290 encoder->crtc->y, 289 encoder->crtc->y,
291 encoder->crtc->fb)) 290 encoder->crtc->fb))
@@ -294,8 +293,8 @@ static int mdfld_dsi_connector_set_property(struct drm_connector *connector,
294 struct drm_encoder_helper_funcs *funcs = 293 struct drm_encoder_helper_funcs *funcs =
295 encoder->helper_private; 294 encoder->helper_private;
296 funcs->mode_set(encoder, 295 funcs->mode_set(encoder,
297 &psb_crtc->saved_mode, 296 &gma_crtc->saved_mode,
298 &psb_crtc->saved_adjusted_mode); 297 &gma_crtc->saved_adjusted_mode);
299 } 298 }
300 } 299 }
301 } else if (!strcmp(property->name, "backlight") && encoder) { 300 } else if (!strcmp(property->name, "backlight") && encoder) {
diff --git a/drivers/gpu/drm/gma500/mdfld_intel_display.c b/drivers/gpu/drm/gma500/mdfld_intel_display.c
index e5d3a02ac650..adb29e370ce5 100644
--- a/drivers/gpu/drm/gma500/mdfld_intel_display.c
+++ b/drivers/gpu/drm/gma500/mdfld_intel_display.c
@@ -165,9 +165,9 @@ static int mdfld__intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
165{ 165{
166 struct drm_device *dev = crtc->dev; 166 struct drm_device *dev = crtc->dev;
167 struct drm_psb_private *dev_priv = dev->dev_private; 167 struct drm_psb_private *dev_priv = dev->dev_private;
168 struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); 168 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
169 struct psb_framebuffer *psbfb = to_psb_fb(crtc->fb); 169 struct psb_framebuffer *psbfb = to_psb_fb(crtc->fb);
170 int pipe = psb_intel_crtc->pipe; 170 int pipe = gma_crtc->pipe;
171 const struct psb_offset *map = &dev_priv->regmap[pipe]; 171 const struct psb_offset *map = &dev_priv->regmap[pipe];
172 unsigned long start, offset; 172 unsigned long start, offset;
173 u32 dspcntr; 173 u32 dspcntr;
@@ -305,8 +305,8 @@ static void mdfld_crtc_dpms(struct drm_crtc *crtc, int mode)
305{ 305{
306 struct drm_device *dev = crtc->dev; 306 struct drm_device *dev = crtc->dev;
307 struct drm_psb_private *dev_priv = dev->dev_private; 307 struct drm_psb_private *dev_priv = dev->dev_private;
308 struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); 308 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
309 int pipe = psb_intel_crtc->pipe; 309 int pipe = gma_crtc->pipe;
310 const struct psb_offset *map = &dev_priv->regmap[pipe]; 310 const struct psb_offset *map = &dev_priv->regmap[pipe];
311 u32 pipeconf = dev_priv->pipeconf[pipe]; 311 u32 pipeconf = dev_priv->pipeconf[pipe];
312 u32 temp; 312 u32 temp;
@@ -669,9 +669,9 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc,
669 struct drm_framebuffer *old_fb) 669 struct drm_framebuffer *old_fb)
670{ 670{
671 struct drm_device *dev = crtc->dev; 671 struct drm_device *dev = crtc->dev;
672 struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); 672 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
673 struct drm_psb_private *dev_priv = dev->dev_private; 673 struct drm_psb_private *dev_priv = dev->dev_private;
674 int pipe = psb_intel_crtc->pipe; 674 int pipe = gma_crtc->pipe;
675 const struct psb_offset *map = &dev_priv->regmap[pipe]; 675 const struct psb_offset *map = &dev_priv->regmap[pipe];
676 int refclk = 0; 676 int refclk = 0;
677 int clk_n = 0, clk_p2 = 0, clk_byte = 1, clk = 0, m_conv = 0, 677 int clk_n = 0, clk_p2 = 0, clk_byte = 1, clk = 0, m_conv = 0,
@@ -730,9 +730,9 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc,
730 if (!gma_power_begin(dev, true)) 730 if (!gma_power_begin(dev, true))
731 return 0; 731 return 0;
732 732
733 memcpy(&psb_intel_crtc->saved_mode, mode, 733 memcpy(&gma_crtc->saved_mode, mode,
734 sizeof(struct drm_display_mode)); 734 sizeof(struct drm_display_mode));
735 memcpy(&psb_intel_crtc->saved_adjusted_mode, adjusted_mode, 735 memcpy(&gma_crtc->saved_adjusted_mode, adjusted_mode,
736 sizeof(struct drm_display_mode)); 736 sizeof(struct drm_display_mode));
737 737
738 list_for_each_entry(connector, &mode_config->connector_list, head) { 738 list_for_each_entry(connector, &mode_config->connector_list, head) {
diff --git a/drivers/gpu/drm/gma500/oaktrail_crtc.c b/drivers/gpu/drm/gma500/oaktrail_crtc.c
index b2744293c5c8..284e62ae7b57 100644
--- a/drivers/gpu/drm/gma500/oaktrail_crtc.c
+++ b/drivers/gpu/drm/gma500/oaktrail_crtc.c
@@ -163,8 +163,8 @@ static void oaktrail_crtc_dpms(struct drm_crtc *crtc, int mode)
163{ 163{
164 struct drm_device *dev = crtc->dev; 164 struct drm_device *dev = crtc->dev;
165 struct drm_psb_private *dev_priv = dev->dev_private; 165 struct drm_psb_private *dev_priv = dev->dev_private;
166 struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); 166 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
167 int pipe = psb_intel_crtc->pipe; 167 int pipe = gma_crtc->pipe;
168 const struct psb_offset *map = &dev_priv->regmap[pipe]; 168 const struct psb_offset *map = &dev_priv->regmap[pipe];
169 u32 temp; 169 u32 temp;
170 170
@@ -292,9 +292,9 @@ static int oaktrail_crtc_mode_set(struct drm_crtc *crtc,
292 struct drm_framebuffer *old_fb) 292 struct drm_framebuffer *old_fb)
293{ 293{
294 struct drm_device *dev = crtc->dev; 294 struct drm_device *dev = crtc->dev;
295 struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); 295 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
296 struct drm_psb_private *dev_priv = dev->dev_private; 296 struct drm_psb_private *dev_priv = dev->dev_private;
297 int pipe = psb_intel_crtc->pipe; 297 int pipe = gma_crtc->pipe;
298 const struct psb_offset *map = &dev_priv->regmap[pipe]; 298 const struct psb_offset *map = &dev_priv->regmap[pipe];
299 int refclk = 0; 299 int refclk = 0;
300 struct oaktrail_clock_t clock; 300 struct oaktrail_clock_t clock;
@@ -313,10 +313,10 @@ static int oaktrail_crtc_mode_set(struct drm_crtc *crtc,
313 if (!gma_power_begin(dev, true)) 313 if (!gma_power_begin(dev, true))
314 return 0; 314 return 0;
315 315
316 memcpy(&psb_intel_crtc->saved_mode, 316 memcpy(&gma_crtc->saved_mode,
317 mode, 317 mode,
318 sizeof(struct drm_display_mode)); 318 sizeof(struct drm_display_mode));
319 memcpy(&psb_intel_crtc->saved_adjusted_mode, 319 memcpy(&gma_crtc->saved_adjusted_mode,
320 adjusted_mode, 320 adjusted_mode,
321 sizeof(struct drm_display_mode)); 321 sizeof(struct drm_display_mode));
322 322
@@ -499,9 +499,9 @@ static int oaktrail_pipe_set_base(struct drm_crtc *crtc,
499{ 499{
500 struct drm_device *dev = crtc->dev; 500 struct drm_device *dev = crtc->dev;
501 struct drm_psb_private *dev_priv = dev->dev_private; 501 struct drm_psb_private *dev_priv = dev->dev_private;
502 struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); 502 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
503 struct psb_framebuffer *psbfb = to_psb_fb(crtc->fb); 503 struct psb_framebuffer *psbfb = to_psb_fb(crtc->fb);
504 int pipe = psb_intel_crtc->pipe; 504 int pipe = gma_crtc->pipe;
505 const struct psb_offset *map = &dev_priv->regmap[pipe]; 505 const struct psb_offset *map = &dev_priv->regmap[pipe];
506 unsigned long start, offset; 506 unsigned long start, offset;
507 507
diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
index ab8b9ef86c37..6c2d139aab8b 100644
--- a/drivers/gpu/drm/gma500/psb_drv.c
+++ b/drivers/gpu/drm/gma500/psb_drv.c
@@ -441,7 +441,7 @@ static int psb_gamma_ioctl(struct drm_device *dev, void *data,
441 struct drm_mode_object *obj; 441 struct drm_mode_object *obj;
442 struct drm_crtc *crtc; 442 struct drm_crtc *crtc;
443 struct drm_connector *connector; 443 struct drm_connector *connector;
444 struct psb_intel_crtc *psb_intel_crtc; 444 struct gma_crtc *gma_crtc;
445 int i = 0; 445 int i = 0;
446 int32_t obj_id; 446 int32_t obj_id;
447 447
@@ -454,10 +454,10 @@ static int psb_gamma_ioctl(struct drm_device *dev, void *data,
454 454
455 connector = obj_to_connector(obj); 455 connector = obj_to_connector(obj);
456 crtc = connector->encoder->crtc; 456 crtc = connector->encoder->crtc;
457 psb_intel_crtc = to_psb_intel_crtc(crtc); 457 gma_crtc = to_gma_crtc(crtc);
458 458
459 for (i = 0; i < 256; i++) 459 for (i = 0; i < 256; i++)
460 psb_intel_crtc->lut_adj[i] = lut_arg->lut[i]; 460 gma_crtc->lut_adj[i] = lut_arg->lut[i];
461 461
462 gma_crtc_load_lut(crtc); 462 gma_crtc_load_lut(crtc);
463 463
diff --git a/drivers/gpu/drm/gma500/psb_intel_display.c b/drivers/gpu/drm/gma500/psb_intel_display.c
index 05faf1c1ff06..c665c91dabde 100644
--- a/drivers/gpu/drm/gma500/psb_intel_display.c
+++ b/drivers/gpu/drm/gma500/psb_intel_display.c
@@ -106,9 +106,9 @@ static int psb_intel_crtc_mode_set(struct drm_crtc *crtc,
106{ 106{
107 struct drm_device *dev = crtc->dev; 107 struct drm_device *dev = crtc->dev;
108 struct drm_psb_private *dev_priv = dev->dev_private; 108 struct drm_psb_private *dev_priv = dev->dev_private;
109 struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); 109 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
110 struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; 110 struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
111 int pipe = psb_intel_crtc->pipe; 111 int pipe = gma_crtc->pipe;
112 const struct psb_offset *map = &dev_priv->regmap[pipe]; 112 const struct psb_offset *map = &dev_priv->regmap[pipe];
113 int refclk; 113 int refclk;
114 struct gma_clock_t clock; 114 struct gma_clock_t clock;
@@ -148,7 +148,7 @@ static int psb_intel_crtc_mode_set(struct drm_crtc *crtc,
148 148
149 refclk = 96000; 149 refclk = 96000;
150 150
151 limit = psb_intel_crtc->clock_funcs->limit(crtc, refclk); 151 limit = gma_crtc->clock_funcs->limit(crtc, refclk);
152 152
153 ok = limit->find_pll(limit, crtc, adjusted_mode->clock, refclk, 153 ok = limit->find_pll(limit, crtc, adjusted_mode->clock, refclk,
154 &clock); 154 &clock);
@@ -308,9 +308,9 @@ static int psb_intel_crtc_mode_set(struct drm_crtc *crtc,
308static int psb_intel_crtc_clock_get(struct drm_device *dev, 308static int psb_intel_crtc_clock_get(struct drm_device *dev,
309 struct drm_crtc *crtc) 309 struct drm_crtc *crtc)
310{ 310{
311 struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); 311 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
312 struct drm_psb_private *dev_priv = dev->dev_private; 312 struct drm_psb_private *dev_priv = dev->dev_private;
313 int pipe = psb_intel_crtc->pipe; 313 int pipe = gma_crtc->pipe;
314 const struct psb_offset *map = &dev_priv->regmap[pipe]; 314 const struct psb_offset *map = &dev_priv->regmap[pipe];
315 u32 dpll; 315 u32 dpll;
316 u32 fp; 316 u32 fp;
@@ -384,8 +384,8 @@ static int psb_intel_crtc_clock_get(struct drm_device *dev,
384struct drm_display_mode *psb_intel_crtc_mode_get(struct drm_device *dev, 384struct drm_display_mode *psb_intel_crtc_mode_get(struct drm_device *dev,
385 struct drm_crtc *crtc) 385 struct drm_crtc *crtc)
386{ 386{
387 struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); 387 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
388 int pipe = psb_intel_crtc->pipe; 388 int pipe = gma_crtc->pipe;
389 struct drm_display_mode *mode; 389 struct drm_display_mode *mode;
390 int htot; 390 int htot;
391 int hsync; 391 int hsync;
@@ -459,7 +459,7 @@ const struct gma_clock_funcs psb_clock_funcs = {
459 * to zero. This is a workaround for h/w defect on Oaktrail 459 * to zero. This is a workaround for h/w defect on Oaktrail
460 */ 460 */
461static void psb_intel_cursor_init(struct drm_device *dev, 461static void psb_intel_cursor_init(struct drm_device *dev,
462 struct psb_intel_crtc *psb_intel_crtc) 462 struct gma_crtc *gma_crtc)
463{ 463{
464 struct drm_psb_private *dev_priv = dev->dev_private; 464 struct drm_psb_private *dev_priv = dev->dev_private;
465 u32 control[3] = { CURACNTR, CURBCNTR, CURCCNTR }; 465 u32 control[3] = { CURACNTR, CURBCNTR, CURCCNTR };
@@ -472,91 +472,87 @@ static void psb_intel_cursor_init(struct drm_device *dev,
472 */ 472 */
473 cursor_gt = psb_gtt_alloc_range(dev, 4 * PAGE_SIZE, "cursor", 1); 473 cursor_gt = psb_gtt_alloc_range(dev, 4 * PAGE_SIZE, "cursor", 1);
474 if (!cursor_gt) { 474 if (!cursor_gt) {
475 psb_intel_crtc->cursor_gt = NULL; 475 gma_crtc->cursor_gt = NULL;
476 goto out; 476 goto out;
477 } 477 }
478 psb_intel_crtc->cursor_gt = cursor_gt; 478 gma_crtc->cursor_gt = cursor_gt;
479 psb_intel_crtc->cursor_addr = dev_priv->stolen_base + 479 gma_crtc->cursor_addr = dev_priv->stolen_base +
480 cursor_gt->offset; 480 cursor_gt->offset;
481 } else { 481 } else {
482 psb_intel_crtc->cursor_gt = NULL; 482 gma_crtc->cursor_gt = NULL;
483 } 483 }
484 484
485out: 485out:
486 REG_WRITE(control[psb_intel_crtc->pipe], 0); 486 REG_WRITE(control[gma_crtc->pipe], 0);
487 REG_WRITE(base[psb_intel_crtc->pipe], 0); 487 REG_WRITE(base[gma_crtc->pipe], 0);
488} 488}
489 489
490void psb_intel_crtc_init(struct drm_device *dev, int pipe, 490void psb_intel_crtc_init(struct drm_device *dev, int pipe,
491 struct psb_intel_mode_device *mode_dev) 491 struct psb_intel_mode_device *mode_dev)
492{ 492{
493 struct drm_psb_private *dev_priv = dev->dev_private; 493 struct drm_psb_private *dev_priv = dev->dev_private;
494 struct psb_intel_crtc *psb_intel_crtc; 494 struct gma_crtc *gma_crtc;
495 int i; 495 int i;
496 uint16_t *r_base, *g_base, *b_base; 496 uint16_t *r_base, *g_base, *b_base;
497 497
498 /* We allocate a extra array of drm_connector pointers 498 /* We allocate a extra array of drm_connector pointers
499 * for fbdev after the crtc */ 499 * for fbdev after the crtc */
500 psb_intel_crtc = 500 gma_crtc = kzalloc(sizeof(struct gma_crtc) +
501 kzalloc(sizeof(struct psb_intel_crtc) + 501 (INTELFB_CONN_LIMIT * sizeof(struct drm_connector *)),
502 (INTELFB_CONN_LIMIT * sizeof(struct drm_connector *)), 502 GFP_KERNEL);
503 GFP_KERNEL); 503 if (gma_crtc == NULL)
504 if (psb_intel_crtc == NULL)
505 return; 504 return;
506 505
507 psb_intel_crtc->crtc_state = 506 gma_crtc->crtc_state =
508 kzalloc(sizeof(struct psb_intel_crtc_state), GFP_KERNEL); 507 kzalloc(sizeof(struct psb_intel_crtc_state), GFP_KERNEL);
509 if (!psb_intel_crtc->crtc_state) { 508 if (!gma_crtc->crtc_state) {
510 dev_err(dev->dev, "Crtc state error: No memory\n"); 509 dev_err(dev->dev, "Crtc state error: No memory\n");
511 kfree(psb_intel_crtc); 510 kfree(gma_crtc);
512 return; 511 return;
513 } 512 }
514 513
515 /* Set the CRTC operations from the chip specific data */ 514 /* Set the CRTC operations from the chip specific data */
516 drm_crtc_init(dev, &psb_intel_crtc->base, dev_priv->ops->crtc_funcs); 515 drm_crtc_init(dev, &gma_crtc->base, dev_priv->ops->crtc_funcs);
517 516
518 /* Set the CRTC clock functions from chip specific data */ 517 /* Set the CRTC clock functions from chip specific data */
519 psb_intel_crtc->clock_funcs = dev_priv->ops->clock_funcs; 518 gma_crtc->clock_funcs = dev_priv->ops->clock_funcs;
520 519
521 drm_mode_crtc_set_gamma_size(&psb_intel_crtc->base, 256); 520 drm_mode_crtc_set_gamma_size(&gma_crtc->base, 256);
522 psb_intel_crtc->pipe = pipe; 521 gma_crtc->pipe = pipe;
523 psb_intel_crtc->plane = pipe; 522 gma_crtc->plane = pipe;
524 523
525 r_base = psb_intel_crtc->base.gamma_store; 524 r_base = gma_crtc->base.gamma_store;
526 g_base = r_base + 256; 525 g_base = r_base + 256;
527 b_base = g_base + 256; 526 b_base = g_base + 256;
528 for (i = 0; i < 256; i++) { 527 for (i = 0; i < 256; i++) {
529 psb_intel_crtc->lut_r[i] = i; 528 gma_crtc->lut_r[i] = i;
530 psb_intel_crtc->lut_g[i] = i; 529 gma_crtc->lut_g[i] = i;
531 psb_intel_crtc->lut_b[i] = i; 530 gma_crtc->lut_b[i] = i;
532 r_base[i] = i << 8; 531 r_base[i] = i << 8;
533 g_base[i] = i << 8; 532 g_base[i] = i << 8;
534 b_base[i] = i << 8; 533 b_base[i] = i << 8;
535 534
536 psb_intel_crtc->lut_adj[i] = 0; 535 gma_crtc->lut_adj[i] = 0;
537 } 536 }
538 537
539 psb_intel_crtc->mode_dev = mode_dev; 538 gma_crtc->mode_dev = mode_dev;
540 psb_intel_crtc->cursor_addr = 0; 539 gma_crtc->cursor_addr = 0;
541 540
542 drm_crtc_helper_add(&psb_intel_crtc->base, 541 drm_crtc_helper_add(&gma_crtc->base,
543 dev_priv->ops->crtc_helper); 542 dev_priv->ops->crtc_helper);
544 543
545 /* Setup the array of drm_connector pointer array */ 544 /* Setup the array of drm_connector pointer array */
546 psb_intel_crtc->mode_set.crtc = &psb_intel_crtc->base; 545 gma_crtc->mode_set.crtc = &gma_crtc->base;
547 BUG_ON(pipe >= ARRAY_SIZE(dev_priv->plane_to_crtc_mapping) || 546 BUG_ON(pipe >= ARRAY_SIZE(dev_priv->plane_to_crtc_mapping) ||
548 dev_priv->plane_to_crtc_mapping[psb_intel_crtc->plane] != NULL); 547 dev_priv->plane_to_crtc_mapping[gma_crtc->plane] != NULL);
549 dev_priv->plane_to_crtc_mapping[psb_intel_crtc->plane] = 548 dev_priv->plane_to_crtc_mapping[gma_crtc->plane] = &gma_crtc->base;
550 &psb_intel_crtc->base; 549 dev_priv->pipe_to_crtc_mapping[gma_crtc->pipe] = &gma_crtc->base;
551 dev_priv->pipe_to_crtc_mapping[psb_intel_crtc->pipe] = 550 gma_crtc->mode_set.connectors = (struct drm_connector **)(gma_crtc + 1);
552 &psb_intel_crtc->base; 551 gma_crtc->mode_set.num_connectors = 0;
553 psb_intel_crtc->mode_set.connectors = 552 psb_intel_cursor_init(dev, gma_crtc);
554 (struct drm_connector **) (psb_intel_crtc + 1);
555 psb_intel_crtc->mode_set.num_connectors = 0;
556 psb_intel_cursor_init(dev, psb_intel_crtc);
557 553
558 /* Set to true so that the pipe is forced off on initial config. */ 554 /* Set to true so that the pipe is forced off on initial config. */
559 psb_intel_crtc->active = true; 555 gma_crtc->active = true;
560} 556}
561 557
562int psb_intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, 558int psb_intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,
@@ -565,7 +561,7 @@ int psb_intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,
565 struct drm_psb_private *dev_priv = dev->dev_private; 561 struct drm_psb_private *dev_priv = dev->dev_private;
566 struct drm_psb_get_pipe_from_crtc_id_arg *pipe_from_crtc_id = data; 562 struct drm_psb_get_pipe_from_crtc_id_arg *pipe_from_crtc_id = data;
567 struct drm_mode_object *drmmode_obj; 563 struct drm_mode_object *drmmode_obj;
568 struct psb_intel_crtc *crtc; 564 struct gma_crtc *crtc;
569 565
570 if (!dev_priv) { 566 if (!dev_priv) {
571 dev_err(dev->dev, "called with no initialization\n"); 567 dev_err(dev->dev, "called with no initialization\n");
@@ -580,7 +576,7 @@ int psb_intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,
580 return -EINVAL; 576 return -EINVAL;
581 } 577 }
582 578
583 crtc = to_psb_intel_crtc(obj_to_crtc(drmmode_obj)); 579 crtc = to_gma_crtc(obj_to_crtc(drmmode_obj));
584 pipe_from_crtc_id->pipe = crtc->pipe; 580 pipe_from_crtc_id->pipe = crtc->pipe;
585 581
586 return 0; 582 return 0;
@@ -591,8 +587,8 @@ struct drm_crtc *psb_intel_get_crtc_from_pipe(struct drm_device *dev, int pipe)
591 struct drm_crtc *crtc = NULL; 587 struct drm_crtc *crtc = NULL;
592 588
593 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 589 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
594 struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); 590 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
595 if (psb_intel_crtc->pipe == pipe) 591 if (gma_crtc->pipe == pipe)
596 break; 592 break;
597 } 593 }
598 return crtc; 594 return crtc;
diff --git a/drivers/gpu/drm/gma500/psb_intel_drv.h b/drivers/gpu/drm/gma500/psb_intel_drv.h
index 1e1bf8bbfe5a..2a73b915347d 100644
--- a/drivers/gpu/drm/gma500/psb_intel_drv.h
+++ b/drivers/gpu/drm/gma500/psb_intel_drv.h
@@ -162,7 +162,7 @@ struct psb_intel_crtc_state {
162 uint32_t savePalette[256]; 162 uint32_t savePalette[256];
163}; 163};
164 164
165struct psb_intel_crtc { 165struct gma_crtc {
166 struct drm_crtc base; 166 struct drm_crtc base;
167 int pipe; 167 int pipe;
168 int plane; 168 int plane;
@@ -193,8 +193,8 @@ struct psb_intel_crtc {
193 const struct gma_clock_funcs *clock_funcs; 193 const struct gma_clock_funcs *clock_funcs;
194}; 194};
195 195
196#define to_psb_intel_crtc(x) \ 196#define to_gma_crtc(x) \
197 container_of(x, struct psb_intel_crtc, base) 197 container_of(x, struct gma_crtc, base)
198#define to_psb_intel_connector(x) \ 198#define to_psb_intel_connector(x) \
199 container_of(x, struct psb_intel_connector, base) 199 container_of(x, struct psb_intel_connector, base)
200#define to_psb_intel_encoder(x) \ 200#define to_psb_intel_encoder(x) \
diff --git a/drivers/gpu/drm/gma500/psb_intel_lvds.c b/drivers/gpu/drm/gma500/psb_intel_lvds.c
index 42541e8ea0ad..861e2e5900f1 100644
--- a/drivers/gpu/drm/gma500/psb_intel_lvds.c
+++ b/drivers/gpu/drm/gma500/psb_intel_lvds.c
@@ -381,8 +381,7 @@ bool psb_intel_lvds_mode_fixup(struct drm_encoder *encoder,
381 struct drm_device *dev = encoder->dev; 381 struct drm_device *dev = encoder->dev;
382 struct drm_psb_private *dev_priv = dev->dev_private; 382 struct drm_psb_private *dev_priv = dev->dev_private;
383 struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev; 383 struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev;
384 struct psb_intel_crtc *psb_intel_crtc = 384 struct gma_crtc *gma_crtc = to_gma_crtc(encoder->crtc);
385 to_psb_intel_crtc(encoder->crtc);
386 struct drm_encoder *tmp_encoder; 385 struct drm_encoder *tmp_encoder;
387 struct drm_display_mode *panel_fixed_mode = mode_dev->panel_fixed_mode; 386 struct drm_display_mode *panel_fixed_mode = mode_dev->panel_fixed_mode;
388 struct psb_intel_encoder *psb_intel_encoder = 387 struct psb_intel_encoder *psb_intel_encoder =
@@ -392,11 +391,11 @@ bool psb_intel_lvds_mode_fixup(struct drm_encoder *encoder,
392 panel_fixed_mode = mode_dev->panel_fixed_mode2; 391 panel_fixed_mode = mode_dev->panel_fixed_mode2;
393 392
394 /* PSB requires the LVDS is on pipe B, MRST has only one pipe anyway */ 393 /* PSB requires the LVDS is on pipe B, MRST has only one pipe anyway */
395 if (!IS_MRST(dev) && psb_intel_crtc->pipe == 0) { 394 if (!IS_MRST(dev) && gma_crtc->pipe == 0) {
396 printk(KERN_ERR "Can't support LVDS on pipe A\n"); 395 printk(KERN_ERR "Can't support LVDS on pipe A\n");
397 return false; 396 return false;
398 } 397 }
399 if (IS_MRST(dev) && psb_intel_crtc->pipe != 0) { 398 if (IS_MRST(dev) && gma_crtc->pipe != 0) {
400 printk(KERN_ERR "Must use PIPE A\n"); 399 printk(KERN_ERR "Must use PIPE A\n");
401 return false; 400 return false;
402 } 401 }
@@ -585,8 +584,7 @@ int psb_intel_lvds_set_property(struct drm_connector *connector,
585 return -1; 584 return -1;
586 585
587 if (!strcmp(property->name, "scaling mode")) { 586 if (!strcmp(property->name, "scaling mode")) {
588 struct psb_intel_crtc *crtc = 587 struct gma_crtc *crtc = to_gma_crtc(encoder->crtc);
589 to_psb_intel_crtc(encoder->crtc);
590 uint64_t curval; 588 uint64_t curval;
591 589
592 if (!crtc) 590 if (!crtc)
diff --git a/drivers/gpu/drm/gma500/psb_intel_sdvo.c b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
index 631e01abc04b..730f3071f188 100644
--- a/drivers/gpu/drm/gma500/psb_intel_sdvo.c
+++ b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
@@ -987,7 +987,7 @@ static void psb_intel_sdvo_mode_set(struct drm_encoder *encoder,
987{ 987{
988 struct drm_device *dev = encoder->dev; 988 struct drm_device *dev = encoder->dev;
989 struct drm_crtc *crtc = encoder->crtc; 989 struct drm_crtc *crtc = encoder->crtc;
990 struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); 990 struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
991 struct psb_intel_sdvo *psb_intel_sdvo = to_psb_intel_sdvo(encoder); 991 struct psb_intel_sdvo *psb_intel_sdvo = to_psb_intel_sdvo(encoder);
992 u32 sdvox; 992 u32 sdvox;
993 struct psb_intel_sdvo_in_out_map in_out; 993 struct psb_intel_sdvo_in_out_map in_out;
@@ -1070,7 +1070,7 @@ static void psb_intel_sdvo_mode_set(struct drm_encoder *encoder,
1070 } 1070 }
1071 sdvox |= (9 << 19) | SDVO_BORDER_ENABLE; 1071 sdvox |= (9 << 19) | SDVO_BORDER_ENABLE;
1072 1072
1073 if (psb_intel_crtc->pipe == 1) 1073 if (gma_crtc->pipe == 1)
1074 sdvox |= SDVO_PIPE_B_SELECT; 1074 sdvox |= SDVO_PIPE_B_SELECT;
1075 if (psb_intel_sdvo->has_hdmi_audio) 1075 if (psb_intel_sdvo->has_hdmi_audio)
1076 sdvox |= SDVO_AUDIO_ENABLE; 1076 sdvox |= SDVO_AUDIO_ENABLE;