All of lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v2 20/32] drm/i915/dg1: add hpd interrupt handling
Date: Mon, 22 Jun 2020 21:35:09 +0300	[thread overview]
Message-ID: <20200622183509.GB25163@ideak-desk.fi.intel.com> (raw)
In-Reply-To: <20200618004240.16263-21-lucas.demarchi@intel.com>

On Wed, Jun 17, 2020 at 05:42:28PM -0700, Lucas De Marchi wrote:
> DG1 has one more combo phy port, no TC and all irq handling goes through
> SDE, like for MCC.
> 
> Cc: Anshuman Gupta <anshuman.gupta@intel.com>
> Cc: José Roberto de Souza <jose.souza@intel.com>
> Cc: Imre Deak <imre.deak@intel.com>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_irq.c | 57 +++++++++++++++++++++++++++++----
>  drivers/gpu/drm/i915/i915_reg.h |  8 +++++
>  2 files changed, 59 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index 48e1686df3416..3707f9231171f 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -167,6 +167,13 @@ static const u32 hpd_tgp[HPD_NUM_PINS] = {
>  	[HPD_PORT_I] = SDE_TC_HOTPLUG_ICP(PORT_TC6),
>  };
>  
> +static const u32 hpd_dg1_sde[HPD_NUM_PINS] = {
> +	[HPD_PORT_A] = SDE_DDI_HOTPLUG_ICP(PHY_A),
> +	[HPD_PORT_B] = SDE_DDI_HOTPLUG_ICP(PHY_B),
> +	[HPD_PORT_D] = SDE_DDI_HOTPLUG_ICP(PHY_C),
> +	[HPD_PORT_E] = SDE_DDI_HOTPLUG_ICP(PHY_D),

The above 2 entries look incorrect. encoder->hpd_pin will be assigned
based on the encoder/port's PHY (see intel_hpd_pin_default()). On DG1
port D is connected to PHY C and port E is connected to PHY D. So the
above two pin definitions should be:

	[HPD_PORT_C] = SDE_DDI_HOTPLUG_ICP(PHY_C),
	[HPD_PORT_D] = SDE_DDI_HOTPLUG_ICP(PHY_D),

> +};
> +
>  static void intel_hpd_init_pins(struct drm_i915_private *dev_priv)
>  {
>  	struct i915_hotplug *hpd = &dev_priv->hotplug;
> @@ -193,10 +200,13 @@ static void intel_hpd_init_pins(struct drm_i915_private *dev_priv)
>  	else
>  		hpd->hpd = hpd_ilk;
>  
> -	if (!HAS_PCH_SPLIT(dev_priv) || HAS_PCH_NOP(dev_priv))
> +	if ((INTEL_PCH_TYPE(dev_priv) < PCH_DG1) &&
> +	    (!HAS_PCH_SPLIT(dev_priv) || HAS_PCH_NOP(dev_priv)))
>  		return;
>  
> -	if (HAS_PCH_TGP(dev_priv) || HAS_PCH_JSP(dev_priv))
> +	if (HAS_PCH_DG1(dev_priv))
> +		hpd->pch_hpd = hpd_dg1_sde;
> +	else if (HAS_PCH_TGP(dev_priv) || HAS_PCH_JSP(dev_priv))
>  		hpd->pch_hpd = hpd_tgp;
>  	else if (HAS_PCH_ICP(dev_priv) || HAS_PCH_MCC(dev_priv))
>  		hpd->pch_hpd = hpd_icp;
> @@ -1145,6 +1155,22 @@ static bool tgp_tc_port_hotplug_long_detect(enum hpd_pin pin, u32 val)
>  	}
>  }
>  
> +static bool dg1_ddi_port_hotplug_long_detect(enum hpd_pin pin, u32 val)
> +{
> +	switch (pin) {
> +	case HPD_PORT_A:
> +		return val & SHOTPLUG_CTL_DDI_HPD_LONG_DETECT(PORT_A);
> +	case HPD_PORT_B:
> +		return val & SHOTPLUG_CTL_DDI_HPD_LONG_DETECT(PORT_B);
> +	case HPD_PORT_D:
> +		return val & SHOTPLUG_CTL_DDI_HPD_LONG_DETECT(PORT_C);
> +	case HPD_PORT_E:
> +		return val & SHOTPLUG_CTL_DDI_HPD_LONG_DETECT(PORT_D);
> +	default:
> +		return false;
> +	}
> +}
> +
>  static bool spt_port_hotplug2_long_detect(enum hpd_pin pin, u32 val)
>  {
>  	switch (pin) {
> @@ -1893,13 +1919,20 @@ static void icp_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir)
>  	u32 ddi_hotplug_trigger, tc_hotplug_trigger;
>  	u32 pin_mask = 0, long_mask = 0;
>  	bool (*tc_port_hotplug_long_detect)(enum hpd_pin pin, u32 val);
> +	bool (*ddi_port_hotplug_long_detect)(enum hpd_pin pin, u32 val);
>  
> -	if (HAS_PCH_TGP(dev_priv)) {
> +	if (HAS_PCH_DG1(dev_priv)) {
> +		ddi_hotplug_trigger = pch_iir & SDE_DDI_MASK_DG1;
> +		ddi_port_hotplug_long_detect = dg1_ddi_port_hotplug_long_detect;
> +		tc_hotplug_trigger = 0;
> +	} else if (HAS_PCH_TGP(dev_priv)) {
>  		ddi_hotplug_trigger = pch_iir & SDE_DDI_MASK_TGP;
> +		ddi_port_hotplug_long_detect = icp_ddi_port_hotplug_long_detect;
>  		tc_hotplug_trigger = pch_iir & SDE_TC_MASK_TGP;
>  		tc_port_hotplug_long_detect = tgp_tc_port_hotplug_long_detect;
>  	} else if (HAS_PCH_JSP(dev_priv)) {
>  		ddi_hotplug_trigger = pch_iir & SDE_DDI_MASK_TGP;
> +		ddi_port_hotplug_long_detect = icp_ddi_port_hotplug_long_detect;
>  		tc_hotplug_trigger = 0;
>  	} else if (HAS_PCH_MCC(dev_priv)) {
>  		ddi_hotplug_trigger = pch_iir & SDE_DDI_MASK_ICP;
> @@ -1911,6 +1944,7 @@ static void icp_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir)
>  			 INTEL_PCH_TYPE(dev_priv));
>  
>  		ddi_hotplug_trigger = pch_iir & SDE_DDI_MASK_ICP;
> +		ddi_port_hotplug_long_detect = icp_ddi_port_hotplug_long_detect;
>  		tc_hotplug_trigger = pch_iir & SDE_TC_MASK_ICP;
>  		tc_port_hotplug_long_detect = icp_tc_port_hotplug_long_detect;
>  	}
> @@ -1924,7 +1958,7 @@ static void icp_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir)
>  		intel_get_hpd_pins(dev_priv, &pin_mask, &long_mask,
>  				   ddi_hotplug_trigger, dig_hotplug_reg,
>  				   dev_priv->hotplug.pch_hpd,
> -				   icp_ddi_port_hotplug_long_detect);
> +				   ddi_port_hotplug_long_detect);
>  	}
>  
>  	if (tc_hotplug_trigger) {
> @@ -3147,6 +3181,13 @@ static void jsp_hpd_irq_setup(struct drm_i915_private *dev_priv)
>  			  TGP_DDI_HPD_ENABLE_MASK, 0);
>  }
>  
> +static void dg1_hpd_irq_setup(struct drm_i915_private *dev_priv)
> +{
> +	icp_hpd_irq_setup(dev_priv,
> +			  SDE_DDI_MASK_DG1, 0,
> +			  DG1_DDI_HPD_ENABLE_MASK, 0);
> +}
> +
>  static void gen11_hpd_detection_setup(struct drm_i915_private *dev_priv)
>  {
>  	u32 hotplug;
> @@ -3535,7 +3576,9 @@ static void icp_irq_postinstall(struct drm_i915_private *dev_priv)
>  	gen3_assert_iir_is_zero(&dev_priv->uncore, SDEIIR);
>  	I915_WRITE(SDEIMR, ~mask);
>  
> -	if (HAS_PCH_TGP(dev_priv))
> +	if (HAS_PCH_DG1(dev_priv))
> +		icp_hpd_detection_setup(dev_priv, DG1_DDI_HPD_ENABLE_MASK, 0);
> +	else if (HAS_PCH_TGP(dev_priv))
>  		icp_hpd_detection_setup(dev_priv, TGP_DDI_HPD_ENABLE_MASK,
>  					TGP_TC_HPD_ENABLE_MASK);
>  	else if (HAS_PCH_JSP(dev_priv))
> @@ -4051,7 +4094,9 @@ void intel_irq_init(struct drm_i915_private *dev_priv)
>  		if (I915_HAS_HOTPLUG(dev_priv))
>  			dev_priv->display.hpd_irq_setup = i915_hpd_irq_setup;
>  	} else {
> -		if (HAS_PCH_JSP(dev_priv))
> +		if (HAS_PCH_DG1(dev_priv))
> +			dev_priv->display.hpd_irq_setup = dg1_hpd_irq_setup;
> +		else if (HAS_PCH_JSP(dev_priv))
>  			dev_priv->display.hpd_irq_setup = jsp_hpd_irq_setup;
>  		else if (HAS_PCH_MCC(dev_priv))
>  			dev_priv->display.hpd_irq_setup = mcc_hpd_irq_setup;
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 6649aeca25d72..13a989f5e8dd3 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -8168,6 +8168,10 @@ enum {
>  					 SDE_TC_HOTPLUG_ICP(PORT_TC3) | \
>  					 SDE_TC_HOTPLUG_ICP(PORT_TC2) | \
>  					 SDE_TC_HOTPLUG_ICP(PORT_TC1))
> +#define SDE_DDI_MASK_DG1		(SDE_DDI_HOTPLUG_ICP(PORT_D) | \
> +					 SDE_DDI_HOTPLUG_ICP(PORT_C) | \
> +					 SDE_DDI_HOTPLUG_ICP(PORT_B) | \
> +					 SDE_DDI_HOTPLUG_ICP(PORT_A))
>  
>  #define SDEISR  _MMIO(0xc4000)
>  #define SDEIMR  _MMIO(0xc4004)
> @@ -8367,6 +8371,10 @@ enum {
>  #define TGP_TC_HPD_ENABLE_MASK		(ICP_TC_HPD_ENABLE(PORT_TC6) | \
>  					 ICP_TC_HPD_ENABLE(PORT_TC5) | \
>  					 ICP_TC_HPD_ENABLE_MASK)
> +#define DG1_DDI_HPD_ENABLE_MASK		(SHOTPLUG_CTL_DDI_HPD_ENABLE(PORT_D) | \
> +					 SHOTPLUG_CTL_DDI_HPD_ENABLE(PORT_C) | \
> +					 SHOTPLUG_CTL_DDI_HPD_ENABLE(PORT_B) | \
> +					 SHOTPLUG_CTL_DDI_HPD_ENABLE(PORT_A))
>  
>  #define _PCH_DPLL_A              0xc6014
>  #define _PCH_DPLL_B              0xc6018
> -- 
> 2.26.2
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2020-06-22 18:35 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-18  0:42 [Intel-gfx] [PATCH v2 00/32] Introduce DG1 Lucas De Marchi
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 01/32] drm/i915/rkl: Handle new DPCLKA_CFGCR0 layout Lucas De Marchi
2020-06-23 23:40   ` Souza, Jose
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 02/32] drm/i915/rkl: Add DPLL4 support Lucas De Marchi
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 03/32] drm/i915/rkl: Handle HTI Lucas De Marchi
2020-06-23 23:56   ` Souza, Jose
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 04/32] drm/i915/rkl: Add initial workarounds Lucas De Marchi
2020-06-24  0:13   ` Souza, Jose
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 05/32] drm/i915/rkl: Add Wa_14011224835 for PHY B initialization Lucas De Marchi
2020-06-24  0:07   ` Souza, Jose
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 06/32] drm/i915: Add has_master_unit_irq flag Lucas De Marchi
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 07/32] drm/i915/dg1: add initial DG-1 definitions Lucas De Marchi
2020-06-22  7:51   ` Daniel Vetter
2020-06-22  9:55     ` Jani Nikula
2020-06-23  4:54       ` Dave Airlie
2020-06-23  6:17         ` Daniel Vetter
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 08/32] drm/i915/dg1: Add DG1 PCI IDs Lucas De Marchi
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 09/32] drm/i915/dg1: add support for the master unit interrupt Lucas De Marchi
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 10/32] drm/i915/dg1: Remove SHPD_FILTER_CNT register programming Lucas De Marchi
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 11/32] drm/i915/dg1: Add fake PCH Lucas De Marchi
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 12/32] drm/i915/dg1: Initialize RAWCLK properly Lucas De Marchi
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 13/32] drm/i915/dg1: Define MOCS table for DG1 Lucas De Marchi
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 14/32] drm/i915/dg1: Add DG1 power wells Lucas De Marchi
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 15/32] drm/i915/dg1: Increase mmio size to 4MB Lucas De Marchi
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 16/32] drm/i915/dg1: Wait for pcode/uncore handshake at startup Lucas De Marchi
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 17/32] drm/i915/dg1: Add DPLL macros for DG1 Lucas De Marchi
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 18/32] drm/i915/dg1: Add and setup DPLLs " Lucas De Marchi
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 19/32] drm/i915/dg1: Enable DPLL " Lucas De Marchi
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 20/32] drm/i915/dg1: add hpd interrupt handling Lucas De Marchi
2020-06-22 18:35   ` Imre Deak [this message]
2020-06-22 20:43     ` Lucas De Marchi
2020-06-22 20:54       ` Imre Deak
2020-06-22 21:59         ` Lucas De Marchi
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 21/32] drm/i915/dg1: invert HPD pins Lucas De Marchi
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 22/32] drm/i915/dg1: gmbus pin mapping Lucas De Marchi
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 23/32] drm/i915/dg1: Enable first 2 ports for DG1 Lucas De Marchi
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 24/32] drm/i915/dg1: Don't program PHY_MISC for PHY-C and PHY-D Lucas De Marchi
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 25/32] drm/i915/dg1: Update comp master/slave relationships for PHYs Lucas De Marchi
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 26/32] drm/i915/dg1: Update voltage swing tables for DP Lucas De Marchi
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 27/32] drm/i915/dg1: provide port/phy mapping for vbt Lucas De Marchi
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 28/32] drm/i915/dg1: map/unmap pll clocks Lucas De Marchi
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 29/32] drm/i915/dg1: enable PORT C/D aka D/E Lucas De Marchi
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 30/32] drm/i915/dg1: Load DMC Lucas De Marchi
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 31/32] drm/i915/dg1: Add initial DG1 workarounds Lucas De Marchi
2020-06-18  0:42 ` [Intel-gfx] [PATCH v2 32/32] drm/i915/dg1: DG1 does not support DC6 Lucas De Marchi
2020-06-18  0:56 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Introduce DG1 (rev2) Patchwork
2020-06-18  0:57 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2020-06-18  1:18 ` [Intel-gfx] ✗ Fi.CI.BAT: 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=20200622183509.GB25163@ideak-desk.fi.intel.com \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=lucas.demarchi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.