[Intel-gfx] [PATCH 10/22] drm/i915: Add function for getting the current link training voltage

Thulasimani, Sivakumar sivakumar.thulasimani at intel.com
Sat Oct 24 20:56:06 PDT 2015



On 10/23/2015 3:31 PM, Ander Conselvan de Oliveira wrote:
> Add a function for retrieving the current voltage swing being used for
> link training. Using that function in the clock recovery code makes it a
> bit more readable.
>
> Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira at intel.com>
> ---
>   drivers/gpu/drm/i915/intel_dp_link_training.c | 10 ++++++++--
>   1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dp_link_training.c b/drivers/gpu/drm/i915/intel_dp_link_training.c
> index 9fdcc77..e5b9410 100644
> --- a/drivers/gpu/drm/i915/intel_dp_link_training.c
> +++ b/drivers/gpu/drm/i915/intel_dp_link_training.c
> @@ -155,6 +155,12 @@ max_voltage_reached_on_all_lanes(struct intel_dp *intel_dp)
>   	return true;
>   }
>   
> +static uint8_t
> +intel_dp_get_train_voltage(struct intel_dp *intel_dp)
> +{
> +	return intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK;
> +}
> +
>   /* Enable corresponding port and start training pattern 1 */
>   static void
>   intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp)
> @@ -214,7 +220,7 @@ intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp)
>   		}
>   
>   		/* Check to see if we've tried the same voltage 5 times */
> -		if ((intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK) == voltage) {
> +		if (intel_dp_get_train_voltage(intel_dp) == voltage) {
i understand this is related to taste/preference but wouldn't a macro be 
enough here ? something like
#define IS_MAX_SWING(train_set)    (train_set & DP_TRAIN_VOLTAGE_SWING_MASK)

regards,
Sivakumar
>   			++voltage_tries;
>   			if (voltage_tries == 5) {
>   				DRM_ERROR("too many voltage retries, give up\n");
> @@ -222,7 +228,7 @@ intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp)
>   			}
>   		} else
>   			voltage_tries = 0;
> -		voltage = intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK;
> +		voltage = intel_dp_get_train_voltage(intel_dp);
>   
>   		/* Update training set as requested by target */
>   		intel_get_adjust_train(intel_dp, link_status);



More information about the Intel-gfx mailing list