On Thu, 2025-08-28 at 15:20 +0300, Jani Nikula wrote:
> Prefer generic poll helpers over i915 custom helpers.
> 
> The functional change is losing the exponentially growing sleep of
> wait_for(), which used to be 10, 20, 40, ..., 640, and 1280 us.
> 
> Use an arbitrary constant 1 ms sleep instead. The timeouts remain,
> being
> 500 ms or 1000 ms depending on the case.
> 
> Signed-off-by: Jani Nikula <jani.nik...@intel.com>

Reviewed-by: Jouni Högander <jouni.hogan...@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_dp.c | 21 +++++++++++----------
>  1 file changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c
> b/drivers/gpu/drm/i915/display/intel_dp.c
> index bed7cba1ca68..65468c0126ff 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -27,6 +27,7 @@
>  
>  #include <linux/export.h>
>  #include <linux/i2c.h>
> +#include <linux/iopoll.h>
>  #include <linux/log2.h>
>  #include <linux/math.h>
>  #include <linux/notifier.h>
> @@ -3878,10 +3879,11 @@ static int
> intel_dp_pcon_start_frl_training(struct intel_dp *intel_dp)
>       if (ret < 0)
>               return ret;
>       /* Wait for PCON to be FRL Ready */
> -     wait_for(is_active = drm_dp_pcon_is_frl_ready(&intel_dp-
> >aux) == true, TIMEOUT_FRL_READY_MS);
> -
> -     if (!is_active)
> -             return -ETIMEDOUT;
> +     ret = poll_timeout_us(is_active =
> drm_dp_pcon_is_frl_ready(&intel_dp->aux),
> +                           is_active,
> +                           1000, TIMEOUT_FRL_READY_MS * 1000,
> false);
> +     if (ret)
> +             return ret;
>  
>       ret = drm_dp_pcon_frl_configure_1(&intel_dp->aux,
> max_frl_bw,
>                                        
> DP_PCON_ENABLE_SEQUENTIAL_LINK);
> @@ -3898,12 +3900,11 @@ static int
> intel_dp_pcon_start_frl_training(struct intel_dp *intel_dp)
>        * Wait for FRL to be completed
>        * Check if the HDMI Link is up and active.
>        */
> -     wait_for(is_active =
> -              intel_dp_pcon_is_frl_trained(intel_dp,
> max_frl_bw_mask, &frl_trained_mask),
> -              TIMEOUT_HDMI_LINK_ACTIVE_MS);
> -
> -     if (!is_active)
> -             return -ETIMEDOUT;
> +     ret = poll_timeout_us(is_active =
> intel_dp_pcon_is_frl_trained(intel_dp, max_frl_bw_mask,
> &frl_trained_mask),
> +                           is_active,
> +                           1000, TIMEOUT_HDMI_LINK_ACTIVE_MS *
> 1000, false);
> +     if (ret)
> +             return ret;
>  
>  frl_trained:
>       drm_dbg(display->drm, "FRL_TRAINED_MASK = %u\n",
> frl_trained_mask);

Reply via email to