Skip to content

Commit b2ccb82

Browse files
committed
drm/i915: Enable/disable TMDS output buffers in DP++ adaptor as needed
To save a bit of power, let's try to turn off the TMDS output buffers in DP++ adaptors when we're not driving the port. v2: Let's not forget DDI, toss in a debug message while at it v3: Just do the TMDS output control based on adaptor type. With the helper getting passed the type, we wouldn't actually have to check at all in the driver, but the check eliminates the debug output more honest Cc: [email protected] Cc: Tore Anderson <[email protected]> Cc: Paulo Zanoni <[email protected]> Cc: Shashank Sharma <[email protected]> Cc: Daniel Vetter <[email protected]> Signed-off-by: Ville Syrjälä <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Reviewed-by: Shashank Sharma <[email protected]>
1 parent b1ba124 commit b2ccb82

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

drivers/gpu/drm/i915/intel_ddi.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,6 +1601,12 @@ static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)
16011601
enum port port = intel_ddi_get_encoder_port(intel_encoder);
16021602
int type = intel_encoder->type;
16031603

1604+
if (type == INTEL_OUTPUT_HDMI) {
1605+
struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
1606+
1607+
intel_dp_dual_mode_set_tmds_output(intel_hdmi, true);
1608+
}
1609+
16041610
intel_prepare_ddi_buffer(intel_encoder);
16051611

16061612
if (type == INTEL_OUTPUT_EDP) {
@@ -1667,6 +1673,12 @@ static void intel_ddi_post_disable(struct intel_encoder *intel_encoder)
16671673
DPLL_CTRL2_DDI_CLK_OFF(port)));
16681674
else if (INTEL_INFO(dev)->gen < 9)
16691675
I915_WRITE(PORT_CLK_SEL(port), PORT_CLK_SEL_NONE);
1676+
1677+
if (type == INTEL_OUTPUT_HDMI) {
1678+
struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
1679+
1680+
intel_dp_dual_mode_set_tmds_output(intel_hdmi, false);
1681+
}
16701682
}
16711683

16721684
static void intel_enable_ddi(struct intel_encoder *intel_encoder)

drivers/gpu/drm/i915/intel_drv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,6 +1417,7 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
14171417
struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder);
14181418
bool intel_hdmi_compute_config(struct intel_encoder *encoder,
14191419
struct intel_crtc_state *pipe_config);
1420+
void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable);
14201421

14211422

14221423
/* intel_lvds.c */

drivers/gpu/drm/i915/intel_hdmi.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,22 @@ static void hsw_set_infoframes(struct drm_encoder *encoder,
836836
intel_hdmi_set_hdmi_infoframe(encoder, adjusted_mode);
837837
}
838838

839+
void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable)
840+
{
841+
struct drm_i915_private *dev_priv = to_i915(intel_hdmi_to_dev(hdmi));
842+
struct i2c_adapter *adapter =
843+
intel_gmbus_get_adapter(dev_priv, hdmi->ddc_bus);
844+
845+
if (hdmi->dp_dual_mode.type < DRM_DP_DUAL_MODE_TYPE2_DVI)
846+
return;
847+
848+
DRM_DEBUG_KMS("%s DP dual mode adaptor TMDS output\n",
849+
enable ? "Enabling" : "Disabling");
850+
851+
drm_dp_dual_mode_set_tmds_output(hdmi->dp_dual_mode.type,
852+
adapter, enable);
853+
}
854+
839855
static void intel_hdmi_prepare(struct intel_encoder *encoder)
840856
{
841857
struct drm_device *dev = encoder->base.dev;
@@ -845,6 +861,8 @@ static void intel_hdmi_prepare(struct intel_encoder *encoder)
845861
const struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;
846862
u32 hdmi_val;
847863

864+
intel_dp_dual_mode_set_tmds_output(intel_hdmi, true);
865+
848866
hdmi_val = SDVO_ENCODING_HDMI;
849867
if (!HAS_PCH_SPLIT(dev) && crtc->config->limited_color_range)
850868
hdmi_val |= HDMI_COLOR_RANGE_16_235;
@@ -1142,6 +1160,8 @@ static void intel_disable_hdmi(struct intel_encoder *encoder)
11421160
}
11431161

11441162
intel_hdmi->set_infoframes(&encoder->base, false, NULL);
1163+
1164+
intel_dp_dual_mode_set_tmds_output(intel_hdmi, false);
11451165
}
11461166

11471167
static void g4x_disable_hdmi(struct intel_encoder *encoder)

0 commit comments

Comments
 (0)