aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_dp.c
diff options
context:
space:
mode:
authorPaulo Zanoni <paulo.r.zanoni@intel.com>2013-02-18 17:00:25 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-02-19 19:33:46 -0500
commit9ed35ab1dd286ed04adde8c988925f1eb149a38a (patch)
tree0248d71a64ce4c31dc07146d0e22c10988f588f4 /drivers/gpu/drm/i915/intel_dp.c
parentb90f517627f76640e0f6d2aa17f143dc10623a58 (diff)
drm/i915: add aux_ch_ctl_reg to struct intel_dp
This way we can remove some duplicated code and avoid more mistakes and regressions with these registers in the future. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_dp.c')
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c66
1 files changed, 21 insertions, 45 deletions
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 00bc79f03039..0e2750cf85ef 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -328,29 +328,10 @@ intel_dp_aux_wait_done(struct intel_dp *intel_dp, bool has_aux_irq)
328 struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); 328 struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
329 struct drm_device *dev = intel_dig_port->base.base.dev; 329 struct drm_device *dev = intel_dig_port->base.base.dev;
330 struct drm_i915_private *dev_priv = dev->dev_private; 330 struct drm_i915_private *dev_priv = dev->dev_private;
331 uint32_t ch_ctl = intel_dp->output_reg + 0x10; 331 uint32_t ch_ctl = intel_dp->aux_ch_ctl_reg;
332 uint32_t status; 332 uint32_t status;
333 bool done; 333 bool done;
334 334
335 if (HAS_DDI(dev)) {
336 switch (intel_dig_port->port) {
337 case PORT_A:
338 ch_ctl = DPA_AUX_CH_CTL;
339 break;
340 case PORT_B:
341 ch_ctl = PCH_DPB_AUX_CH_CTL;
342 break;
343 case PORT_C:
344 ch_ctl = PCH_DPC_AUX_CH_CTL;
345 break;
346 case PORT_D:
347 ch_ctl = PCH_DPD_AUX_CH_CTL;
348 break;
349 default:
350 BUG();
351 }
352 }
353
354#define C (((status = I915_READ_NOTRACE(ch_ctl)) & DP_AUX_CH_CTL_SEND_BUSY) == 0) 335#define C (((status = I915_READ_NOTRACE(ch_ctl)) & DP_AUX_CH_CTL_SEND_BUSY) == 0)
355 if (has_aux_irq) 336 if (has_aux_irq)
356 done = wait_event_timeout(dev_priv->gmbus_wait_queue, C, 337 done = wait_event_timeout(dev_priv->gmbus_wait_queue, C,
@@ -370,11 +351,10 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
370 uint8_t *send, int send_bytes, 351 uint8_t *send, int send_bytes,
371 uint8_t *recv, int recv_size) 352 uint8_t *recv, int recv_size)
372{ 353{
373 uint32_t output_reg = intel_dp->output_reg;
374 struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); 354 struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
375 struct drm_device *dev = intel_dig_port->base.base.dev; 355 struct drm_device *dev = intel_dig_port->base.base.dev;
376 struct drm_i915_private *dev_priv = dev->dev_private; 356 struct drm_i915_private *dev_priv = dev->dev_private;
377 uint32_t ch_ctl = output_reg + 0x10; 357 uint32_t ch_ctl = intel_dp->aux_ch_ctl_reg;
378 uint32_t ch_data = ch_ctl + 4; 358 uint32_t ch_data = ch_ctl + 4;
379 int i, ret, recv_bytes; 359 int i, ret, recv_bytes;
380 uint32_t status; 360 uint32_t status;
@@ -388,29 +368,6 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
388 */ 368 */
389 pm_qos_update_request(&dev_priv->pm_qos, 0); 369 pm_qos_update_request(&dev_priv->pm_qos, 0);
390 370
391 if (HAS_DDI(dev)) {
392 switch (intel_dig_port->port) {
393 case PORT_A:
394 ch_ctl = DPA_AUX_CH_CTL;
395 ch_data = DPA_AUX_CH_DATA1;
396 break;
397 case PORT_B:
398 ch_ctl = PCH_DPB_AUX_CH_CTL;
399 ch_data = PCH_DPB_AUX_CH_DATA1;
400 break;
401 case PORT_C:
402 ch_ctl = PCH_DPC_AUX_CH_CTL;
403 ch_data = PCH_DPC_AUX_CH_DATA1;
404 break;
405 case PORT_D:
406 ch_ctl = PCH_DPD_AUX_CH_CTL;
407 ch_data = PCH_DPD_AUX_CH_DATA1;
408 break;
409 default:
410 BUG();
411 }
412 }
413
414 intel_dp_check_edp(intel_dp); 371 intel_dp_check_edp(intel_dp);
415 /* The clock divider is based off the hrawclk, 372 /* The clock divider is based off the hrawclk,
416 * and would like to run at 2MHz. So, take the 373 * and would like to run at 2MHz. So, take the
@@ -2832,6 +2789,25 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
2832 else 2789 else
2833 intel_connector->get_hw_state = intel_connector_get_hw_state; 2790 intel_connector->get_hw_state = intel_connector_get_hw_state;
2834 2791
2792 intel_dp->aux_ch_ctl_reg = intel_dp->output_reg + 0x10;
2793 if (HAS_DDI(dev)) {
2794 switch (intel_dig_port->port) {
2795 case PORT_A:
2796 intel_dp->aux_ch_ctl_reg = DPA_AUX_CH_CTL;
2797 break;
2798 case PORT_B:
2799 intel_dp->aux_ch_ctl_reg = PCH_DPB_AUX_CH_CTL;
2800 break;
2801 case PORT_C:
2802 intel_dp->aux_ch_ctl_reg = PCH_DPC_AUX_CH_CTL;
2803 break;
2804 case PORT_D:
2805 intel_dp->aux_ch_ctl_reg = PCH_DPD_AUX_CH_CTL;
2806 break;
2807 default:
2808 BUG();
2809 }
2810 }
2835 2811
2836 /* Set up the DDC bus. */ 2812 /* Set up the DDC bus. */
2837 switch (port) { 2813 switch (port) {