Commit 0b9c9290 authored by Sean Paul's avatar Sean Paul Committed by Ramalingam C

drm/i915: Use the cpu_transcoder in intel_hdcp to toggle HDCP signalling

Instead of using intel_dig_port's encoder pipe to determine which
transcoder to toggle signalling on, use the cpu_transcoder field already
stored in intel_hdmi.

This is particularly important for MST.
Suggested-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarRamalingam C <ramalingam.c@intel.com>
Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20191212190230.188505-6-sean@poorly.run #v2
Link: https://patchwork.freedesktop.org/patch/msgid/20200117193103.156821-6-sean@poorly.run #v3
Link: https://patchwork.freedesktop.org/patch/msgid/20200218220242.107265-6-sean@poorly.run #v4
Link: https://patchwork.freedesktop.org/patch/msgid/20200305201236.152307-6-sean@poorly.run #v5
Link: https://patchwork.freedesktop.org/patch/msgid/20200429195502.39919-6-sean@poorly.run #v6
Link: https://patchwork.freedesktop.org/patch/msgid/20200623155907.22961-6-sean@poorly.run #v7

Changes in v2:
-Added to the set
Changes in v3:
-s/hdcp/hdmi/ in commit msg (Ram)
Changes in v4:
-Rebased on intel_de_(read|write) change
Changes in v5:
-Update hdcp->cpu_transcoder in intel_hdcp_enable so it works with pipe != 0
Changes in v6:
-None
Changes in v7:
-None
Changes in v8:
-None
Signed-off-by: default avatarRamalingam C <ramalingam.c@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200818153910.27894-6-sean@poorly.run
parent 58418f0c
...@@ -1850,12 +1850,12 @@ void intel_ddi_disable_transcoder_func(const struct intel_crtc_state *crtc_state ...@@ -1850,12 +1850,12 @@ void intel_ddi_disable_transcoder_func(const struct intel_crtc_state *crtc_state
} }
int intel_ddi_toggle_hdcp_signalling(struct intel_encoder *intel_encoder, int intel_ddi_toggle_hdcp_signalling(struct intel_encoder *intel_encoder,
enum transcoder cpu_transcoder,
bool enable) bool enable)
{ {
struct drm_device *dev = intel_encoder->base.dev; struct drm_device *dev = intel_encoder->base.dev;
struct drm_i915_private *dev_priv = to_i915(dev); struct drm_i915_private *dev_priv = to_i915(dev);
intel_wakeref_t wakeref; intel_wakeref_t wakeref;
enum pipe pipe = 0;
int ret = 0; int ret = 0;
u32 tmp; u32 tmp;
...@@ -1864,19 +1864,12 @@ int intel_ddi_toggle_hdcp_signalling(struct intel_encoder *intel_encoder, ...@@ -1864,19 +1864,12 @@ int intel_ddi_toggle_hdcp_signalling(struct intel_encoder *intel_encoder,
if (drm_WARN_ON(dev, !wakeref)) if (drm_WARN_ON(dev, !wakeref))
return -ENXIO; return -ENXIO;
if (drm_WARN_ON(dev, tmp = intel_de_read(dev_priv, TRANS_DDI_FUNC_CTL(cpu_transcoder));
!intel_encoder->get_hw_state(intel_encoder, &pipe))) {
ret = -EIO;
goto out;
}
tmp = intel_de_read(dev_priv, TRANS_DDI_FUNC_CTL(pipe));
if (enable) if (enable)
tmp |= TRANS_DDI_HDCP_SIGNALLING; tmp |= TRANS_DDI_HDCP_SIGNALLING;
else else
tmp &= ~TRANS_DDI_HDCP_SIGNALLING; tmp &= ~TRANS_DDI_HDCP_SIGNALLING;
intel_de_write(dev_priv, TRANS_DDI_FUNC_CTL(pipe), tmp); intel_de_write(dev_priv, TRANS_DDI_FUNC_CTL(cpu_transcoder), tmp);
out:
intel_display_power_put(dev_priv, intel_encoder->power_domain, wakeref); intel_display_power_put(dev_priv, intel_encoder->power_domain, wakeref);
return ret; return ret;
} }
......
...@@ -16,6 +16,7 @@ struct intel_crtc_state; ...@@ -16,6 +16,7 @@ struct intel_crtc_state;
struct intel_dp; struct intel_dp;
struct intel_dpll_hw_state; struct intel_dpll_hw_state;
struct intel_encoder; struct intel_encoder;
enum transcoder;
void intel_ddi_fdi_post_disable(struct intel_atomic_state *state, void intel_ddi_fdi_post_disable(struct intel_atomic_state *state,
struct intel_encoder *intel_encoder, struct intel_encoder *intel_encoder,
...@@ -43,6 +44,7 @@ void intel_ddi_compute_min_voltage_level(struct drm_i915_private *dev_priv, ...@@ -43,6 +44,7 @@ void intel_ddi_compute_min_voltage_level(struct drm_i915_private *dev_priv,
u32 bxt_signal_levels(struct intel_dp *intel_dp); u32 bxt_signal_levels(struct intel_dp *intel_dp);
u32 ddi_signal_levels(struct intel_dp *intel_dp); u32 ddi_signal_levels(struct intel_dp *intel_dp);
int intel_ddi_toggle_hdcp_signalling(struct intel_encoder *intel_encoder, int intel_ddi_toggle_hdcp_signalling(struct intel_encoder *intel_encoder,
enum transcoder cpu_transcoder,
bool enable); bool enable);
void icl_sanitize_encoder_pll_mapping(struct intel_encoder *encoder); void icl_sanitize_encoder_pll_mapping(struct intel_encoder *encoder);
......
...@@ -314,6 +314,7 @@ struct intel_hdcp_shim { ...@@ -314,6 +314,7 @@ struct intel_hdcp_shim {
/* Enables HDCP signalling on the port */ /* Enables HDCP signalling on the port */
int (*toggle_signalling)(struct intel_digital_port *dig_port, int (*toggle_signalling)(struct intel_digital_port *dig_port,
enum transcoder cpu_transcoder,
bool enable); bool enable);
/* Ensures the link is still protected */ /* Ensures the link is still protected */
......
...@@ -6616,6 +6616,7 @@ int intel_dp_hdcp_read_v_prime_part(struct intel_digital_port *dig_port, ...@@ -6616,6 +6616,7 @@ int intel_dp_hdcp_read_v_prime_part(struct intel_digital_port *dig_port,
static static
int intel_dp_hdcp_toggle_signalling(struct intel_digital_port *dig_port, int intel_dp_hdcp_toggle_signalling(struct intel_digital_port *dig_port,
enum transcoder cpu_transcoder,
bool enable) bool enable)
{ {
/* Not used for single stream DisplayPort setups */ /* Not used for single stream DisplayPort setups */
......
...@@ -704,7 +704,7 @@ static int intel_hdcp_auth(struct intel_connector *connector) ...@@ -704,7 +704,7 @@ static int intel_hdcp_auth(struct intel_connector *connector)
intel_de_write(dev_priv, HDCP_REP_CTL, intel_de_write(dev_priv, HDCP_REP_CTL,
intel_hdcp_get_repeater_ctl(dev_priv, cpu_transcoder, port)); intel_hdcp_get_repeater_ctl(dev_priv, cpu_transcoder, port));
ret = shim->toggle_signalling(dig_port, true); ret = shim->toggle_signalling(dig_port, cpu_transcoder, true);
if (ret) if (ret)
return ret; return ret;
...@@ -807,7 +807,7 @@ static int _intel_hdcp_disable(struct intel_connector *connector) ...@@ -807,7 +807,7 @@ static int _intel_hdcp_disable(struct intel_connector *connector)
intel_de_write(dev_priv, HDCP_REP_CTL, intel_de_write(dev_priv, HDCP_REP_CTL,
intel_de_read(dev_priv, HDCP_REP_CTL) & ~repeater_ctl); intel_de_read(dev_priv, HDCP_REP_CTL) & ~repeater_ctl);
ret = hdcp->shim->toggle_signalling(dig_port, false); ret = hdcp->shim->toggle_signalling(dig_port, cpu_transcoder, false);
if (ret) { if (ret) {
drm_err(&dev_priv->drm, "Failed to disable HDCP signalling\n"); drm_err(&dev_priv->drm, "Failed to disable HDCP signalling\n");
return ret; return ret;
...@@ -1591,7 +1591,8 @@ static int hdcp2_enable_encryption(struct intel_connector *connector) ...@@ -1591,7 +1591,8 @@ static int hdcp2_enable_encryption(struct intel_connector *connector)
intel_de_read(dev_priv, HDCP2_STATUS(dev_priv, cpu_transcoder, port)) & intel_de_read(dev_priv, HDCP2_STATUS(dev_priv, cpu_transcoder, port)) &
LINK_ENCRYPTION_STATUS); LINK_ENCRYPTION_STATUS);
if (hdcp->shim->toggle_signalling) { if (hdcp->shim->toggle_signalling) {
ret = hdcp->shim->toggle_signalling(dig_port, true); ret = hdcp->shim->toggle_signalling(dig_port, cpu_transcoder,
true);
if (ret) { if (ret) {
drm_err(&dev_priv->drm, drm_err(&dev_priv->drm,
"Failed to enable HDCP signalling. %d\n", "Failed to enable HDCP signalling. %d\n",
...@@ -1641,7 +1642,8 @@ static int hdcp2_disable_encryption(struct intel_connector *connector) ...@@ -1641,7 +1642,8 @@ static int hdcp2_disable_encryption(struct intel_connector *connector)
drm_dbg_kms(&dev_priv->drm, "Disable Encryption Timedout"); drm_dbg_kms(&dev_priv->drm, "Disable Encryption Timedout");
if (hdcp->shim->toggle_signalling) { if (hdcp->shim->toggle_signalling) {
ret = hdcp->shim->toggle_signalling(dig_port, false); ret = hdcp->shim->toggle_signalling(dig_port, cpu_transcoder,
false);
if (ret) { if (ret) {
drm_err(&dev_priv->drm, drm_err(&dev_priv->drm,
"Failed to disable HDCP signalling. %d\n", "Failed to disable HDCP signalling. %d\n",
...@@ -2027,11 +2029,10 @@ int intel_hdcp_enable(struct intel_connector *connector, ...@@ -2027,11 +2029,10 @@ int intel_hdcp_enable(struct intel_connector *connector,
drm_WARN_ON(&dev_priv->drm, drm_WARN_ON(&dev_priv->drm,
hdcp->value == DRM_MODE_CONTENT_PROTECTION_ENABLED); hdcp->value == DRM_MODE_CONTENT_PROTECTION_ENABLED);
hdcp->content_type = content_type; hdcp->content_type = content_type;
hdcp->cpu_transcoder = cpu_transcoder;
if (INTEL_GEN(dev_priv) >= 12) { if (INTEL_GEN(dev_priv) >= 12)
hdcp->cpu_transcoder = cpu_transcoder;
hdcp->port_data.fw_tc = intel_get_mei_fw_tc(cpu_transcoder); hdcp->port_data.fw_tc = intel_get_mei_fw_tc(cpu_transcoder);
}
/* /*
* Considering that HDCP2.2 is more secure than HDCP1.4, If the setup * Considering that HDCP2.2 is more secure than HDCP1.4, If the setup
......
...@@ -1477,7 +1477,8 @@ int intel_hdmi_hdcp_read_v_prime_part(struct intel_digital_port *dig_port, ...@@ -1477,7 +1477,8 @@ int intel_hdmi_hdcp_read_v_prime_part(struct intel_digital_port *dig_port,
return ret; return ret;
} }
static int kbl_repositioning_enc_en_signal(struct intel_connector *connector) static int kbl_repositioning_enc_en_signal(struct intel_connector *connector,
enum transcoder cpu_transcoder)
{ {
struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
struct intel_digital_port *dig_port = intel_attached_dig_port(connector); struct intel_digital_port *dig_port = intel_attached_dig_port(connector);
...@@ -1494,13 +1495,15 @@ static int kbl_repositioning_enc_en_signal(struct intel_connector *connector) ...@@ -1494,13 +1495,15 @@ static int kbl_repositioning_enc_en_signal(struct intel_connector *connector)
usleep_range(25, 50); usleep_range(25, 50);
} }
ret = intel_ddi_toggle_hdcp_signalling(&dig_port->base, false); ret = intel_ddi_toggle_hdcp_signalling(&dig_port->base, cpu_transcoder,
false);
if (ret) { if (ret) {
drm_err(&dev_priv->drm, drm_err(&dev_priv->drm,
"Disable HDCP signalling failed (%d)\n", ret); "Disable HDCP signalling failed (%d)\n", ret);
return ret; return ret;
} }
ret = intel_ddi_toggle_hdcp_signalling(&dig_port->base, true); ret = intel_ddi_toggle_hdcp_signalling(&dig_port->base, cpu_transcoder,
true);
if (ret) { if (ret) {
drm_err(&dev_priv->drm, drm_err(&dev_priv->drm,
"Enable HDCP signalling failed (%d)\n", ret); "Enable HDCP signalling failed (%d)\n", ret);
...@@ -1512,6 +1515,7 @@ static int kbl_repositioning_enc_en_signal(struct intel_connector *connector) ...@@ -1512,6 +1515,7 @@ static int kbl_repositioning_enc_en_signal(struct intel_connector *connector)
static static
int intel_hdmi_hdcp_toggle_signalling(struct intel_digital_port *dig_port, int intel_hdmi_hdcp_toggle_signalling(struct intel_digital_port *dig_port,
enum transcoder cpu_transcoder,
bool enable) bool enable)
{ {
struct intel_hdmi *hdmi = &dig_port->hdmi; struct intel_hdmi *hdmi = &dig_port->hdmi;
...@@ -1522,7 +1526,8 @@ int intel_hdmi_hdcp_toggle_signalling(struct intel_digital_port *dig_port, ...@@ -1522,7 +1526,8 @@ int intel_hdmi_hdcp_toggle_signalling(struct intel_digital_port *dig_port,
if (!enable) if (!enable)
usleep_range(6, 60); /* Bspec says >= 6us */ usleep_range(6, 60); /* Bspec says >= 6us */
ret = intel_ddi_toggle_hdcp_signalling(&dig_port->base, enable); ret = intel_ddi_toggle_hdcp_signalling(&dig_port->base, cpu_transcoder,
enable);
if (ret) { if (ret) {
drm_err(&dev_priv->drm, "%s HDCP signalling failed (%d)\n", drm_err(&dev_priv->drm, "%s HDCP signalling failed (%d)\n",
enable ? "Enable" : "Disable", ret); enable ? "Enable" : "Disable", ret);
...@@ -1534,7 +1539,8 @@ int intel_hdmi_hdcp_toggle_signalling(struct intel_digital_port *dig_port, ...@@ -1534,7 +1539,8 @@ int intel_hdmi_hdcp_toggle_signalling(struct intel_digital_port *dig_port,
* opportunity and enc_en signalling in KABYLAKE. * opportunity and enc_en signalling in KABYLAKE.
*/ */
if (IS_KABYLAKE(dev_priv) && enable) if (IS_KABYLAKE(dev_priv) && enable)
return kbl_repositioning_enc_en_signal(connector); return kbl_repositioning_enc_en_signal(connector,
cpu_transcoder);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment