aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/i915')
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c5
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h1
-rw-r--r--drivers/gpu/drm/i915/i915_gem_execbuffer.c2
-rw-r--r--drivers/gpu/drm/i915/intel_crt.c40
-rw-r--r--drivers/gpu/drm/i915/intel_display.c10
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c5
-rw-r--r--drivers/gpu/drm/i915/intel_panel.c13
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c3
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c2
9 files changed, 42 insertions, 39 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 0a8eceb75902..e9b57893db2b 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -125,6 +125,11 @@ MODULE_PARM_DESC(preliminary_hw_support,
125 "Enable Haswell and ValleyView Support. " 125 "Enable Haswell and ValleyView Support. "
126 "(default: false)"); 126 "(default: false)");
127 127
128int i915_disable_power_well __read_mostly = 0;
129module_param_named(disable_power_well, i915_disable_power_well, int, 0600);
130MODULE_PARM_DESC(disable_power_well,
131 "Disable the power well when possible (default: false)");
132
128static struct drm_driver driver; 133static struct drm_driver driver;
129extern int intel_agp_enabled; 134extern int intel_agp_enabled;
130 135
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index e95337c97459..01769e2a9953 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1398,6 +1398,7 @@ extern int i915_enable_fbc __read_mostly;
1398extern bool i915_enable_hangcheck __read_mostly; 1398extern bool i915_enable_hangcheck __read_mostly;
1399extern int i915_enable_ppgtt __read_mostly; 1399extern int i915_enable_ppgtt __read_mostly;
1400extern unsigned int i915_preliminary_hw_support __read_mostly; 1400extern unsigned int i915_preliminary_hw_support __read_mostly;
1401extern int i915_disable_power_well __read_mostly;
1401 1402
1402extern int i915_suspend(struct drm_device *dev, pm_message_t state); 1403extern int i915_suspend(struct drm_device *dev, pm_message_t state);
1403extern int i915_resume(struct drm_device *dev); 1404extern int i915_resume(struct drm_device *dev);
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 3b11ab0fbc96..9a48e1a2d417 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -57,7 +57,7 @@ eb_create(struct drm_i915_gem_execbuffer2 *args)
57 if (eb == NULL) { 57 if (eb == NULL) {
58 int size = args->buffer_count; 58 int size = args->buffer_count;
59 int count = PAGE_SIZE / sizeof(struct hlist_head) / 2; 59 int count = PAGE_SIZE / sizeof(struct hlist_head) / 2;
60 BUILD_BUG_ON(!is_power_of_2(PAGE_SIZE / sizeof(struct hlist_head))); 60 BUILD_BUG_ON_NOT_POWER_OF_2(PAGE_SIZE / sizeof(struct hlist_head));
61 while (count > 2*size) 61 while (count > 2*size)
62 count >>= 1; 62 count >>= 1;
63 eb = kzalloc(count*sizeof(struct hlist_head) + 63 eb = kzalloc(count*sizeof(struct hlist_head) +
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 32a3693905ec..1ce45a0a2d3e 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -45,6 +45,9 @@
45 45
46struct intel_crt { 46struct intel_crt {
47 struct intel_encoder base; 47 struct intel_encoder base;
48 /* DPMS state is stored in the connector, which we need in the
49 * encoder's enable/disable callbacks */
50 struct intel_connector *connector;
48 bool force_hotplug_required; 51 bool force_hotplug_required;
49 u32 adpa_reg; 52 u32 adpa_reg;
50}; 53};
@@ -81,29 +84,6 @@ static bool intel_crt_get_hw_state(struct intel_encoder *encoder,
81 return true; 84 return true;
82} 85}
83 86
84static void intel_disable_crt(struct intel_encoder *encoder)
85{
86 struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
87 struct intel_crt *crt = intel_encoder_to_crt(encoder);
88 u32 temp;
89
90 temp = I915_READ(crt->adpa_reg);
91 temp |= ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE;
92 temp &= ~ADPA_DAC_ENABLE;
93 I915_WRITE(crt->adpa_reg, temp);
94}
95
96static void intel_enable_crt(struct intel_encoder *encoder)
97{
98 struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
99 struct intel_crt *crt = intel_encoder_to_crt(encoder);
100 u32 temp;
101
102 temp = I915_READ(crt->adpa_reg);
103 temp |= ADPA_DAC_ENABLE;
104 I915_WRITE(crt->adpa_reg, temp);
105}
106
107/* Note: The caller is required to filter out dpms modes not supported by the 87/* Note: The caller is required to filter out dpms modes not supported by the
108 * platform. */ 88 * platform. */
109static void intel_crt_set_dpms(struct intel_encoder *encoder, int mode) 89static void intel_crt_set_dpms(struct intel_encoder *encoder, int mode)
@@ -135,6 +115,19 @@ static void intel_crt_set_dpms(struct intel_encoder *encoder, int mode)
135 I915_WRITE(crt->adpa_reg, temp); 115 I915_WRITE(crt->adpa_reg, temp);
136} 116}
137 117
118static void intel_disable_crt(struct intel_encoder *encoder)
119{
120 intel_crt_set_dpms(encoder, DRM_MODE_DPMS_OFF);
121}
122
123static void intel_enable_crt(struct intel_encoder *encoder)
124{
125 struct intel_crt *crt = intel_encoder_to_crt(encoder);
126
127 intel_crt_set_dpms(encoder, crt->connector->base.dpms);
128}
129
130
138static void intel_crt_dpms(struct drm_connector *connector, int mode) 131static void intel_crt_dpms(struct drm_connector *connector, int mode)
139{ 132{
140 struct drm_device *dev = connector->dev; 133 struct drm_device *dev = connector->dev;
@@ -746,6 +739,7 @@ void intel_crt_init(struct drm_device *dev)
746 } 739 }
747 740
748 connector = &intel_connector->base; 741 connector = &intel_connector->base;
742 crt->connector = intel_connector;
749 drm_connector_init(dev, &intel_connector->base, 743 drm_connector_init(dev, &intel_connector->base,
750 &intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA); 744 &intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA);
751 745
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 287b42c9d1a8..b20d50192fcc 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5771,6 +5771,11 @@ static int haswell_crtc_mode_set(struct drm_crtc *crtc,
5771 num_connectors++; 5771 num_connectors++;
5772 } 5772 }
5773 5773
5774 if (is_cpu_edp)
5775 intel_crtc->cpu_transcoder = TRANSCODER_EDP;
5776 else
5777 intel_crtc->cpu_transcoder = pipe;
5778
5774 /* We are not sure yet this won't happen. */ 5779 /* We are not sure yet this won't happen. */
5775 WARN(!HAS_PCH_LPT(dev), "Unexpected PCH type %d\n", 5780 WARN(!HAS_PCH_LPT(dev), "Unexpected PCH type %d\n",
5776 INTEL_PCH_TYPE(dev)); 5781 INTEL_PCH_TYPE(dev));
@@ -5837,11 +5842,6 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
5837 int pipe = intel_crtc->pipe; 5842 int pipe = intel_crtc->pipe;
5838 int ret; 5843 int ret;
5839 5844
5840 if (IS_HASWELL(dev) && intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP))
5841 intel_crtc->cpu_transcoder = TRANSCODER_EDP;
5842 else
5843 intel_crtc->cpu_transcoder = pipe;
5844
5845 drm_vblank_pre_modeset(dev, pipe); 5845 drm_vblank_pre_modeset(dev, pipe);
5846 5846
5847 ret = dev_priv->display.crtc_mode_set(crtc, mode, adjusted_mode, 5847 ret = dev_priv->display.crtc_mode_set(crtc, mode, adjusted_mode,
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index d7d4afe01341..c3f5bd8a5077 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -2028,7 +2028,7 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp)
2028 } 2028 }
2029 2029
2030 if (channel_eq) 2030 if (channel_eq)
2031 DRM_DEBUG_KMS("Channel EQ done. DP Training successfull\n"); 2031 DRM_DEBUG_KMS("Channel EQ done. DP Training successful\n");
2032 2032
2033 intel_dp_set_link_train(intel_dp, DP, DP_TRAINING_PATTERN_DISABLE); 2033 intel_dp_set_link_train(intel_dp, DP, DP_TRAINING_PATTERN_DISABLE);
2034} 2034}
@@ -2559,12 +2559,15 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder)
2559{ 2559{
2560 struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder); 2560 struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
2561 struct intel_dp *intel_dp = &intel_dig_port->dp; 2561 struct intel_dp *intel_dp = &intel_dig_port->dp;
2562 struct drm_device *dev = intel_dp_to_dev(intel_dp);
2562 2563
2563 i2c_del_adapter(&intel_dp->adapter); 2564 i2c_del_adapter(&intel_dp->adapter);
2564 drm_encoder_cleanup(encoder); 2565 drm_encoder_cleanup(encoder);
2565 if (is_edp(intel_dp)) { 2566 if (is_edp(intel_dp)) {
2566 cancel_delayed_work_sync(&intel_dp->panel_vdd_work); 2567 cancel_delayed_work_sync(&intel_dp->panel_vdd_work);
2568 mutex_lock(&dev->mode_config.mutex);
2567 ironlake_panel_vdd_off_sync(intel_dp); 2569 ironlake_panel_vdd_off_sync(intel_dp);
2570 mutex_unlock(&dev->mode_config.mutex);
2568 } 2571 }
2569 kfree(intel_dig_port); 2572 kfree(intel_dig_port);
2570} 2573}
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index a3730e0289e5..bee8cb6108a7 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -321,9 +321,6 @@ void intel_panel_enable_backlight(struct drm_device *dev,
321 if (dev_priv->backlight_level == 0) 321 if (dev_priv->backlight_level == 0)
322 dev_priv->backlight_level = intel_panel_get_max_backlight(dev); 322 dev_priv->backlight_level = intel_panel_get_max_backlight(dev);
323 323
324 dev_priv->backlight_enabled = true;
325 intel_panel_actually_set_backlight(dev, dev_priv->backlight_level);
326
327 if (INTEL_INFO(dev)->gen >= 4) { 324 if (INTEL_INFO(dev)->gen >= 4) {
328 uint32_t reg, tmp; 325 uint32_t reg, tmp;
329 326
@@ -359,12 +356,12 @@ void intel_panel_enable_backlight(struct drm_device *dev,
359 } 356 }
360 357
361set_level: 358set_level:
362 /* Check the current backlight level and try to set again if it's zero. 359 /* Call below after setting BLC_PWM_CPU_CTL2 and BLC_PWM_PCH_CTL1.
363 * On some machines, BLC_PWM_CPU_CTL is cleared to zero automatically 360 * BLC_PWM_CPU_CTL may be cleared to zero automatically when these
364 * when BLC_PWM_CPU_CTL2 and BLC_PWM_PCH_CTL1 are written. 361 * registers are set.
365 */ 362 */
366 if (!intel_panel_get_backlight(dev)) 363 dev_priv->backlight_enabled = true;
367 intel_panel_actually_set_backlight(dev, dev_priv->backlight_level); 364 intel_panel_actually_set_backlight(dev, dev_priv->backlight_level);
368} 365}
369 366
370static void intel_panel_init_backlight(struct drm_device *dev) 367static void intel_panel_init_backlight(struct drm_device *dev)
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index a1794c6df1bf..adca00783e61 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -4079,6 +4079,9 @@ void intel_set_power_well(struct drm_device *dev, bool enable)
4079 if (!IS_HASWELL(dev)) 4079 if (!IS_HASWELL(dev))
4080 return; 4080 return;
4081 4081
4082 if (!i915_disable_power_well && !enable)
4083 return;
4084
4082 tmp = I915_READ(HSW_PWR_WELL_DRIVER); 4085 tmp = I915_READ(HSW_PWR_WELL_DRIVER);
4083 is_enabled = tmp & HSW_PWR_WELL_STATE; 4086 is_enabled = tmp & HSW_PWR_WELL_STATE;
4084 enable_requested = tmp & HSW_PWR_WELL_ENABLE; 4087 enable_requested = tmp & HSW_PWR_WELL_ENABLE;
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index d07a8cdf998e..78413ec623c9 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -451,7 +451,7 @@ static bool intel_sdvo_write_cmd(struct intel_sdvo *intel_sdvo, u8 cmd,
451 int i, ret = true; 451 int i, ret = true;
452 452
453 /* Would be simpler to allocate both in one go ? */ 453 /* Would be simpler to allocate both in one go ? */
454 buf = (u8 *)kzalloc(args_len * 2 + 2, GFP_KERNEL); 454 buf = kzalloc(args_len * 2 + 2, GFP_KERNEL);
455 if (!buf) 455 if (!buf)
456 return false; 456 return false;
457 457