Commit 8159c796 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Keep the AKSV details in intel_dp_hdcp_write_an_aksv()

Let's try to keep the details on the AKSV stuff concentrated
in one place. So move the control bit and +5 data size handling
there.

v2: Increase txbuf[] to include the payload which intel_dp_aux_xfer()
    will still load into the registers even though the hardware
    will ignore it

Cc: Sean Paul <seanpaul@chromium.org>
Cc: Ramalingam C <ramalingam.c@intel.com>
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180222212732.4665-1-ville.syrjala@linux.intel.comReviewed-by: default avatarRamalingam C <ramalingam.c@intel.com>
parent f7606265
...@@ -1065,29 +1065,11 @@ static uint32_t skl_get_aux_send_ctl(struct intel_dp *intel_dp, ...@@ -1065,29 +1065,11 @@ static uint32_t skl_get_aux_send_ctl(struct intel_dp *intel_dp,
DP_AUX_CH_CTL_SYNC_PULSE_SKL(32); DP_AUX_CH_CTL_SYNC_PULSE_SKL(32);
} }
static uint32_t intel_dp_get_aux_send_ctl(struct intel_dp *intel_dp,
bool has_aux_irq,
int send_bytes,
uint32_t aux_clock_divider,
bool aksv_write)
{
uint32_t val = 0;
if (aksv_write) {
send_bytes += 5;
val |= DP_AUX_CH_CTL_AUX_AKSV_SELECT;
}
return val | intel_dp->get_aux_send_ctl(intel_dp,
has_aux_irq,
send_bytes,
aux_clock_divider);
}
static int static int
intel_dp_aux_xfer(struct intel_dp *intel_dp, intel_dp_aux_xfer(struct intel_dp *intel_dp,
const uint8_t *send, int send_bytes, const uint8_t *send, int send_bytes,
uint8_t *recv, int recv_size, bool aksv_write) uint8_t *recv, int recv_size,
u32 aux_send_ctl_flags)
{ {
struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
struct drm_i915_private *dev_priv = struct drm_i915_private *dev_priv =
...@@ -1151,11 +1133,12 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp, ...@@ -1151,11 +1133,12 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp,
} }
while ((aux_clock_divider = intel_dp->get_aux_clock_divider(intel_dp, clock++))) { while ((aux_clock_divider = intel_dp->get_aux_clock_divider(intel_dp, clock++))) {
u32 send_ctl = intel_dp_get_aux_send_ctl(intel_dp, u32 send_ctl = intel_dp->get_aux_send_ctl(intel_dp,
has_aux_irq, has_aux_irq,
send_bytes, send_bytes,
aux_clock_divider, aux_clock_divider);
aksv_write);
send_ctl |= aux_send_ctl_flags;
/* Must try at least 3 times according to DP spec */ /* Must try at least 3 times according to DP spec */
for (try = 0; try < 5; try++) { for (try = 0; try < 5; try++) {
...@@ -1285,7 +1268,7 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) ...@@ -1285,7 +1268,7 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
memcpy(txbuf + HEADER_SIZE, msg->buffer, msg->size); memcpy(txbuf + HEADER_SIZE, msg->buffer, msg->size);
ret = intel_dp_aux_xfer(intel_dp, txbuf, txsize, ret = intel_dp_aux_xfer(intel_dp, txbuf, txsize,
rxbuf, rxsize, false); rxbuf, rxsize, 0);
if (ret > 0) { if (ret > 0) {
msg->reply = rxbuf[0] >> 4; msg->reply = rxbuf[0] >> 4;
...@@ -1308,7 +1291,7 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) ...@@ -1308,7 +1291,7 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
return -E2BIG; return -E2BIG;
ret = intel_dp_aux_xfer(intel_dp, txbuf, txsize, ret = intel_dp_aux_xfer(intel_dp, txbuf, txsize,
rxbuf, rxsize, false); rxbuf, rxsize, 0);
if (ret > 0) { if (ret > 0) {
msg->reply = rxbuf[0] >> 4; msg->reply = rxbuf[0] >> 4;
/* /*
...@@ -5021,7 +5004,7 @@ int intel_dp_hdcp_write_an_aksv(struct intel_digital_port *intel_dig_port, ...@@ -5021,7 +5004,7 @@ int intel_dp_hdcp_write_an_aksv(struct intel_digital_port *intel_dig_port,
u8 *an) u8 *an)
{ {
struct intel_dp *intel_dp = enc_to_intel_dp(&intel_dig_port->base.base); struct intel_dp *intel_dp = enc_to_intel_dp(&intel_dig_port->base.base);
uint8_t txbuf[4], rxbuf[2], reply = 0; uint8_t txbuf[4+5] = {}, rxbuf[2], reply = 0;
ssize_t dpcd_ret; ssize_t dpcd_ret;
int ret; int ret;
...@@ -5046,7 +5029,8 @@ int intel_dp_hdcp_write_an_aksv(struct intel_digital_port *intel_dig_port, ...@@ -5046,7 +5029,8 @@ int intel_dp_hdcp_write_an_aksv(struct intel_digital_port *intel_dig_port,
txbuf[3] = DRM_HDCP_KSV_LEN - 1; txbuf[3] = DRM_HDCP_KSV_LEN - 1;
ret = intel_dp_aux_xfer(intel_dp, txbuf, sizeof(txbuf), ret = intel_dp_aux_xfer(intel_dp, txbuf, sizeof(txbuf),
rxbuf, sizeof(rxbuf), true); rxbuf, sizeof(rxbuf),
DP_AUX_CH_CTL_AUX_AKSV_SELECT);
if (ret < 0) { if (ret < 0) {
DRM_ERROR("Write Aksv over DP/AUX failed (%d)\n", ret); DRM_ERROR("Write Aksv over DP/AUX failed (%d)\n", ret);
return ret; return ret;
......
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