Merge tag 'drm-intel-fixes-2020-09-03' of git://anongit.freedesktop.org/drm/drm-intel into drm-fixes

drm/i915 fixes for v5.9-rc4:
- Clang build warning fix
- HDCP fixes

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/87sgbz2pnx.fsf@intel.com
This commit is contained in:
Dave Airlie 2020-09-04 11:00:47 +10:00
commit 0f8aeef1a5
3 changed files with 32 additions and 9 deletions

View File

@ -258,7 +258,7 @@ static bool phy_is_master(struct drm_i915_private *dev_priv, enum phy phy)
static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv, static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv,
enum phy phy) enum phy phy)
{ {
bool ret; bool ret = true;
u32 expected_val = 0; u32 expected_val = 0;
if (!icl_combo_phy_enabled(dev_priv, phy)) if (!icl_combo_phy_enabled(dev_priv, phy))
@ -276,7 +276,7 @@ static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv,
DCC_MODE_SELECT_CONTINUOSLY); DCC_MODE_SELECT_CONTINUOSLY);
} }
ret = cnl_verify_procmon_ref_values(dev_priv, phy); ret &= cnl_verify_procmon_ref_values(dev_priv, phy);
if (phy_is_master(dev_priv, phy)) { if (phy_is_master(dev_priv, phy)) {
ret &= check_phy_reg(dev_priv, phy, ICL_PORT_COMP_DW8(phy), ret &= check_phy_reg(dev_priv, phy, ICL_PORT_COMP_DW8(phy),

View File

@ -336,8 +336,10 @@ int intel_hdcp_validate_v_prime(struct intel_connector *connector,
/* Fill up the empty slots in sha_text and write it out */ /* Fill up the empty slots in sha_text and write it out */
sha_empty = sizeof(sha_text) - sha_leftovers; sha_empty = sizeof(sha_text) - sha_leftovers;
for (j = 0; j < sha_empty; j++) for (j = 0; j < sha_empty; j++) {
sha_text |= ksv[j] << ((sizeof(sha_text) - j - 1) * 8); u8 off = ((sizeof(sha_text) - j - 1 - sha_leftovers) * 8);
sha_text |= ksv[j] << off;
}
ret = intel_write_sha_text(dev_priv, sha_text); ret = intel_write_sha_text(dev_priv, sha_text);
if (ret < 0) if (ret < 0)
@ -435,7 +437,7 @@ int intel_hdcp_validate_v_prime(struct intel_connector *connector,
/* Write 32 bits of text */ /* Write 32 bits of text */
intel_de_write(dev_priv, HDCP_REP_CTL, intel_de_write(dev_priv, HDCP_REP_CTL,
rep_ctl | HDCP_SHA1_TEXT_32); rep_ctl | HDCP_SHA1_TEXT_32);
sha_text |= bstatus[0] << 24 | bstatus[1] << 16; sha_text |= bstatus[0] << 8 | bstatus[1];
ret = intel_write_sha_text(dev_priv, sha_text); ret = intel_write_sha_text(dev_priv, sha_text);
if (ret < 0) if (ret < 0)
return ret; return ret;
@ -450,17 +452,29 @@ int intel_hdcp_validate_v_prime(struct intel_connector *connector,
return ret; return ret;
sha_idx += sizeof(sha_text); sha_idx += sizeof(sha_text);
} }
} else if (sha_leftovers == 3) {
/* Write 32 bits of text */ /*
* Terminate the SHA-1 stream by hand. For the other leftover
* cases this is appended by the hardware.
*/
intel_de_write(dev_priv, HDCP_REP_CTL, intel_de_write(dev_priv, HDCP_REP_CTL,
rep_ctl | HDCP_SHA1_TEXT_32); rep_ctl | HDCP_SHA1_TEXT_32);
sha_text |= bstatus[0] << 24; sha_text = DRM_HDCP_SHA1_TERMINATOR << 24;
ret = intel_write_sha_text(dev_priv, sha_text);
if (ret < 0)
return ret;
sha_idx += sizeof(sha_text);
} else if (sha_leftovers == 3) {
/* Write 32 bits of text (filled from LSB) */
intel_de_write(dev_priv, HDCP_REP_CTL,
rep_ctl | HDCP_SHA1_TEXT_32);
sha_text |= bstatus[0];
ret = intel_write_sha_text(dev_priv, sha_text); ret = intel_write_sha_text(dev_priv, sha_text);
if (ret < 0) if (ret < 0)
return ret; return ret;
sha_idx += sizeof(sha_text); sha_idx += sizeof(sha_text);
/* Write 8 bits of text, 24 bits of M0 */ /* Write 8 bits of text (filled from LSB), 24 bits of M0 */
intel_de_write(dev_priv, HDCP_REP_CTL, intel_de_write(dev_priv, HDCP_REP_CTL,
rep_ctl | HDCP_SHA1_TEXT_8); rep_ctl | HDCP_SHA1_TEXT_8);
ret = intel_write_sha_text(dev_priv, bstatus[1]); ret = intel_write_sha_text(dev_priv, bstatus[1]);
@ -781,6 +795,7 @@ static int _intel_hdcp_disable(struct intel_connector *connector)
struct intel_hdcp *hdcp = &connector->hdcp; struct intel_hdcp *hdcp = &connector->hdcp;
enum port port = dig_port->base.port; enum port port = dig_port->base.port;
enum transcoder cpu_transcoder = hdcp->cpu_transcoder; enum transcoder cpu_transcoder = hdcp->cpu_transcoder;
u32 repeater_ctl;
int ret; int ret;
drm_dbg_kms(&dev_priv->drm, "[%s:%d] HDCP is being disabled...\n", drm_dbg_kms(&dev_priv->drm, "[%s:%d] HDCP is being disabled...\n",
@ -796,6 +811,11 @@ static int _intel_hdcp_disable(struct intel_connector *connector)
return -ETIMEDOUT; return -ETIMEDOUT;
} }
repeater_ctl = intel_hdcp_get_repeater_ctl(dev_priv, cpu_transcoder,
port);
intel_de_write(dev_priv, HDCP_REP_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, 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");

View File

@ -29,6 +29,9 @@
/* Slave address for the HDCP registers in the receiver */ /* Slave address for the HDCP registers in the receiver */
#define DRM_HDCP_DDC_ADDR 0x3A #define DRM_HDCP_DDC_ADDR 0x3A
/* Value to use at the end of the SHA-1 bytestream used for repeaters */
#define DRM_HDCP_SHA1_TERMINATOR 0x80
/* HDCP register offsets for HDMI/DVI devices */ /* HDCP register offsets for HDMI/DVI devices */
#define DRM_HDCP_DDC_BKSV 0x00 #define DRM_HDCP_DDC_BKSV 0x00
#define DRM_HDCP_DDC_RI_PRIME 0x08 #define DRM_HDCP_DDC_RI_PRIME 0x08