Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Move the g45 PEG band gap HPD workaround to the HPD code
Date: Thu, 12 Oct 2023 17:48:16 +0300	[thread overview]
Message-ID: <87lec728y7.fsf@intel.com> (raw)
In-Reply-To: <20231012124033.26983-1-ville.syrjala@linux.intel.com>

On Thu, 12 Oct 2023, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> We are asked to reprogram PEG_BAND_GAP_DATA prior to enabling
> hotplug detection on the g45 HDMI/DP ports. Currently we do said
> reprogamming from the DP/HDMI connector initialization functions.
> That code should be mostly platform agnostic so clearly not the
> best place for this. Move the workaround to the place where we
> actually enable HPD detection.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_dp.c          | 10 ----------
>  drivers/gpu/drm/i915/display/intel_hdmi.c        | 10 ----------
>  drivers/gpu/drm/i915/display/intel_hotplug_irq.c | 16 ++++++++++++++++
>  3 files changed, 16 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index 4f6835a7578e..f2d6c4da72ab 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -6198,16 +6198,6 @@ intel_dp_init_connector(struct intel_digital_port *dig_port,
>  				    "HDCP init failed, skipping.\n");
>  	}
>  
> -	/* For G4X desktop chip, PEG_BAND_GAP_DATA 3:0 must first be written
> -	 * 0xd.  Failure to do so will result in spurious interrupts being
> -	 * generated on the port when a cable is not attached.
> -	 */
> -	if (IS_G45(dev_priv)) {
> -		u32 temp = intel_de_read(dev_priv, PEG_BAND_GAP_DATA);
> -		intel_de_write(dev_priv, PEG_BAND_GAP_DATA,
> -			       (temp & ~0xf) | 0xd);
> -	}
> -
>  	intel_dp->frl.is_trained = false;
>  	intel_dp->frl.trained_rate_gbps = 0;
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c
> index ac315f8e7820..ab18cfc19c0a 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
> @@ -3030,16 +3030,6 @@ void intel_hdmi_init_connector(struct intel_digital_port *dig_port,
>  				    "HDCP init failed, skipping.\n");
>  	}
>  
> -	/* For G4X desktop chip, PEG_BAND_GAP_DATA 3:0 must first be written
> -	 * 0xd.  Failure to do so will result in spurious interrupts being
> -	 * generated on the port when a cable is not attached.
> -	 */
> -	if (IS_G45(dev_priv)) {
> -		u32 temp = intel_de_read(dev_priv, PEG_BAND_GAP_DATA);
> -		intel_de_write(dev_priv, PEG_BAND_GAP_DATA,
> -		               (temp & ~0xf) | 0xd);
> -	}
> -
>  	cec_fill_conn_info_from_drm(&conn_info, connector);
>  
>  	intel_hdmi->cec_notifier =
> diff --git a/drivers/gpu/drm/i915/display/intel_hotplug_irq.c b/drivers/gpu/drm/i915/display/intel_hotplug_irq.c
> index f07047e9cb30..04f62f27ad74 100644
> --- a/drivers/gpu/drm/i915/display/intel_hotplug_irq.c
> +++ b/drivers/gpu/drm/i915/display/intel_hotplug_irq.c
> @@ -1361,11 +1361,24 @@ static void bxt_hpd_irq_setup(struct drm_i915_private *dev_priv)
>  	bxt_hpd_detection_setup(dev_priv);
>  }
>  
> +static void g45_hpd_peg_band_gap_wa(struct drm_i915_private *i915)
> +{
> +	/*
> +	 * For G4X desktop chip, PEG_BAND_GAP_DATA 3:0 must first be written
> +	 * 0xd.  Failure to do so will result in spurious interrupts being
> +	 * generated on the port when a cable is not attached.
> +	 */
> +	intel_de_rmw(i915, PEG_BAND_GAP_DATA, 0xf, 0xd);
> +}
> +
>  static void i915_hpd_enable_detection(struct intel_encoder *encoder)
>  {
>  	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
>  	u32 hotplug_en = hpd_mask_i915[encoder->hpd_pin];
>  
> +	if (IS_G45(i915))
> +		g45_hpd_peg_band_gap_wa(i915);
> +
>  	/* HPD sense and interrupt enable are one and the same */
>  	i915_hotplug_interrupt_update(i915, hotplug_en, hotplug_en);
>  }
> @@ -1389,6 +1402,9 @@ static void i915_hpd_irq_setup(struct drm_i915_private *dev_priv)
>  		hotplug_en |= CRT_HOTPLUG_ACTIVATION_PERIOD_64;
>  	hotplug_en |= CRT_HOTPLUG_VOLTAGE_COMPARE_50;
>  
> +	if (IS_G45(dev_priv))
> +		g45_hpd_peg_band_gap_wa(dev_priv);
> +
>  	/* Ignore TV since it's buggy */
>  	i915_hotplug_interrupt_update_locked(dev_priv,
>  					     HOTPLUG_INT_EN_MASK |

-- 
Jani Nikula, Intel

  reply	other threads:[~2023-10-12 14:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-12 12:40 [Intel-gfx] [PATCH] drm/i915: Move the g45 PEG band gap HPD workaround to the HPD code Ville Syrjala
2023-10-12 14:48 ` Jani Nikula [this message]
2023-10-12 20:49 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for " Patchwork
2023-10-13 22:30 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915: Move the g45 PEG band gap HPD workaround to the HPD code (rev2) Patchwork
2023-10-17  1:53 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915: Move the g45 PEG band gap HPD workaround to the HPD code (rev4) Patchwork
2023-10-27 22:01 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915: Move the g45 PEG band gap HPD workaround to the HPD code (rev5) Patchwork
2023-10-28 14:38 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: Move the g45 PEG band gap HPD workaround to the HPD code (rev6) Patchwork
2023-10-31  8:20 ` [Intel-gfx] ✗ Fi.CI.IGT: 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=87lec728y7.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.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