// SPDX-License-Identifier: MIT /* * Copyright (C) 2013-2019 NVIDIA Corporation * Copyright (C) 2015 Rob Clark */ #include <drm/display/drm_dp_helper.h> #include <drm/drm_crtc.h> #include <drm/drm_print.h> #include "dp.h" static const u8 drm_dp_edp_revisions[] = …; static void drm_dp_link_caps_reset(struct drm_dp_link_caps *caps) { … } void drm_dp_link_caps_copy(struct drm_dp_link_caps *dest, const struct drm_dp_link_caps *src) { … } static void drm_dp_link_reset(struct drm_dp_link *link) { … } /** * drm_dp_link_add_rate() - add a rate to the list of supported rates * @link: the link to add the rate to * @rate: the rate to add * * Add a link rate to the list of supported link rates. * * Returns: * 0 on success or one of the following negative error codes on failure: * - ENOSPC if the maximum number of supported rates has been reached * - EEXISTS if the link already supports this rate * * See also: * drm_dp_link_remove_rate() */ int drm_dp_link_add_rate(struct drm_dp_link *link, unsigned long rate) { … } /** * drm_dp_link_remove_rate() - remove a rate from the list of supported rates * @link: the link from which to remove the rate * @rate: the rate to remove * * Removes a link rate from the list of supported link rates. * * Returns: * 0 on success or one of the following negative error codes on failure: * - EINVAL if the specified rate is not among the supported rates * * See also: * drm_dp_link_add_rate() */ int drm_dp_link_remove_rate(struct drm_dp_link *link, unsigned long rate) { … } /** * drm_dp_link_update_rates() - normalize the supported link rates array * @link: the link for which to normalize the supported link rates * * Users should call this function after they've manually modified the array * of supported link rates. This function removes any stale entries, compacts * the array and updates the supported link rate count. Note that calling the * drm_dp_link_remove_rate() function already does this janitorial work. * * See also: * drm_dp_link_add_rate(), drm_dp_link_remove_rate() */ void drm_dp_link_update_rates(struct drm_dp_link *link) { … } /** * drm_dp_link_probe() - probe a DisplayPort link for capabilities * @aux: DisplayPort AUX channel * @link: pointer to structure in which to return link capabilities * * The structure filled in by this function can usually be passed directly * into drm_dp_link_power_up() and drm_dp_link_configure() to power up and * configure the link based on the link's capabilities. * * Returns 0 on success or a negative error code on failure. */ int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link) { … } /** * drm_dp_link_power_up() - power up a DisplayPort link * @aux: DisplayPort AUX channel * @link: pointer to a structure containing the link configuration * * Returns 0 on success or a negative error code on failure. */ int drm_dp_link_power_up(struct drm_dp_aux *aux, struct drm_dp_link *link) { … } /** * drm_dp_link_power_down() - power down a DisplayPort link * @aux: DisplayPort AUX channel * @link: pointer to a structure containing the link configuration * * Returns 0 on success or a negative error code on failure. */ int drm_dp_link_power_down(struct drm_dp_aux *aux, struct drm_dp_link *link) { … } /** * drm_dp_link_configure() - configure a DisplayPort link * @aux: DisplayPort AUX channel * @link: pointer to a structure containing the link configuration * * Returns 0 on success or a negative error code on failure. */ int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link) { … } /** * drm_dp_link_choose() - choose the lowest possible configuration for a mode * @link: DRM DP link object * @mode: DRM display mode * @info: DRM display information * * According to the eDP specification, a source should select a configuration * with the lowest number of lanes and the lowest possible link rate that can * match the bitrate requirements of a video mode. However it must ensure not * to exceed the capabilities of the sink. * * Returns: 0 on success or a negative error code on failure. */ int drm_dp_link_choose(struct drm_dp_link *link, const struct drm_display_mode *mode, const struct drm_display_info *info) { … } /** * DOC: Link training * * These functions contain common logic and helpers to implement DisplayPort * link training. */ /** * drm_dp_link_train_init() - initialize DisplayPort link training state * @train: DisplayPort link training state */ void drm_dp_link_train_init(struct drm_dp_link_train *train) { … } static bool drm_dp_link_train_valid(const struct drm_dp_link_train *train) { … } static int drm_dp_link_apply_training(struct drm_dp_link *link) { … } static void drm_dp_link_train_wait(struct drm_dp_link *link) { … } static void drm_dp_link_get_adjustments(struct drm_dp_link *link, u8 status[DP_LINK_STATUS_SIZE]) { … } static void drm_dp_link_train_adjust(struct drm_dp_link_train *train) { … } static int drm_dp_link_recover_clock(struct drm_dp_link *link) { … } static int drm_dp_link_clock_recovery(struct drm_dp_link *link) { … } static int drm_dp_link_equalize_channel(struct drm_dp_link *link) { … } static int drm_dp_link_channel_equalization(struct drm_dp_link *link) { … } static int drm_dp_link_downgrade(struct drm_dp_link *link) { … } static void drm_dp_link_train_disable(struct drm_dp_link *link) { … } static int drm_dp_link_train_full(struct drm_dp_link *link) { … } static int drm_dp_link_train_fast(struct drm_dp_link *link) { … } /** * drm_dp_link_train() - perform DisplayPort link training * @link: a DP link object * * Uses the context stored in the DP link object to perform link training. It * is expected that drivers will call drm_dp_link_probe() to obtain the link * capabilities before performing link training. * * If the sink supports fast link training (no AUX CH handshake) and valid * training settings are available, this function will try to perform fast * link training and fall back to full link training on failure. * * Returns: 0 on success or a negative error code on failure. */ int drm_dp_link_train(struct drm_dp_link *link) { … }