Commit 078c4457 authored by Thierry Reding's avatar Thierry Reding

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: default avatarThierry Reding <treding@nvidia.com>
parent 6a127160
This diff is collapsed.
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
struct drm_display_info; struct drm_display_info;
struct drm_display_mode; struct drm_display_mode;
struct drm_dp_aux; struct drm_dp_aux;
struct drm_dp_link;
/** /**
* struct drm_dp_link_caps - DP link capabilities * struct drm_dp_link_caps - DP link capabilities
...@@ -56,6 +57,55 @@ struct drm_dp_link_caps { ...@@ -56,6 +57,55 @@ struct drm_dp_link_caps {
void drm_dp_link_caps_copy(struct drm_dp_link_caps *dest, void drm_dp_link_caps_copy(struct drm_dp_link_caps *dest,
const struct drm_dp_link_caps *src); 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 * struct drm_dp_link - DP link capabilities and configuration
* @revision: DP specification revision supported on the link * @revision: DP specification revision supported on the link
...@@ -92,6 +142,21 @@ struct drm_dp_link { ...@@ -92,6 +142,21 @@ struct drm_dp_link {
unsigned long rates[DP_MAX_SUPPORTED_RATES]; unsigned long rates[DP_MAX_SUPPORTED_RATES];
unsigned int num_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); 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, ...@@ -106,4 +171,7 @@ int drm_dp_link_choose(struct drm_dp_link *link,
const struct drm_display_mode *mode, const struct drm_display_mode *mode,
const struct drm_display_info *info); 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 #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment