aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>2016-10-14 05:13:44 -0400
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>2016-10-14 07:23:19 -0400
commit920a14b2459701196e42a47c7bc1559582e79ab9 (patch)
tree0f16396e8c052771781fb5c7dc350a4ea0738db8
parent9beb5fea044e32848b56bb3c17f79d3ed2a2efb8 (diff)
drm/i915: Make IS_CHERRYVIEW only take dev_priv
Saves 864 bytes of .rodata strings and ~100 of .text. v2: Add parantheses around dev_priv. (Ville Syrjala) v3: Rebase. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: David Weinehall <david.weinehall@linux.intel.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by: Jani Nikula <jani.nikula@linux.intel.com> Acked-by: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c2
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h8
-rw-r--r--drivers/gpu/drm/i915/i915_gem_gtt.c2
-rw-r--r--drivers/gpu/drm/i915/intel_audio.c4
-rw-r--r--drivers/gpu/drm/i915/intel_color.c2
-rw-r--r--drivers/gpu/drm/i915/intel_display.c67
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c55
-rw-r--r--drivers/gpu/drm/i915/intel_dsi.c8
-rw-r--r--drivers/gpu/drm/i915/intel_hdmi.c10
-rw-r--r--drivers/gpu/drm/i915/intel_i2c.c2
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c4
-rw-r--r--drivers/gpu/drm/i915/intel_psr.c4
-rw-r--r--drivers/gpu/drm/i915/intel_runtime_pm.c2
-rw-r--r--drivers/gpu/drm/i915/intel_sprite.c10
14 files changed, 93 insertions, 87 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 64e31cd25dea..1b4cfaa0e0e1 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -424,7 +424,7 @@ intel_setup_mchbar(struct drm_device *dev)
424 u32 temp; 424 u32 temp;
425 bool enabled; 425 bool enabled;
426 426
427 if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) 427 if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
428 return; 428 return;
429 429
430 dev_priv->mchbar_need_disable = false; 430 dev_priv->mchbar_need_disable = false;
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index f9ef7334f6dd..15e81cf01ce2 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2656,7 +2656,7 @@ struct drm_i915_cmd_table {
2656 INTEL_DEVID(dev_priv) == 0x0152 || \ 2656 INTEL_DEVID(dev_priv) == 0x0152 || \
2657 INTEL_DEVID(dev_priv) == 0x015a) 2657 INTEL_DEVID(dev_priv) == 0x015a)
2658#define IS_VALLEYVIEW(dev) (INTEL_INFO(dev)->is_valleyview) 2658#define IS_VALLEYVIEW(dev) (INTEL_INFO(dev)->is_valleyview)
2659#define IS_CHERRYVIEW(dev) (INTEL_INFO(dev)->is_cherryview) 2659#define IS_CHERRYVIEW(dev_priv) ((dev_priv)->info.is_cherryview)
2660#define IS_HASWELL(dev_priv) ((dev_priv)->info.is_haswell) 2660#define IS_HASWELL(dev_priv) ((dev_priv)->info.is_haswell)
2661#define IS_BROADWELL(dev_priv) ((dev_priv)->info.is_broadwell) 2661#define IS_BROADWELL(dev_priv) ((dev_priv)->info.is_broadwell)
2662#define IS_SKYLAKE(dev_priv) ((dev_priv)->info.is_skylake) 2662#define IS_SKYLAKE(dev_priv) ((dev_priv)->info.is_skylake)
@@ -3847,11 +3847,11 @@ __raw_write(64, q)
3847#define INTEL_BROADCAST_RGB_FULL 1 3847#define INTEL_BROADCAST_RGB_FULL 1
3848#define INTEL_BROADCAST_RGB_LIMITED 2 3848#define INTEL_BROADCAST_RGB_LIMITED 2
3849 3849
3850static inline i915_reg_t i915_vgacntrl_reg(struct drm_device *dev) 3850static inline i915_reg_t i915_vgacntrl_reg(struct drm_i915_private *dev_priv)
3851{ 3851{
3852 if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) 3852 if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
3853 return VLV_VGACNTRL; 3853 return VLV_VGACNTRL;
3854 else if (INTEL_INFO(dev)->gen >= 5) 3854 else if (INTEL_GEN(dev_priv) >= 5)
3855 return CPU_VGACNTRL; 3855 return CPU_VGACNTRL;
3856 else 3856 else
3857 return VGACNTRL; 3857 return VGACNTRL;
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 1eef0de03159..c3c3f28aa5a1 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -2135,7 +2135,7 @@ static void gtt_write_workarounds(struct drm_device *dev)
2135 /* WaIncreaseDefaultTLBEntries:chv,bdw,skl,bxt */ 2135 /* WaIncreaseDefaultTLBEntries:chv,bdw,skl,bxt */
2136 if (IS_BROADWELL(dev_priv)) 2136 if (IS_BROADWELL(dev_priv))
2137 I915_WRITE(GEN8_L3_LRA_1_GPGPU, GEN8_L3_LRA_1_GPGPU_DEFAULT_VALUE_BDW); 2137 I915_WRITE(GEN8_L3_LRA_1_GPGPU, GEN8_L3_LRA_1_GPGPU_DEFAULT_VALUE_BDW);
2138 else if (IS_CHERRYVIEW(dev)) 2138 else if (IS_CHERRYVIEW(dev_priv))
2139 I915_WRITE(GEN8_L3_LRA_1_GPGPU, GEN8_L3_LRA_1_GPGPU_DEFAULT_VALUE_CHV); 2139 I915_WRITE(GEN8_L3_LRA_1_GPGPU, GEN8_L3_LRA_1_GPGPU_DEFAULT_VALUE_CHV);
2140 else if (IS_SKYLAKE(dev_priv)) 2140 else if (IS_SKYLAKE(dev_priv))
2141 I915_WRITE(GEN8_L3_LRA_1_GPGPU, GEN9_L3_LRA_1_GPGPU_DEFAULT_VALUE_SKL); 2141 I915_WRITE(GEN8_L3_LRA_1_GPGPU, GEN9_L3_LRA_1_GPGPU_DEFAULT_VALUE_SKL);
diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c
index e20da59b1020..7093cfbb62b1 100644
--- a/drivers/gpu/drm/i915/intel_audio.c
+++ b/drivers/gpu/drm/i915/intel_audio.c
@@ -435,8 +435,8 @@ static void ilk_audio_codec_enable(struct drm_connector *connector,
435 aud_config = IBX_AUD_CFG(pipe); 435 aud_config = IBX_AUD_CFG(pipe);
436 aud_cntl_st = IBX_AUD_CNTL_ST(pipe); 436 aud_cntl_st = IBX_AUD_CNTL_ST(pipe);
437 aud_cntrl_st2 = IBX_AUD_CNTL_ST2; 437 aud_cntrl_st2 = IBX_AUD_CNTL_ST2;
438 } else if (IS_VALLEYVIEW(connector->dev) || 438 } else if (IS_VALLEYVIEW(dev_priv) ||
439 IS_CHERRYVIEW(connector->dev)) { 439 IS_CHERRYVIEW(dev_priv)) {
440 hdmiw_hdmiedid = VLV_HDMIW_HDMIEDID(pipe); 440 hdmiw_hdmiedid = VLV_HDMIW_HDMIEDID(pipe);
441 aud_config = VLV_AUD_CFG(pipe); 441 aud_config = VLV_AUD_CFG(pipe);
442 aud_cntl_st = VLV_AUD_CNTL_ST(pipe); 442 aud_cntl_st = VLV_AUD_CNTL_ST(pipe);
diff --git a/drivers/gpu/drm/i915/intel_color.c b/drivers/gpu/drm/i915/intel_color.c
index da76a799411a..445108855275 100644
--- a/drivers/gpu/drm/i915/intel_color.c
+++ b/drivers/gpu/drm/i915/intel_color.c
@@ -534,7 +534,7 @@ void intel_color_init(struct drm_crtc *crtc)
534 534
535 drm_mode_crtc_set_gamma_size(crtc, 256); 535 drm_mode_crtc_set_gamma_size(crtc, 256);
536 536
537 if (IS_CHERRYVIEW(dev)) { 537 if (IS_CHERRYVIEW(dev_priv)) {
538 dev_priv->display.load_csc_matrix = cherryview_load_csc_matrix; 538 dev_priv->display.load_csc_matrix = cherryview_load_csc_matrix;
539 dev_priv->display.load_luts = cherryview_load_luts; 539 dev_priv->display.load_luts = cherryview_load_luts;
540 } else if (IS_HASWELL(dev_priv)) { 540 } else if (IS_HASWELL(dev_priv)) {
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 749bc3299206..aaa1c707f6f1 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -849,7 +849,7 @@ static bool vlv_PLL_is_optimal(struct drm_device *dev, int target_freq,
849 * For CHV ignore the error and consider only the P value. 849 * For CHV ignore the error and consider only the P value.
850 * Prefer a bigger P value based on HW requirements. 850 * Prefer a bigger P value based on HW requirements.
851 */ 851 */
852 if (IS_CHERRYVIEW(dev)) { 852 if (IS_CHERRYVIEW(to_i915(dev))) {
853 *error_ppm = 0; 853 *error_ppm = 0;
854 854
855 return calculated_clock->p > best_clock->p; 855 return calculated_clock->p > best_clock->p;
@@ -1332,7 +1332,7 @@ static void assert_sprites_disabled(struct drm_i915_private *dev_priv,
1332 "plane %d assertion failure, should be off on pipe %c but is still active\n", 1332 "plane %d assertion failure, should be off on pipe %c but is still active\n",
1333 sprite, pipe_name(pipe)); 1333 sprite, pipe_name(pipe));
1334 } 1334 }
1335 } else if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) { 1335 } else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
1336 for_each_sprite(dev_priv, pipe, sprite) { 1336 for_each_sprite(dev_priv, pipe, sprite) {
1337 u32 val = I915_READ(SPCNTR(pipe, sprite)); 1337 u32 val = I915_READ(SPCNTR(pipe, sprite));
1338 I915_STATE_WARN(val & SP_ENABLE, 1338 I915_STATE_WARN(val & SP_ENABLE,
@@ -3033,7 +3033,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
3033 ((crtc_state->pipe_src_h - 1) << 16) | 3033 ((crtc_state->pipe_src_h - 1) << 16) |
3034 (crtc_state->pipe_src_w - 1)); 3034 (crtc_state->pipe_src_w - 1));
3035 I915_WRITE(DSPPOS(plane), 0); 3035 I915_WRITE(DSPPOS(plane), 0);
3036 } else if (IS_CHERRYVIEW(dev) && plane == PLANE_B) { 3036 } else if (IS_CHERRYVIEW(dev_priv) && plane == PLANE_B) {
3037 I915_WRITE(PRIMSIZE(plane), 3037 I915_WRITE(PRIMSIZE(plane),
3038 ((crtc_state->pipe_src_h - 1) << 16) | 3038 ((crtc_state->pipe_src_h - 1) << 16) |
3039 (crtc_state->pipe_src_w - 1)); 3039 (crtc_state->pipe_src_w - 1));
@@ -5872,7 +5872,7 @@ static void intel_update_max_cdclk(struct drm_device *dev)
5872 dev_priv->max_cdclk_freq = 540000; 5872 dev_priv->max_cdclk_freq = 540000;
5873 else 5873 else
5874 dev_priv->max_cdclk_freq = 675000; 5874 dev_priv->max_cdclk_freq = 675000;
5875 } else if (IS_CHERRYVIEW(dev)) { 5875 } else if (IS_CHERRYVIEW(dev_priv)) {
5876 dev_priv->max_cdclk_freq = 320000; 5876 dev_priv->max_cdclk_freq = 320000;
5877 } else if (IS_VALLEYVIEW(dev)) { 5877 } else if (IS_VALLEYVIEW(dev)) {
5878 dev_priv->max_cdclk_freq = 400000; 5878 dev_priv->max_cdclk_freq = 400000;
@@ -6674,7 +6674,7 @@ static void valleyview_modeset_commit_cdclk(struct drm_atomic_state *old_state)
6674 */ 6674 */
6675 intel_display_power_get(dev_priv, POWER_DOMAIN_PIPE_A); 6675 intel_display_power_get(dev_priv, POWER_DOMAIN_PIPE_A);
6676 6676
6677 if (IS_CHERRYVIEW(dev)) 6677 if (IS_CHERRYVIEW(dev_priv))
6678 cherryview_set_cdclk(dev, req_cdclk); 6678 cherryview_set_cdclk(dev, req_cdclk);
6679 else 6679 else
6680 valleyview_set_cdclk(dev, req_cdclk); 6680 valleyview_set_cdclk(dev, req_cdclk);
@@ -6702,7 +6702,7 @@ static void valleyview_crtc_enable(struct intel_crtc_state *pipe_config,
6702 intel_set_pipe_timings(intel_crtc); 6702 intel_set_pipe_timings(intel_crtc);
6703 intel_set_pipe_src_size(intel_crtc); 6703 intel_set_pipe_src_size(intel_crtc);
6704 6704
6705 if (IS_CHERRYVIEW(dev) && pipe == PIPE_B) { 6705 if (IS_CHERRYVIEW(dev_priv) && pipe == PIPE_B) {
6706 struct drm_i915_private *dev_priv = to_i915(dev); 6706 struct drm_i915_private *dev_priv = to_i915(dev);
6707 6707
6708 I915_WRITE(CHV_BLEND(pipe), CHV_BLEND_LEGACY); 6708 I915_WRITE(CHV_BLEND(pipe), CHV_BLEND_LEGACY);
@@ -6717,7 +6717,7 @@ static void valleyview_crtc_enable(struct intel_crtc_state *pipe_config,
6717 6717
6718 intel_encoders_pre_pll_enable(crtc, pipe_config, old_state); 6718 intel_encoders_pre_pll_enable(crtc, pipe_config, old_state);
6719 6719
6720 if (IS_CHERRYVIEW(dev)) { 6720 if (IS_CHERRYVIEW(dev_priv)) {
6721 chv_prepare_pll(intel_crtc, intel_crtc->config); 6721 chv_prepare_pll(intel_crtc, intel_crtc->config);
6722 chv_enable_pll(intel_crtc, intel_crtc->config); 6722 chv_enable_pll(intel_crtc, intel_crtc->config);
6723 } else { 6723 } else {
@@ -6836,7 +6836,7 @@ static void i9xx_crtc_disable(struct intel_crtc_state *old_crtc_state,
6836 intel_encoders_post_disable(crtc, old_crtc_state, old_state); 6836 intel_encoders_post_disable(crtc, old_crtc_state, old_state);
6837 6837
6838 if (!intel_crtc_has_type(intel_crtc->config, INTEL_OUTPUT_DSI)) { 6838 if (!intel_crtc_has_type(intel_crtc->config, INTEL_OUTPUT_DSI)) {
6839 if (IS_CHERRYVIEW(dev)) 6839 if (IS_CHERRYVIEW(dev_priv))
6840 chv_disable_pll(dev_priv, pipe); 6840 chv_disable_pll(dev_priv, pipe);
6841 else if (IS_VALLEYVIEW(dev)) 6841 else if (IS_VALLEYVIEW(dev))
6842 vlv_disable_pll(dev_priv, pipe); 6842 vlv_disable_pll(dev_priv, pipe);
@@ -7803,8 +7803,8 @@ static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
7803 * for gen < 8) and if DRRS is supported (to make sure the 7803 * for gen < 8) and if DRRS is supported (to make sure the
7804 * registers are not unnecessarily accessed). 7804 * registers are not unnecessarily accessed).
7805 */ 7805 */
7806 if (m2_n2 && (IS_CHERRYVIEW(dev) || INTEL_INFO(dev)->gen < 8) && 7806 if (m2_n2 && (IS_CHERRYVIEW(dev_priv) ||
7807 crtc->config->has_drrs) { 7807 INTEL_GEN(dev_priv) < 8) && crtc->config->has_drrs) {
7808 I915_WRITE(PIPE_DATA_M2(transcoder), 7808 I915_WRITE(PIPE_DATA_M2(transcoder),
7809 TU_SIZE(m2_n2->tu) | m2_n2->gmch_m); 7809 TU_SIZE(m2_n2->tu) | m2_n2->gmch_m);
7810 I915_WRITE(PIPE_DATA_N2(transcoder), m2_n2->gmch_n); 7810 I915_WRITE(PIPE_DATA_N2(transcoder), m2_n2->gmch_n);
@@ -8106,7 +8106,7 @@ int vlv_force_pll_on(struct drm_device *dev, enum pipe pipe,
8106 pipe_config->pixel_multiplier = 1; 8106 pipe_config->pixel_multiplier = 1;
8107 pipe_config->dpll = *dpll; 8107 pipe_config->dpll = *dpll;
8108 8108
8109 if (IS_CHERRYVIEW(dev)) { 8109 if (IS_CHERRYVIEW(to_i915(dev))) {
8110 chv_compute_dpll(crtc, pipe_config); 8110 chv_compute_dpll(crtc, pipe_config);
8111 chv_prepare_pll(crtc, pipe_config); 8111 chv_prepare_pll(crtc, pipe_config);
8112 chv_enable_pll(crtc, pipe_config); 8112 chv_enable_pll(crtc, pipe_config);
@@ -8131,7 +8131,7 @@ int vlv_force_pll_on(struct drm_device *dev, enum pipe pipe,
8131 */ 8131 */
8132void vlv_force_pll_off(struct drm_device *dev, enum pipe pipe) 8132void vlv_force_pll_off(struct drm_device *dev, enum pipe pipe)
8133{ 8133{
8134 if (IS_CHERRYVIEW(dev)) 8134 if (IS_CHERRYVIEW(to_i915(dev)))
8135 chv_disable_pll(to_i915(dev), pipe); 8135 chv_disable_pll(to_i915(dev), pipe);
8136 else 8136 else
8137 vlv_disable_pll(to_i915(dev), pipe); 8137 vlv_disable_pll(to_i915(dev), pipe);
@@ -8455,7 +8455,7 @@ static void i9xx_set_pipeconf(struct intel_crtc *intel_crtc)
8455 } else 8455 } else
8456 pipeconf |= PIPECONF_PROGRESSIVE; 8456 pipeconf |= PIPECONF_PROGRESSIVE;
8457 8457
8458 if ((IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) && 8458 if ((IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) &&
8459 intel_crtc->config->limited_color_range) 8459 intel_crtc->config->limited_color_range)
8460 pipeconf |= PIPECONF_COLOR_RANGE_SELECT; 8460 pipeconf |= PIPECONF_COLOR_RANGE_SELECT;
8461 8461
@@ -8849,7 +8849,7 @@ static bool i9xx_get_pipe_config(struct intel_crtc *crtc,
8849 } 8849 }
8850 } 8850 }
8851 8851
8852 if ((IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) && 8852 if ((IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) &&
8853 (tmp & PIPECONF_COLOR_RANGE_SELECT)) 8853 (tmp & PIPECONF_COLOR_RANGE_SELECT))
8854 pipe_config->limited_color_range = true; 8854 pipe_config->limited_color_range = true;
8855 8855
@@ -8863,7 +8863,7 @@ static bool i9xx_get_pipe_config(struct intel_crtc *crtc,
8863 8863
8864 if (INTEL_INFO(dev)->gen >= 4) { 8864 if (INTEL_INFO(dev)->gen >= 4) {
8865 /* No way to read it out on pipes B and C */ 8865 /* No way to read it out on pipes B and C */
8866 if (IS_CHERRYVIEW(dev) && crtc->pipe != PIPE_A) 8866 if (IS_CHERRYVIEW(dev_priv) && crtc->pipe != PIPE_A)
8867 tmp = dev_priv->chv_dpll_md[crtc->pipe]; 8867 tmp = dev_priv->chv_dpll_md[crtc->pipe];
8868 else 8868 else
8869 tmp = I915_READ(DPLL_MD(crtc->pipe)); 8869 tmp = I915_READ(DPLL_MD(crtc->pipe));
@@ -8884,7 +8884,7 @@ static bool i9xx_get_pipe_config(struct intel_crtc *crtc,
8884 pipe_config->pixel_multiplier = 1; 8884 pipe_config->pixel_multiplier = 1;
8885 } 8885 }
8886 pipe_config->dpll_hw_state.dpll = I915_READ(DPLL(crtc->pipe)); 8886 pipe_config->dpll_hw_state.dpll = I915_READ(DPLL(crtc->pipe));
8887 if (!IS_VALLEYVIEW(dev) && !IS_CHERRYVIEW(dev)) { 8887 if (!IS_VALLEYVIEW(dev_priv) && !IS_CHERRYVIEW(dev_priv)) {
8888 /* 8888 /*
8889 * DPLL_DVO_2X_MODE must be enabled for both DPLLs 8889 * DPLL_DVO_2X_MODE must be enabled for both DPLLs
8890 * on 830. Filter it out here so that we don't 8890 * on 830. Filter it out here so that we don't
@@ -8902,7 +8902,7 @@ static bool i9xx_get_pipe_config(struct intel_crtc *crtc,
8902 DPLL_PORTB_READY_MASK); 8902 DPLL_PORTB_READY_MASK);
8903 } 8903 }
8904 8904
8905 if (IS_CHERRYVIEW(dev)) 8905 if (IS_CHERRYVIEW(dev_priv))
8906 chv_crtc_clock_get(crtc, pipe_config); 8906 chv_crtc_clock_get(crtc, pipe_config);
8907 else if (IS_VALLEYVIEW(dev)) 8907 else if (IS_VALLEYVIEW(dev))
8908 vlv_crtc_clock_get(crtc, pipe_config); 8908 vlv_crtc_clock_get(crtc, pipe_config);
@@ -12248,7 +12248,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
12248 if (INTEL_GEN(dev_priv) >= 5 || IS_G4X(dev_priv)) 12248 if (INTEL_GEN(dev_priv) >= 5 || IS_G4X(dev_priv))
12249 work->flip_count = I915_READ(PIPE_FLIPCOUNT_G4X(pipe)) + 1; 12249 work->flip_count = I915_READ(PIPE_FLIPCOUNT_G4X(pipe)) + 1;
12250 12250
12251 if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) { 12251 if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
12252 engine = dev_priv->engine[BCS]; 12252 engine = dev_priv->engine[BCS];
12253 if (fb->modifier[0] != old_fb->modifier[0]) 12253 if (fb->modifier[0] != old_fb->modifier[0])
12254 /* vlv: DISPLAY_FLIP fails to change tiling */ 12254 /* vlv: DISPLAY_FLIP fails to change tiling */
@@ -13346,7 +13346,7 @@ intel_pipe_config_compare(struct drm_device *dev,
13346 PIPE_CONF_CHECK_I(pixel_multiplier); 13346 PIPE_CONF_CHECK_I(pixel_multiplier);
13347 PIPE_CONF_CHECK_I(has_hdmi_sink); 13347 PIPE_CONF_CHECK_I(has_hdmi_sink);
13348 if ((INTEL_GEN(dev_priv) < 8 && !IS_HASWELL(dev_priv)) || 13348 if ((INTEL_GEN(dev_priv) < 8 && !IS_HASWELL(dev_priv)) ||
13349 IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) 13349 IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
13350 PIPE_CONF_CHECK_I(limited_color_range); 13350 PIPE_CONF_CHECK_I(limited_color_range);
13351 PIPE_CONF_CHECK_I(has_infoframe); 13351 PIPE_CONF_CHECK_I(has_infoframe);
13352 13352
@@ -15066,7 +15066,7 @@ intel_check_cursor_plane(struct drm_plane *plane,
15066 * display power well must be turned off and on again. 15066 * display power well must be turned off and on again.
15067 * Refuse the put the cursor into that compromised position. 15067 * Refuse the put the cursor into that compromised position.
15068 */ 15068 */
15069 if (IS_CHERRYVIEW(plane->dev) && pipe == PIPE_C && 15069 if (IS_CHERRYVIEW(to_i915(plane->dev)) && pipe == PIPE_C &&
15070 state->base.visible && state->base.crtc_x < 0) { 15070 state->base.visible && state->base.crtc_x < 0) {
15071 DRM_DEBUG_KMS("CHV cursor C not allowed to straddle the left screen edge\n"); 15071 DRM_DEBUG_KMS("CHV cursor C not allowed to straddle the left screen edge\n");
15072 return -EINVAL; 15072 return -EINVAL;
@@ -15336,7 +15336,7 @@ static bool intel_crt_present(struct drm_device *dev)
15336 if (IS_HSW_ULT(dev_priv) || IS_BDW_ULT(dev_priv)) 15336 if (IS_HSW_ULT(dev_priv) || IS_BDW_ULT(dev_priv))
15337 return false; 15337 return false;
15338 15338
15339 if (IS_CHERRYVIEW(dev)) 15339 if (IS_CHERRYVIEW(dev_priv))
15340 return false; 15340 return false;
15341 15341
15342 if (HAS_PCH_LPT_H(dev_priv) && 15342 if (HAS_PCH_LPT_H(dev_priv) &&
@@ -15477,7 +15477,7 @@ static void intel_setup_outputs(struct drm_device *dev)
15477 15477
15478 if (I915_READ(PCH_DP_D) & DP_DETECTED) 15478 if (I915_READ(PCH_DP_D) & DP_DETECTED)
15479 intel_dp_init(dev, PCH_DP_D, PORT_D); 15479 intel_dp_init(dev, PCH_DP_D, PORT_D);
15480 } else if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) { 15480 } else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
15481 bool has_edp, has_port; 15481 bool has_edp, has_port;
15482 15482
15483 /* 15483 /*
@@ -15509,7 +15509,7 @@ static void intel_setup_outputs(struct drm_device *dev)
15509 if ((I915_READ(VLV_HDMIC) & SDVO_DETECTED || has_port) && !has_edp) 15509 if ((I915_READ(VLV_HDMIC) & SDVO_DETECTED || has_port) && !has_edp)
15510 intel_hdmi_init(dev, VLV_HDMIC, PORT_C); 15510 intel_hdmi_init(dev, VLV_HDMIC, PORT_C);
15511 15511
15512 if (IS_CHERRYVIEW(dev)) { 15512 if (IS_CHERRYVIEW(dev_priv)) {
15513 /* 15513 /*
15514 * eDP not supported on port D, 15514 * eDP not supported on port D,
15515 * so no need to worry about it 15515 * so no need to worry about it
@@ -15627,10 +15627,10 @@ static const struct drm_framebuffer_funcs intel_fb_funcs = {
15627}; 15627};
15628 15628
15629static 15629static
15630u32 intel_fb_pitch_limit(struct drm_device *dev, uint64_t fb_modifier, 15630u32 intel_fb_pitch_limit(struct drm_i915_private *dev_priv,
15631 uint32_t pixel_format) 15631 uint64_t fb_modifier, uint32_t pixel_format)
15632{ 15632{
15633 u32 gen = INTEL_INFO(dev)->gen; 15633 u32 gen = INTEL_INFO(dev_priv)->gen;
15634 15634
15635 if (gen >= 9) { 15635 if (gen >= 9) {
15636 int cpp = drm_format_plane_cpp(pixel_format, 0); 15636 int cpp = drm_format_plane_cpp(pixel_format, 0);
@@ -15639,7 +15639,8 @@ u32 intel_fb_pitch_limit(struct drm_device *dev, uint64_t fb_modifier,
15639 * pixels and 32K bytes." 15639 * pixels and 32K bytes."
15640 */ 15640 */
15641 return min(8192 * cpp, 32768); 15641 return min(8192 * cpp, 32768);
15642 } else if (gen >= 5 && !IS_VALLEYVIEW(dev) && !IS_CHERRYVIEW(dev)) { 15642 } else if (gen >= 5 && !IS_VALLEYVIEW(dev_priv) &&
15643 !IS_CHERRYVIEW(dev_priv)) {
15643 return 32*1024; 15644 return 32*1024;
15644 } else if (gen >= 4) { 15645 } else if (gen >= 4) {
15645 if (fb_modifier == I915_FORMAT_MOD_X_TILED) 15646 if (fb_modifier == I915_FORMAT_MOD_X_TILED)
@@ -15726,7 +15727,7 @@ static int intel_framebuffer_init(struct drm_device *dev,
15726 return -EINVAL; 15727 return -EINVAL;
15727 } 15728 }
15728 15729
15729 pitch_limit = intel_fb_pitch_limit(dev, mode_cmd->modifier[0], 15730 pitch_limit = intel_fb_pitch_limit(dev_priv, mode_cmd->modifier[0],
15730 mode_cmd->pixel_format); 15731 mode_cmd->pixel_format);
15731 if (mode_cmd->pitches[0] > pitch_limit) { 15732 if (mode_cmd->pitches[0] > pitch_limit) {
15732 DRM_DEBUG("%s pitch (%u) must be at less than %d\n", 15733 DRM_DEBUG("%s pitch (%u) must be at less than %d\n",
@@ -15764,7 +15765,7 @@ static int intel_framebuffer_init(struct drm_device *dev,
15764 } 15765 }
15765 break; 15766 break;
15766 case DRM_FORMAT_ABGR8888: 15767 case DRM_FORMAT_ABGR8888:
15767 if (!IS_VALLEYVIEW(dev) && !IS_CHERRYVIEW(dev) && 15768 if (!IS_VALLEYVIEW(dev_priv) && !IS_CHERRYVIEW(dev_priv) &&
15768 INTEL_INFO(dev)->gen < 9) { 15769 INTEL_INFO(dev)->gen < 9) {
15769 format_name = drm_get_format_name(mode_cmd->pixel_format); 15770 format_name = drm_get_format_name(mode_cmd->pixel_format);
15770 DRM_DEBUG("unsupported pixel format: %s\n", format_name); 15771 DRM_DEBUG("unsupported pixel format: %s\n", format_name);
@@ -15783,7 +15784,7 @@ static int intel_framebuffer_init(struct drm_device *dev,
15783 } 15784 }
15784 break; 15785 break;
15785 case DRM_FORMAT_ABGR2101010: 15786 case DRM_FORMAT_ABGR2101010:
15786 if (!IS_VALLEYVIEW(dev) && !IS_CHERRYVIEW(dev)) { 15787 if (!IS_VALLEYVIEW(dev_priv) && !IS_CHERRYVIEW(dev_priv)) {
15787 format_name = drm_get_format_name(mode_cmd->pixel_format); 15788 format_name = drm_get_format_name(mode_cmd->pixel_format);
15788 DRM_DEBUG("unsupported pixel format: %s\n", format_name); 15789 DRM_DEBUG("unsupported pixel format: %s\n", format_name);
15789 kfree(format_name); 15790 kfree(format_name);
@@ -16230,7 +16231,7 @@ static void i915_disable_vga(struct drm_device *dev)
16230 struct drm_i915_private *dev_priv = to_i915(dev); 16231 struct drm_i915_private *dev_priv = to_i915(dev);
16231 struct pci_dev *pdev = dev_priv->drm.pdev; 16232 struct pci_dev *pdev = dev_priv->drm.pdev;
16232 u8 sr1; 16233 u8 sr1;
16233 i915_reg_t vga_reg = i915_vgacntrl_reg(dev); 16234 i915_reg_t vga_reg = i915_vgacntrl_reg(dev_priv);
16234 16235
16235 /* WaEnableVGAAccessThroughIOPort:ctg,elk,ilk,snb,ivb,vlv,hsw */ 16236 /* WaEnableVGAAccessThroughIOPort:ctg,elk,ilk,snb,ivb,vlv,hsw */
16236 vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO); 16237 vga_get_uninterruptible(pdev, VGA_RSRC_LEGACY_IO);
@@ -16675,7 +16676,7 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder)
16675void i915_redisable_vga_power_on(struct drm_device *dev) 16676void i915_redisable_vga_power_on(struct drm_device *dev)
16676{ 16677{
16677 struct drm_i915_private *dev_priv = to_i915(dev); 16678 struct drm_i915_private *dev_priv = to_i915(dev);
16678 i915_reg_t vga_reg = i915_vgacntrl_reg(dev); 16679 i915_reg_t vga_reg = i915_vgacntrl_reg(dev_priv);
16679 16680
16680 if (!(I915_READ(vga_reg) & VGA_DISP_DISABLE)) { 16681 if (!(I915_READ(vga_reg) & VGA_DISP_DISABLE)) {
16681 DRM_DEBUG_KMS("Something enabled VGA plane, disabling it\n"); 16682 DRM_DEBUG_KMS("Something enabled VGA plane, disabling it\n");
@@ -16913,7 +16914,7 @@ intel_modeset_setup_hw_state(struct drm_device *dev)
16913 pll->on = false; 16914 pll->on = false;
16914 } 16915 }
16915 16916
16916 if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) 16917 if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
16917 vlv_wm_get_hw_state(dev); 16918 vlv_wm_get_hw_state(dev);
16918 else if (IS_GEN9(dev)) 16919 else if (IS_GEN9(dev))
16919 skl_wm_get_hw_state(dev); 16920 skl_wm_get_hw_state(dev);
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 63bf500edbbd..03379baffe49 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -344,7 +344,7 @@ vlv_power_sequencer_kick(struct intel_dp *intel_dp)
344 DP |= DP_PORT_WIDTH(1); 344 DP |= DP_PORT_WIDTH(1);
345 DP |= DP_LINK_TRAIN_PAT_1; 345 DP |= DP_LINK_TRAIN_PAT_1;
346 346
347 if (IS_CHERRYVIEW(dev)) 347 if (IS_CHERRYVIEW(dev_priv))
348 DP |= DP_PIPE_SELECT_CHV(pipe); 348 DP |= DP_PIPE_SELECT_CHV(pipe);
349 else if (pipe == PIPE_B) 349 else if (pipe == PIPE_B)
350 DP |= DP_PIPEB_SELECT; 350 DP |= DP_PIPEB_SELECT;
@@ -356,10 +356,10 @@ vlv_power_sequencer_kick(struct intel_dp *intel_dp)
356 * So enable temporarily it if it's not already enabled. 356 * So enable temporarily it if it's not already enabled.
357 */ 357 */
358 if (!pll_enabled) { 358 if (!pll_enabled) {
359 release_cl_override = IS_CHERRYVIEW(dev) && 359 release_cl_override = IS_CHERRYVIEW(dev_priv) &&
360 !chv_phy_powergate_ch(dev_priv, phy, ch, true); 360 !chv_phy_powergate_ch(dev_priv, phy, ch, true);
361 361
362 if (vlv_force_pll_on(dev, pipe, IS_CHERRYVIEW(dev) ? 362 if (vlv_force_pll_on(dev, pipe, IS_CHERRYVIEW(dev_priv) ?
363 &chv_dpll[0].dpll : &vlv_dpll[0].dpll)) { 363 &chv_dpll[0].dpll : &vlv_dpll[0].dpll)) {
364 DRM_ERROR("Failed to force on pll for pipe %c!\n", 364 DRM_ERROR("Failed to force on pll for pipe %c!\n",
365 pipe_name(pipe)); 365 pipe_name(pipe));
@@ -570,7 +570,7 @@ void intel_power_sequencer_reset(struct drm_i915_private *dev_priv)
570 struct drm_device *dev = &dev_priv->drm; 570 struct drm_device *dev = &dev_priv->drm;
571 struct intel_encoder *encoder; 571 struct intel_encoder *encoder;
572 572
573 if (WARN_ON(!IS_VALLEYVIEW(dev) && !IS_CHERRYVIEW(dev) && 573 if (WARN_ON(!IS_VALLEYVIEW(dev_priv) && !IS_CHERRYVIEW(dev_priv) &&
574 !IS_BROXTON(dev_priv))) 574 !IS_BROXTON(dev_priv)))
575 return; 575 return;
576 576
@@ -664,7 +664,7 @@ static int edp_notify_handler(struct notifier_block *this, unsigned long code,
664 664
665 pps_lock(intel_dp); 665 pps_lock(intel_dp);
666 666
667 if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) { 667 if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
668 enum pipe pipe = vlv_power_sequencer_pipe(intel_dp); 668 enum pipe pipe = vlv_power_sequencer_pipe(intel_dp);
669 i915_reg_t pp_ctrl_reg, pp_div_reg; 669 i915_reg_t pp_ctrl_reg, pp_div_reg;
670 u32 pp_div; 670 u32 pp_div;
@@ -692,7 +692,7 @@ static bool edp_have_panel_power(struct intel_dp *intel_dp)
692 692
693 lockdep_assert_held(&dev_priv->pps_mutex); 693 lockdep_assert_held(&dev_priv->pps_mutex);
694 694
695 if ((IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) && 695 if ((IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) &&
696 intel_dp->pps_pipe == INVALID_PIPE) 696 intel_dp->pps_pipe == INVALID_PIPE)
697 return false; 697 return false;
698 698
@@ -706,7 +706,7 @@ static bool edp_have_panel_vdd(struct intel_dp *intel_dp)
706 706
707 lockdep_assert_held(&dev_priv->pps_mutex); 707 lockdep_assert_held(&dev_priv->pps_mutex);
708 708
709 if ((IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) && 709 if ((IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) &&
710 intel_dp->pps_pipe == INVALID_PIPE) 710 intel_dp->pps_pipe == INVALID_PIPE)
711 return false; 711 return false;
712 712
@@ -1347,7 +1347,7 @@ intel_dp_set_clock(struct intel_encoder *encoder,
1347 } else if (HAS_PCH_SPLIT(dev_priv)) { 1347 } else if (HAS_PCH_SPLIT(dev_priv)) {
1348 divisor = pch_dpll; 1348 divisor = pch_dpll;
1349 count = ARRAY_SIZE(pch_dpll); 1349 count = ARRAY_SIZE(pch_dpll);
1350 } else if (IS_CHERRYVIEW(dev)) { 1350 } else if (IS_CHERRYVIEW(dev_priv)) {
1351 divisor = chv_dpll; 1351 divisor = chv_dpll;
1352 count = ARRAY_SIZE(chv_dpll); 1352 count = ARRAY_SIZE(chv_dpll);
1353 } else if (IS_VALLEYVIEW(dev)) { 1353 } else if (IS_VALLEYVIEW(dev)) {
@@ -1791,7 +1791,8 @@ static void intel_dp_prepare(struct intel_encoder *encoder,
1791 I915_WRITE(TRANS_DP_CTL(crtc->pipe), trans_dp); 1791 I915_WRITE(TRANS_DP_CTL(crtc->pipe), trans_dp);
1792 } else { 1792 } else {
1793 if (!HAS_PCH_SPLIT(dev_priv) && !IS_VALLEYVIEW(dev) && 1793 if (!HAS_PCH_SPLIT(dev_priv) && !IS_VALLEYVIEW(dev) &&
1794 !IS_CHERRYVIEW(dev) && pipe_config->limited_color_range) 1794 !IS_CHERRYVIEW(dev_priv) &&
1795 pipe_config->limited_color_range)
1795 intel_dp->DP |= DP_COLOR_RANGE_16_235; 1796 intel_dp->DP |= DP_COLOR_RANGE_16_235;
1796 1797
1797 if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) 1798 if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
@@ -1803,7 +1804,7 @@ static void intel_dp_prepare(struct intel_encoder *encoder,
1803 if (drm_dp_enhanced_frame_cap(intel_dp->dpcd)) 1804 if (drm_dp_enhanced_frame_cap(intel_dp->dpcd))
1804 intel_dp->DP |= DP_ENHANCED_FRAMING; 1805 intel_dp->DP |= DP_ENHANCED_FRAMING;
1805 1806
1806 if (IS_CHERRYVIEW(dev)) 1807 if (IS_CHERRYVIEW(dev_priv))
1807 intel_dp->DP |= DP_PIPE_SELECT_CHV(crtc->pipe); 1808 intel_dp->DP |= DP_PIPE_SELECT_CHV(crtc->pipe);
1808 else if (crtc->pipe == PIPE_B) 1809 else if (crtc->pipe == PIPE_B)
1809 intel_dp->DP |= DP_PIPEB_SELECT; 1810 intel_dp->DP |= DP_PIPEB_SELECT;
@@ -2459,7 +2460,7 @@ static bool intel_dp_get_hw_state(struct intel_encoder *encoder,
2459 2460
2460 DRM_DEBUG_KMS("No pipe for dp port 0x%x found\n", 2461 DRM_DEBUG_KMS("No pipe for dp port 0x%x found\n",
2461 i915_mmio_reg_offset(intel_dp->output_reg)); 2462 i915_mmio_reg_offset(intel_dp->output_reg));
2462 } else if (IS_CHERRYVIEW(dev)) { 2463 } else if (IS_CHERRYVIEW(dev_priv)) {
2463 *pipe = DP_PORT_TO_PIPE_CHV(tmp); 2464 *pipe = DP_PORT_TO_PIPE_CHV(tmp);
2464 } else { 2465 } else {
2465 *pipe = PORT_TO_PIPE(tmp); 2466 *pipe = PORT_TO_PIPE(tmp);
@@ -2681,7 +2682,7 @@ _intel_dp_set_link_train(struct intel_dp *intel_dp,
2681 } 2682 }
2682 2683
2683 } else { 2684 } else {
2684 if (IS_CHERRYVIEW(dev)) 2685 if (IS_CHERRYVIEW(dev_priv))
2685 *DP &= ~DP_LINK_TRAIN_MASK_CHV; 2686 *DP &= ~DP_LINK_TRAIN_MASK_CHV;
2686 else 2687 else
2687 *DP &= ~DP_LINK_TRAIN_MASK; 2688 *DP &= ~DP_LINK_TRAIN_MASK;
@@ -2697,7 +2698,7 @@ _intel_dp_set_link_train(struct intel_dp *intel_dp,
2697 *DP |= DP_LINK_TRAIN_PAT_2; 2698 *DP |= DP_LINK_TRAIN_PAT_2;
2698 break; 2699 break;
2699 case DP_TRAINING_PATTERN_3: 2700 case DP_TRAINING_PATTERN_3:
2700 if (IS_CHERRYVIEW(dev)) { 2701 if (IS_CHERRYVIEW(dev_priv)) {
2701 *DP |= DP_LINK_TRAIN_PAT_3_CHV; 2702 *DP |= DP_LINK_TRAIN_PAT_3_CHV;
2702 } else { 2703 } else {
2703 DRM_DEBUG_KMS("TPS3 not supported, using TPS2 instead\n"); 2704 DRM_DEBUG_KMS("TPS3 not supported, using TPS2 instead\n");
@@ -2747,7 +2748,7 @@ static void intel_enable_dp(struct intel_encoder *encoder,
2747 2748
2748 pps_lock(intel_dp); 2749 pps_lock(intel_dp);
2749 2750
2750 if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) 2751 if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
2751 vlv_init_panel_power_sequencer(intel_dp); 2752 vlv_init_panel_power_sequencer(intel_dp);
2752 2753
2753 intel_dp_enable_port(intel_dp, pipe_config); 2754 intel_dp_enable_port(intel_dp, pipe_config);
@@ -2758,10 +2759,10 @@ static void intel_enable_dp(struct intel_encoder *encoder,
2758 2759
2759 pps_unlock(intel_dp); 2760 pps_unlock(intel_dp);
2760 2761
2761 if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) { 2762 if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
2762 unsigned int lane_mask = 0x0; 2763 unsigned int lane_mask = 0x0;
2763 2764
2764 if (IS_CHERRYVIEW(dev)) 2765 if (IS_CHERRYVIEW(dev_priv))
2765 lane_mask = intel_dp_unused_lane_mask(pipe_config->lane_count); 2766 lane_mask = intel_dp_unused_lane_mask(pipe_config->lane_count);
2766 2767
2767 vlv_wait_port_ready(dev_priv, dp_to_dig_port(intel_dp), 2768 vlv_wait_port_ready(dev_priv, dp_to_dig_port(intel_dp),
@@ -2987,7 +2988,7 @@ intel_dp_voltage_max(struct intel_dp *intel_dp)
2987 if (dev_priv->vbt.edp.low_vswing && port == PORT_A) 2988 if (dev_priv->vbt.edp.low_vswing && port == PORT_A)
2988 return DP_TRAIN_VOLTAGE_SWING_LEVEL_3; 2989 return DP_TRAIN_VOLTAGE_SWING_LEVEL_3;
2989 return DP_TRAIN_VOLTAGE_SWING_LEVEL_2; 2990 return DP_TRAIN_VOLTAGE_SWING_LEVEL_2;
2990 } else if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) 2991 } else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
2991 return DP_TRAIN_VOLTAGE_SWING_LEVEL_3; 2992 return DP_TRAIN_VOLTAGE_SWING_LEVEL_3;
2992 else if (IS_GEN7(dev) && port == PORT_A) 2993 else if (IS_GEN7(dev) && port == PORT_A)
2993 return DP_TRAIN_VOLTAGE_SWING_LEVEL_2; 2994 return DP_TRAIN_VOLTAGE_SWING_LEVEL_2;
@@ -3348,7 +3349,7 @@ intel_dp_set_signal_levels(struct intel_dp *intel_dp)
3348 signal_levels = 0; 3349 signal_levels = 0;
3349 else 3350 else
3350 mask = DDI_BUF_EMP_MASK; 3351 mask = DDI_BUF_EMP_MASK;
3351 } else if (IS_CHERRYVIEW(dev)) { 3352 } else if (IS_CHERRYVIEW(dev_priv)) {
3352 signal_levels = chv_signal_levels(intel_dp); 3353 signal_levels = chv_signal_levels(intel_dp);
3353 } else if (IS_VALLEYVIEW(dev)) { 3354 } else if (IS_VALLEYVIEW(dev)) {
3354 signal_levels = vlv_signal_levels(intel_dp); 3355 signal_levels = vlv_signal_levels(intel_dp);
@@ -3448,7 +3449,7 @@ intel_dp_link_down(struct intel_dp *intel_dp)
3448 DP &= ~DP_LINK_TRAIN_MASK_CPT; 3449 DP &= ~DP_LINK_TRAIN_MASK_CPT;
3449 DP |= DP_LINK_TRAIN_PAT_IDLE_CPT; 3450 DP |= DP_LINK_TRAIN_PAT_IDLE_CPT;
3450 } else { 3451 } else {
3451 if (IS_CHERRYVIEW(dev)) 3452 if (IS_CHERRYVIEW(dev_priv))
3452 DP &= ~DP_LINK_TRAIN_MASK_CHV; 3453 DP &= ~DP_LINK_TRAIN_MASK_CHV;
3453 else 3454 else
3454 DP &= ~DP_LINK_TRAIN_MASK; 3455 DP &= ~DP_LINK_TRAIN_MASK;
@@ -5085,7 +5086,7 @@ intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev,
5085 5086
5086 /* Haswell doesn't have any port selection bits for the panel 5087 /* Haswell doesn't have any port selection bits for the panel
5087 * power sequencer any more. */ 5088 * power sequencer any more. */
5088 if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) { 5089 if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
5089 port_sel = PANEL_PORT_SELECT_VLV(port); 5090 port_sel = PANEL_PORT_SELECT_VLV(port);
5090 } else if (HAS_PCH_IBX(dev_priv) || HAS_PCH_CPT(dev_priv)) { 5091 } else if (HAS_PCH_IBX(dev_priv) || HAS_PCH_CPT(dev_priv)) {
5091 if (port == PORT_A) 5092 if (port == PORT_A)
@@ -5114,7 +5115,9 @@ intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev,
5114static void intel_dp_pps_init(struct drm_device *dev, 5115static void intel_dp_pps_init(struct drm_device *dev,
5115 struct intel_dp *intel_dp) 5116 struct intel_dp *intel_dp)
5116{ 5117{
5117 if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) { 5118 struct drm_i915_private *dev_priv = to_i915(dev);
5119
5120 if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
5118 vlv_initial_power_sequencer_setup(intel_dp); 5121 vlv_initial_power_sequencer_setup(intel_dp);
5119 } else { 5122 } else {
5120 intel_dp_init_panel_power_sequencer(dev, intel_dp); 5123 intel_dp_init_panel_power_sequencer(dev, intel_dp);
@@ -5584,7 +5587,7 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
5584 } 5587 }
5585 mutex_unlock(&dev->mode_config.mutex); 5588 mutex_unlock(&dev->mode_config.mutex);
5586 5589
5587 if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) { 5590 if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
5588 intel_dp->edp_notifier.notifier_call = edp_notify_handler; 5591 intel_dp->edp_notifier.notifier_call = edp_notify_handler;
5589 register_reboot_notifier(&intel_dp->edp_notifier); 5592 register_reboot_notifier(&intel_dp->edp_notifier);
5590 5593
@@ -5593,7 +5596,7 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
5593 * If the current pipe isn't valid, try the PPS pipe, and if that 5596 * If the current pipe isn't valid, try the PPS pipe, and if that
5594 * fails just assume pipe A. 5597 * fails just assume pipe A.
5595 */ 5598 */
5596 if (IS_CHERRYVIEW(dev)) 5599 if (IS_CHERRYVIEW(dev_priv))
5597 pipe = DP_PORT_TO_PIPE_CHV(intel_dp->DP); 5600 pipe = DP_PORT_TO_PIPE_CHV(intel_dp->DP);
5598 else 5601 else
5599 pipe = PORT_TO_PIPE(intel_dp->DP); 5602 pipe = PORT_TO_PIPE(intel_dp->DP);
@@ -5682,7 +5685,7 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
5682 intel_encoder->type = INTEL_OUTPUT_EDP; 5685 intel_encoder->type = INTEL_OUTPUT_EDP;
5683 5686
5684 /* eDP only on port B and/or C on vlv/chv */ 5687 /* eDP only on port B and/or C on vlv/chv */
5685 if (WARN_ON((IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) && 5688 if (WARN_ON((IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) &&
5686 is_edp(intel_dp) && port != PORT_B && port != PORT_C)) 5689 is_edp(intel_dp) && port != PORT_B && port != PORT_C))
5687 return false; 5690 return false;
5688 5691
@@ -5792,7 +5795,7 @@ bool intel_dp_init(struct drm_device *dev,
5792 intel_encoder->get_hw_state = intel_dp_get_hw_state; 5795 intel_encoder->get_hw_state = intel_dp_get_hw_state;
5793 intel_encoder->get_config = intel_dp_get_config; 5796 intel_encoder->get_config = intel_dp_get_config;
5794 intel_encoder->suspend = intel_dp_encoder_suspend; 5797 intel_encoder->suspend = intel_dp_encoder_suspend;
5795 if (IS_CHERRYVIEW(dev)) { 5798 if (IS_CHERRYVIEW(dev_priv)) {
5796 intel_encoder->pre_pll_enable = chv_dp_pre_pll_enable; 5799 intel_encoder->pre_pll_enable = chv_dp_pre_pll_enable;
5797 intel_encoder->pre_enable = chv_pre_enable_dp; 5800 intel_encoder->pre_enable = chv_pre_enable_dp;
5798 intel_encoder->enable = vlv_enable_dp; 5801 intel_encoder->enable = vlv_enable_dp;
@@ -5815,7 +5818,7 @@ bool intel_dp_init(struct drm_device *dev,
5815 intel_dig_port->max_lanes = 4; 5818 intel_dig_port->max_lanes = 4;
5816 5819
5817 intel_encoder->type = INTEL_OUTPUT_DP; 5820 intel_encoder->type = INTEL_OUTPUT_DP;
5818 if (IS_CHERRYVIEW(dev)) { 5821 if (IS_CHERRYVIEW(dev_priv)) {
5819 if (port == PORT_D) 5822 if (port == PORT_D)
5820 intel_encoder->crtc_mask = 1 << 2; 5823 intel_encoder->crtc_mask = 1 << 2;
5821 else 5824 else
diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index 48e8dd108f4f..4e0d025490a3 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -740,7 +740,6 @@ static bool intel_dsi_get_hw_state(struct intel_encoder *encoder,
740{ 740{
741 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); 741 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
742 struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base); 742 struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
743 struct drm_device *dev = encoder->base.dev;
744 enum intel_display_power_domain power_domain; 743 enum intel_display_power_domain power_domain;
745 enum port port; 744 enum port port;
746 bool active = false; 745 bool active = false;
@@ -770,7 +769,8 @@ static bool intel_dsi_get_hw_state(struct intel_encoder *encoder,
770 * bit in port C control register does not get set. As a 769 * bit in port C control register does not get set. As a
771 * workaround, check pipe B conf instead. 770 * workaround, check pipe B conf instead.
772 */ 771 */
773 if ((IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) && port == PORT_C) 772 if ((IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) &&
773 port == PORT_C)
774 enabled = I915_READ(PIPECONF(PIPE_B)) & PIPECONF_ENABLE; 774 enabled = I915_READ(PIPECONF(PIPE_B)) & PIPECONF_ENABLE;
775 775
776 /* Try command mode if video mode not enabled */ 776 /* Try command mode if video mode not enabled */
@@ -1137,7 +1137,7 @@ static void intel_dsi_prepare(struct intel_encoder *intel_encoder,
1137 } 1137 }
1138 1138
1139 for_each_dsi_port(port, intel_dsi->ports) { 1139 for_each_dsi_port(port, intel_dsi->ports) {
1140 if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) { 1140 if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
1141 /* 1141 /*
1142 * escape clock divider, 20MHz, shared for A and C. 1142 * escape clock divider, 20MHz, shared for A and C.
1143 * device ready must be off when doing this! txclkesc? 1143 * device ready must be off when doing this! txclkesc?
@@ -1449,7 +1449,7 @@ void intel_dsi_init(struct drm_device *dev)
1449 if (!intel_bios_is_dsi_present(dev_priv, &port)) 1449 if (!intel_bios_is_dsi_present(dev_priv, &port))
1450 return; 1450 return;
1451 1451
1452 if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) { 1452 if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
1453 dev_priv->mipi_mmio_base = VLV_MIPI_BASE; 1453 dev_priv->mipi_mmio_base = VLV_MIPI_BASE;
1454 } else if (IS_BROXTON(dev_priv)) { 1454 } else if (IS_BROXTON(dev_priv)) {
1455 dev_priv->mipi_mmio_base = BXT_MIPI_BASE; 1455 dev_priv->mipi_mmio_base = BXT_MIPI_BASE;
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index c7d9cddf4e3e..c8243dc4d2b9 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -881,7 +881,7 @@ static void intel_hdmi_prepare(struct intel_encoder *encoder)
881 881
882 if (HAS_PCH_CPT(dev_priv)) 882 if (HAS_PCH_CPT(dev_priv))
883 hdmi_val |= SDVO_PIPE_SEL_CPT(crtc->pipe); 883 hdmi_val |= SDVO_PIPE_SEL_CPT(crtc->pipe);
884 else if (IS_CHERRYVIEW(dev)) 884 else if (IS_CHERRYVIEW(dev_priv))
885 hdmi_val |= SDVO_PIPE_SEL_CHV(crtc->pipe); 885 hdmi_val |= SDVO_PIPE_SEL_CHV(crtc->pipe);
886 else 886 else
887 hdmi_val |= SDVO_PIPE_SEL(crtc->pipe); 887 hdmi_val |= SDVO_PIPE_SEL(crtc->pipe);
@@ -913,7 +913,7 @@ static bool intel_hdmi_get_hw_state(struct intel_encoder *encoder,
913 913
914 if (HAS_PCH_CPT(dev_priv)) 914 if (HAS_PCH_CPT(dev_priv))
915 *pipe = PORT_TO_PIPE_CPT(tmp); 915 *pipe = PORT_TO_PIPE_CPT(tmp);
916 else if (IS_CHERRYVIEW(dev)) 916 else if (IS_CHERRYVIEW(dev_priv))
917 *pipe = SDVO_PORT_TO_PIPE_CHV(tmp); 917 *pipe = SDVO_PORT_TO_PIPE_CHV(tmp);
918 else 918 else
919 *pipe = PORT_TO_PIPE(tmp); 919 *pipe = PORT_TO_PIPE(tmp);
@@ -1885,7 +1885,7 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
1885 BUG(); 1885 BUG();
1886 } 1886 }
1887 1887
1888 if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) { 1888 if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
1889 intel_hdmi->write_infoframe = vlv_write_infoframe; 1889 intel_hdmi->write_infoframe = vlv_write_infoframe;
1890 intel_hdmi->set_infoframes = vlv_set_infoframes; 1890 intel_hdmi->set_infoframes = vlv_set_infoframes;
1891 intel_hdmi->infoframe_enabled = vlv_infoframe_enabled; 1891 intel_hdmi->infoframe_enabled = vlv_infoframe_enabled;
@@ -1959,7 +1959,7 @@ void intel_hdmi_init(struct drm_device *dev,
1959 } 1959 }
1960 intel_encoder->get_hw_state = intel_hdmi_get_hw_state; 1960 intel_encoder->get_hw_state = intel_hdmi_get_hw_state;
1961 intel_encoder->get_config = intel_hdmi_get_config; 1961 intel_encoder->get_config = intel_hdmi_get_config;
1962 if (IS_CHERRYVIEW(dev)) { 1962 if (IS_CHERRYVIEW(dev_priv)) {
1963 intel_encoder->pre_pll_enable = chv_hdmi_pre_pll_enable; 1963 intel_encoder->pre_pll_enable = chv_hdmi_pre_pll_enable;
1964 intel_encoder->pre_enable = chv_hdmi_pre_enable; 1964 intel_encoder->pre_enable = chv_hdmi_pre_enable;
1965 intel_encoder->enable = vlv_enable_hdmi; 1965 intel_encoder->enable = vlv_enable_hdmi;
@@ -1982,7 +1982,7 @@ void intel_hdmi_init(struct drm_device *dev,
1982 1982
1983 intel_encoder->type = INTEL_OUTPUT_HDMI; 1983 intel_encoder->type = INTEL_OUTPUT_HDMI;
1984 intel_encoder->port = port; 1984 intel_encoder->port = port;
1985 if (IS_CHERRYVIEW(dev)) { 1985 if (IS_CHERRYVIEW(dev_priv)) {
1986 if (port == PORT_D) 1986 if (port == PORT_D)
1987 intel_encoder->crtc_mask = 1 << 2; 1987 intel_encoder->crtc_mask = 1 << 2;
1988 else 1988 else
diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
index afb2652919d0..d04185e1edd6 100644
--- a/drivers/gpu/drm/i915/intel_i2c.c
+++ b/drivers/gpu/drm/i915/intel_i2c.c
@@ -635,7 +635,7 @@ int intel_setup_gmbus(struct drm_device *dev)
635 if (HAS_PCH_NOP(dev_priv)) 635 if (HAS_PCH_NOP(dev_priv))
636 return 0; 636 return 0;
637 637
638 if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) 638 if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
639 dev_priv->gpio_mmio_base = VLV_DISPLAY_BASE; 639 dev_priv->gpio_mmio_base = VLV_DISPLAY_BASE;
640 else if (!HAS_GMCH_DISPLAY(dev_priv)) 640 else if (!HAS_GMCH_DISPLAY(dev_priv))
641 dev_priv->gpio_mmio_base = 641 dev_priv->gpio_mmio_base =
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 0e3d557f214b..d36b5071e066 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -322,7 +322,7 @@ void intel_set_memory_cxsr(struct drm_i915_private *dev_priv, bool enable)
322 struct drm_device *dev = &dev_priv->drm; 322 struct drm_device *dev = &dev_priv->drm;
323 u32 val; 323 u32 val;
324 324
325 if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) { 325 if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
326 I915_WRITE(FW_BLC_SELF_VLV, enable ? FW_CSPWRDWNEN : 0); 326 I915_WRITE(FW_BLC_SELF_VLV, enable ? FW_CSPWRDWNEN : 0);
327 POSTING_READ(FW_BLC_SELF_VLV); 327 POSTING_READ(FW_BLC_SELF_VLV);
328 dev_priv->wm.vlv.cxsr = enable; 328 dev_priv->wm.vlv.cxsr = enable;
@@ -7768,7 +7768,7 @@ void intel_init_pm(struct drm_device *dev)
7768 DRM_DEBUG_KMS("Failed to read display plane latency. " 7768 DRM_DEBUG_KMS("Failed to read display plane latency. "
7769 "Disable CxSR\n"); 7769 "Disable CxSR\n");
7770 } 7770 }
7771 } else if (IS_CHERRYVIEW(dev)) { 7771 } else if (IS_CHERRYVIEW(dev_priv)) {
7772 vlv_setup_wm_latency(dev); 7772 vlv_setup_wm_latency(dev);
7773 dev_priv->display.update_wm = vlv_update_wm; 7773 dev_priv->display.update_wm = vlv_update_wm;
7774 } else if (IS_VALLEYVIEW(dev)) { 7774 } else if (IS_VALLEYVIEW(dev)) {
diff --git a/drivers/gpu/drm/i915/intel_psr.c b/drivers/gpu/drm/i915/intel_psr.c
index 4a973b34348a..271a3e29ff23 100644
--- a/drivers/gpu/drm/i915/intel_psr.c
+++ b/drivers/gpu/drm/i915/intel_psr.c
@@ -354,7 +354,7 @@ static bool intel_psr_match_conditions(struct intel_dp *intel_dp)
354 return false; 354 return false;
355 } 355 }
356 356
357 if ((IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) && 357 if ((IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) &&
358 !dev_priv->psr.link_standby) { 358 !dev_priv->psr.link_standby) {
359 DRM_ERROR("PSR condition failed: Link off requested but not supported on this platform\n"); 359 DRM_ERROR("PSR condition failed: Link off requested but not supported on this platform\n");
360 return false; 360 return false;
@@ -837,7 +837,7 @@ void intel_psr_init(struct drm_device *dev)
837 if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) 837 if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
838 /* HSW and BDW require workarounds that we don't implement. */ 838 /* HSW and BDW require workarounds that we don't implement. */
839 dev_priv->psr.link_standby = false; 839 dev_priv->psr.link_standby = false;
840 else if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) 840 else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
841 /* On VLV and CHV only standby mode is supported. */ 841 /* On VLV and CHV only standby mode is supported. */
842 dev_priv->psr.link_standby = true; 842 dev_priv->psr.link_standby = true;
843 else 843 else
diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c
index e4bb85c9c6e1..3a6e1a93aed9 100644
--- a/drivers/gpu/drm/i915/intel_runtime_pm.c
+++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
@@ -2598,7 +2598,7 @@ void intel_power_domains_init_hw(struct drm_i915_private *dev_priv, bool resume)
2598 skl_display_core_init(dev_priv, resume); 2598 skl_display_core_init(dev_priv, resume);
2599 } else if (IS_BROXTON(dev_priv)) { 2599 } else if (IS_BROXTON(dev_priv)) {
2600 bxt_display_core_init(dev_priv, resume); 2600 bxt_display_core_init(dev_priv, resume);
2601 } else if (IS_CHERRYVIEW(dev)) { 2601 } else if (IS_CHERRYVIEW(dev_priv)) {
2602 mutex_lock(&power_domains->lock); 2602 mutex_lock(&power_domains->lock);
2603 chv_phy_control_init(dev_priv); 2603 chv_phy_control_init(dev_priv);
2604 mutex_unlock(&power_domains->lock); 2604 mutex_unlock(&power_domains->lock);
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index fefd3034aead..f760d5fcbe48 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -450,7 +450,7 @@ vlv_update_plane(struct drm_plane *dplane,
450 if (key->flags & I915_SET_COLORKEY_SOURCE) 450 if (key->flags & I915_SET_COLORKEY_SOURCE)
451 sprctl |= SP_SOURCE_KEY; 451 sprctl |= SP_SOURCE_KEY;
452 452
453 if (IS_CHERRYVIEW(dev) && pipe == PIPE_B) 453 if (IS_CHERRYVIEW(dev_priv) && pipe == PIPE_B)
454 chv_update_csc(intel_plane, fb->pixel_format); 454 chv_update_csc(intel_plane, fb->pixel_format);
455 455
456 I915_WRITE(SPSTRIDE(pipe, plane), fb->pitches[0]); 456 I915_WRITE(SPSTRIDE(pipe, plane), fb->pitches[0]);
@@ -944,6 +944,7 @@ intel_check_sprite_plane(struct drm_plane *plane,
944int intel_sprite_set_colorkey(struct drm_device *dev, void *data, 944int intel_sprite_set_colorkey(struct drm_device *dev, void *data,
945 struct drm_file *file_priv) 945 struct drm_file *file_priv)
946{ 946{
947 struct drm_i915_private *dev_priv = to_i915(dev);
947 struct drm_intel_sprite_colorkey *set = data; 948 struct drm_intel_sprite_colorkey *set = data;
948 struct drm_plane *plane; 949 struct drm_plane *plane;
949 struct drm_plane_state *plane_state; 950 struct drm_plane_state *plane_state;
@@ -955,7 +956,7 @@ int intel_sprite_set_colorkey(struct drm_device *dev, void *data,
955 if ((set->flags & (I915_SET_COLORKEY_DESTINATION | I915_SET_COLORKEY_SOURCE)) == (I915_SET_COLORKEY_DESTINATION | I915_SET_COLORKEY_SOURCE)) 956 if ((set->flags & (I915_SET_COLORKEY_DESTINATION | I915_SET_COLORKEY_SOURCE)) == (I915_SET_COLORKEY_DESTINATION | I915_SET_COLORKEY_SOURCE))
956 return -EINVAL; 957 return -EINVAL;
957 958
958 if ((IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) && 959 if ((IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) &&
959 set->flags & I915_SET_COLORKEY_DESTINATION) 960 set->flags & I915_SET_COLORKEY_DESTINATION)
960 return -EINVAL; 961 return -EINVAL;
961 962
@@ -1042,6 +1043,7 @@ static uint32_t skl_plane_formats[] = {
1042int 1043int
1043intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane) 1044intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
1044{ 1045{
1046 struct drm_i915_private *dev_priv = to_i915(dev);
1045 struct intel_plane *intel_plane = NULL; 1047 struct intel_plane *intel_plane = NULL;
1046 struct intel_plane_state *state = NULL; 1048 struct intel_plane_state *state = NULL;
1047 unsigned long possible_crtcs; 1049 unsigned long possible_crtcs;
@@ -1084,7 +1086,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
1084 1086
1085 case 7: 1087 case 7:
1086 case 8: 1088 case 8:
1087 if (IS_IVYBRIDGE(to_i915(dev))) { 1089 if (IS_IVYBRIDGE(dev_priv)) {
1088 intel_plane->can_scale = true; 1090 intel_plane->can_scale = true;
1089 intel_plane->max_downscale = 2; 1091 intel_plane->max_downscale = 2;
1090 } else { 1092 } else {
@@ -1092,7 +1094,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
1092 intel_plane->max_downscale = 1; 1094 intel_plane->max_downscale = 1;
1093 } 1095 }
1094 1096
1095 if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) { 1097 if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
1096 intel_plane->update_plane = vlv_update_plane; 1098 intel_plane->update_plane = vlv_update_plane;
1097 intel_plane->disable_plane = vlv_disable_plane; 1099 intel_plane->disable_plane = vlv_disable_plane;
1098 1100