diff options
author | Thierry Reding <treding@nvidia.com> | 2015-07-07 21:21:48 +0200 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2019-10-28 11:18:53 +0100 |
commit | 078c445733c1e8092e23391b251cad6b12f6156e (patch) | |
tree | e6ce90b8267447b64263c997df760aa46b2a5235 /drivers/gpu/drm/tegra/dp.h | |
parent | 6a127160c4883abf3a54d97024eda8118849fd5c (diff) | |
download | lwn-078c445733c1e8092e23391b251cad6b12f6156e.tar.gz lwn-078c445733c1e8092e23391b251cad6b12f6156e.zip |
drm/tegra: dp: Add DisplayPort link training helper
Add a helper that will perform link training as described in the
DisplayPort specification.
Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/gpu/drm/tegra/dp.h')
-rw-r--r-- | drivers/gpu/drm/tegra/dp.h | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/drivers/gpu/drm/tegra/dp.h b/drivers/gpu/drm/tegra/dp.h index a20ee9f1f1b6..cb12ed0c54e7 100644 --- a/drivers/gpu/drm/tegra/dp.h +++ b/drivers/gpu/drm/tegra/dp.h @@ -12,6 +12,7 @@ struct drm_display_info; struct drm_display_mode; struct drm_dp_aux; +struct drm_dp_link; /** * struct drm_dp_link_caps - DP link capabilities @@ -57,6 +58,55 @@ void drm_dp_link_caps_copy(struct drm_dp_link_caps *dest, const struct drm_dp_link_caps *src); /** + * struct drm_dp_link_ops - DP link operations + */ +struct drm_dp_link_ops { + /** + * @apply_training: + */ + int (*apply_training)(struct drm_dp_link *link); + + /** + * @configure: + */ + int (*configure)(struct drm_dp_link *link); +}; + +#define DP_TRAIN_VOLTAGE_SWING_LEVEL(x) ((x) << 0) +#define DP_TRAIN_PRE_EMPHASIS_LEVEL(x) ((x) << 3) +#define DP_LANE_POST_CURSOR(i, x) (((x) & 0x3) << (((i) & 1) << 2)) + +/** + * struct drm_dp_link_train_set - link training settings + * @voltage_swing: per-lane voltage swing + * @pre_emphasis: per-lane pre-emphasis + * @post_cursor: per-lane post-cursor + */ +struct drm_dp_link_train_set { + unsigned int voltage_swing[4]; + unsigned int pre_emphasis[4]; + unsigned int post_cursor[4]; +}; + +/** + * struct drm_dp_link_train - link training state information + * @request: currently requested settings + * @adjust: adjustments requested by sink + * @pattern: currently requested training pattern + * @clock_recovered: flag to track if clock recovery has completed + * @channel_equalized: flag to track if channel equalization has completed + */ +struct drm_dp_link_train { + struct drm_dp_link_train_set request; + struct drm_dp_link_train_set adjust; + + unsigned int pattern; + + bool clock_recovered; + bool channel_equalized; +}; + +/** * struct drm_dp_link - DP link capabilities and configuration * @revision: DP specification revision supported on the link * @max_rate: maximum clock rate supported on the link @@ -92,6 +142,21 @@ struct drm_dp_link { unsigned long rates[DP_MAX_SUPPORTED_RATES]; unsigned int num_rates; + + /** + * @ops: DP link operations + */ + const struct drm_dp_link_ops *ops; + + /** + * @aux: DP AUX channel + */ + struct drm_dp_aux *aux; + + /** + * @train: DP link training state + */ + struct drm_dp_link_train train; }; int drm_dp_link_add_rate(struct drm_dp_link *link, unsigned long rate); @@ -106,4 +171,7 @@ int drm_dp_link_choose(struct drm_dp_link *link, const struct drm_display_mode *mode, const struct drm_display_info *info); +void drm_dp_link_train_init(struct drm_dp_link_train *train); +int drm_dp_link_train(struct drm_dp_link *link); + #endif |