diff options
author | Chon Ming Lee <chon.ming.lee@intel.com> | 2014-04-09 06:28:20 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-05-12 13:50:15 -0400 |
commit | e4a1d8467d9ecd793b10d7a49ae32a9f50886aec (patch) | |
tree | a18e09cddbfde22e53b4deb258e2734cb33e396a /drivers/gpu/drm/i915/intel_hdmi.c | |
parent | 9d556c99ed48ae9aa6e41cb5542f1735bc70c16e (diff) |
drm/i915/chv: Add phy supports for Cherryview
Added programming phy layer for CHV based on "Application note for 1273
CHV Display phy".
v2: Rebase the code and do some cleanup.
v3: Rework based on Ville review.
-Fix the macro where the ch info need to swap, and add parens to ?
operator.
-Fix wrong bit define for DPIO_PCS_SWING_CALC_0 and
DPIO_PCS_SWING_CALC_1 and rename for meaningful.
-Add some comments for CHV specific DPIO registers.
-Change the dp margin registery value to decimal to align with the
doc.
-Fix the not clearing some value in vlv_dpio_read before write again.
-Create new hdmi/dp encoder function for chv instead of share with
valleyview.
v4: Rebase the code after rename the DPIO registers define and upstream
change.
Based on Ville review.
-For unique transition scale selection, after Ville point out, look
like the doc might wrong for the bit 26. Use bit 27 for ch0 and
ch1.
-Break up some dpio write value into two/three steps for readability.
-Remove unrelated change.
-Add some shift define for some registers instead just give the hex
value.
-Fix a bug where write to wrong VLV_TX_DW3.
v5: Based on Ville review.
- Move tx lane latency optimal setting from chv_dp_pre_pll_enable to
chv_pre_enable_dp, and chv_hdmi_pre_pll_enable to
chv_hdmi_pre_enable respectively.
- Fix typo in one margin_reg_value for DP_TRAIN_VOLTAGE_SWING_400.
- Clear DPIO_TX_UNIQ_TRANS_SCALE_EN for DP and HDMI.
- Mask the old deemph and swing bits for hdmi.
v6: Remove stub for pre_pll_enable for dp and hdmi.
Signed-off-by: Chon Ming Lee <chon.ming.lee@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
[vsyrjala: Don't touch panel power sequencing on DP]
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_hdmi.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_hdmi.c | 84 |
1 files changed, 83 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index b606162cc17c..586cee04cc06 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c | |||
@@ -1224,6 +1224,85 @@ static void vlv_hdmi_post_disable(struct intel_encoder *encoder) | |||
1224 | mutex_unlock(&dev_priv->dpio_lock); | 1224 | mutex_unlock(&dev_priv->dpio_lock); |
1225 | } | 1225 | } |
1226 | 1226 | ||
1227 | static void chv_hdmi_pre_enable(struct intel_encoder *encoder) | ||
1228 | { | ||
1229 | struct intel_digital_port *dport = enc_to_dig_port(&encoder->base); | ||
1230 | struct drm_device *dev = encoder->base.dev; | ||
1231 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1232 | struct intel_crtc *intel_crtc = | ||
1233 | to_intel_crtc(encoder->base.crtc); | ||
1234 | enum dpio_channel ch = vlv_dport_to_channel(dport); | ||
1235 | int pipe = intel_crtc->pipe; | ||
1236 | int data, i; | ||
1237 | u32 val; | ||
1238 | |||
1239 | /* Program Tx latency optimal setting */ | ||
1240 | mutex_lock(&dev_priv->dpio_lock); | ||
1241 | for (i = 0; i < 4; i++) { | ||
1242 | /* Set the latency optimal bit */ | ||
1243 | data = (i == 1) ? 0x0 : 0x6; | ||
1244 | vlv_dpio_write(dev_priv, pipe, CHV_TX_DW11(ch, i), | ||
1245 | data << DPIO_FRC_LATENCY_SHFIT); | ||
1246 | |||
1247 | /* Set the upar bit */ | ||
1248 | data = (i == 1) ? 0x0 : 0x1; | ||
1249 | vlv_dpio_write(dev_priv, pipe, CHV_TX_DW14(ch, i), | ||
1250 | data << DPIO_UPAR_SHIFT); | ||
1251 | } | ||
1252 | |||
1253 | /* Data lane stagger programming */ | ||
1254 | /* FIXME: Fix up value only after power analysis */ | ||
1255 | |||
1256 | /* Clear calc init */ | ||
1257 | vlv_dpio_write(dev_priv, pipe, CHV_PCS_DW10(ch), 0); | ||
1258 | |||
1259 | /* FIXME: Program the support xxx V-dB */ | ||
1260 | /* Use 800mV-0dB */ | ||
1261 | val = vlv_dpio_read(dev_priv, pipe, VLV_TX_DW4(ch)); | ||
1262 | val &= ~DPIO_SWING_DEEMPH9P5_MASK; | ||
1263 | val |= 128 << DPIO_SWING_DEEMPH9P5_SHIFT; | ||
1264 | vlv_dpio_write(dev_priv, pipe, VLV_TX_DW4(ch), val); | ||
1265 | |||
1266 | val = vlv_dpio_read(dev_priv, pipe, VLV_TX_DW2(ch)); | ||
1267 | val &= ~DPIO_SWING_MARGIN_MASK; | ||
1268 | val |= 102 << DPIO_SWING_MARGIN_SHIFT; | ||
1269 | vlv_dpio_write(dev_priv, pipe, VLV_TX_DW2(ch), val); | ||
1270 | |||
1271 | /* Disable unique transition scale */ | ||
1272 | val = vlv_dpio_read(dev_priv, pipe, VLV_TX_DW3(ch)); | ||
1273 | val &= ~DPIO_TX_UNIQ_TRANS_SCALE_EN; | ||
1274 | vlv_dpio_write(dev_priv, pipe, VLV_TX_DW3(ch), val); | ||
1275 | |||
1276 | /* Additional steps for 1200mV-0dB */ | ||
1277 | #if 0 | ||
1278 | val = vlv_dpio_read(dev_priv, pipe, VLV_TX_DW3(ch)); | ||
1279 | if (ch) | ||
1280 | val |= DPIO_TX_UNIQ_TRANS_SCALE_CH1; | ||
1281 | else | ||
1282 | val |= DPIO_TX_UNIQ_TRANS_SCALE_CH0; | ||
1283 | vlv_dpio_write(dev_priv, pipe, VLV_TX_DW3(ch), val); | ||
1284 | |||
1285 | vlv_dpio_write(dev_priv, pipe, VLV_TX_DW2(ch), | ||
1286 | vlv_dpio_read(dev_priv, pipe, VLV_TX_DW2(ch)) | | ||
1287 | (0x9a << DPIO_UNIQ_TRANS_SCALE_SHIFT)); | ||
1288 | #endif | ||
1289 | /* Start swing calculation */ | ||
1290 | vlv_dpio_write(dev_priv, pipe, CHV_PCS_DW10(ch), | ||
1291 | DPIO_PCS_SWING_CALC_TX0_TX2 | | ||
1292 | DPIO_PCS_SWING_CALC_TX1_TX3); | ||
1293 | |||
1294 | /* LRC Bypass */ | ||
1295 | val = vlv_dpio_read(dev_priv, pipe, CHV_CMN_DW30); | ||
1296 | val |= DPIO_LRC_BYPASS; | ||
1297 | vlv_dpio_write(dev_priv, pipe, CHV_CMN_DW30, val); | ||
1298 | |||
1299 | mutex_unlock(&dev_priv->dpio_lock); | ||
1300 | |||
1301 | intel_enable_hdmi(encoder); | ||
1302 | |||
1303 | vlv_wait_port_ready(dev_priv, dport); | ||
1304 | } | ||
1305 | |||
1227 | static void intel_hdmi_destroy(struct drm_connector *connector) | 1306 | static void intel_hdmi_destroy(struct drm_connector *connector) |
1228 | { | 1307 | { |
1229 | drm_connector_cleanup(connector); | 1308 | drm_connector_cleanup(connector); |
@@ -1358,7 +1437,10 @@ void intel_hdmi_init(struct drm_device *dev, int hdmi_reg, enum port port) | |||
1358 | intel_encoder->disable = intel_disable_hdmi; | 1437 | intel_encoder->disable = intel_disable_hdmi; |
1359 | intel_encoder->get_hw_state = intel_hdmi_get_hw_state; | 1438 | intel_encoder->get_hw_state = intel_hdmi_get_hw_state; |
1360 | intel_encoder->get_config = intel_hdmi_get_config; | 1439 | intel_encoder->get_config = intel_hdmi_get_config; |
1361 | if (IS_VALLEYVIEW(dev)) { | 1440 | if (IS_CHERRYVIEW(dev)) { |
1441 | intel_encoder->pre_enable = chv_hdmi_pre_enable; | ||
1442 | intel_encoder->enable = vlv_enable_hdmi; | ||
1443 | } else if (IS_VALLEYVIEW(dev)) { | ||
1362 | intel_encoder->pre_pll_enable = vlv_hdmi_pre_pll_enable; | 1444 | intel_encoder->pre_pll_enable = vlv_hdmi_pre_pll_enable; |
1363 | intel_encoder->pre_enable = vlv_hdmi_pre_enable; | 1445 | intel_encoder->pre_enable = vlv_hdmi_pre_enable; |
1364 | intel_encoder->enable = vlv_enable_hdmi; | 1446 | intel_encoder->enable = vlv_enable_hdmi; |