aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorChon Ming Lee <chon.ming.lee@intel.com>2013-11-06 01:36:35 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-11-11 04:57:45 -0500
commite4607fcfb1cd5d869425e190a85f841fc910c4ca (patch)
tree6b7b542956709d4d656e8ed435fec3e0007c8cdf /drivers/gpu/drm
parent00fe639a56b40930bf27eabeef9a826344d8f4c4 (diff)
drm/i915/vlv: Make the vlv_dpio_read/vlv_dpio_write more PHY centric
vlv_dpio_read/write should be describe more in PHY centric instead of display controller centric. Create a enum dpio_channel for channel index and enum dpio_phy for PHY index. This should better to gather for upcoming platform. v2: Rebase the code based on drm/i915/vlv: Fix typo in the DPIO register define. v3: Rename vlv_phy to dpio_phy_iosf_port and define additional macro DPIO_PHY, and remove unrelated change. (Ville) Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Chon Ming Lee <chon.ming.lee@intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h13
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h3
-rw-r--r--drivers/gpu/drm/i915/intel_display.c16
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c8
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h7
-rw-r--r--drivers/gpu/drm/i915/intel_hdmi.c8
-rw-r--r--drivers/gpu/drm/i915/intel_sideband.c13
7 files changed, 42 insertions, 26 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index efca30dc6c57..c546316ac649 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -88,6 +88,18 @@ enum port {
88}; 88};
89#define port_name(p) ((p) + 'A') 89#define port_name(p) ((p) + 'A')
90 90
91#define I915_NUM_PHYS_VLV 1
92
93enum dpio_channel {
94 DPIO_CH0,
95 DPIO_CH1
96};
97
98enum dpio_phy {
99 DPIO_PHY0,
100 DPIO_PHY1
101};
102
91enum intel_display_power_domain { 103enum intel_display_power_domain {
92 POWER_DOMAIN_PIPE_A, 104 POWER_DOMAIN_PIPE_A,
93 POWER_DOMAIN_PIPE_B, 105 POWER_DOMAIN_PIPE_B,
@@ -1403,6 +1415,7 @@ typedef struct drm_i915_private {
1403 int num_shared_dpll; 1415 int num_shared_dpll;
1404 struct intel_shared_dpll shared_dplls[I915_NUM_PLLS]; 1416 struct intel_shared_dpll shared_dplls[I915_NUM_PLLS];
1405 struct intel_ddi_plls ddi_plls; 1417 struct intel_ddi_plls ddi_plls;
1418 int dpio_phy_iosf_port[I915_NUM_PHYS_VLV];
1406 1419
1407 /* Reclocking support */ 1420 /* Reclocking support */
1408 bool render_reclock_avail; 1421 bool render_reclock_avail;
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 29265638bf56..a8a5bcb521c7 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -452,6 +452,9 @@
452#define DPIO_SFR_BYPASS (1<<1) 452#define DPIO_SFR_BYPASS (1<<1)
453#define DPIO_CMNRST (1<<0) 453#define DPIO_CMNRST (1<<0)
454 454
455#define DPIO_PHY(pipe) ((pipe) >> 1)
456#define DPIO_PHY_IOSF_PORT(phy) (dev_priv->dpio_phy_iosf_port[phy])
457
455/* 458/*
456 * Per pipe/PLL DPIO regs 459 * Per pipe/PLL DPIO regs
457 */ 460 */
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index abf509ce5e26..752d83019f36 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1361,6 +1361,7 @@ static void intel_init_dpio(struct drm_device *dev)
1361 if (!IS_VALLEYVIEW(dev)) 1361 if (!IS_VALLEYVIEW(dev))
1362 return; 1362 return;
1363 1363
1364 DPIO_PHY_IOSF_PORT(DPIO_PHY0) = IOSF_PORT_DPIO;
1364 /* 1365 /*
1365 * From VLV2A0_DP_eDP_DPIO_driver_vbios_notes_10.docx - 1366 * From VLV2A0_DP_eDP_DPIO_driver_vbios_notes_10.docx -
1366 * 6. De-assert cmn_reset/side_reset. Same as VLV X0. 1367 * 6. De-assert cmn_reset/side_reset. Same as VLV X0.
@@ -1494,18 +1495,25 @@ static void vlv_disable_pll(struct drm_i915_private *dev_priv, enum pipe pipe)
1494 POSTING_READ(DPLL(pipe)); 1495 POSTING_READ(DPLL(pipe));
1495} 1496}
1496 1497
1497void vlv_wait_port_ready(struct drm_i915_private *dev_priv, int port) 1498void vlv_wait_port_ready(struct drm_i915_private *dev_priv,
1499 struct intel_digital_port *dport)
1498{ 1500{
1499 u32 port_mask; 1501 u32 port_mask;
1500 1502
1501 if (!port) 1503 switch (dport->port) {
1504 case PORT_B:
1502 port_mask = DPLL_PORTB_READY_MASK; 1505 port_mask = DPLL_PORTB_READY_MASK;
1503 else 1506 break;
1507 case PORT_C:
1504 port_mask = DPLL_PORTC_READY_MASK; 1508 port_mask = DPLL_PORTC_READY_MASK;
1509 break;
1510 default:
1511 BUG();
1512 }
1505 1513
1506 if (wait_for((I915_READ(DPLL(0)) & port_mask) == 0, 1000)) 1514 if (wait_for((I915_READ(DPLL(0)) & port_mask) == 0, 1000))
1507 WARN(1, "timed out waiting for port %c ready: 0x%08x\n", 1515 WARN(1, "timed out waiting for port %c ready: 0x%08x\n",
1508 'B' + port, I915_READ(DPLL(0))); 1516 'B' + dport->port, I915_READ(DPLL(0)));
1509} 1517}
1510 1518
1511/** 1519/**
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 2584eb4bbf0b..34d605762a60 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1839,7 +1839,7 @@ static void vlv_pre_enable_dp(struct intel_encoder *encoder)
1839 struct drm_device *dev = encoder->base.dev; 1839 struct drm_device *dev = encoder->base.dev;
1840 struct drm_i915_private *dev_priv = dev->dev_private; 1840 struct drm_i915_private *dev_priv = dev->dev_private;
1841 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc); 1841 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
1842 int port = vlv_dport_to_channel(dport); 1842 enum dpio_channel port = vlv_dport_to_channel(dport);
1843 int pipe = intel_crtc->pipe; 1843 int pipe = intel_crtc->pipe;
1844 struct edp_power_seq power_seq; 1844 struct edp_power_seq power_seq;
1845 u32 val; 1845 u32 val;
@@ -1866,7 +1866,7 @@ static void vlv_pre_enable_dp(struct intel_encoder *encoder)
1866 1866
1867 intel_enable_dp(encoder); 1867 intel_enable_dp(encoder);
1868 1868
1869 vlv_wait_port_ready(dev_priv, port); 1869 vlv_wait_port_ready(dev_priv, dport);
1870} 1870}
1871 1871
1872static void vlv_dp_pre_pll_enable(struct intel_encoder *encoder) 1872static void vlv_dp_pre_pll_enable(struct intel_encoder *encoder)
@@ -1876,7 +1876,7 @@ static void vlv_dp_pre_pll_enable(struct intel_encoder *encoder)
1876 struct drm_i915_private *dev_priv = dev->dev_private; 1876 struct drm_i915_private *dev_priv = dev->dev_private;
1877 struct intel_crtc *intel_crtc = 1877 struct intel_crtc *intel_crtc =
1878 to_intel_crtc(encoder->base.crtc); 1878 to_intel_crtc(encoder->base.crtc);
1879 int port = vlv_dport_to_channel(dport); 1879 enum dpio_channel port = vlv_dport_to_channel(dport);
1880 int pipe = intel_crtc->pipe; 1880 int pipe = intel_crtc->pipe;
1881 1881
1882 /* Program Tx lane resets to default */ 1882 /* Program Tx lane resets to default */
@@ -2033,7 +2033,7 @@ static uint32_t intel_vlv_signal_levels(struct intel_dp *intel_dp)
2033 unsigned long demph_reg_value, preemph_reg_value, 2033 unsigned long demph_reg_value, preemph_reg_value,
2034 uniqtranscale_reg_value; 2034 uniqtranscale_reg_value;
2035 uint8_t train_set = intel_dp->train_set[0]; 2035 uint8_t train_set = intel_dp->train_set[0];
2036 int port = vlv_dport_to_channel(dport); 2036 enum dpio_channel port = vlv_dport_to_channel(dport);
2037 int pipe = intel_crtc->pipe; 2037 int pipe = intel_crtc->pipe;
2038 2038
2039 switch (train_set & DP_TRAIN_PRE_EMPHASIS_MASK) { 2039 switch (train_set & DP_TRAIN_PRE_EMPHASIS_MASK) {
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 6d701e79b611..9134a5464dd5 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -490,9 +490,9 @@ vlv_dport_to_channel(struct intel_digital_port *dport)
490{ 490{
491 switch (dport->port) { 491 switch (dport->port) {
492 case PORT_B: 492 case PORT_B:
493 return 0; 493 return DPIO_CH0;
494 case PORT_C: 494 case PORT_C:
495 return 1; 495 return DPIO_CH1;
496 default: 496 default:
497 BUG(); 497 BUG();
498 } 498 }
@@ -637,7 +637,8 @@ enum transcoder intel_pipe_to_cpu_transcoder(struct drm_i915_private *dev_priv,
637void intel_wait_for_vblank(struct drm_device *dev, int pipe); 637void intel_wait_for_vblank(struct drm_device *dev, int pipe);
638void intel_wait_for_pipe_off(struct drm_device *dev, int pipe); 638void intel_wait_for_pipe_off(struct drm_device *dev, int pipe);
639int ironlake_get_lanes_required(int target_clock, int link_bw, int bpp); 639int ironlake_get_lanes_required(int target_clock, int link_bw, int bpp);
640void vlv_wait_port_ready(struct drm_i915_private *dev_priv, int port); 640void vlv_wait_port_ready(struct drm_i915_private *dev_priv,
641 struct intel_digital_port *dport);
641bool intel_get_load_detect_pipe(struct drm_connector *connector, 642bool intel_get_load_detect_pipe(struct drm_connector *connector,
642 struct drm_display_mode *mode, 643 struct drm_display_mode *mode,
643 struct intel_load_detect_pipe *old); 644 struct intel_load_detect_pipe *old);
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 5b9143fc9b5a..61cff670ff3f 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1081,7 +1081,7 @@ static void vlv_hdmi_pre_enable(struct intel_encoder *encoder)
1081 struct drm_i915_private *dev_priv = dev->dev_private; 1081 struct drm_i915_private *dev_priv = dev->dev_private;
1082 struct intel_crtc *intel_crtc = 1082 struct intel_crtc *intel_crtc =
1083 to_intel_crtc(encoder->base.crtc); 1083 to_intel_crtc(encoder->base.crtc);
1084 int port = vlv_dport_to_channel(dport); 1084 enum dpio_channel port = vlv_dport_to_channel(dport);
1085 int pipe = intel_crtc->pipe; 1085 int pipe = intel_crtc->pipe;
1086 u32 val; 1086 u32 val;
1087 1087
@@ -1116,7 +1116,7 @@ static void vlv_hdmi_pre_enable(struct intel_encoder *encoder)
1116 1116
1117 intel_enable_hdmi(encoder); 1117 intel_enable_hdmi(encoder);
1118 1118
1119 vlv_wait_port_ready(dev_priv, port); 1119 vlv_wait_port_ready(dev_priv, dport);
1120} 1120}
1121 1121
1122static void vlv_hdmi_pre_pll_enable(struct intel_encoder *encoder) 1122static void vlv_hdmi_pre_pll_enable(struct intel_encoder *encoder)
@@ -1126,7 +1126,7 @@ static void vlv_hdmi_pre_pll_enable(struct intel_encoder *encoder)
1126 struct drm_i915_private *dev_priv = dev->dev_private; 1126 struct drm_i915_private *dev_priv = dev->dev_private;
1127 struct intel_crtc *intel_crtc = 1127 struct intel_crtc *intel_crtc =
1128 to_intel_crtc(encoder->base.crtc); 1128 to_intel_crtc(encoder->base.crtc);
1129 int port = vlv_dport_to_channel(dport); 1129 enum dpio_channel port = vlv_dport_to_channel(dport);
1130 int pipe = intel_crtc->pipe; 1130 int pipe = intel_crtc->pipe;
1131 1131
1132 if (!IS_VALLEYVIEW(dev)) 1132 if (!IS_VALLEYVIEW(dev))
@@ -1159,7 +1159,7 @@ static void vlv_hdmi_post_disable(struct intel_encoder *encoder)
1159 struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; 1159 struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
1160 struct intel_crtc *intel_crtc = 1160 struct intel_crtc *intel_crtc =
1161 to_intel_crtc(encoder->base.crtc); 1161 to_intel_crtc(encoder->base.crtc);
1162 int port = vlv_dport_to_channel(dport); 1162 enum dpio_channel port = vlv_dport_to_channel(dport);
1163 int pipe = intel_crtc->pipe; 1163 int pipe = intel_crtc->pipe;
1164 1164
1165 /* Reset lanes to avoid HDMI flicker (VLV w/a) */ 1165 /* Reset lanes to avoid HDMI flicker (VLV w/a) */
diff --git a/drivers/gpu/drm/i915/intel_sideband.c b/drivers/gpu/drm/i915/intel_sideband.c
index d43e457b6961..cc6fbcde7d3d 100644
--- a/drivers/gpu/drm/i915/intel_sideband.c
+++ b/drivers/gpu/drm/i915/intel_sideband.c
@@ -176,27 +176,18 @@ void vlv_gps_core_write(struct drm_i915_private *dev_priv, u32 reg, u32 val)
176 PUNIT_OPCODE_REG_WRITE, reg, &val); 176 PUNIT_OPCODE_REG_WRITE, reg, &val);
177} 177}
178 178
179static u32 vlv_get_phy_port(enum pipe pipe)
180{
181 u32 port = IOSF_PORT_DPIO;
182
183 WARN_ON ((pipe != PIPE_A) && (pipe != PIPE_B));
184
185 return port;
186}
187
188u32 vlv_dpio_read(struct drm_i915_private *dev_priv, enum pipe pipe, int reg) 179u32 vlv_dpio_read(struct drm_i915_private *dev_priv, enum pipe pipe, int reg)
189{ 180{
190 u32 val = 0; 181 u32 val = 0;
191 182
192 vlv_sideband_rw(dev_priv, DPIO_DEVFN, vlv_get_phy_port(pipe), 183 vlv_sideband_rw(dev_priv, DPIO_DEVFN, DPIO_PHY_IOSF_PORT(DPIO_PHY(pipe)),
193 DPIO_OPCODE_REG_READ, reg, &val); 184 DPIO_OPCODE_REG_READ, reg, &val);
194 return val; 185 return val;
195} 186}
196 187
197void vlv_dpio_write(struct drm_i915_private *dev_priv, enum pipe pipe, int reg, u32 val) 188void vlv_dpio_write(struct drm_i915_private *dev_priv, enum pipe pipe, int reg, u32 val)
198{ 189{
199 vlv_sideband_rw(dev_priv, DPIO_DEVFN, vlv_get_phy_port(pipe), 190 vlv_sideband_rw(dev_priv, DPIO_DEVFN, DPIO_PHY_IOSF_PORT(DPIO_PHY(pipe)),
200 DPIO_OPCODE_REG_WRITE, reg, &val); 191 DPIO_OPCODE_REG_WRITE, reg, &val);
201} 192}
202 193