Lines Matching +full:timeout +full:- +full:enable
1 /* SPDX-License-Identifier: MIT */
40 int timeout) in intel_dp_hdcp_wait_for_cp_irq() argument
43 struct intel_dp *dp = &dig_port->dp; in intel_dp_hdcp_wait_for_cp_irq()
44 struct intel_hdcp *hdcp = &dp->attached_connector->hdcp; in intel_dp_hdcp_wait_for_cp_irq()
47 #define C (hdcp->cp_irq_count_cached != atomic_read(&hdcp->cp_irq_count)) in intel_dp_hdcp_wait_for_cp_irq()
48 ret = wait_event_interruptible_timeout(hdcp->cp_irq_queue, C, in intel_dp_hdcp_wait_for_cp_irq()
49 msecs_to_jiffies(timeout)); in intel_dp_hdcp_wait_for_cp_irq()
52 drm_dbg_kms(connector->base.dev, in intel_dp_hdcp_wait_for_cp_irq()
60 struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev); in intel_dp_hdcp_write_an_aksv()
65 dpcd_ret = drm_dp_dpcd_write(&dig_port->dp.aux, DP_AUX_HDCP_AN, in intel_dp_hdcp_write_an_aksv()
68 drm_dbg_kms(&i915->drm, in intel_dp_hdcp_write_an_aksv()
71 return dpcd_ret >= 0 ? -EIO : dpcd_ret; in intel_dp_hdcp_write_an_aksv()
75 * Since Aksv is Oh-So-Secret, we can't access it in software. So we in intel_dp_hdcp_write_an_aksv()
81 dpcd_ret = drm_dp_dpcd_write(&dig_port->dp.aux, DP_AUX_HDCP_AKSV, in intel_dp_hdcp_write_an_aksv()
84 drm_dbg_kms(&i915->drm, in intel_dp_hdcp_write_an_aksv()
87 return dpcd_ret >= 0 ? -EIO : dpcd_ret; in intel_dp_hdcp_write_an_aksv()
95 struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev); in intel_dp_hdcp_read_bksv()
98 ret = drm_dp_dpcd_read(&dig_port->dp.aux, DP_AUX_HDCP_BKSV, bksv, in intel_dp_hdcp_read_bksv()
101 drm_dbg_kms(&i915->drm, in intel_dp_hdcp_read_bksv()
103 return ret >= 0 ? -EIO : ret; in intel_dp_hdcp_read_bksv()
111 struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev); in intel_dp_hdcp_read_bstatus()
119 ret = drm_dp_dpcd_read(&dig_port->dp.aux, DP_AUX_HDCP_BINFO, in intel_dp_hdcp_read_bstatus()
122 drm_dbg_kms(&i915->drm, in intel_dp_hdcp_read_bstatus()
124 return ret >= 0 ? -EIO : ret; in intel_dp_hdcp_read_bstatus()
139 drm_dbg_kms(&i915->drm, in intel_dp_hdcp_read_bcaps()
141 return ret >= 0 ? -EIO : ret; in intel_dp_hdcp_read_bcaps()
151 struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev); in intel_dp_hdcp_repeater_present()
155 ret = intel_dp_hdcp_read_bcaps(&dig_port->dp.aux, i915, &bcaps); in intel_dp_hdcp_repeater_present()
167 struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev); in intel_dp_hdcp_read_ri_prime()
170 ret = drm_dp_dpcd_read(&dig_port->dp.aux, DP_AUX_HDCP_RI_PRIME, in intel_dp_hdcp_read_ri_prime()
173 drm_dbg_kms(&i915->drm, "Read Ri' from DP/AUX failed (%zd)\n", in intel_dp_hdcp_read_ri_prime()
175 return ret >= 0 ? -EIO : ret; in intel_dp_hdcp_read_ri_prime()
184 struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev); in intel_dp_hdcp_read_ksv_ready()
188 ret = drm_dp_dpcd_read(&dig_port->dp.aux, DP_AUX_HDCP_BSTATUS, in intel_dp_hdcp_read_ksv_ready()
191 drm_dbg_kms(&i915->drm, in intel_dp_hdcp_read_ksv_ready()
193 return ret >= 0 ? -EIO : ret; in intel_dp_hdcp_read_ksv_ready()
203 struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev); in intel_dp_hdcp_read_ksv_fifo()
209 size_t len = min(num_downstream - i, 3) * DRM_HDCP_KSV_LEN; in intel_dp_hdcp_read_ksv_fifo()
210 ret = drm_dp_dpcd_read(&dig_port->dp.aux, in intel_dp_hdcp_read_ksv_fifo()
215 drm_dbg_kms(&i915->drm, in intel_dp_hdcp_read_ksv_fifo()
218 return ret >= 0 ? -EIO : ret; in intel_dp_hdcp_read_ksv_fifo()
228 struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev); in intel_dp_hdcp_read_v_prime_part()
232 return -EINVAL; in intel_dp_hdcp_read_v_prime_part()
234 ret = drm_dp_dpcd_read(&dig_port->dp.aux, in intel_dp_hdcp_read_v_prime_part()
238 drm_dbg_kms(&i915->drm, in intel_dp_hdcp_read_v_prime_part()
240 return ret >= 0 ? -EIO : ret; in intel_dp_hdcp_read_v_prime_part()
248 bool enable) in intel_dp_hdcp_toggle_signalling() argument
258 struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev); in intel_dp_hdcp_check_link()
262 ret = drm_dp_dpcd_read(&dig_port->dp.aux, DP_AUX_HDCP_BSTATUS, in intel_dp_hdcp_check_link()
265 drm_dbg_kms(&i915->drm, in intel_dp_hdcp_check_link()
277 struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev); in intel_dp_hdcp_get_capability()
281 ret = intel_dp_hdcp_read_bcaps(&dig_port->dp.aux, i915, &bcaps); in intel_dp_hdcp_get_capability()
298 u32 timeout; member
300 /* Timeout to read entire msg */
344 struct drm_i915_private *i915 = to_i915(connector->base.dev); in intel_dp_hdcp2_read_rx_status()
346 struct drm_dp_aux *aux = &dig_port->dp.aux; in intel_dp_hdcp2_read_rx_status()
353 drm_dbg_kms(&i915->drm, in intel_dp_hdcp2_read_rx_status()
355 return ret >= 0 ? -EIO : ret; in intel_dp_hdcp2_read_rx_status()
387 drm_err(connector->base.dev, in hdcp2_detect_msg_availability()
389 return -EINVAL; in hdcp2_detect_msg_availability()
399 struct drm_i915_private *i915 = to_i915(connector->base.dev); in intel_dp_hdcp2_wait_for_msg()
401 struct intel_dp *dp = &dig_port->dp; in intel_dp_hdcp2_wait_for_msg()
402 struct intel_hdcp *hdcp = &dp->attached_connector->hdcp; in intel_dp_hdcp2_wait_for_msg()
403 u8 msg_id = hdcp2_msg_data->msg_id; in intel_dp_hdcp2_wait_for_msg()
404 int ret, timeout; in intel_dp_hdcp2_wait_for_msg() local
407 if (msg_id == HDCP_2_2_AKE_SEND_HPRIME && !hdcp->is_paired) in intel_dp_hdcp2_wait_for_msg()
408 timeout = hdcp2_msg_data->timeout2; in intel_dp_hdcp2_wait_for_msg()
410 timeout = hdcp2_msg_data->timeout; in intel_dp_hdcp2_wait_for_msg()
414 * availability. So Wait for timeout and read the msg. in intel_dp_hdcp2_wait_for_msg()
416 if (!hdcp2_msg_data->msg_detectable) { in intel_dp_hdcp2_wait_for_msg()
417 mdelay(timeout); in intel_dp_hdcp2_wait_for_msg()
421 * As we want to check the msg availability at timeout, Ignoring in intel_dp_hdcp2_wait_for_msg()
422 * the timeout at wait for CP_IRQ. in intel_dp_hdcp2_wait_for_msg()
424 intel_dp_hdcp_wait_for_cp_irq(connector, timeout); in intel_dp_hdcp2_wait_for_msg()
428 ret = -ETIMEDOUT; in intel_dp_hdcp2_wait_for_msg()
432 drm_dbg_kms(&i915->drm, in intel_dp_hdcp2_wait_for_msg()
433 "msg_id %d, ret %d, timeout(mSec): %d\n", in intel_dp_hdcp2_wait_for_msg()
434 hdcp2_msg_data->msg_id, ret, timeout); in intel_dp_hdcp2_wait_for_msg()
458 struct drm_dp_aux *aux = &dig_port->dp.aux; in intel_dp_hdcp2_write_msg()
463 return -EINVAL; in intel_dp_hdcp2_write_msg()
465 offset = hdcp2_msg_data->offset; in intel_dp_hdcp2_write_msg()
468 bytes_to_write = size - 1; in intel_dp_hdcp2_write_msg()
480 bytes_to_write -= ret; in intel_dp_hdcp2_write_msg()
493 struct drm_dp_aux *aux = &dig_port->dp.aux; in get_receiver_id_list_rx_info()
501 return ret >= 0 ? -EIO : ret; in get_receiver_id_list_rx_info()
517 struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev); in intel_dp_hdcp2_read_msg()
518 struct drm_dp_aux *aux = &dig_port->dp.aux; in intel_dp_hdcp2_read_msg()
519 struct intel_dp *dp = &dig_port->dp; in intel_dp_hdcp2_read_msg()
520 struct intel_hdcp *hdcp = &dp->attached_connector->hdcp; in intel_dp_hdcp2_read_msg()
531 return -EINVAL; in intel_dp_hdcp2_read_msg()
532 offset = hdcp2_msg_data->offset; in intel_dp_hdcp2_read_msg()
538 hdcp->cp_irq_count_cached = atomic_read(&hdcp->cp_irq_count); in intel_dp_hdcp2_read_msg()
549 size = sizeof(struct hdcp2_rep_send_receiverid_list) - in intel_dp_hdcp2_read_msg()
550 HDCP_2_2_RXINFO_LEN - HDCP_2_2_RECEIVER_IDS_MAX_LEN + in intel_dp_hdcp2_read_msg()
555 bytes_to_recv = size - 1; in intel_dp_hdcp2_read_msg()
561 /* Entire msg read timeout since initiate of msg read */ in intel_dp_hdcp2_read_msg()
562 if (bytes_to_recv == size - 1 && hdcp2_msg_data->msg_read_timeout > 0) { in intel_dp_hdcp2_read_msg()
564 hdcp2_msg_data->msg_read_timeout); in intel_dp_hdcp2_read_msg()
570 drm_dbg_kms(&i915->drm, "msg_id %d, ret %zd\n", in intel_dp_hdcp2_read_msg()
575 bytes_to_recv -= ret; in intel_dp_hdcp2_read_msg()
580 if (hdcp2_msg_data->msg_read_timeout > 0) { in intel_dp_hdcp2_read_msg()
583 drm_dbg_kms(&i915->drm, "msg_id %d, entire msg read timeout(mSec): %d\n", in intel_dp_hdcp2_read_msg()
584 msg_id, hdcp2_msg_data->msg_read_timeout); in intel_dp_hdcp2_read_msg()
585 return -ETIMEDOUT; in intel_dp_hdcp2_read_msg()
664 return ret >= 0 ? -EIO : ret; in _intel_dp_hdcp2_get_capability()
685 return -EINVAL; in intel_dp_hdcp2_get_capability()
688 aux = &dig_port->dp.aux; in intel_dp_hdcp2_get_capability()
698 struct drm_i915_private *i915 = to_i915(connector->base.dev); in intel_dp_hdcp_get_remote_capability()
705 if (!connector->mst_port) in intel_dp_hdcp_get_remote_capability()
706 return -EINVAL; in intel_dp_hdcp_get_remote_capability()
708 aux = &connector->port->aux; in intel_dp_hdcp_get_remote_capability()
711 drm_dbg_kms(&i915->drm, in intel_dp_hdcp_get_remote_capability()
745 bool enable) in intel_dp_mst_toggle_hdcp_stream_select() argument
748 struct drm_i915_private *i915 = to_i915(connector->base.dev); in intel_dp_mst_toggle_hdcp_stream_select()
749 struct intel_hdcp *hdcp = &connector->hdcp; in intel_dp_mst_toggle_hdcp_stream_select()
752 ret = intel_ddi_toggle_hdcp_bits(&dig_port->base, in intel_dp_mst_toggle_hdcp_stream_select()
753 hdcp->stream_transcoder, enable, in intel_dp_mst_toggle_hdcp_stream_select()
756 drm_err(&i915->drm, "%s HDCP stream select failed (%d)\n", in intel_dp_mst_toggle_hdcp_stream_select()
757 enable ? "Enable" : "Disable", ret); in intel_dp_mst_toggle_hdcp_stream_select()
763 bool enable) in intel_dp_mst_hdcp_stream_encryption() argument
766 struct drm_i915_private *i915 = to_i915(connector->base.dev); in intel_dp_mst_hdcp_stream_encryption()
767 struct intel_hdcp *hdcp = &connector->hdcp; in intel_dp_mst_hdcp_stream_encryption()
768 enum port port = dig_port->base.port; in intel_dp_mst_hdcp_stream_encryption()
769 enum transcoder cpu_transcoder = hdcp->stream_transcoder; in intel_dp_mst_hdcp_stream_encryption()
773 ret = intel_dp_mst_toggle_hdcp_stream_select(connector, enable); in intel_dp_mst_hdcp_stream_encryption()
779 return -EINVAL; in intel_dp_mst_hdcp_stream_encryption()
783 stream_enc_status, enable ? stream_enc_status : 0, in intel_dp_mst_hdcp_stream_encryption()
785 drm_err(&i915->drm, "Timed out waiting for transcoder: %s stream encryption %s\n", in intel_dp_mst_hdcp_stream_encryption()
786 transcoder_name(cpu_transcoder), enable ? "enabled" : "disabled"); in intel_dp_mst_hdcp_stream_encryption()
787 return -ETIMEDOUT; in intel_dp_mst_hdcp_stream_encryption()
795 bool enable) in intel_dp_mst_hdcp2_stream_encryption() argument
798 struct drm_i915_private *i915 = to_i915(connector->base.dev); in intel_dp_mst_hdcp2_stream_encryption()
799 struct hdcp_port_data *data = &dig_port->hdcp_port_data; in intel_dp_mst_hdcp2_stream_encryption()
800 struct intel_hdcp *hdcp = &connector->hdcp; in intel_dp_mst_hdcp2_stream_encryption()
801 enum transcoder cpu_transcoder = hdcp->stream_transcoder; in intel_dp_mst_hdcp2_stream_encryption()
803 enum port port = dig_port->base.port; in intel_dp_mst_hdcp2_stream_encryption()
806 drm_WARN_ON(&i915->drm, enable && in intel_dp_mst_hdcp2_stream_encryption()
808 & AUTH_STREAM_TYPE) != data->streams[0].stream_type); in intel_dp_mst_hdcp2_stream_encryption()
810 ret = intel_dp_mst_toggle_hdcp_stream_select(connector, enable); in intel_dp_mst_hdcp2_stream_encryption()
817 enable ? STREAM_ENCRYPTION_STATUS : 0, in intel_dp_mst_hdcp2_stream_encryption()
819 drm_err(&i915->drm, "Timed out waiting for transcoder: %s stream encryption %s\n", in intel_dp_mst_hdcp2_stream_encryption()
820 transcoder_name(cpu_transcoder), enable ? "enabled" : "disabled"); in intel_dp_mst_hdcp2_stream_encryption()
821 return -ETIMEDOUT; in intel_dp_mst_hdcp2_stream_encryption()
831 struct intel_hdcp *hdcp = &connector->hdcp; in intel_dp_mst_hdcp2_check_link()
837 * We can re-use the hdcp->is_repeater flag to know that the connector in intel_dp_mst_hdcp2_check_link()
840 if (hdcp->is_repeater) { in intel_dp_mst_hdcp2_check_link()
875 struct drm_device *dev = intel_connector->base.dev; in intel_dp_hdcp_init()
877 struct intel_encoder *intel_encoder = &dig_port->base; in intel_dp_hdcp_init()
878 enum port port = intel_encoder->port; in intel_dp_hdcp_init()
879 struct intel_dp *intel_dp = &dig_port->dp; in intel_dp_hdcp_init()
884 if (intel_connector->mst_port) in intel_dp_hdcp_init()