Lines Matching +full:hdmi +full:- +full:out
1 // SPDX-License-Identifier: MIT
12 * __drm_atomic_helper_connector_hdmi_reset() - Initializes all HDMI @drm_connector_state resources
16 * Initializes all HDMI resources from a @drm_connector_state without
17 * actually allocating it. This is useful for HDMI drivers, in
24 unsigned int max_bpc = connector->max_bpc; in __drm_atomic_helper_connector_hdmi_reset()
26 new_conn_state->max_bpc = max_bpc; in __drm_atomic_helper_connector_hdmi_reset()
27 new_conn_state->max_requested_bpc = max_bpc; in __drm_atomic_helper_connector_hdmi_reset()
28 new_conn_state->hdmi.broadcast_rgb = DRM_HDMI_BROADCAST_RGB_AUTO; in __drm_atomic_helper_connector_hdmi_reset()
39 state = conn_state->state; in connector_state_get_mode()
43 crtc = conn_state->crtc; in connector_state_get_mode()
51 return &crtc_state->mode; in connector_state_get_mode()
57 const struct drm_display_info *info = &connector->display_info; in hdmi_is_limited_range()
66 if (conn_state->hdmi.output_format != HDMI_COLORSPACE_RGB) in hdmi_is_limited_range()
69 if (conn_state->hdmi.broadcast_rgb == DRM_HDMI_BROADCAST_RGB_FULL) in hdmi_is_limited_range()
72 if (conn_state->hdmi.broadcast_rgb == DRM_HDMI_BROADCAST_RGB_LIMITED) in hdmi_is_limited_range()
75 if (!info->is_hdmi) in hdmi_is_limited_range()
87 struct drm_device *dev = connector->dev; in sink_supports_format_bpc()
91 * CTA-861-F, section 5.4 - Color Coding & Quantization states in sink_supports_format_bpc()
105 if (!info->is_hdmi && in sink_supports_format_bpc()
111 if (!(connector->hdmi.supported_formats & BIT(format))) { in sink_supports_format_bpc()
123 * is not an HDMI compliant EDID for some reason, the in sink_supports_format_bpc()
129 if (!(info->color_formats & DRM_COLOR_FORMAT_RGB444)) in sink_supports_format_bpc()
130 drm_warn(dev, "HDMI Sink doesn't support RGB, something's wrong.\n"); in sink_supports_format_bpc()
132 if (bpc == 10 && !(info->edid_hdmi_rgb444_dc_modes & DRM_EDID_HDMI_DC_30)) { in sink_supports_format_bpc()
137 if (bpc == 12 && !(info->edid_hdmi_rgb444_dc_modes & DRM_EDID_HDMI_DC_36)) { in sink_supports_format_bpc()
154 if (!(info->color_formats & DRM_COLOR_FORMAT_YCBCR422)) { in sink_supports_format_bpc()
165 * HDMI Spec 1.3 - Section 6.5 Pixel Encodings and Color Depth in sink_supports_format_bpc()
177 if (!(info->color_formats & DRM_COLOR_FORMAT_YCBCR444)) { in sink_supports_format_bpc()
182 if (bpc == 10 && !(info->edid_hdmi_ycbcr444_dc_modes & DRM_EDID_HDMI_DC_30)) { in sink_supports_format_bpc()
187 if (bpc == 12 && !(info->edid_hdmi_ycbcr444_dc_modes & DRM_EDID_HDMI_DC_36)) { in sink_supports_format_bpc()
206 const struct drm_connector_hdmi_funcs *funcs = connector->hdmi.funcs; in hdmi_clock_valid()
207 const struct drm_display_info *info = &connector->display_info; in hdmi_clock_valid()
209 if (info->max_tmds_clock && clock > info->max_tmds_clock * 1000) in hdmi_clock_valid()
212 if (funcs && funcs->tmds_char_rate_valid) { in hdmi_clock_valid()
215 status = funcs->tmds_char_rate_valid(connector, mode, clock); in hdmi_clock_valid()
234 return -EINVAL; in hdmi_compute_clock()
238 return -EINVAL; in hdmi_compute_clock()
240 conn_state->hdmi.tmds_char_rate = clock; in hdmi_compute_clock()
251 const struct drm_display_info *info = &connector->display_info; in hdmi_try_format_bpc()
252 struct drm_device *dev = connector->dev; in hdmi_try_format_bpc()
275 bpc, conn_state->hdmi.tmds_char_rate); in hdmi_try_format_bpc()
286 struct drm_device *dev = connector->dev; in hdmi_compute_format()
289 * TODO: Add support for YCbCr420 output for HDMI 2.0 capable in hdmi_compute_format()
293 conn_state->hdmi.output_format = HDMI_COLORSPACE_RGB; in hdmi_compute_format()
299 return -EINVAL; in hdmi_compute_format()
307 struct drm_device *dev = connector->dev; in hdmi_compute_config()
309 conn_state->max_bpc, in hdmi_compute_config()
310 8, connector->max_bpc); in hdmi_compute_config()
314 for (bpc = max_bpc; bpc >= 8; bpc -= 2) { in hdmi_compute_config()
321 conn_state->hdmi.output_bpc = bpc; in hdmi_compute_config()
325 mode->hdisplay, mode->vdisplay, drm_mode_vrefresh(mode), in hdmi_compute_config()
326 conn_state->hdmi.output_bpc, in hdmi_compute_config()
327 drm_hdmi_connector_get_output_format_name(conn_state->hdmi.output_format), in hdmi_compute_config()
328 conn_state->hdmi.tmds_char_rate); in hdmi_compute_config()
333 return -EINVAL; in hdmi_compute_config()
342 &conn_state->hdmi.infoframes.avi; in hdmi_generate_avi_infoframe()
344 &infoframe->data.avi; in hdmi_generate_avi_infoframe()
345 bool is_limited_range = conn_state->hdmi.is_limited_range; in hdmi_generate_avi_infoframe()
354 frame->colorspace = conn_state->hdmi.output_format; in hdmi_generate_avi_infoframe()
365 infoframe->set = true; in hdmi_generate_avi_infoframe()
374 &conn_state->hdmi.infoframes.spd; in hdmi_generate_spd_infoframe()
376 &infoframe->data.spd; in hdmi_generate_spd_infoframe()
380 connector->hdmi.vendor, in hdmi_generate_spd_infoframe()
381 connector->hdmi.product); in hdmi_generate_spd_infoframe()
385 frame->sdi = HDMI_SPD_SDI_PC; in hdmi_generate_spd_infoframe()
387 infoframe->set = true; in hdmi_generate_spd_infoframe()
396 &conn_state->hdmi.infoframes.hdr_drm; in hdmi_generate_hdr_infoframe()
398 &infoframe->data.drm; in hdmi_generate_hdr_infoframe()
401 if (connector->max_bpc < 10) in hdmi_generate_hdr_infoframe()
404 if (!conn_state->hdr_output_metadata) in hdmi_generate_hdr_infoframe()
411 infoframe->set = true; in hdmi_generate_hdr_infoframe()
419 const struct drm_display_info *info = &connector->display_info; in hdmi_generate_hdmi_vendor_infoframe()
423 &conn_state->hdmi.infoframes.hdmi; in hdmi_generate_hdmi_vendor_infoframe()
425 &infoframe->data.vendor.hdmi; in hdmi_generate_hdmi_vendor_infoframe()
428 if (!info->has_hdmi_infoframe) in hdmi_generate_hdmi_vendor_infoframe()
435 infoframe->set = true; in hdmi_generate_hdmi_vendor_infoframe()
444 const struct drm_display_info *info = &connector->display_info; in hdmi_generate_infoframes()
447 if (!info->is_hdmi) in hdmi_generate_infoframes()
475 * drm_atomic_helper_connector_hdmi_check() - Helper to check HDMI connector atomic state
479 * Provides a default connector state check handler for HDMI connectors.
497 new_conn_state->hdmi.is_limited_range = hdmi_is_limited_range(connector, new_conn_state); in drm_atomic_helper_connector_hdmi_check()
507 if (old_conn_state->hdmi.broadcast_rgb != new_conn_state->hdmi.broadcast_rgb || in drm_atomic_helper_connector_hdmi_check()
508 old_conn_state->hdmi.output_bpc != new_conn_state->hdmi.output_bpc || in drm_atomic_helper_connector_hdmi_check()
509 old_conn_state->hdmi.output_format != new_conn_state->hdmi.output_format) { in drm_atomic_helper_connector_hdmi_check()
510 struct drm_crtc *crtc = new_conn_state->crtc; in drm_atomic_helper_connector_hdmi_check()
517 crtc_state->mode_changed = true; in drm_atomic_helper_connector_hdmi_check()
527 const struct drm_connector_hdmi_funcs *funcs = connector->hdmi.funcs; in clear_device_infoframe()
528 struct drm_device *dev = connector->dev; in clear_device_infoframe()
533 if (!funcs || !funcs->clear_infoframe) { in clear_device_infoframe()
538 ret = funcs->clear_infoframe(connector, type); in clear_device_infoframe()
552 ret = clear_device_infoframe(connector, old_frame->data.any.type); in clear_infoframe()
562 const struct drm_connector_hdmi_funcs *funcs = connector->hdmi.funcs; in write_device_infoframe()
563 struct drm_device *dev = connector->dev; in write_device_infoframe()
568 drm_dbg_kms(dev, "Writing infoframe type %x\n", frame->any.type); in write_device_infoframe()
570 if (!funcs || !funcs->write_infoframe) { in write_device_infoframe()
572 return -EINVAL; in write_device_infoframe()
579 ret = funcs->write_infoframe(connector, frame->any.type, buffer, len); in write_device_infoframe()
593 ret = write_device_infoframe(connector, &new_frame->data); in write_infoframe()
604 if (new_frame->set) in write_or_clear_infoframe()
607 if (old_frame->set && !new_frame->set) in write_or_clear_infoframe()
614 * drm_atomic_helper_connector_hdmi_update_infoframes - Update the Infoframes
615 * @connector: A pointer to the HDMI connector
616 * @state: The HDMI connector state to generate the infoframe from
618 * This function is meant for HDMI connector drivers to write their
632 struct drm_display_info *info = &connector->display_info; in drm_atomic_helper_connector_hdmi_update_infoframes()
635 if (!info->is_hdmi) in drm_atomic_helper_connector_hdmi_update_infoframes()
638 mutex_lock(&connector->hdmi.infoframes.lock); in drm_atomic_helper_connector_hdmi_update_infoframes()
641 &old_conn_state->hdmi.infoframes.avi, in drm_atomic_helper_connector_hdmi_update_infoframes()
642 &new_conn_state->hdmi.infoframes.avi); in drm_atomic_helper_connector_hdmi_update_infoframes()
644 goto out; in drm_atomic_helper_connector_hdmi_update_infoframes()
646 if (connector->hdmi.infoframes.audio.set) { in drm_atomic_helper_connector_hdmi_update_infoframes()
648 &connector->hdmi.infoframes.audio); in drm_atomic_helper_connector_hdmi_update_infoframes()
650 goto out; in drm_atomic_helper_connector_hdmi_update_infoframes()
654 &old_conn_state->hdmi.infoframes.hdr_drm, in drm_atomic_helper_connector_hdmi_update_infoframes()
655 &new_conn_state->hdmi.infoframes.hdr_drm); in drm_atomic_helper_connector_hdmi_update_infoframes()
657 goto out; in drm_atomic_helper_connector_hdmi_update_infoframes()
660 &old_conn_state->hdmi.infoframes.spd, in drm_atomic_helper_connector_hdmi_update_infoframes()
661 &new_conn_state->hdmi.infoframes.spd); in drm_atomic_helper_connector_hdmi_update_infoframes()
663 goto out; in drm_atomic_helper_connector_hdmi_update_infoframes()
665 if (info->has_hdmi_infoframe) { in drm_atomic_helper_connector_hdmi_update_infoframes()
667 &old_conn_state->hdmi.infoframes.hdmi, in drm_atomic_helper_connector_hdmi_update_infoframes()
668 &new_conn_state->hdmi.infoframes.hdmi); in drm_atomic_helper_connector_hdmi_update_infoframes()
670 goto out; in drm_atomic_helper_connector_hdmi_update_infoframes()
673 out: in drm_atomic_helper_connector_hdmi_update_infoframes()
674 mutex_unlock(&connector->hdmi.infoframes.lock); in drm_atomic_helper_connector_hdmi_update_infoframes()
680 * drm_atomic_helper_connector_hdmi_update_audio_infoframe - Update the Audio Infoframe
681 * @connector: A pointer to the HDMI connector
684 * This function is meant for HDMI connector drivers to update their
696 &connector->hdmi.infoframes.audio; in drm_atomic_helper_connector_hdmi_update_audio_infoframe()
697 struct drm_display_info *info = &connector->display_info; in drm_atomic_helper_connector_hdmi_update_audio_infoframe()
700 if (!info->is_hdmi) in drm_atomic_helper_connector_hdmi_update_audio_infoframe()
703 mutex_lock(&connector->hdmi.infoframes.lock); in drm_atomic_helper_connector_hdmi_update_audio_infoframe()
705 memcpy(&infoframe->data, frame, sizeof(infoframe->data)); in drm_atomic_helper_connector_hdmi_update_audio_infoframe()
706 infoframe->set = true; in drm_atomic_helper_connector_hdmi_update_audio_infoframe()
710 mutex_unlock(&connector->hdmi.infoframes.lock); in drm_atomic_helper_connector_hdmi_update_audio_infoframe()
717 * drm_atomic_helper_connector_hdmi_clear_audio_infoframe - Stop sending the Audio Infoframe
718 * @connector: A pointer to the HDMI connector
720 * This function is meant for HDMI connector drivers to stop sending their
731 &connector->hdmi.infoframes.audio; in drm_atomic_helper_connector_hdmi_clear_audio_infoframe()
732 struct drm_display_info *info = &connector->display_info; in drm_atomic_helper_connector_hdmi_clear_audio_infoframe()
735 if (!info->is_hdmi) in drm_atomic_helper_connector_hdmi_clear_audio_infoframe()
738 mutex_lock(&connector->hdmi.infoframes.lock); in drm_atomic_helper_connector_hdmi_clear_audio_infoframe()
740 infoframe->set = false; in drm_atomic_helper_connector_hdmi_clear_audio_infoframe()
744 memset(&infoframe->data, 0, sizeof(infoframe->data)); in drm_atomic_helper_connector_hdmi_clear_audio_infoframe()
746 mutex_unlock(&connector->hdmi.infoframes.lock); in drm_atomic_helper_connector_hdmi_clear_audio_infoframe()