/* * There is no protection in the DRM framework to check if the display * pipeline has been already disabled before trying to disable it again. * Hence if the sink is unplugged, the pipeline gets disabled, but the * crtc->active is still true. Any attempt to set the mode or manually * disable this encoder will result in the crash. * * TODO: add support for telling the DRM subsystem that the pipeline is * disabled by the hardware and thus all access to it should be forbidden. * After that this piece of code can be removed.
*/ if (bridge->ops & DRM_BRIDGE_OP_HPD) return (dp->link_ready) ? 0 : -ENOTCONN;
return 0;
}
/** * msm_dp_bridge_get_modes - callback to add drm modes via drm_mode_probed_add() * @bridge: Poiner to drm bridge * @connector: Pointer to drm connector structure * Returns: Number of modes added
*/ staticint msm_dp_bridge_get_modes(struct drm_bridge *bridge, struct drm_connector *connector)
{ int rc = 0; struct msm_dp *dp;
if (!connector) return 0;
dp = to_dp_bridge(bridge)->msm_dp_display;
/* pluggable case assumes EDID is read when HPD */ if (dp->link_ready) {
rc = msm_dp_display_get_modes(dp); if (rc <= 0) {
DRM_ERROR("failed to get DP sink modes, rc=%d\n", rc); return rc;
}
} else {
drm_dbg_dp(connector->dev, "No sink connected\n");
} return rc;
}
/* * Check the old state of the crtc to determine if the panel * was put into psr state previously by the msm_edp_bridge_atomic_disable. * If the panel is in psr, just exit psr state and skip the full * bridge enable sequence.
*/
crtc = drm_atomic_get_new_crtc_for_encoder(state,
drm_bridge->encoder); if (!crtc) return;
crtc = drm_atomic_get_old_crtc_for_encoder(atomic_state,
drm_bridge->encoder); if (!crtc) goto out;
new_crtc_state = drm_atomic_get_new_crtc_state(atomic_state, crtc); if (!new_crtc_state) goto out;
old_crtc_state = drm_atomic_get_old_crtc_state(atomic_state, crtc); if (!old_crtc_state) goto out;
/* * Set self refresh mode if current crtc state is active. * * If old crtc state is active, then this is a display disable * call while the sink is in psr state. So, exit psr here. * The eDP controller will be disabled in the * msm_edp_bridge_atomic_post_disable function. * * We observed sink is stuck in self refresh if psr exit is skipped * when display disable occurs while the sink is in psr state.
*/ if (new_crtc_state->self_refresh_active) {
msm_dp_display_set_psr(dp, true); return;
} elseif (old_crtc_state->self_refresh_active) {
msm_dp_display_set_psr(dp, false); return;
}
if (msm_dp_wide_bus_available(dp))
mode_pclk_khz /= 2;
if (mode_pclk_khz > DP_MAX_PIXEL_CLK_KHZ) return MODE_CLOCK_HIGH;
/* * The eDP controller currently does not have a reliable way of * enabling panel power to read sink capabilities. So, we rely * on the panel driver to populate only supported modes for now.
*/ return MODE_OK;
}
/* * Many ops only make sense for DP. Why? * - Detect/HPD are used by DRM to know if a display is _physically_ * there, not whether the display is powered on / finished initting. * On eDP we assume the display is always there because you can't * know until power is applied. If we don't implement the ops DRM will * assume our display is always there. * - Currently eDP mode reading is driven by the panel driver. This * allows the panel driver to properly power itself on to read the * modes.
*/ if (!msm_dp_display->is_edp) {
bridge->ops =
DRM_BRIDGE_OP_DP_AUDIO |
DRM_BRIDGE_OP_DETECT |
DRM_BRIDGE_OP_HPD |
DRM_BRIDGE_OP_MODES;
bridge->hdmi_audio_dev = &msm_dp_display->pdev->dev;
bridge->hdmi_audio_max_i2s_playback_channels = 8;
bridge->hdmi_audio_dai_port = -1;
}
rc = devm_drm_bridge_add(dev->dev, bridge); if (rc) {
DRM_ERROR("failed to add bridge, rc=%d\n", rc);
return rc;
}
rc = drm_bridge_attach(encoder, bridge, NULL, DRM_BRIDGE_ATTACH_NO_CONNECTOR); if (rc) {
DRM_ERROR("failed to attach bridge, rc=%d\n", rc);
return rc;
}
if (msm_dp_display->next_bridge) {
rc = drm_bridge_attach(encoder,
msm_dp_display->next_bridge, bridge,
DRM_BRIDGE_ATTACH_NO_CONNECTOR); if (rc < 0) {
DRM_ERROR("failed to attach panel bridge: %d\n", rc); return rc;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.