Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Gustavo Sousa <gustavo.sousa@intel.com>
To: Jani Nikula <jani.nikula@intel.com>,
	<intel-gfx@lists.freedesktop.org>,
	<intel-xe@lists.freedesktop.org>
Cc: <jani.nikula@intel.com>
Subject: Re: [PATCH v2 2/7] drm/i915/ddi: use intel_de_wait_custom() instead of wait_for_us()
Date: Thu, 31 Jul 2025 10:00:55 -0300	[thread overview]
Message-ID: <175396685525.2011.3239000262739473384@intel.com> (raw)
In-Reply-To: <232a554db6a327974c06f2491311b28f865467b9.1753956266.git.jani.nikula@intel.com>

Quoting Jani Nikula (2025-07-31 07:05:09-03:00)
>Prefer the register read specific wait function over i915 wait_for_us().
>
>v2: Wait for bits to clear in mtl_ddi_disable_d2d()
>
>Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>---
> drivers/gpu/drm/i915/display/intel_ddi.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
>index 0405396c7750..866ed3e46664 100644
>--- a/drivers/gpu/drm/i915/display/intel_ddi.c
>+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
>@@ -2561,6 +2561,7 @@ mtl_ddi_enable_d2d(struct intel_encoder *encoder)
>         enum port port = encoder->port;
>         i915_reg_t reg;
>         u32 set_bits, wait_bits;
>+        int ret;
> 
>         if (DISPLAY_VER(display) < 14)
>                 return;
>@@ -2576,7 +2577,11 @@ mtl_ddi_enable_d2d(struct intel_encoder *encoder)
>         }
> 
>         intel_de_rmw(display, reg, 0, set_bits);
>-        if (wait_for_us(intel_de_read(display, reg) & wait_bits, 100)) {
>+
>+        ret = intel_de_wait_custom(display, reg,
>+                                   wait_bits, wait_bits,
>+                                   100, 0, NULL);

Hm... Strictly speaking, in the previous version, we are waiting for the
register value with wait_bits mask applied to be any non-zero value.
But, since wait_bits is just a single bit, I think using
intel_de_wait_custom() works fine here.

Perhaps using plural in wait_bits was not precise?

Anyways,

Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>


>+        if (ret) {
>                 drm_err(display->drm, "Timeout waiting for D2D Link enable for DDI/PORT_BUF_CTL %c\n",
>                         port_name(port));
>         }
>@@ -3058,6 +3063,7 @@ mtl_ddi_disable_d2d(struct intel_encoder *encoder)
>         enum port port = encoder->port;
>         i915_reg_t reg;
>         u32 clr_bits, wait_bits;
>+        int ret;
> 
>         if (DISPLAY_VER(display) < 14)
>                 return;
>@@ -3073,7 +3079,11 @@ mtl_ddi_disable_d2d(struct intel_encoder *encoder)
>         }
> 
>         intel_de_rmw(display, reg, clr_bits, 0);
>-        if (wait_for_us(!(intel_de_read(display, reg) & wait_bits), 100))
>+
>+        ret = intel_de_wait_custom(display, reg,
>+                                   wait_bits, 0,
>+                                   100, 0, NULL);
>+        if (ret)
>                 drm_err(display->drm, "Timeout waiting for D2D Link disable for DDI/PORT_BUF_CTL %c\n",
>                         port_name(port));
> }
>-- 
>2.39.5
>

  reply	other threads:[~2025-07-31 13:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-31 10:05 [PATCH v2 0/7] drm/i915/display: use intel_de_wait_*() functions Jani Nikula
2025-07-31 10:05 ` [PATCH v2 1/7] drm/i915/hdmi: use intel_de_wait_for_set() instead of wait_for() Jani Nikula
2025-07-31 12:54   ` Gustavo Sousa
2025-07-31 10:05 ` [PATCH v2 2/7] drm/i915/ddi: use intel_de_wait_custom() instead of wait_for_us() Jani Nikula
2025-07-31 13:00   ` Gustavo Sousa [this message]
2025-08-01  9:10     ` Jani Nikula
2025-07-31 10:05 ` [PATCH v2 3/7] drm/i915/dpll: " Jani Nikula
2025-07-31 13:09   ` Gustavo Sousa
2025-07-31 10:05 ` [PATCH v2 4/7] drm/i915/cdclk: " Jani Nikula
2025-07-31 13:22   ` Gustavo Sousa
2025-07-31 10:05 ` [PATCH v2 5/7] drm/i915/power: " Jani Nikula
2025-07-31 13:25   ` Gustavo Sousa
2025-07-31 10:05 ` [PATCH v2 6/7] drm/i915/pch: " Jani Nikula
2025-07-31 13:27   ` Gustavo Sousa
2025-07-31 10:05 ` [PATCH v2 7/7] drm/i915/dsi: " Jani Nikula
2025-07-31 13:32   ` Gustavo Sousa
2025-07-31 12:43 ` ✓ CI.KUnit: success for drm/i915/display: use intel_de_wait_*() functions (rev3) Patchwork
2025-07-31 12:58 ` ✗ CI.checksparse: warning " Patchwork
2025-07-31 13:54 ` ✓ Xe.CI.BAT: success " Patchwork
2025-07-31 15:25 ` ✗ Xe.CI.Full: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=175396685525.2011.3239000262739473384@intel.com \
    --to=gustavo.sousa@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox