Skip to contentSkip to conversation

More ICL display patches

PATCH In review Paulo Zanoni 15 participants 127 messages May 22, 2018 – Jul 11, 2018 Page 1 of 2

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover More ICL display patches

Hi

This series contains some more ICL patches that haven't seen the mailing list yet. While I'll definitely help re-review the patches not authored by me, please help me with the ones I can't review.

Thanks,
Paulo

Animesh Manna (1):
drm/i915/icl: Update FIA supported lane count for hpd.

Anusha Srivatsa (2):
drm/i915/icp: Add Interrupt Support
drm/i915/icl: Add Icelake PCH detection

Arkadiusz Hiler (1):
drm/i915/icl: Calculate link clock using the new registers

Dhinakaran Pandiyan (4):
drm/i915/icl: Extend AUX F interrupts to ICL drm/i915/icl: GSE interrupt moves from DE_MISC to GU_MISC drm/i915/icl: Support for TC North Display interrupts drm/i915/icl: Handle hotplug interrupts for DP over TBT

Manasi Navare (3):
drm/i915/ICL: Add register definition for DFLEXDPMLE drm/i915/icl: Add DDI HDMI level selection for ICL drm/i915/icl: Get DDI clock for ICL based on PLLs.

Paulo Zanoni (11):
drm/i915/icl: introduce tc_port
drm/i915/icl: add icelake_get_ddi_pll()
drm/i915/icl: unconditionally init DDI for every port drm/i915/icl: start adding the TBT pll
drm/i915/icl: compute the TBT PLL registers drm/i915/icl: implement icl_digital_port_connected() drm/i915/icl: store the port type for TC ports drm/i915/icl: implement the tc/legacy HPD {dis,}connect flow for DP drm/i915/icl: implement the legacy HPD {dis,}connect flow for HDMI drm/i915/icl: program MG_DP_MODE
drm/i915/icl: toggle PHY clock gating around link training

Sripada, Radhakrishna (2):
drm/i915/icl: Map VBT DDC Pin to BSpec DDC Pin
drm/i915/icl: Add 10-bit support for hdmi

 drivers/gpu/drm/i915/i915_drv.c       |   2 +
 drivers/gpu/drm/i915/i915_irq.c       | 295 +++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h       | 142 ++++++++++++++++
 drivers/gpu/drm/i915/intel_bios.c     |  35 +++-
 drivers/gpu/drm/i915/intel_ddi.c      |  65 ++++++-
 drivers/gpu/drm/i915/intel_display.c  |  67 +++++++-
 drivers/gpu/drm/i915/intel_display.h  |  18 ++
 drivers/gpu/drm/i915/intel_dp.c       | 311 +++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/intel_dpll_mgr.c | 111 +++++++++++-
 drivers/gpu/drm/i915/intel_dpll_mgr.h |  16 +-
 drivers/gpu/drm/i915/intel_drv.h      |   7 +
 drivers/gpu/drm/i915/intel_hdmi.c     |  75 +++++---
 drivers/gpu/drm/i915/intel_vbt_defs.h |   6 +
 13 files changed, 1098 insertions(+), 52 deletions(-)
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 1/24 drm/i915/icl: Extend AUX F interrupts to ICL

From: Dhinakaran Pandiyan <[email protected]>

ICL has AUX F.

---
 drivers/gpu/drm/i915/i915_irq.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +3 -2
index f9bc3aaa90d0..2fd92a886789 100644
@@ -2640,7 +2640,8 @@ gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl)
 					    GEN9_AUX_CHANNEL_C |
 					    GEN9_AUX_CHANNEL_D;
 
-			if (IS_CNL_WITH_PORT_F(dev_priv))
+			if (IS_CNL_WITH_PORT_F(dev_priv) ||
+			    INTEL_GEN(dev_priv) >= 11)
 				tmp_mask |= CNL_AUX_CHANNEL_F;
 
 			if (iir & tmp_mask) {
@@ -3920,7 +3921,7 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)
 		de_pipe_masked |= GEN8_DE_PIPE_IRQ_FAULT_ERRORS;
 	}
 
-	if (IS_CNL_WITH_PORT_F(dev_priv))
+	if (IS_CNL_WITH_PORT_F(dev_priv) || INTEL_GEN(dev_priv) >= 11)
 		de_port_masked |= CNL_AUX_CHANNEL_F;
 
 	de_pipe_enables = de_pipe_masked | GEN8_PIPE_VBLANK |
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/24
#2 lore raw

Re: [PATCH 01/24] drm/i915/icl: Extend AUX F interrupts to ICL

Quoted 10 lines

-----Original Message-----
From: Zanoni, Paulo R
Sent: Monday, May 21, 2018 5:26 PM
To: [email protected]
Cc: Pandiyan, Dhinakaran <[email protected]>; Zanoni, Paulo R <[email protected]>; Srivatsa, Anusha <[email protected]>
Subject: [PATCH 01/24] drm/i915/icl: Extend AUX F interrupts to ICL

Quoted 8 lines

From: Dhinakaran Pandiyan <[email protected]>

ICL has AUX F.

Looks good.

Quoted 28 lines

---
drivers/gpu/drm/i915/i915_irq.c | 5 +++--

1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +2 -1
index f9bc3aaa90d0..2fd92a886789 100644
@@ -2640,7 +2640,8 @@ gen8_de_irq_handler(struct drm_i915_private
 *dev_priv, u32 master_ctl)
 					    GEN9_AUX_CHANNEL_C |
 					    GEN9_AUX_CHANNEL_D;
 
-			if (IS_CNL_WITH_PORT_F(dev_priv))
+			if (IS_CNL_WITH_PORT_F(dev_priv) ||
+			    INTEL_GEN(dev_priv) >= 11)
 				tmp_mask |= CNL_AUX_CHANNEL_F;
 
			if (iir & tmp_mask) {
drivers/gpu/drm/i915/i915_irq.c +1 -1
@@ -3920,7 +3921,7 @@ static void gen8_de_irq_postinstall(struct
 drm_i915_private *dev_priv)
 		de_pipe_masked |= GEN8_DE_PIPE_IRQ_FAULT_ERRORS;
 	}
 
-	if (IS_CNL_WITH_PORT_F(dev_priv))
+	if (IS_CNL_WITH_PORT_F(dev_priv) || INTEL_GEN(dev_priv) >= 11)
 		de_port_masked |= CNL_AUX_CHANNEL_F;
 
Quoted 3 lines

de_pipe_enables = de_pipe_masked | GEN8_PIPE_VBLANK |
--
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

PATCH 2/24 drm/i915/icl: GSE interrupt moves from DE_MISC to GU_MISC

In reply to Paulo Zanoni

From: Dhinakaran Pandiyan <[email protected]>

The Graphics System Event(GSE) interrupt bit has a new location in the GU_MISC_INTERRUPT_{IIR, ISR, IMR, IER} registers. Since GSE was the only DE_MISC interrupt that was enabled, with this change we don't enable/handle any of DE_MISC interrupts for gen11. Credits to Paulo for pointing out the register change.

[Paulo: bikesheds and rebases]
---
 drivers/gpu/drm/i915/i915_irq.c | 38 ++++++++++++++++++++++++++++++++++++--
 drivers/gpu/drm/i915/i915_reg.h |  7 +++++++
 2 files changed, 43 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +36 -2
index 2fd92a886789..dde938bbfb0a 100644
@@ -2605,7 +2605,8 @@ gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl)
 			I915_WRITE(GEN8_DE_MISC_IIR, iir);
 			ret = IRQ_HANDLED;
 
-			if (iir & GEN8_DE_MISC_GSE) {
+			if (INTEL_GEN(dev_priv) <= 10 &&
+			    (iir & GEN8_DE_MISC_GSE)) {
 				intel_opregion_asle_intr(dev_priv);
 				found = true;
 			}
@@ -2943,6 +2944,30 @@ gen11_gt_irq_handler(struct drm_i915_private * const i915,
 	spin_unlock(&i915->irq_lock);
 }
 
+static irqreturn_t
+gen11_gu_misc_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl)
+{
+	irqreturn_t ret = IRQ_NONE;
+	u32 iir;
+
+	if (!(master_ctl & GEN11_GU_MISC_IRQ))
+		return ret;
+
+	iir = I915_READ(GEN11_GU_MISC_IIR);
+	if (iir) {
+		I915_WRITE(GEN11_GU_MISC_IIR, iir);
+		ret = IRQ_HANDLED;
+		if (iir & GEN11_GU_MISC_GSE)
+			intel_opregion_asle_intr(dev_priv);
+		else
+			DRM_ERROR("Unexpected GU Misc interrupt 0x%08x\n", iir);
+	} else {
+		DRM_ERROR("The master control interrupt lied (GU MISC)!\n");
+	}
+
+	return ret;
+}
+
 static irqreturn_t gen11_irq_handler(int irq, void *arg)
 {
 	struct drm_i915_private * const i915 = to_i915(arg);
@@ -2976,6 +3001,8 @@ static irqreturn_t gen11_irq_handler(int irq, void *arg)
 		enable_rpm_wakeref_asserts(i915);
 	}
 
+	gen11_gu_misc_irq_handler(i915, master_ctl);
+
 	/* Acknowledge and enable interrupts. */
 	raw_reg_write(regs, GEN11_GFX_MSTR_IRQ, GEN11_MASTER_IRQ | master_ctl);
 
@@ -3465,6 +3492,7 @@ static void gen11_irq_reset(struct drm_device *dev)
 
 	GEN3_IRQ_RESET(GEN8_DE_PORT_);
 	GEN3_IRQ_RESET(GEN8_DE_MISC_);
+	GEN3_IRQ_RESET(GEN11_GU_MISC_);
 	GEN3_IRQ_RESET(GEN8_PCU_);
 }
 
@@ -3908,9 +3936,12 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)
 	uint32_t de_pipe_enables;
 	u32 de_port_masked = GEN8_AUX_CHANNEL_A;
 	u32 de_port_enables;
-	u32 de_misc_masked = GEN8_DE_MISC_GSE | GEN8_DE_EDP_PSR;
+	u32 de_misc_masked = GEN8_DE_EDP_PSR;
 	enum pipe pipe;
 
+	if (INTEL_GEN(dev_priv) <= 10)
+		de_misc_masked |= GEN8_DE_MISC_GSE;
+
 	if (INTEL_GEN(dev_priv) >= 9) {
 		de_pipe_masked |= GEN9_DE_PIPE_IRQ_FAULT_ERRORS;
 		de_port_masked |= GEN9_AUX_CHANNEL_B | GEN9_AUX_CHANNEL_C |
@@ -4004,10 +4035,13 @@ static void gen11_gt_irq_postinstall(struct drm_i915_private *dev_priv)
 static int gen11_irq_postinstall(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
+	u32 gu_misc_masked = GEN11_GU_MISC_GSE;
 
 	gen11_gt_irq_postinstall(dev_priv);
 	gen8_de_irq_postinstall(dev_priv);
 
+	GEN3_IRQ_INIT(GEN11_GU_MISC_, ~gu_misc_masked, gu_misc_masked);
+
 	I915_WRITE(GEN11_DISPLAY_INT_CTL, GEN11_DISPLAY_IRQ_ENABLE);
 
 	I915_WRITE(GEN11_GFX_MSTR_IRQ, GEN11_MASTER_IRQ);
drivers/gpu/drm/i915/i915_reg.h +7 -0
index 196a0eb79272..ca474f6f523c 100644
@@ -7016,9 +7016,16 @@ enum {
 #define GEN8_PCU_IIR _MMIO(0x444e8)
 #define GEN8_PCU_IER _MMIO(0x444ec)
 
+#define GEN11_GU_MISC_ISR	_MMIO(0x444f0)
+#define GEN11_GU_MISC_IMR	_MMIO(0x444f4)
+#define GEN11_GU_MISC_IIR	_MMIO(0x444f8)
+#define GEN11_GU_MISC_IER	_MMIO(0x444fc)
+#define  GEN11_GU_MISC_GSE	(1 << 27)
+
 #define GEN11_GFX_MSTR_IRQ		_MMIO(0x190010)
 #define  GEN11_MASTER_IRQ		(1 << 31)
 #define  GEN11_PCU_IRQ			(1 << 30)
+#define  GEN11_GU_MISC_IRQ		(1 << 29)
 #define  GEN11_DISPLAY_IRQ		(1 << 16)
 #define  GEN11_GT_DW_IRQ(x)		(1 << (x))
 #define  GEN11_GT_DW1_IRQ		(1 << 1)
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

Re: [PATCH 02/24] drm/i915/icl: GSE interrupt moves from DE_MISC to GU_MISC

Quoted 21 lines · Paulo Zanoni

From: Dhinakaran Pandiyan <[email protected]>

The Graphics System Event(GSE) interrupt bit has a new location in the GU_MISC_INTERRUPT_{IIR, ISR, IMR, IER} registers. Since GSE was the only DE_MISC interrupt that was enabled, with this change we don't enable/handle any of DE_MISC interrupts for gen11. Credits to Paulo for pointing out the register change.

[Paulo: bikesheds and rebases]
---
 drivers/gpu/drm/i915/i915_irq.c | 38 ++++++++++++++++++++++++++++++++++++--
 drivers/gpu/drm/i915/i915_reg.h |  7 +++++++
 2 files changed, 43 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +0 -0
index 2fd92a886789..dde938bbfb0a 100644

drivers/gpu/drm/i915/i915_irq.c gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl) · line 2609

Quoted 6 lines
drivers/gpu/drm/i915/i915_irq.c +2 -1
@@ -2605,7 +2605,8 @@ gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl)
 			I915_WRITE(GEN8_DE_MISC_IIR, iir);
 			ret = IRQ_HANDLED;
 
-			if (iir & GEN8_DE_MISC_GSE) {
+			if (INTEL_GEN(dev_priv) <= 10 &&
+			    (iir & GEN8_DE_MISC_GSE)) {

This bit should not be ever set with gen11 so no need to add extra guards?

drivers/gpu/drm/i915/i915_irq.c gen11_gt_irq_handler(struct drm_i915_private * const i915, · line 2947

Quoted 8 lines
drivers/gpu/drm/i915/i915_irq.c +1 -0
 				intel_opregion_asle_intr(dev_priv);
 				found = true;
 			}
@@ -2943,6 +2944,30 @@ gen11_gt_irq_handler(struct drm_i915_private * const i915,
 	spin_unlock(&i915->irq_lock);
 }
 
+static irqreturn_t

Return is never used for anything, just use void.

drivers/gpu/drm/i915/i915_irq.c gen11_gt_irq_handler(struct drm_i915_private * const i915, · line 2956

Quoted 9 lines
drivers/gpu/drm/i915/i915_irq.c +9 -0
+gen11_gu_misc_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl)
+{
+	irqreturn_t ret = IRQ_NONE;
+	u32 iir;
+
+	if (!(master_ctl & GEN11_GU_MISC_IRQ))
+		return ret;
+
+	iir = I915_READ(GEN11_GU_MISC_IIR);

This reg seems to out of forcewake domain so
just use raw_reg_read() in here.

drivers/gpu/drm/i915/i915_irq.c gen11_gt_irq_handler(struct drm_i915_private * const i915, · line 2957

Quoted 1 line
drivers/gpu/drm/i915/i915_irq.c +1 -0
+	if (iir) {

just a note that likely(iir) if you want to add emphasis.

drivers/gpu/drm/i915/i915_irq.c gen11_gt_irq_handler(struct drm_i915_private * const i915, · line 2958

Quoted 1 line
drivers/gpu/drm/i915/i915_irq.c +1 -0
+		I915_WRITE(GEN11_GU_MISC_IIR, iir);

raw_reg_write()
-Mika

Quoted 88 lines
drivers/gpu/drm/i915/i915_irq.c +22 -1
+		ret = IRQ_HANDLED;
+		if (iir & GEN11_GU_MISC_GSE)
+			intel_opregion_asle_intr(dev_priv);
+		else
+			DRM_ERROR("Unexpected GU Misc interrupt 0x%08x\n", iir);
+	} else {
+		DRM_ERROR("The master control interrupt lied (GU MISC)!\n");
+	}
+
+	return ret;
+}
+
 static irqreturn_t gen11_irq_handler(int irq, void *arg)
 {
 	struct drm_i915_private * const i915 = to_i915(arg);
@@ -2976,6 +3001,8 @@ static irqreturn_t gen11_irq_handler(int irq, void *arg)
 		enable_rpm_wakeref_asserts(i915);
 	}
 
+	gen11_gu_misc_irq_handler(i915, master_ctl);
+
 	/* Acknowledge and enable interrupts. */
 	raw_reg_write(regs, GEN11_GFX_MSTR_IRQ, GEN11_MASTER_IRQ | master_ctl);
 
@@ -3465,6 +3492,7 @@ static void gen11_irq_reset(struct drm_device *dev)
 
 	GEN3_IRQ_RESET(GEN8_DE_PORT_);
 	GEN3_IRQ_RESET(GEN8_DE_MISC_);
+	GEN3_IRQ_RESET(GEN11_GU_MISC_);
 	GEN3_IRQ_RESET(GEN8_PCU_);
 }
 
@@ -3908,9 +3936,12 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)
 	uint32_t de_pipe_enables;
 	u32 de_port_masked = GEN8_AUX_CHANNEL_A;
 	u32 de_port_enables;
-	u32 de_misc_masked = GEN8_DE_MISC_GSE | GEN8_DE_EDP_PSR;
+	u32 de_misc_masked = GEN8_DE_EDP_PSR;
 	enum pipe pipe;
 
+	if (INTEL_GEN(dev_priv) <= 10)
+		de_misc_masked |= GEN8_DE_MISC_GSE;
+
 	if (INTEL_GEN(dev_priv) >= 9) {
 		de_pipe_masked |= GEN9_DE_PIPE_IRQ_FAULT_ERRORS;
 		de_port_masked |= GEN9_AUX_CHANNEL_B | GEN9_AUX_CHANNEL_C |
@@ -4004,10 +4035,13 @@ static void gen11_gt_irq_postinstall(struct drm_i915_private *dev_priv)
 static int gen11_irq_postinstall(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
+	u32 gu_misc_masked = GEN11_GU_MISC_GSE;
 
 	gen11_gt_irq_postinstall(dev_priv);
 	gen8_de_irq_postinstall(dev_priv);
 
+	GEN3_IRQ_INIT(GEN11_GU_MISC_, ~gu_misc_masked, gu_misc_masked);
+
 	I915_WRITE(GEN11_DISPLAY_INT_CTL, GEN11_DISPLAY_IRQ_ENABLE);
 
 	I915_WRITE(GEN11_GFX_MSTR_IRQ, GEN11_MASTER_IRQ);
drivers/gpu/drm/i915/i915_reg.h +7 -0
index 196a0eb79272..ca474f6f523c 100644
@@ -7016,9 +7016,16 @@ enum {
 #define GEN8_PCU_IIR _MMIO(0x444e8)
 #define GEN8_PCU_IER _MMIO(0x444ec)
 
+#define GEN11_GU_MISC_ISR	_MMIO(0x444f0)
+#define GEN11_GU_MISC_IMR	_MMIO(0x444f4)
+#define GEN11_GU_MISC_IIR	_MMIO(0x444f8)
+#define GEN11_GU_MISC_IER	_MMIO(0x444fc)
+#define  GEN11_GU_MISC_GSE	(1 << 27)
+
 #define GEN11_GFX_MSTR_IRQ		_MMIO(0x190010)
 #define  GEN11_MASTER_IRQ		(1 << 31)
 #define  GEN11_PCU_IRQ			(1 << 30)
+#define  GEN11_GU_MISC_IRQ		(1 << 29)
 #define  GEN11_DISPLAY_IRQ		(1 << 16)
 #define  GEN11_GT_DW_IRQ(x)		(1 << (x))
 #define  GEN11_GT_DW1_IRQ		(1 << 1)
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

Re: [PATCH 02/24] drm/i915/icl: GSE interrupt moves from DE_MISC to GU_MISC

Quoted 24 lines · Mika Kuoppala
Quoted 22 lines · Paulo Zanoni

From: Dhinakaran Pandiyan <[email protected]>

The Graphics System Event(GSE) interrupt bit has a new location in the
GU_MISC_INTERRUPT_{IIR, ISR, IMR, IER} registers. Since GSE was the only
DE_MISC interrupt that was enabled, with this change we don't enable/handle
any of DE_MISC interrupts for gen11. Credits to Paulo for pointing out
the register change.

[Paulo: bikesheds and rebases]

---
 drivers/gpu/drm/i915/i915_irq.c | 38
++++++++++++++++++++++++++++++++++++--
 drivers/gpu/drm/i915/i915_reg.h |  7 +++++++

 2 files changed, 43 insertions(+), 2 deletions(-)
Quoted 15 lines

drivers/gpu/drm/i915/i915_irq.c gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl) · line 2609

Quoted 13 lines
drivers/gpu/drm/i915/i915_irq.c +0 -0
index 2fd92a886789..dde938bbfb0a 100644
@@ -2605,7 +2605,8 @@ gen8_de_irq_handler(struct drm_i915_private
 *dev_priv, u32 master_ctl)
  			I915_WRITE(GEN8_DE_MISC_IIR, iir);
  			ret = IRQ_HANDLED;

drivers/gpu/drm/i915/i915_irq.c +2 -1
-			if (iir & GEN8_DE_MISC_GSE) {
+			if (INTEL_GEN(dev_priv) <= 10 &&
+			    (iir & GEN8_DE_MISC_GSE)) {

This bit should not be ever set with gen11 so no need to add extra guards?

The bit is reserved on gen-11, we can't be sure if some future platform is not going to reuse it for something else.The guard also adds clarity that the gen-11 handler is elsewhere.

Quoted 13 lines
Quoted 10 lines

  intel_opregion_asle_intr(dev_priv) ;
  found = true;
  }

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -2943,6 +2944,30 @@ gen11_gt_irq_handler(struct drm_i915_private
 * const i915,
  	spin_unlock(&i915->irq_lock);
  }
Quoted 2 lines


+static irqreturn_t

Return is never used for anything, just use void.

Looks like the caller was reworked upstream, I'll change this.

Quoted 14 lines

drivers/gpu/drm/i915/i915_irq.c gen11_gt_irq_handler(struct drm_i915_private * const i915, · line 2956

Quoted 12 lines

+gen11_gu_misc_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl)

drivers/gpu/drm/i915/i915_irq.c +8 -0
+{
+	irqreturn_t ret = IRQ_NONE;
+	u32 iir;
+
+	if (!(master_ctl & GEN11_GU_MISC_IRQ))
+		return ret;
+
+	iir = I915_READ(GEN11_GU_MISC_IIR);

This reg seems to out of forcewake domain so
just use raw_reg_read() in here.

How do you check that? And what exactly is the forcewake domain? Is it similar to a power domain?

Quoted 95 lines

drivers/gpu/drm/i915/i915_irq.c gen11_gt_irq_handler(struct drm_i915_private * const i915, · line 2957

Quoted 3 lines
drivers/gpu/drm/i915/i915_irq.c +1 -0
+	if (iir) {

just a note that likely(iir) if you want to add emphasis.

drivers/gpu/drm/i915/i915_irq.c gen11_gt_irq_handler(struct drm_i915_private * const i915, · line 2958

Quoted 2 lines
drivers/gpu/drm/i915/i915_irq.c +1 -0
+		I915_WRITE(GEN11_GU_MISC_IIR, iir);

raw_reg_write()
-Mika

Quoted 85 lines
drivers/gpu/drm/i915/i915_irq.c +5 -0
+		ret = IRQ_HANDLED;
+		if (iir & GEN11_GU_MISC_GSE)
+			intel_opregion_asle_intr(dev_priv);
+		else
+			DRM_ERROR("Unexpected GU Misc interrupt

0x%08x\n", iir);

drivers/gpu/drm/i915/i915_irq.c +2 -0
+	} else {
+		DRM_ERROR("The master control interrupt lied (GU

MISC)!\n");

drivers/gpu/drm/i915/i915_irq.c +5 -0
+	}
+
+	return ret;
+}
+

 static irqreturn_t gen11_irq_handler(int irq, void *arg) {
  struct drm_i915_private * const i915 = to_i915(arg);

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -2976,6 +3001,8 @@ static irqreturn_t gen11_irq_handler(int irq,
 void *arg)
  		enable_rpm_wakeref_asserts(i915);
  	}

drivers/gpu/drm/i915/i915_irq.c +2 -0
+	gen11_gu_misc_irq_handler(i915, master_ctl);
+

  /* Acknowledge and enable interrupts. */ raw_reg_write(regs, GEN11_GFX_MSTR_IRQ, GEN11_MASTER_IRQ | master_ctl);

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -3465,6 +3492,7 @@ static void gen11_irq_reset(struct drm_device
 *dev)


  GEN3_IRQ_RESET(GEN8_DE_PORT_);
  GEN3_IRQ_RESET(GEN8_DE_MISC_);

drivers/gpu/drm/i915/i915_irq.c +1 -0
+	GEN3_IRQ_RESET(GEN11_GU_MISC_);

  GEN3_IRQ_RESET(GEN8_PCU_);
 }

drivers/gpu/drm/i915/i915_irq.c +1 -1
@@ -3908,9 +3936,12 @@ static void gen8_de_irq_postinstall(struct
 drm_i915_private *dev_priv)
  	uint32_t de_pipe_enables;
  	u32 de_port_masked = GEN8_AUX_CHANNEL_A;
  	u32 de_port_enables;
-	u32 de_misc_masked = GEN8_DE_MISC_GSE | GEN8_DE_EDP_PSR;
+	u32 de_misc_masked = GEN8_DE_EDP_PSR;
  	enum pipe pipe;

drivers/gpu/drm/i915/i915_irq.c +3 -0
+	if (INTEL_GEN(dev_priv) <= 10)
+		de_misc_masked |= GEN8_DE_MISC_GSE;
+

  if (INTEL_GEN(dev_priv) >= 9) {

 		de_pipe_masked |= GEN9_DE_PIPE_IRQ_FAULT_ERRORS;
 		de_port_masked |= GEN9_AUX_CHANNEL_B |
GEN9_AUX_CHANNEL_C |
drivers/gpu/drm/i915/i915_irq.c +1 -0
@@ -4004,10 +4035,13 @@ static void gen11_gt_irq_postinstall(struct
 drm_i915_private *dev_priv)
  static int gen11_irq_postinstall(struct drm_device *dev)
  {
  	struct drm_i915_private *dev_priv = dev->dev_private;
+	u32 gu_misc_masked = GEN11_GU_MISC_GSE;


  gen11_gt_irq_postinstall(dev_priv);
  gen8_de_irq_postinstall(dev_priv);

drivers/gpu/drm/i915/i915_irq.c +1 -0
+	GEN3_IRQ_INIT(GEN11_GU_MISC_, ~gu_misc_masked,

gu_misc_masked);
+
  I915_WRITE(GEN11_DISPLAY_INT_CTL, GEN11_DISPLAY_IRQ_ENABLE);

  I915_WRITE(GEN11_GFX_MSTR_IRQ, GEN11_MASTER_IRQ);

drivers/gpu/drm/i915/i915_reg.h +0 -0
index 196a0eb79272..ca474f6f523c 100644
@@ -7016,9 +7016,16 @@ enum {
  #define GEN8_PCU_IIR _MMIO(0x444e8)
  #define GEN8_PCU_IER _MMIO(0x444ec)

drivers/gpu/drm/i915/i915_reg.h +5 -0
+#define GEN11_GU_MISC_ISR	_MMIO(0x444f0)
+#define GEN11_GU_MISC_IMR	_MMIO(0x444f4)
+#define GEN11_GU_MISC_IIR	_MMIO(0x444f8)
+#define GEN11_GU_MISC_IER	_MMIO(0x444fc)
+#define  GEN11_GU_MISC_GSE	(1 << 27)
Quoted 8 lines
Quoted 8 lines

+
 #define GEN11_GFX_MSTR_IRQ _MMIO(0x190010)
 #define  GEN11_MASTER_IRQ (1 << 31)
 #define  GEN11_PCU_IRQ (1 << 30)
+#define  GEN11_GU_MISC_IRQ (1 << 29)
 #define  GEN11_DISPLAY_IRQ (1 << 16)
 #define  GEN11_GT_DW_IRQ(x) (1 << (x))
 #define  GEN11_GT_DW1_IRQ (1 << 1)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw

Re: [PATCH 02/24] drm/i915/icl: GSE interrupt moves from DE_MISC to GU_MISC

Quoted 40 lines · Dhinakaran Pandiyan
Quoted 24 lines · Mika Kuoppala
Quoted 22 lines · Paulo Zanoni

From: Dhinakaran Pandiyan <[email protected]>

The Graphics System Event(GSE) interrupt bit has a new location in the
GU_MISC_INTERRUPT_{IIR, ISR, IMR, IER} registers. Since GSE was the only
DE_MISC interrupt that was enabled, with this change we don't enable/handle
any of DE_MISC interrupts for gen11. Credits to Paulo for pointing out
the register change.

[Paulo: bikesheds and rebases]

---
 drivers/gpu/drm/i915/i915_irq.c | 38
++++++++++++++++++++++++++++++++++++--
 drivers/gpu/drm/i915/i915_reg.h |  7 +++++++

 2 files changed, 43 insertions(+), 2 deletions(-)
Quoted 15 lines

drivers/gpu/drm/i915/i915_irq.c gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl) · line 2609

Quoted 13 lines
drivers/gpu/drm/i915/i915_irq.c +0 -0
index 2fd92a886789..dde938bbfb0a 100644
@@ -2605,7 +2605,8 @@ gen8_de_irq_handler(struct drm_i915_private
 *dev_priv, u32 master_ctl)
  			I915_WRITE(GEN8_DE_MISC_IIR, iir);
  			ret = IRQ_HANDLED;

drivers/gpu/drm/i915/i915_irq.c +2 -1
-			if (iir & GEN8_DE_MISC_GSE) {
+			if (INTEL_GEN(dev_priv) <= 10 &&
+			    (iir & GEN8_DE_MISC_GSE)) {

This bit should not be ever set with gen11 so no need to add extra guards?

Quoted 3 lines

The bit is reserved on gen-11, we can't be sure if some future platform is not going to reuse it for something else.The guard also adds clarity that the gen-11 handler is elsewhere.

It adds latency to interrupt handler too. We already mask that specific interrupt so guarding against collision would be the responsibility of that future platform enabling patchset.

Quoted 30 lines
Quoted 14 lines
Quoted 11 lines

  intel_opregion_asle_intr(dev_priv) ;
  found = true;
  }

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -2943,6 +2944,30 @@ gen11_gt_irq_handler(struct drm_i915_private
 * const i915,
  	spin_unlock(&i915->irq_lock);
  }
Quoted 2 lines


+static irqreturn_t

Return is never used for anything, just use void.

Looks like the caller was reworked upstream, I'll change this.

Quoted 14 lines

drivers/gpu/drm/i915/i915_irq.c gen11_gt_irq_handler(struct drm_i915_private * const i915, · line 2956

Quoted 12 lines

+gen11_gu_misc_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl)

drivers/gpu/drm/i915/i915_irq.c +8 -0
+{
+	irqreturn_t ret = IRQ_NONE;
+	u32 iir;
+
+	if (!(master_ctl & GEN11_GU_MISC_IRQ))
+		return ret;
+
+	iir = I915_READ(GEN11_GU_MISC_IIR);

This reg seems to out of forcewake domain so
just use raw_reg_read() in here.

Quoted 3 lines

How do you check that? And what exactly is the forcewake domain? Is it similar to a power domain?

from intel_uncore.c:
static const struct intel_forcewake_range __gen11_fw_ranges[] = { ..

	GEN_FW_RANGE(0x40000, 0x1bffff, 0),

...

So using I915_READ will work as it will that it doesn't need forcewake dance. But the checks add latency, not much, but this is interrupt handler after all so we do care.

forcewake domains are per engine power saving feature where you need to do certain dance to wake the domain up and also to let it sleep.

For more details skim through intel_uncore.[hc].

-Mika

Quoted 95 lines
Quoted 95 lines

drivers/gpu/drm/i915/i915_irq.c gen11_gt_irq_handler(struct drm_i915_private * const i915, · line 2957

Quoted 3 lines
drivers/gpu/drm/i915/i915_irq.c +1 -0
+	if (iir) {

just a note that likely(iir) if you want to add emphasis.

drivers/gpu/drm/i915/i915_irq.c gen11_gt_irq_handler(struct drm_i915_private * const i915, · line 2958

Quoted 2 lines
drivers/gpu/drm/i915/i915_irq.c +1 -0
+		I915_WRITE(GEN11_GU_MISC_IIR, iir);

raw_reg_write()
-Mika

Quoted 85 lines
drivers/gpu/drm/i915/i915_irq.c +5 -0
+		ret = IRQ_HANDLED;
+		if (iir & GEN11_GU_MISC_GSE)
+			intel_opregion_asle_intr(dev_priv);
+		else
+			DRM_ERROR("Unexpected GU Misc interrupt

0x%08x\n", iir);

drivers/gpu/drm/i915/i915_irq.c +2 -0
+	} else {
+		DRM_ERROR("The master control interrupt lied (GU

MISC)!\n");

drivers/gpu/drm/i915/i915_irq.c +5 -0
+	}
+
+	return ret;
+}
+

 static irqreturn_t gen11_irq_handler(int irq, void *arg) {
  struct drm_i915_private * const i915 = to_i915(arg);

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -2976,6 +3001,8 @@ static irqreturn_t gen11_irq_handler(int irq,
 void *arg)
  		enable_rpm_wakeref_asserts(i915);
  	}

drivers/gpu/drm/i915/i915_irq.c +2 -0
+	gen11_gu_misc_irq_handler(i915, master_ctl);
+

  /* Acknowledge and enable interrupts. */ raw_reg_write(regs, GEN11_GFX_MSTR_IRQ, GEN11_MASTER_IRQ | master_ctl);

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -3465,6 +3492,7 @@ static void gen11_irq_reset(struct drm_device
 *dev)


  GEN3_IRQ_RESET(GEN8_DE_PORT_);
  GEN3_IRQ_RESET(GEN8_DE_MISC_);

drivers/gpu/drm/i915/i915_irq.c +1 -0
+	GEN3_IRQ_RESET(GEN11_GU_MISC_);

  GEN3_IRQ_RESET(GEN8_PCU_);
 }

drivers/gpu/drm/i915/i915_irq.c +1 -1
@@ -3908,9 +3936,12 @@ static void gen8_de_irq_postinstall(struct
 drm_i915_private *dev_priv)
  	uint32_t de_pipe_enables;
  	u32 de_port_masked = GEN8_AUX_CHANNEL_A;
  	u32 de_port_enables;
-	u32 de_misc_masked = GEN8_DE_MISC_GSE | GEN8_DE_EDP_PSR;
+	u32 de_misc_masked = GEN8_DE_EDP_PSR;
  	enum pipe pipe;

drivers/gpu/drm/i915/i915_irq.c +3 -0
+	if (INTEL_GEN(dev_priv) <= 10)
+		de_misc_masked |= GEN8_DE_MISC_GSE;
+

  if (INTEL_GEN(dev_priv) >= 9) {

 		de_pipe_masked |= GEN9_DE_PIPE_IRQ_FAULT_ERRORS;
 		de_port_masked |= GEN9_AUX_CHANNEL_B |
GEN9_AUX_CHANNEL_C |
drivers/gpu/drm/i915/i915_irq.c +1 -0
@@ -4004,10 +4035,13 @@ static void gen11_gt_irq_postinstall(struct
 drm_i915_private *dev_priv)
  static int gen11_irq_postinstall(struct drm_device *dev)
  {
  	struct drm_i915_private *dev_priv = dev->dev_private;
+	u32 gu_misc_masked = GEN11_GU_MISC_GSE;


  gen11_gt_irq_postinstall(dev_priv);
  gen8_de_irq_postinstall(dev_priv);

drivers/gpu/drm/i915/i915_irq.c +1 -0
+	GEN3_IRQ_INIT(GEN11_GU_MISC_, ~gu_misc_masked,

gu_misc_masked);
+
  I915_WRITE(GEN11_DISPLAY_INT_CTL, GEN11_DISPLAY_IRQ_ENABLE);

  I915_WRITE(GEN11_GFX_MSTR_IRQ, GEN11_MASTER_IRQ);

drivers/gpu/drm/i915/i915_reg.h +0 -0
index 196a0eb79272..ca474f6f523c 100644
@@ -7016,9 +7016,16 @@ enum {
  #define GEN8_PCU_IIR _MMIO(0x444e8)
  #define GEN8_PCU_IER _MMIO(0x444ec)

drivers/gpu/drm/i915/i915_reg.h +5 -0
+#define GEN11_GU_MISC_ISR	_MMIO(0x444f0)
+#define GEN11_GU_MISC_IMR	_MMIO(0x444f4)
+#define GEN11_GU_MISC_IIR	_MMIO(0x444f8)
+#define GEN11_GU_MISC_IER	_MMIO(0x444fc)
+#define  GEN11_GU_MISC_GSE	(1 << 27)
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

+
 #define GEN11_GFX_MSTR_IRQ _MMIO(0x190010)
 #define  GEN11_MASTER_IRQ (1 << 31)
 #define  GEN11_PCU_IRQ (1 << 30)
+#define  GEN11_GU_MISC_IRQ (1 << 29)
 #define  GEN11_DISPLAY_IRQ (1 << 16)
 #define  GEN11_GT_DW_IRQ(x) (1 << (x))
 #define  GEN11_GT_DW1_IRQ (1 << 1)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw

PATCH v2 1/1 drm/i915/icl: GSE interrupt moves from DE_MISC to GU_MISC

The Graphics System Event(GSE) interrupt bit has a new location in the GU_MISC_INTERRUPT_{IIR, ISR, IMR, IER} registers. Since GSE was the only DE_MISC interrupt that was enabled, with this change we don't enable/handle any of DE_MISC interrupts for gen11. Credits to Paulo for pointing out the register change.

v2: from DK
raw_reg_[read/write], branch prediction hint and drop platform check (Mika)

Cc Mika Kuoppala <[email protected]>
[Paulo: bikesheds and rebases]
---
 drivers/gpu/drm/i915/i915_irq.c | 31 ++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h |  7 +++++++
 2 files changed, 37 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_irq.c +30 -1
index 2fd92a886789..cdbc23b21df6 100644
@@ -2943,6 +2943,26 @@ gen11_gt_irq_handler(struct drm_i915_private * const i915,
 	spin_unlock(&i915->irq_lock);
 }
 
+static void
+gen11_gu_misc_irq_handler(struct drm_i915_private *dev_priv,
+			  const u32 master_ctl)
+{
+	void __iomem * const regs = dev_priv->regs;
+	u32 iir;
+
+	if (!(master_ctl & GEN11_GU_MISC_IRQ))
+		return;
+
+	iir = raw_reg_read(regs, GEN11_GU_MISC_IIR);
+	if (likely(iir)) {
+		raw_reg_write(regs, GEN11_GU_MISC_IIR, iir);
+		if (iir & GEN11_GU_MISC_GSE)
+			intel_opregion_asle_intr(dev_priv);
+		else
+			DRM_ERROR("Unexpected GU Misc interrupt 0x%08x\n", iir);
+	}
+}
+
 static irqreturn_t gen11_irq_handler(int irq, void *arg)
 {
 	struct drm_i915_private * const i915 = to_i915(arg);
@@ -2976,6 +2996,8 @@ static irqreturn_t gen11_irq_handler(int irq, void *arg)
 		enable_rpm_wakeref_asserts(i915);
 	}
 
+	gen11_gu_misc_irq_handler(i915, master_ctl);
+
 	/* Acknowledge and enable interrupts. */
 	raw_reg_write(regs, GEN11_GFX_MSTR_IRQ, GEN11_MASTER_IRQ | master_ctl);
 
@@ -3465,6 +3487,7 @@ static void gen11_irq_reset(struct drm_device *dev)
 
 	GEN3_IRQ_RESET(GEN8_DE_PORT_);
 	GEN3_IRQ_RESET(GEN8_DE_MISC_);
+	GEN3_IRQ_RESET(GEN11_GU_MISC_);
 	GEN3_IRQ_RESET(GEN8_PCU_);
 }
 
@@ -3908,9 +3931,12 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)
 	uint32_t de_pipe_enables;
 	u32 de_port_masked = GEN8_AUX_CHANNEL_A;
 	u32 de_port_enables;
-	u32 de_misc_masked = GEN8_DE_MISC_GSE | GEN8_DE_EDP_PSR;
+	u32 de_misc_masked = GEN8_DE_EDP_PSR;
 	enum pipe pipe;
 
+	if (INTEL_GEN(dev_priv) <= 10)
+		de_misc_masked |= GEN8_DE_MISC_GSE;
+
 	if (INTEL_GEN(dev_priv) >= 9) {
 		de_pipe_masked |= GEN9_DE_PIPE_IRQ_FAULT_ERRORS;
 		de_port_masked |= GEN9_AUX_CHANNEL_B | GEN9_AUX_CHANNEL_C |
@@ -4004,10 +4030,13 @@ static void gen11_gt_irq_postinstall(struct drm_i915_private *dev_priv)
 static int gen11_irq_postinstall(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
+	u32 gu_misc_masked = GEN11_GU_MISC_GSE;
 
 	gen11_gt_irq_postinstall(dev_priv);
 	gen8_de_irq_postinstall(dev_priv);
 
+	GEN3_IRQ_INIT(GEN11_GU_MISC_, ~gu_misc_masked, gu_misc_masked);
+
 	I915_WRITE(GEN11_DISPLAY_INT_CTL, GEN11_DISPLAY_IRQ_ENABLE);
 
 	I915_WRITE(GEN11_GFX_MSTR_IRQ, GEN11_MASTER_IRQ);
drivers/gpu/drm/i915/i915_reg.h +7 -0
index 6953419881c4..67d392c3ca2c 100644
@@ -7025,9 +7025,16 @@ enum {
 #define GEN8_PCU_IIR _MMIO(0x444e8)
 #define GEN8_PCU_IER _MMIO(0x444ec)
 
+#define GEN11_GU_MISC_ISR	_MMIO(0x444f0)
+#define GEN11_GU_MISC_IMR	_MMIO(0x444f4)
+#define GEN11_GU_MISC_IIR	_MMIO(0x444f8)
+#define GEN11_GU_MISC_IER	_MMIO(0x444fc)
+#define  GEN11_GU_MISC_GSE	(1 << 27)
+
 #define GEN11_GFX_MSTR_IRQ		_MMIO(0x190010)
 #define  GEN11_MASTER_IRQ		(1 << 31)
 #define  GEN11_PCU_IRQ			(1 << 30)
+#define  GEN11_GU_MISC_IRQ		(1 << 29)
 #define  GEN11_DISPLAY_IRQ		(1 << 16)
 #define  GEN11_GT_DW_IRQ(x)		(1 << (x))
 #define  GEN11_GT_DW1_IRQ		(1 << 1)
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw

Re: [PATCH v2] drm/i915/icl: GSE interrupt moves from DE_MISC to GU_MISC

Quoting Dhinakaran Pandiyan (2018-05-25 20:43:13)

Quoted 33 lines

The Graphics System Event(GSE) interrupt bit has a new location in the GU_MISC_INTERRUPT_{IIR, ISR, IMR, IER} registers. Since GSE was the only DE_MISC interrupt that was enabled, with this change we don't enable/handle any of DE_MISC interrupts for gen11. Credits to Paulo for pointing out the register change.

v2: from DK
raw_reg_[read/write], branch prediction hint and drop platform check (Mika)

Cc Mika Kuoppala <[email protected]>
[Paulo: bikesheds and rebases]
---
 drivers/gpu/drm/i915/i915_irq.c | 31 ++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h |  7 +++++++
 2 files changed, 37 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_irq.c +7 -0
index 2fd92a886789..cdbc23b21df6 100644
@@ -2943,6 +2943,26 @@ gen11_gt_irq_handler(struct drm_i915_private * const i915,
        spin_unlock(&i915->irq_lock);
 }
 
+static void
+gen11_gu_misc_irq_handler(struct drm_i915_private *dev_priv,
+                         const u32 master_ctl)
+{
+       void __iomem * const regs = dev_priv->regs;
+       u32 iir;
+

drivers/gpu/drm/i915/i915_irq.c gen11_gt_irq_handler(struct drm_i915_private * const i915, · line 2962

Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +10 -0
+       if (!(master_ctl & GEN11_GU_MISC_IRQ))
+               return;
+
+       iir = raw_reg_read(regs, GEN11_GU_MISC_IIR);
+       if (likely(iir)) {
+               raw_reg_write(regs, GEN11_GU_MISC_IIR, iir);
+               if (iir & GEN11_GU_MISC_GSE)
+                       intel_opregion_asle_intr(dev_priv);
+               else
+                       DRM_ERROR("Unexpected GU Misc interrupt 0x%08x\n", iir);

You should be re-enabling the master interrupt *before* doing any work. No?

Keeping the master interrupt disabled stops all other CPUs from processing our interrupts; e.g. basically stopping us feeding the GPU with work while we wait for you.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw

Re: [PATCH v2] drm/i915/icl: GSE interrupt moves from DE_MISC to GU_MISC

Quoted 49 lines · Chris Wilson

Quoting Dhinakaran Pandiyan (2018-05-25 20:43:13)

Quoted 48 lines

The Graphics System Event(GSE) interrupt bit has a new location in the
GU_MISC_INTERRUPT_{IIR, ISR, IMR, IER} registers. Since GSE was the only
DE_MISC interrupt that was enabled, with this change we don't enable/handle
any of DE_MISC interrupts for gen11. Credits to Paulo for pointing out
the register change.

v2: from DK
raw_reg_[read/write], branch prediction hint and drop platform check (Mika)

Cc Mika Kuoppala <[email protected]>
[Paulo: bikesheds and rebases]

---
 drivers/gpu/drm/i915/i915_irq.c | 31
++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h |  7 +++++++

 2 files changed, 37 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_irq.c +0 -0
index 2fd92a886789..cdbc23b21df6 100644
@@ -2943,6 +2943,26 @@ gen11_gt_irq_handler(struct drm_i915_private
 * const i915,
         spin_unlock(&i915->irq_lock);
  }

drivers/gpu/drm/i915/i915_irq.c +13 -0
+static void
+gen11_gu_misc_irq_handler(struct drm_i915_private *dev_priv,
+                         const u32 master_ctl)
+{
+       void __iomem * const regs = dev_priv->regs;
+       u32 iir;
+
+       if (!(master_ctl & GEN11_GU_MISC_IRQ))
+               return;
+
+       iir = raw_reg_read(regs, GEN11_GU_MISC_IIR);
+       if (likely(iir)) {
+               raw_reg_write(regs, GEN11_GU_MISC_IIR, iir);
Quoted 8 lines
Quoted 5 lines

+               if (iir & GEN11_GU_MISC_GSE)
+                       intel_opregion_asle_intr(dev_priv); +               else
+                       DRM_ERROR("Unexpected GU Misc interrupt 0x%08x\n", iir);

You should be re-enabling the master interrupt *before* doing any work.
No?

intel_opregion_asle_intr() doesn't do much other than scheduling work and this is similar to how interrupts are handled for other platforms.

Are you suggesting we optimize our interrupt handling logic to read all the required IIR's first, re-enable the master interrupt and then call the specific handlers based on the set IIR's? This would be a widespread change.

Quoted 5 lines

Keeping the master interrupt disabled stops all other CPUs from processing our interrupts; e.g. basically stopping us feeding the GPU with work while we wait for you.
-Chris

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#10 lore raw

Re: [PATCH v2] drm/i915/icl: GSE interrupt moves from DE_MISC to GU_MISC

Quoted 58 lines · Dhinakaran Pandiyan
Quoted 49 lines · Chris Wilson

Quoting Dhinakaran Pandiyan (2018-05-25 20:43:13)

Quoted 48 lines

The Graphics System Event(GSE) interrupt bit has a new location in the
GU_MISC_INTERRUPT_{IIR, ISR, IMR, IER} registers. Since GSE was the only
DE_MISC interrupt that was enabled, with this change we don't enable/handle
any of DE_MISC interrupts for gen11. Credits to Paulo for pointing out
the register change.

v2: from DK
raw_reg_[read/write], branch prediction hint and drop platform check (Mika)

Cc Mika Kuoppala <[email protected]>
[Paulo: bikesheds and rebases]

---
 drivers/gpu/drm/i915/i915_irq.c | 31
++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h |  7 +++++++

 2 files changed, 37 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_irq.c +0 -0
index 2fd92a886789..cdbc23b21df6 100644
@@ -2943,6 +2943,26 @@ gen11_gt_irq_handler(struct drm_i915_private
 * const i915,
         spin_unlock(&i915->irq_lock);
  }

drivers/gpu/drm/i915/i915_irq.c +13 -0
+static void
+gen11_gu_misc_irq_handler(struct drm_i915_private *dev_priv,
+                         const u32 master_ctl)
+{
+       void __iomem * const regs = dev_priv->regs;
+       u32 iir;
+
+       if (!(master_ctl & GEN11_GU_MISC_IRQ))
+               return;
+
+       iir = raw_reg_read(regs, GEN11_GU_MISC_IIR);
+       if (likely(iir)) {
+               raw_reg_write(regs, GEN11_GU_MISC_IIR, iir);
Quoted 8 lines
Quoted 5 lines

+               if (iir & GEN11_GU_MISC_GSE)
+                       intel_opregion_asle_intr(dev_priv); +               else
+                       DRM_ERROR("Unexpected GU Misc interrupt 0x%08x\n", iir);

You should be re-enabling the master interrupt *before* doing any work.
No?

Quoted 7 lines

intel_opregion_asle_intr() doesn't do much other than scheduling work and this is similar to how interrupts are handled for other platforms.

Are you suggesting we optimize our interrupt handling logic to read all the required IIR's first, re-enable the master interrupt and then call the specific handlers based on the set IIR's? This would be a widespread change.

That is what I have done for all the gmch platforms. The gen8+ gt irq handler is already split up as well because chv needed it. I think it's the right way to do things. I just didn't have the energy at the time to convert all the more moden platforms as well.

It would also open up the possibility of using threaded irqs and keeping some of the super latency sensitive stuff in the hard irq handler while moving everthing else into the thread.

Quoted 10 lines
Quoted 6 lines

Keeping the master interrupt disabled stops all other CPUs from processing our interrupts; e.g. basically stopping us feeding the GPU with work while we wait for you.
-Chris

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw

Re: [PATCH v2] drm/i915/icl: GSE interrupt moves from DE_MISC to GU_MISC

Quoted 78 lines · Ville Syrjälä
Quoted 71 lines · Dhinakaran Pandiyan
Quoted 56 lines · Chris Wilson

Quoting Dhinakaran Pandiyan (2018-05-25 20:43:13)

Quoted 54 lines

The Graphics System Event(GSE) interrupt bit has a new location in
the
GU_MISC_INTERRUPT_{IIR, ISR, IMR, IER} registers. Since GSE was the
only
DE_MISC interrupt that was enabled, with this change we don't enable/handle
any of DE_MISC interrupts for gen11. Credits to Paulo for pointing
out
the register change.

v2: from DK
raw_reg_[read/write], branch prediction hint and drop platform check (Mika)

om>

[Paulo: bikesheds and rebases]

---
 drivers/gpu/drm/i915/i915_irq.c | 31
++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h |  7 +++++++

 2 files changed, 37 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_irq.c +0 -0
index 2fd92a886789..cdbc23b21df6 100644
@@ -2943,6 +2943,26 @@ gen11_gt_irq_handler(struct

drm_i915_private
* const i915,
        spin_unlock(&i915->irq_lock);
 }

drivers/gpu/drm/i915/i915_irq.c +13 -0
+static void
+gen11_gu_misc_irq_handler(struct drm_i915_private *dev_priv,
+                         const u32 master_ctl)
+{
+       void __iomem * const regs = dev_priv->regs;
+       u32 iir;
+
+       if (!(master_ctl & GEN11_GU_MISC_IRQ))
+               return;
+
+       iir = raw_reg_read(regs, GEN11_GU_MISC_IIR);
+       if (likely(iir)) {
+               raw_reg_write(regs, GEN11_GU_MISC_IIR, iir);
Quoted 8 lines
Quoted 5 lines

+               if (iir & GEN11_GU_MISC_GSE)
+                       intel_opregion_asle_intr(dev_priv); +               else
+                       DRM_ERROR("Unexpected GU Misc interrupt 0x%08x\n", iir);

You should be re-enabling the master interrupt *before* doing any work.
No?

intel_opregion_asle_intr() doesn't do much other than scheduling work
and this is similar to how interrupts are handled for other platforms.

Quoted 6 lines

Are you suggesting we optimize our interrupt handling logic to read all
the required IIR's first, re-enable the master interrupt and then call
the specific handlers based on the set IIR's? This would be a widespread change.

Quoted 4 lines

That is what I have done for all the gmch platforms. The gen8+ gt irq handler is already split up as well because chv needed it. I think it's the right way to do things. I just didn't have the energy at the time to convert all the more moden platforms as well.

Makes a lot of sense.I have converted this particular patch for now.

-DK

Quoted 18 lines

It would also open up the possibility of using threaded irqs and keeping some of the super latency sensitive stuff in the hard irq handler while moving everthing else into the thread.

Quoted 13 lines
Quoted 9 lines

Keeping the master interrupt disabled stops all other CPUs from processing our interrupts; e.g. basically stopping us feeding the GPU
with work while we wait for you.
-Chris

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#12 lore raw

PATCH v3 1/1 drm/i915/icl: GSE interrupt moves from DE_MISC to GU_MISC

In reply to Chris Wilson

The Graphics System Event(GSE) interrupt bit has a new location in the GU_MISC_INTERRUPT_{IIR, ISR, IMR, IER} registers. Since GSE was the only DE_MISC interrupt that was enabled, with this change we don't enable/handle any of DE_MISC interrupts for gen11. Credits to Paulo for pointing out the register change.

v2: from DK
raw_reg_[read/write], branch prediction hint and drop platform check (Mika)

v3: From DK
Early re-enable of master interrupt (Chris)

Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
[Paulo: bikesheds and rebases]
---
 drivers/gpu/drm/i915/i915_irq.c | 46 ++++++++++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h |  7 +++++++
 2 files changed, 52 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_irq.c +45 -1
index c52060a35317..c7bd6caa98ea 100644
@@ -2946,11 +2946,44 @@ gen11_gt_irq_handler(struct drm_i915_private * const i915,
 	spin_unlock(&i915->irq_lock);
 }
 
+static void
+gen11_gu_misc_irq_ack(struct drm_i915_private *dev_priv, const u32 master_ctl,
+		      u32 *iir)
+{
+	void __iomem * const regs = dev_priv->regs;
+
+	if (!(master_ctl & GEN11_GU_MISC_IRQ))
+		return;
+
+	*iir = raw_reg_read(regs, GEN11_GU_MISC_IIR);
+	if (likely(*iir))
+		raw_reg_write(regs, GEN11_GU_MISC_IIR, *iir);
+}
+
+static void
+gen11_gu_misc_irq_handler(struct drm_i915_private *dev_priv,
+			  const u32 master_ctl, const u32 iir)
+{
+	if (!(master_ctl & GEN11_GU_MISC_IRQ))
+		return;
+
+	if (unlikely(!iir)) {
+		DRM_ERROR("GU_MISC iir blank!\n");
+		return;
+	}
+
+	if (iir & GEN11_GU_MISC_GSE)
+		intel_opregion_asle_intr(dev_priv);
+	else
+		DRM_ERROR("Unexpected GU_MISC interrupt 0x%x\n", iir);
+}
+
 static irqreturn_t gen11_irq_handler(int irq, void *arg)
 {
 	struct drm_i915_private * const i915 = to_i915(arg);
 	void __iomem * const regs = i915->regs;
 	u32 master_ctl;
+	u32 gu_misc_iir;
 
 	if (!intel_irqs_enabled(i915))
 		return IRQ_NONE;
@@ -2979,9 +3012,13 @@ static irqreturn_t gen11_irq_handler(int irq, void *arg)
 		enable_rpm_wakeref_asserts(i915);
 	}
 
+	gen11_gu_misc_irq_ack(i915, master_ctl, &gu_misc_iir);
+
 	/* Acknowledge and enable interrupts. */
 	raw_reg_write(regs, GEN11_GFX_MSTR_IRQ, GEN11_MASTER_IRQ | master_ctl);
 
+	gen11_gu_misc_irq_handler(i915, master_ctl, gu_misc_iir);
+
 	return IRQ_HANDLED;
 }
 
@@ -3468,6 +3505,7 @@ static void gen11_irq_reset(struct drm_device *dev)
 
 	GEN3_IRQ_RESET(GEN8_DE_PORT_);
 	GEN3_IRQ_RESET(GEN8_DE_MISC_);
+	GEN3_IRQ_RESET(GEN11_GU_MISC_);
 	GEN3_IRQ_RESET(GEN8_PCU_);
 }
 
@@ -3911,9 +3949,12 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)
 	uint32_t de_pipe_enables;
 	u32 de_port_masked = GEN8_AUX_CHANNEL_A;
 	u32 de_port_enables;
-	u32 de_misc_masked = GEN8_DE_MISC_GSE | GEN8_DE_EDP_PSR;
+	u32 de_misc_masked = GEN8_DE_EDP_PSR;
 	enum pipe pipe;
 
+	if (INTEL_GEN(dev_priv) <= 10)
+		de_misc_masked |= GEN8_DE_MISC_GSE;
+
 	if (INTEL_GEN(dev_priv) >= 9) {
 		de_pipe_masked |= GEN9_DE_PIPE_IRQ_FAULT_ERRORS;
 		de_port_masked |= GEN9_AUX_CHANNEL_B | GEN9_AUX_CHANNEL_C |
@@ -4010,10 +4051,13 @@ static void gen11_gt_irq_postinstall(struct drm_i915_private *dev_priv)
 static int gen11_irq_postinstall(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
+	u32 gu_misc_masked = GEN11_GU_MISC_GSE;
 
 	gen11_gt_irq_postinstall(dev_priv);
 	gen8_de_irq_postinstall(dev_priv);
 
+	GEN3_IRQ_INIT(GEN11_GU_MISC_, ~gu_misc_masked, gu_misc_masked);
+
 	I915_WRITE(GEN11_DISPLAY_INT_CTL, GEN11_DISPLAY_IRQ_ENABLE);
 
 	I915_WRITE(GEN11_GFX_MSTR_IRQ, GEN11_MASTER_IRQ);
drivers/gpu/drm/i915/i915_reg.h +7 -0
index 140f6a27d696..e4aebccf4461 100644
@@ -7053,9 +7053,16 @@ enum {
 #define GEN8_PCU_IIR _MMIO(0x444e8)
 #define GEN8_PCU_IER _MMIO(0x444ec)
 
+#define GEN11_GU_MISC_ISR	_MMIO(0x444f0)
+#define GEN11_GU_MISC_IMR	_MMIO(0x444f4)
+#define GEN11_GU_MISC_IIR	_MMIO(0x444f8)
+#define GEN11_GU_MISC_IER	_MMIO(0x444fc)
+#define  GEN11_GU_MISC_GSE	(1 << 27)
+
 #define GEN11_GFX_MSTR_IRQ		_MMIO(0x190010)
 #define  GEN11_MASTER_IRQ		(1 << 31)
 #define  GEN11_PCU_IRQ			(1 << 30)
+#define  GEN11_GU_MISC_IRQ		(1 << 29)
 #define  GEN11_DISPLAY_IRQ		(1 << 16)
 #define  GEN11_GT_DW_IRQ(x)		(1 << (x))
 #define  GEN11_GT_DW1_IRQ		(1 << 1)
Signature · 6 lines
2.14.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author Reviewed-by on v3 1/1
#13 lore raw

Re: [PATCH v3] drm/i915/icl: GSE interrupt moves from DE_MISC to GU_MISC

Em Qui, 2018-06-14 às 12:54 -0700, Dhinakaran Pandiyan escreveu:

Quoted 10 lines

The Graphics System Event(GSE) interrupt bit has a new location in the
GU_MISC_INTERRUPT_{IIR, ISR, IMR, IER} registers. Since GSE was the only
DE_MISC interrupt that was enabled, with this change we don't enable/handle
any of DE_MISC interrupts for gen11. Credits to Paulo for pointing out
the register change.

Quoted 6 lines

v2: from DK
raw_reg_[read/write], branch prediction hint and drop platform check (Mika)

v3: From DK
Early re-enable of master interrupt (Chris)

Looks like all the requests have been implemented:

Quoted 134 lines
Cc Chris Wilson <[email protected]>
Cc Mika Kuoppala <[email protected]>
[Paulo: bikesheds and rebases]
---
 drivers/gpu/drm/i915/i915_irq.c | 46
++++++++++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h |  7 +++++++
 2 files changed, 52 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_irq.c +33 -0
index c52060a35317..c7bd6caa98ea 100644
@@ -2946,11 +2946,44 @@ gen11_gt_irq_handler(struct drm_i915_private
 * const i915,
 	spin_unlock(&i915->irq_lock);
 }
 
+static void
+gen11_gu_misc_irq_ack(struct drm_i915_private *dev_priv, const u32
 master_ctl,
+		      u32 *iir)
+{
+	void __iomem * const regs = dev_priv->regs;
+
+	if (!(master_ctl & GEN11_GU_MISC_IRQ))
+		return;
+
+	*iir = raw_reg_read(regs, GEN11_GU_MISC_IIR);
+	if (likely(*iir))
+		raw_reg_write(regs, GEN11_GU_MISC_IIR, *iir);
+}
+
+static void
+gen11_gu_misc_irq_handler(struct drm_i915_private *dev_priv,
+			  const u32 master_ctl, const u32 iir)
+{
+	if (!(master_ctl & GEN11_GU_MISC_IRQ))
+		return;
+
+	if (unlikely(!iir)) {
+		DRM_ERROR("GU_MISC iir blank!\n");
+		return;
+	}
+
+	if (iir & GEN11_GU_MISC_GSE)
+		intel_opregion_asle_intr(dev_priv);
+	else
+		DRM_ERROR("Unexpected GU_MISC interrupt 0x%x\n",
 iir);
+}
+
 static irqreturn_t gen11_irq_handler(int irq, void *arg)
 {
 	struct drm_i915_private * const i915 = to_i915(arg);
 	void __iomem * const regs = i915->regs;
 	u32 master_ctl;
+	u32 gu_misc_iir;
drivers/gpu/drm/i915/i915_irq.c +4 -0
 	if (!intel_irqs_enabled(i915))
 		return IRQ_NONE;
@@ -2979,9 +3012,13 @@ static irqreturn_t gen11_irq_handler(int irq,
 void *arg)
 		enable_rpm_wakeref_asserts(i915);
 	}
 
+	gen11_gu_misc_irq_ack(i915, master_ctl, &gu_misc_iir);
+
 	/* Acknowledge and enable interrupts. */
 	raw_reg_write(regs, GEN11_GFX_MSTR_IRQ, GEN11_MASTER_IRQ |
 master_ctl);
 
+	gen11_gu_misc_irq_handler(i915, master_ctl, gu_misc_iir);
+
 	return IRQ_HANDLED;

}

drivers/gpu/drm/i915/i915_irq.c +5 -1
@@ -3468,6 +3505,7 @@ static void gen11_irq_reset(struct drm_device
 *dev)
 
 	GEN3_IRQ_RESET(GEN8_DE_PORT_);
 	GEN3_IRQ_RESET(GEN8_DE_MISC_);
+	GEN3_IRQ_RESET(GEN11_GU_MISC_);
 	GEN3_IRQ_RESET(GEN8_PCU_);
 }
@@ -3911,9 +3949,12 @@ static void gen8_de_irq_postinstall(struct
 drm_i915_private *dev_priv)
 	uint32_t de_pipe_enables;
 	u32 de_port_masked = GEN8_AUX_CHANNEL_A;
 	u32 de_port_enables;
-	u32 de_misc_masked = GEN8_DE_MISC_GSE | GEN8_DE_EDP_PSR;
+	u32 de_misc_masked = GEN8_DE_EDP_PSR;
 	enum pipe pipe;
 
+	if (INTEL_GEN(dev_priv) <= 10)
+		de_misc_masked |= GEN8_DE_MISC_GSE;
+
 	if (INTEL_GEN(dev_priv) >= 9) {
 		de_pipe_masked |= GEN9_DE_PIPE_IRQ_FAULT_ERRORS;

de_port_masked |= GEN9_AUX_CHANNEL_B |
GEN9_AUX_CHANNEL_C |

drivers/gpu/drm/i915/i915_irq.c +3 -0
@@ -4010,10 +4051,13 @@ static void gen11_gt_irq_postinstall(struct
 drm_i915_private *dev_priv)
 static int gen11_irq_postinstall(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
+	u32 gu_misc_masked = GEN11_GU_MISC_GSE;
 
 	gen11_gt_irq_postinstall(dev_priv);
 	gen8_de_irq_postinstall(dev_priv);
 
+	GEN3_IRQ_INIT(GEN11_GU_MISC_, ~gu_misc_masked,
 gu_misc_masked);
+
 	I915_WRITE(GEN11_DISPLAY_INT_CTL, GEN11_DISPLAY_IRQ_ENABLE);
drivers/gpu/drm/i915/i915_irq.c +0 -0
 	I915_WRITE(GEN11_GFX_MSTR_IRQ, GEN11_MASTER_IRQ);
drivers/gpu/drm/i915/i915_reg.h +3 -0
index 140f6a27d696..e4aebccf4461 100644
@@ -7053,9 +7053,16 @@ enum {
 #define GEN8_PCU_IIR _MMIO(0x444e8)
 #define GEN8_PCU_IER _MMIO(0x444ec)
 
+#define GEN11_GU_MISC_ISR	_MMIO(0x444f0)
+#define GEN11_GU_MISC_IMR	_MMIO(0x444f4)
+#define GEN11_GU_MISC_IIR	_MMIO(0x444f8)

drivers/gpu/drm/i915/i915_reg.h enum { · line 7068

Quoted 10 lines
drivers/gpu/drm/i915/i915_reg.h +4 -0
+#define GEN11_GU_MISC_IER	_MMIO(0x444fc)
+#define  GEN11_GU_MISC_GSE	(1 << 27)
+
 #define GEN11_GFX_MSTR_IRQ		_MMIO(0x190010)
 #define  GEN11_MASTER_IRQ		(1 << 31)
 #define  GEN11_PCU_IRQ			(1 << 30)
+#define  GEN11_GU_MISC_IRQ		(1 << 29)
 #define  GEN11_DISPLAY_IRQ		(1 << 16)
 #define  GEN11_GT_DW_IRQ(x)		(1 << (x))
 #define  GEN11_GT_DW1_IRQ		(1 << 1)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#14 lore raw

PATCH 3/24 drm/i915/icl: introduce tc_port

In reply to Paulo Zanoni

Add and enum for TC ports and auxiliary functions to handle them. Icelake brings a lot of registers and other things that only apply to the TC ports and are indexed starting from 0, so having an enum for tc_ports that starts at 0 really helps the indexing.

This patch is based on previous patches written by Dhinakaran Pandiyan and Mahesh Kumar.

Cc Dhinakaran Pandiyan <[email protected]>
Cc Mahesh Kumar <[email protected]>
---
 drivers/gpu/drm/i915/intel_display.c | 16 ++++++++++++++++
 drivers/gpu/drm/i915/intel_display.h | 11 +++++++++++
 drivers/gpu/drm/i915/intel_drv.h     |  3 +++
 3 files changed, 30 insertions(+)
drivers/gpu/drm/i915/intel_display.c +16 -0
index c9ec88acad9c..64593b0fbebd 100644
@@ -5807,6 +5807,22 @@ static void i9xx_pfit_enable(struct intel_crtc *crtc)
 	I915_WRITE(BCLRPAT(crtc->pipe), 0);
 }
 
+bool intel_port_is_tc(struct drm_i915_private *dev_priv, enum port port)
+{
+	if (IS_ICELAKE(dev_priv))
+		return port >= PORT_C && port <= PORT_F;
+
+	return false;
+}
+
+enum tc_port intel_port_to_tc(struct drm_i915_private *dev_priv, enum port port)
+{
+	if (!intel_port_is_tc(dev_priv, port))
+		return PORT_TC_NONE;
+
+	return port - PORT_C;
+}
+
 enum intel_display_power_domain intel_port_to_power_domain(enum port port)
 {
 	switch (port) {
drivers/gpu/drm/i915/intel_display.h +11 -0
index 2ef31617614a..c88185ed7594 100644
@@ -126,6 +126,17 @@ enum port {
 
 #define port_name(p) ((p) + 'A')
 
+enum tc_port {
+	PORT_TC_NONE = -1,
+
+	PORT_TC1 = 0,
+	PORT_TC2,
+	PORT_TC3,
+	PORT_TC4,
+
+	I915_MAX_TC_PORTS
+};
+
 enum dpio_channel {
 	DPIO_CH0,
 	DPIO_CH1
drivers/gpu/drm/i915/intel_drv.h +3 -0
index 22af249393a4..a54232c270e1 100644
@@ -1493,6 +1493,9 @@ void intel_connector_attach_encoder(struct intel_connector *connector,
 				    struct intel_encoder *encoder);
 struct drm_display_mode *
 intel_encoder_current_mode(struct intel_encoder *encoder);
+bool intel_port_is_tc(struct drm_i915_private *dev_priv, enum port port);
+enum tc_port intel_port_to_tc(struct drm_i915_private *dev_priv,
+			      enum port port);
 
 enum pipe intel_get_pipe_from_connector(struct intel_connector *connector);
 int intel_get_pipe_from_crtc_id_ioctl(struct drm_device *dev, void *data,
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 3/24
#15 lore raw

Re: [PATCH 03/24] drm/i915/icl: introduce tc_port

Quoted 71 lines · Paulo Zanoni

Add and enum for TC ports and auxiliary functions to handle them. Icelake brings a lot of registers and other things that only apply to the TC ports and are indexed starting from 0, so having an enum for tc_ports that starts at 0 really helps the indexing.

This patch is based on previous patches written by Dhinakaran Pandiyan and Mahesh Kumar.

Cc Dhinakaran Pandiyan <[email protected]>
Cc Mahesh Kumar <[email protected]>
---
  drivers/gpu/drm/i915/intel_display.c | 16 ++++++++++++++++
  drivers/gpu/drm/i915/intel_display.h | 11 +++++++++++
  drivers/gpu/drm/i915/intel_drv.h     |  3 +++
  3 files changed, 30 insertions(+)
drivers/gpu/drm/i915/intel_display.c +16 -0
index c9ec88acad9c..64593b0fbebd 100644
@@ -5807,6 +5807,22 @@ static void i9xx_pfit_enable(struct intel_crtc *crtc)
  	I915_WRITE(BCLRPAT(crtc->pipe), 0);
  }
 
+bool intel_port_is_tc(struct drm_i915_private *dev_priv, enum port port)
+{
+	if (IS_ICELAKE(dev_priv))
+		return port >= PORT_C && port <= PORT_F;
+
+	return false;
+}
+
+enum tc_port intel_port_to_tc(struct drm_i915_private *dev_priv, enum port port)
+{
+	if (!intel_port_is_tc(dev_priv, port))
+		return PORT_TC_NONE;
+
+	return port - PORT_C;
+}
+
  enum intel_display_power_domain intel_port_to_power_domain(enum port port)
  {
  	switch (port) {
drivers/gpu/drm/i915/intel_display.h +11 -0
index 2ef31617614a..c88185ed7594 100644
@@ -126,6 +126,17 @@ enum port {
 
  #define port_name(p) ((p) + 'A')
 
+enum tc_port {
+	PORT_TC_NONE = -1,
+
+	PORT_TC1 = 0,
+	PORT_TC2,
+	PORT_TC3,
+	PORT_TC4,
+
+	I915_MAX_TC_PORTS
+};
+
  enum dpio_channel {
  	DPIO_CH0,
  	DPIO_CH1
drivers/gpu/drm/i915/intel_drv.h +0 -0
index 22af249393a4..a54232c270e1 100644

drivers/gpu/drm/i915/intel_drv.h void intel_connector_attach_encoder(struct intel_connector *connector, · line 1501

Quoted 9 lines
drivers/gpu/drm/i915/intel_drv.h +3 -0
@@ -1493,6 +1493,9 @@ void intel_connector_attach_encoder(struct intel_connector *connector,
  				    struct intel_encoder *encoder);
  struct drm_display_mode *
  intel_encoder_current_mode(struct intel_encoder *encoder);
+bool intel_port_is_tc(struct drm_i915_private *dev_priv, enum port port);
+enum tc_port intel_port_to_tc(struct drm_i915_private *dev_priv,
+			      enum port port);
 
  enum pipe intel_get_pipe_from_connector(struct intel_connector *connector);
  int intel_get_pipe_from_crtc_id_ioctl(struct drm_device *dev, void *data,

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#16 lore raw

PATCH 4/24 drm/i915/icl: Support for TC North Display interrupts

In reply to Paulo Zanoni

From: Dhinakaran Pandiyan <[email protected]>

The hotplug interrupts for the ports can be routed to either North Display or South Display depending on the output mode. DP Alternate or DP over TBT outputs will have hotplug interrupts routed to the North Display while interrupts for legacy modes will be routed to the South Display in PCH. This patch adds hotplug interrupt handling support for DP Alternate mode.

Cc Jani Nikula <[email protected]>
Cc Anusha Srivatsa <[email protected]>
[Paulo: coding style changes]
---
 drivers/gpu/drm/i915/i915_irq.c | 95 +++++++++++++++++++++++++++++++++++++++--
 drivers/gpu/drm/i915/i915_reg.h | 20 +++++++++
 2 files changed, 112 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +92 -3
index dde938bbfb0a..9bcec5fdb9d0 100644
@@ -115,6 +115,13 @@ static const u32 hpd_bxt[HPD_NUM_PINS] = {
 	[HPD_PORT_C] = BXT_DE_PORT_HP_DDIC
 };
 
+static const u32 hpd_tc_gen11[HPD_NUM_PINS] = {
+	[HPD_PORT_C] = GEN11_TC1_HOTPLUG,
+	[HPD_PORT_D] = GEN11_TC2_HOTPLUG,
+	[HPD_PORT_E] = GEN11_TC3_HOTPLUG,
+	[HPD_PORT_F] = GEN11_TC4_HOTPLUG
+};
+
 /* IIR can theoretically queue up two events. Be paranoid. */
 #define GEN8_IRQ_RESET_NDX(type, which) do { \
 	I915_WRITE(GEN8_##type##_IMR(which), 0xffffffff); \
@@ -1549,6 +1556,22 @@ static void gen8_gt_irq_handler(struct drm_i915_private *i915,
 	}
 }
 
+static bool gen11_port_hotplug_long_detect(enum port port, u32 val)
+{
+	switch (port) {
+	case PORT_C:
+		return val & GEN11_HOTPLUG_CTL_LONG_DETECT(PORT_TC1);
+	case PORT_D:
+		return val & GEN11_HOTPLUG_CTL_LONG_DETECT(PORT_TC2);
+	case PORT_E:
+		return val & GEN11_HOTPLUG_CTL_LONG_DETECT(PORT_TC3);
+	case PORT_F:
+		return val & GEN11_HOTPLUG_CTL_LONG_DETECT(PORT_TC4);
+	default:
+		return false;
+	}
+}
+
 static bool bxt_port_hotplug_long_detect(enum port port, u32 val)
 {
 	switch (port) {
@@ -2590,6 +2613,25 @@ static void bxt_hpd_irq_handler(struct drm_i915_private *dev_priv,
 	intel_hpd_irq_handler(dev_priv, pin_mask, long_mask);
 }
 
+static void gen11_hpd_irq_handler(struct drm_i915_private *dev_priv, u32 iir)
+{
+	u32 pin_mask = 0, long_mask = 0;
+	u32 trigger_tc, dig_hotplug_reg;
+
+	trigger_tc = iir & GEN11_DE_TC_HOTPLUG_MASK;
+	if (trigger_tc) {
+		dig_hotplug_reg = I915_READ(GEN11_TC_HOTPLUG_CTL);
+		I915_WRITE(GEN11_TC_HOTPLUG_CTL, dig_hotplug_reg);
+
+		intel_get_hpd_pins(dev_priv, &pin_mask, &long_mask, trigger_tc,
+				   dig_hotplug_reg, hpd_tc_gen11,
+				   gen11_port_hotplug_long_detect);
+		intel_hpd_irq_handler(dev_priv, pin_mask, long_mask);
+	} else {
+		DRM_ERROR("Unexpected DE HPD interrupt 0x%08x\n", iir);
+	}
+}
+
 static irqreturn_t
 gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl)
 {
@@ -2626,6 +2668,17 @@ gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl)
 			DRM_ERROR("The master control interrupt lied (DE MISC)!\n");
 	}
 
+	if (INTEL_GEN(dev_priv) >= 11 && (master_ctl & GEN11_DE_HPD_IRQ)) {
+		iir = I915_READ(GEN11_DE_HPD_IIR);
+		if (iir) {
+			I915_WRITE(GEN11_DE_HPD_IIR, iir);
+			ret = IRQ_HANDLED;
+			gen11_hpd_irq_handler(dev_priv, iir);
+		} else {
+			DRM_ERROR("The master control interrupt lied, (DE HPD)!\n");
+		}
+	}
+
 	if (master_ctl & GEN8_DE_PORT_IRQ) {
 		iir = I915_READ(GEN8_DE_PORT_IIR);
 		if (iir) {
@@ -3492,6 +3545,7 @@ static void gen11_irq_reset(struct drm_device *dev)
 
 	GEN3_IRQ_RESET(GEN8_DE_PORT_);
 	GEN3_IRQ_RESET(GEN8_DE_MISC_);
+	GEN3_IRQ_RESET(GEN11_DE_HPD_);
 	GEN3_IRQ_RESET(GEN11_GU_MISC_);
 	GEN3_IRQ_RESET(GEN8_PCU_);
 }
@@ -3610,6 +3664,34 @@ static void ibx_hpd_irq_setup(struct drm_i915_private *dev_priv)
 	ibx_hpd_detection_setup(dev_priv);
 }
 
+static void gen11_hpd_detection_setup(struct drm_i915_private *dev_priv)
+{
+	u32 hotplug;
+
+	hotplug = I915_READ(GEN11_TC_HOTPLUG_CTL);
+	hotplug |= GEN11_HOTPLUG_CTL_ENABLE(PORT_TC1) |
+		   GEN11_HOTPLUG_CTL_ENABLE(PORT_TC2) |
+		   GEN11_HOTPLUG_CTL_ENABLE(PORT_TC3) |
+		   GEN11_HOTPLUG_CTL_ENABLE(PORT_TC4);
+	I915_WRITE(GEN11_TC_HOTPLUG_CTL, hotplug);
+}
+
+static void gen11_hpd_irq_setup(struct drm_i915_private *dev_priv)
+{
+	u32 hotplug_irqs, enabled_irqs;
+	u32 val;
+
+	enabled_irqs = intel_hpd_enabled_irqs(dev_priv, hpd_tc_gen11);
+	hotplug_irqs = GEN11_DE_TC_HOTPLUG_MASK;
+
+	val = I915_READ(GEN11_DE_HPD_IMR);
+	val &= ~hotplug_irqs;
+	I915_WRITE(GEN11_DE_HPD_IMR, val);
+	POSTING_READ(GEN11_DE_HPD_IMR);
+
+	gen11_hpd_detection_setup(dev_priv);
+}
+
 static void spt_hpd_detection_setup(struct drm_i915_private *dev_priv)
 {
 	u32 val, hotplug;
@@ -3980,10 +4062,17 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)
 	GEN3_IRQ_INIT(GEN8_DE_PORT_, ~de_port_masked, de_port_enables);
 	GEN3_IRQ_INIT(GEN8_DE_MISC_, ~de_misc_masked, de_misc_masked);
 
-	if (IS_GEN9_LP(dev_priv))
+	if (INTEL_GEN(dev_priv) >= 11) {
+		u32 de_hpd_masked = 0;
+		u32 de_hpd_enables = GEN11_DE_TC_HOTPLUG_MASK;
+
+		GEN3_IRQ_INIT(GEN11_DE_HPD_, ~de_hpd_masked, de_hpd_enables);
+		gen11_hpd_detection_setup(dev_priv);
+	} else if (IS_GEN9_LP(dev_priv)) {
 		bxt_hpd_detection_setup(dev_priv);
-	else if (IS_BROADWELL(dev_priv))
+	} else if (IS_BROADWELL(dev_priv)) {
 		ilk_hpd_detection_setup(dev_priv);
+	}
 }
 
 static int gen8_irq_postinstall(struct drm_device *dev)
@@ -4505,7 +4594,7 @@ void intel_irq_init(struct drm_i915_private *dev_priv)
 		dev->driver->irq_uninstall = gen11_irq_reset;
 		dev->driver->enable_vblank = gen8_enable_vblank;
 		dev->driver->disable_vblank = gen8_disable_vblank;
-		dev_priv->display.hpd_irq_setup = spt_hpd_irq_setup;
+		dev_priv->display.hpd_irq_setup = gen11_hpd_irq_setup;
 	} else if (INTEL_GEN(dev_priv) >= 8) {
 		dev->driver->irq_handler = gen8_irq_handler;
 		dev->driver->irq_preinstall = gen8_irq_reset;
drivers/gpu/drm/i915/i915_reg.h +20 -0
index ca474f6f523c..19600097581f 100644
@@ -7036,11 +7036,31 @@ enum {
 #define  GEN11_AUDIO_CODEC_IRQ		(1 << 24)
 #define  GEN11_DE_PCH_IRQ		(1 << 23)
 #define  GEN11_DE_MISC_IRQ		(1 << 22)
+#define  GEN11_DE_HPD_IRQ		(1 << 21)
 #define  GEN11_DE_PORT_IRQ		(1 << 20)
 #define  GEN11_DE_PIPE_C		(1 << 18)
 #define  GEN11_DE_PIPE_B		(1 << 17)
 #define  GEN11_DE_PIPE_A		(1 << 16)
 
+#define GEN11_DE_HPD_ISR		_MMIO(0x44470)
+#define GEN11_DE_HPD_IMR		_MMIO(0x44474)
+#define GEN11_DE_HPD_IIR		_MMIO(0x44478)
+#define GEN11_DE_HPD_IER		_MMIO(0x4447c)
+#define  GEN11_TC4_HOTPLUG			(1 << 19)
+#define  GEN11_TC3_HOTPLUG			(1 << 18)
+#define  GEN11_TC2_HOTPLUG			(1 << 17)
+#define  GEN11_TC1_HOTPLUG			(1 << 16)
+#define  GEN11_DE_TC_HOTPLUG_MASK		(GEN11_TC4_HOTPLUG | \
+						 GEN11_TC3_HOTPLUG | \
+						 GEN11_TC2_HOTPLUG | \
+						 GEN11_TC1_HOTPLUG)
+
+#define GEN11_TC_HOTPLUG_CTL				_MMIO(0x44038)
+#define  GEN11_HOTPLUG_CTL_ENABLE(tc_port)		(8 << (tc_port) * 4)
+#define  GEN11_HOTPLUG_CTL_LONG_DETECT(tc_port)		(2 << (tc_port) * 4)
+#define  GEN11_HOTPLUG_CTL_SHORT_DETECT(tc_port)	(1 << (tc_port) * 4)
+#define  GEN11_HOTPLUG_CTL_NO_DETECT(tc_port)		(0 << (tc_port) * 4)
+
 #define GEN11_GT_INTR_DW0		_MMIO(0x190018)
 #define  GEN11_CSME			(31)
 #define  GEN11_GUNIT			(28)
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#17 lore raw

Re: [PATCH 04/24] drm/i915/icl: Support for TC North Display interrupts

+Chris

Quoted 87 lines · Paulo Zanoni

From: Dhinakaran Pandiyan <[email protected]>

The hotplug interrupts for the ports can be routed to either North Display or South Display depending on the output mode. DP Alternate or DP over TBT outputs will have hotplug interrupts routed to the North Display while interrupts for legacy modes will be routed to the South Display in PCH. This patch adds hotplug interrupt handling support for DP Alternate mode.

Cc Jani Nikula <[email protected]>
Cc Anusha Srivatsa <[email protected]>
[Paulo: coding style changes]
---
 drivers/gpu/drm/i915/i915_irq.c | 95 +++++++++++++++++++++++++++++++++++++++--
 drivers/gpu/drm/i915/i915_reg.h | 20 +++++++++
 2 files changed, 112 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +42 -0
index dde938bbfb0a..9bcec5fdb9d0 100644
@@ -115,6 +115,13 @@ static const u32 hpd_bxt[HPD_NUM_PINS] = {
 	[HPD_PORT_C] = BXT_DE_PORT_HP_DDIC
 };
 
+static const u32 hpd_tc_gen11[HPD_NUM_PINS] = {
+	[HPD_PORT_C] = GEN11_TC1_HOTPLUG,
+	[HPD_PORT_D] = GEN11_TC2_HOTPLUG,
+	[HPD_PORT_E] = GEN11_TC3_HOTPLUG,
+	[HPD_PORT_F] = GEN11_TC4_HOTPLUG
+};
+
 /* IIR can theoretically queue up two events. Be paranoid. */
 #define GEN8_IRQ_RESET_NDX(type, which) do { \
 	I915_WRITE(GEN8_##type##_IMR(which), 0xffffffff); \
@@ -1549,6 +1556,22 @@ static void gen8_gt_irq_handler(struct drm_i915_private *i915,
 	}
 }
 
+static bool gen11_port_hotplug_long_detect(enum port port, u32 val)
+{
+	switch (port) {
+	case PORT_C:
+		return val & GEN11_HOTPLUG_CTL_LONG_DETECT(PORT_TC1);
+	case PORT_D:
+		return val & GEN11_HOTPLUG_CTL_LONG_DETECT(PORT_TC2);
+	case PORT_E:
+		return val & GEN11_HOTPLUG_CTL_LONG_DETECT(PORT_TC3);
+	case PORT_F:
+		return val & GEN11_HOTPLUG_CTL_LONG_DETECT(PORT_TC4);
+	default:
+		return false;
+	}
+}
+
 static bool bxt_port_hotplug_long_detect(enum port port, u32 val)
 {
 	switch (port) {
@@ -2590,6 +2613,25 @@ static void bxt_hpd_irq_handler(struct drm_i915_private *dev_priv,
 	intel_hpd_irq_handler(dev_priv, pin_mask, long_mask);
 }
 
+static void gen11_hpd_irq_handler(struct drm_i915_private *dev_priv, u32 iir)
+{
+	u32 pin_mask = 0, long_mask = 0;
+	u32 trigger_tc, dig_hotplug_reg;
+
+	trigger_tc = iir & GEN11_DE_TC_HOTPLUG_MASK;
+	if (trigger_tc) {
+		dig_hotplug_reg = I915_READ(GEN11_TC_HOTPLUG_CTL);
+		I915_WRITE(GEN11_TC_HOTPLUG_CTL, dig_hotplug_reg);
+
+		intel_get_hpd_pins(dev_priv, &pin_mask, &long_mask, trigger_tc,
+				   dig_hotplug_reg, hpd_tc_gen11,
+				   gen11_port_hotplug_long_detect);
+		intel_hpd_irq_handler(dev_priv, pin_mask, long_mask);
+	} else {
+		DRM_ERROR("Unexpected DE HPD interrupt 0x%08x\n", iir);
+	}
+}
+
 static irqreturn_t
 gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl)
 {

drivers/gpu/drm/i915/i915_irq.c gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl) · line 2676

Quoted 9 lines
drivers/gpu/drm/i915/i915_irq.c +6 -0
@@ -2626,6 +2668,17 @@ gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl)
 			DRM_ERROR("The master control interrupt lied (DE MISC)!\n");
 	}
 
+	if (INTEL_GEN(dev_priv) >= 11 && (master_ctl & GEN11_DE_HPD_IRQ)) {
+		iir = I915_READ(GEN11_DE_HPD_IIR);
+		if (iir) {
+			I915_WRITE(GEN11_DE_HPD_IIR, iir);
+			ret = IRQ_HANDLED;
+			gen11_hpd_irq_handler(dev_priv, iir);

I think the same question as for the 2nd patch remains here. Shouldn't we being re-enabling the master interrupt before doing any further processing?

However all gens are like that. A change here seems to belong on a different patch... it's also the case for previous gens. Chris, is there anything different you are seeing on gen11?

Lucas De Marchi

Quoted 123 lines
drivers/gpu/drm/i915/i915_irq.c +44 -3
+		} else {
+			DRM_ERROR("The master control interrupt lied, (DE HPD)!\n");
+		}
+	}
+
 	if (master_ctl & GEN8_DE_PORT_IRQ) {
 		iir = I915_READ(GEN8_DE_PORT_IIR);
 		if (iir) {
@@ -3492,6 +3545,7 @@ static void gen11_irq_reset(struct drm_device *dev)
 
 	GEN3_IRQ_RESET(GEN8_DE_PORT_);
 	GEN3_IRQ_RESET(GEN8_DE_MISC_);
+	GEN3_IRQ_RESET(GEN11_DE_HPD_);
 	GEN3_IRQ_RESET(GEN11_GU_MISC_);
 	GEN3_IRQ_RESET(GEN8_PCU_);
 }
@@ -3610,6 +3664,34 @@ static void ibx_hpd_irq_setup(struct drm_i915_private *dev_priv)
 	ibx_hpd_detection_setup(dev_priv);
 }
 
+static void gen11_hpd_detection_setup(struct drm_i915_private *dev_priv)
+{
+	u32 hotplug;
+
+	hotplug = I915_READ(GEN11_TC_HOTPLUG_CTL);
+	hotplug |= GEN11_HOTPLUG_CTL_ENABLE(PORT_TC1) |
+		   GEN11_HOTPLUG_CTL_ENABLE(PORT_TC2) |
+		   GEN11_HOTPLUG_CTL_ENABLE(PORT_TC3) |
+		   GEN11_HOTPLUG_CTL_ENABLE(PORT_TC4);
+	I915_WRITE(GEN11_TC_HOTPLUG_CTL, hotplug);
+}
+
+static void gen11_hpd_irq_setup(struct drm_i915_private *dev_priv)
+{
+	u32 hotplug_irqs, enabled_irqs;
+	u32 val;
+
+	enabled_irqs = intel_hpd_enabled_irqs(dev_priv, hpd_tc_gen11);
+	hotplug_irqs = GEN11_DE_TC_HOTPLUG_MASK;
+
+	val = I915_READ(GEN11_DE_HPD_IMR);
+	val &= ~hotplug_irqs;
+	I915_WRITE(GEN11_DE_HPD_IMR, val);
+	POSTING_READ(GEN11_DE_HPD_IMR);
+
+	gen11_hpd_detection_setup(dev_priv);
+}
+
 static void spt_hpd_detection_setup(struct drm_i915_private *dev_priv)
 {
 	u32 val, hotplug;
@@ -3980,10 +4062,17 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)
 	GEN3_IRQ_INIT(GEN8_DE_PORT_, ~de_port_masked, de_port_enables);
 	GEN3_IRQ_INIT(GEN8_DE_MISC_, ~de_misc_masked, de_misc_masked);
 
-	if (IS_GEN9_LP(dev_priv))
+	if (INTEL_GEN(dev_priv) >= 11) {
+		u32 de_hpd_masked = 0;
+		u32 de_hpd_enables = GEN11_DE_TC_HOTPLUG_MASK;
+
+		GEN3_IRQ_INIT(GEN11_DE_HPD_, ~de_hpd_masked, de_hpd_enables);
+		gen11_hpd_detection_setup(dev_priv);
+	} else if (IS_GEN9_LP(dev_priv)) {
 		bxt_hpd_detection_setup(dev_priv);
-	else if (IS_BROADWELL(dev_priv))
+	} else if (IS_BROADWELL(dev_priv)) {
 		ilk_hpd_detection_setup(dev_priv);
+	}
 }
 
 static int gen8_irq_postinstall(struct drm_device *dev)
@@ -4505,7 +4594,7 @@ void intel_irq_init(struct drm_i915_private *dev_priv)
 		dev->driver->irq_uninstall = gen11_irq_reset;
 		dev->driver->enable_vblank = gen8_enable_vblank;
 		dev->driver->disable_vblank = gen8_disable_vblank;
-		dev_priv->display.hpd_irq_setup = spt_hpd_irq_setup;
+		dev_priv->display.hpd_irq_setup = gen11_hpd_irq_setup;
 	} else if (INTEL_GEN(dev_priv) >= 8) {
 		dev->driver->irq_handler = gen8_irq_handler;
 		dev->driver->irq_preinstall = gen8_irq_reset;
drivers/gpu/drm/i915/i915_reg.h +20 -0
index ca474f6f523c..19600097581f 100644
@@ -7036,11 +7036,31 @@ enum {
 #define  GEN11_AUDIO_CODEC_IRQ		(1 << 24)
 #define  GEN11_DE_PCH_IRQ		(1 << 23)
 #define  GEN11_DE_MISC_IRQ		(1 << 22)
+#define  GEN11_DE_HPD_IRQ		(1 << 21)
 #define  GEN11_DE_PORT_IRQ		(1 << 20)
 #define  GEN11_DE_PIPE_C		(1 << 18)
 #define  GEN11_DE_PIPE_B		(1 << 17)
 #define  GEN11_DE_PIPE_A		(1 << 16)
 
+#define GEN11_DE_HPD_ISR		_MMIO(0x44470)
+#define GEN11_DE_HPD_IMR		_MMIO(0x44474)
+#define GEN11_DE_HPD_IIR		_MMIO(0x44478)
+#define GEN11_DE_HPD_IER		_MMIO(0x4447c)
+#define  GEN11_TC4_HOTPLUG			(1 << 19)
+#define  GEN11_TC3_HOTPLUG			(1 << 18)
+#define  GEN11_TC2_HOTPLUG			(1 << 17)
+#define  GEN11_TC1_HOTPLUG			(1 << 16)
+#define  GEN11_DE_TC_HOTPLUG_MASK		(GEN11_TC4_HOTPLUG | \
+						 GEN11_TC3_HOTPLUG | \
+						 GEN11_TC2_HOTPLUG | \
+						 GEN11_TC1_HOTPLUG)
+
+#define GEN11_TC_HOTPLUG_CTL				_MMIO(0x44038)
+#define  GEN11_HOTPLUG_CTL_ENABLE(tc_port)		(8 << (tc_port) * 4)
+#define  GEN11_HOTPLUG_CTL_LONG_DETECT(tc_port)		(2 << (tc_port) * 4)
+#define  GEN11_HOTPLUG_CTL_SHORT_DETECT(tc_port)	(1 << (tc_port) * 4)
+#define  GEN11_HOTPLUG_CTL_NO_DETECT(tc_port)		(0 << (tc_port) * 4)
+
 #define GEN11_GT_INTR_DW0		_MMIO(0x190018)
 #define  GEN11_CSME			(31)
 #define  GEN11_GUNIT			(28)
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

author Reviewed-by
#18 lore raw

Re: [PATCH 04/24] drm/i915/icl: Support for TC North Display interrupts

Em Qua, 2018-06-13 às 15:20 -0700, Lucas De Marchi escreveu:

Quoted 127 lines

+Chris

Quoted 108 lines · Paulo Zanoni

From: Dhinakaran Pandiyan <[email protected]>

The hotplug interrupts for the ports can be routed to either North Display or South Display depending on the output mode. DP Alternate or
DP over TBT outputs will have hotplug interrupts routed to the North
Display while interrupts for legacy modes will be routed to the South
Display in PCH. This patch adds hotplug interrupt handling support for
DP Alternate mode.

Cc Jani Nikula <[email protected]>
Cc Anusha Srivatsa <[email protected]>
[Paulo: coding style changes]
---
 drivers/gpu/drm/i915/i915_irq.c | 95
+++++++++++++++++++++++++++++++++++++++--
 drivers/gpu/drm/i915/i915_reg.h | 20 +++++++++
 2 files changed, 112 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +14 -0
index dde938bbfb0a..9bcec5fdb9d0 100644
@@ -115,6 +115,13 @@ static const u32 hpd_bxt[HPD_NUM_PINS] = {
 	[HPD_PORT_C] = BXT_DE_PORT_HP_DDIC
 };
 
+static const u32 hpd_tc_gen11[HPD_NUM_PINS] = {
+	[HPD_PORT_C] = GEN11_TC1_HOTPLUG,
+	[HPD_PORT_D] = GEN11_TC2_HOTPLUG,
+	[HPD_PORT_E] = GEN11_TC3_HOTPLUG,
+	[HPD_PORT_F] = GEN11_TC4_HOTPLUG
+};
+
 /* IIR can theoretically queue up two events. Be paranoid. */
 #define GEN8_IRQ_RESET_NDX(type, which) do { \
 	I915_WRITE(GEN8_##type##_IMR(which), 0xffffffff); \
@@ -1549,6 +1556,22 @@ static void gen8_gt_irq_handler(struct
 drm_i915_private *i915,
 	}
 }
 
+static bool gen11_port_hotplug_long_detect(enum port port, u32
 val)
+{
+	switch (port) {
+	case PORT_C:
+		return val &
 GEN11_HOTPLUG_CTL_LONG_DETECT(PORT_TC1);
+	case PORT_D:
+		return val &

GEN11_HOTPLUG_CTL_LONG_DETECT(PORT_TC2);

drivers/gpu/drm/i915/i915_irq.c +2 -0
+	case PORT_E:
+		return val &

GEN11_HOTPLUG_CTL_LONG_DETECT(PORT_TC3);

drivers/gpu/drm/i915/i915_irq.c +2 -0
+	case PORT_F:
+		return val &

GEN11_HOTPLUG_CTL_LONG_DETECT(PORT_TC4);

drivers/gpu/drm/i915/i915_irq.c +18 -0
+	default:
+		return false;
+	}
+}
+
 static bool bxt_port_hotplug_long_detect(enum port port, u32 val)
 {
 	switch (port) {
@@ -2590,6 +2613,25 @@ static void bxt_hpd_irq_handler(struct
 drm_i915_private *dev_priv,
 	intel_hpd_irq_handler(dev_priv, pin_mask, long_mask);
 }
 
+static void gen11_hpd_irq_handler(struct drm_i915_private
 *dev_priv, u32 iir)
+{
+	u32 pin_mask = 0, long_mask = 0;
+	u32 trigger_tc, dig_hotplug_reg;
+
+	trigger_tc = iir & GEN11_DE_TC_HOTPLUG_MASK;
+	if (trigger_tc) {
+		dig_hotplug_reg = I915_READ(GEN11_TC_HOTPLUG_CTL);
+		I915_WRITE(GEN11_TC_HOTPLUG_CTL, dig_hotplug_reg);
+
+		intel_get_hpd_pins(dev_priv, &pin_mask,
 &long_mask, trigger_tc,
+				   dig_hotplug_reg, hpd_tc_gen11,
+				   gen11_port_hotplug_long_detect)

;

drivers/gpu/drm/i915/i915_irq.c +1 -0
+		intel_hpd_irq_handler(dev_priv, pin_mask,

long_mask);

drivers/gpu/drm/i915/i915_irq.c +2 -0
+	} else {
+		DRM_ERROR("Unexpected DE HPD interrupt 0x%08x\n",

iir);

drivers/gpu/drm/i915/i915_irq.c +3 -0
+	}
+}
+
 static irqreturn_t
 gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32

master_ctl)
{

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -2626,6 +2668,17 @@ gen8_de_irq_handler(struct drm_i915_private
 *dev_priv, u32 master_ctl)
 			DRM_ERROR("The master control interrupt

drivers/gpu/drm/i915/i915_irq.c gen8_de_irq_handler(struct drm_i915_private · line 2679

Quoted 10 lines
drivers/gpu/drm/i915/i915_irq.c +6 -0
 lied (DE MISC)!\n");
 	}
 
+	if (INTEL_GEN(dev_priv) >= 11 && (master_ctl &
 GEN11_DE_HPD_IRQ)) {
+		iir = I915_READ(GEN11_DE_HPD_IIR);
+		if (iir) {
+			I915_WRITE(GEN11_DE_HPD_IIR, iir);
+			ret = IRQ_HANDLED;
+			gen11_hpd_irq_handler(dev_priv, iir);

I think the same question as for the 2nd patch remains here. Shouldn't
we being re-enabling the master interrupt before doing any further processing?

Quoted 4 lines

However all gens are like that. A change here seems to belong on a different patch... it's also the case for previous gens. Chris, is there
anything different you are seeing on gen11?

I'd say this type of request should definitely be on a separate patch.

We have some major inconsistencies in the way we handle interrupts:
some places use raw write/read, some places don't, some places do use the likely/unlikely helpers, some places don't, some places do the post processing, some places don't. If we want people to use a specific style we should probably convert the current code to use it first.

Quoted 146 lines

Lucas De Marchi

Quoted 142 lines
drivers/gpu/drm/i915/i915_irq.c +2 -0
+		} else {
+			DRM_ERROR("The master control interrupt

lied, (DE HPD)!\n");

drivers/gpu/drm/i915/i915_irq.c +4 -0
+		}
+	}
+
 	if (master_ctl & GEN8_DE_PORT_IRQ) {
 		iir = I915_READ(GEN8_DE_PORT_IIR);
 		if (iir) {
@@ -3492,6 +3545,7 @@ static void gen11_irq_reset(struct drm_device
 *dev)
 
 	GEN3_IRQ_RESET(GEN8_DE_PORT_);
 	GEN3_IRQ_RESET(GEN8_DE_MISC_);
+	GEN3_IRQ_RESET(GEN11_DE_HPD_);
 	GEN3_IRQ_RESET(GEN11_GU_MISC_);
 	GEN3_IRQ_RESET(GEN8_PCU_);

}

drivers/gpu/drm/i915/i915_irq.c +28 -0
@@ -3610,6 +3664,34 @@ static void ibx_hpd_irq_setup(struct
 drm_i915_private *dev_priv)
 	ibx_hpd_detection_setup(dev_priv);
 }
 
+static void gen11_hpd_detection_setup(struct drm_i915_private
 *dev_priv)
+{
+	u32 hotplug;
+
+	hotplug = I915_READ(GEN11_TC_HOTPLUG_CTL);
+	hotplug |= GEN11_HOTPLUG_CTL_ENABLE(PORT_TC1) |
+		   GEN11_HOTPLUG_CTL_ENABLE(PORT_TC2) |
+		   GEN11_HOTPLUG_CTL_ENABLE(PORT_TC3) |
+		   GEN11_HOTPLUG_CTL_ENABLE(PORT_TC4);
+	I915_WRITE(GEN11_TC_HOTPLUG_CTL, hotplug);
+}
+
+static void gen11_hpd_irq_setup(struct drm_i915_private *dev_priv)
+{
+	u32 hotplug_irqs, enabled_irqs;
+	u32 val;
+
+	enabled_irqs = intel_hpd_enabled_irqs(dev_priv,
 hpd_tc_gen11);
+	hotplug_irqs = GEN11_DE_TC_HOTPLUG_MASK;
+
+	val = I915_READ(GEN11_DE_HPD_IMR);
+	val &= ~hotplug_irqs;
+	I915_WRITE(GEN11_DE_HPD_IMR, val);
+	POSTING_READ(GEN11_DE_HPD_IMR);
+
+	gen11_hpd_detection_setup(dev_priv);
+}
+

static void spt_hpd_detection_setup(struct drm_i915_private
*dev_priv)
{

drivers/gpu/drm/i915/i915_irq.c +10 -3
 	u32 val, hotplug;
@@ -3980,10 +4062,17 @@ static void gen8_de_irq_postinstall(struct
 drm_i915_private *dev_priv)
 	GEN3_IRQ_INIT(GEN8_DE_PORT_, ~de_port_masked,
 de_port_enables);
 	GEN3_IRQ_INIT(GEN8_DE_MISC_, ~de_misc_masked,
 de_misc_masked);
 
-	if (IS_GEN9_LP(dev_priv))
+	if (INTEL_GEN(dev_priv) >= 11) {
+		u32 de_hpd_masked = 0;
+		u32 de_hpd_enables = GEN11_DE_TC_HOTPLUG_MASK;
+
+		GEN3_IRQ_INIT(GEN11_DE_HPD_, ~de_hpd_masked,
 de_hpd_enables);
+		gen11_hpd_detection_setup(dev_priv);
+	} else if (IS_GEN9_LP(dev_priv)) {
 		bxt_hpd_detection_setup(dev_priv);
-	else if (IS_BROADWELL(dev_priv))
+	} else if (IS_BROADWELL(dev_priv)) {
 		ilk_hpd_detection_setup(dev_priv);
+	}
 }
 
 static int gen8_irq_postinstall(struct drm_device *dev)
@@ -4505,7 +4594,7 @@ void intel_irq_init(struct drm_i915_private
 *dev_priv)
 		dev->driver->irq_uninstall = gen11_irq_reset;
 		dev->driver->enable_vblank = gen8_enable_vblank;
 		dev->driver->disable_vblank = gen8_disable_vblank;
-		dev_priv->display.hpd_irq_setup =
 spt_hpd_irq_setup;
+		dev_priv->display.hpd_irq_setup =
 gen11_hpd_irq_setup;
drivers/gpu/drm/i915/i915_irq.c +0 -0
 	} else if (INTEL_GEN(dev_priv) >= 8) {
 		dev->driver->irq_handler = gen8_irq_handler;
 		dev->driver->irq_preinstall = gen8_irq_reset;
drivers/gpu/drm/i915/i915_reg.h +13 -0
index ca474f6f523c..19600097581f 100644
@@ -7036,11 +7036,31 @@ enum {
 #define  GEN11_AUDIO_CODEC_IRQ		(1 << 24)
 #define  GEN11_DE_PCH_IRQ		(1 << 23)
 #define  GEN11_DE_MISC_IRQ		(1 << 22)
+#define  GEN11_DE_HPD_IRQ		(1 << 21)
 #define  GEN11_DE_PORT_IRQ		(1 << 20)
 #define  GEN11_DE_PIPE_C		(1 << 18)
 #define  GEN11_DE_PIPE_B		(1 << 17)
 #define  GEN11_DE_PIPE_A		(1 << 16)
 
+#define GEN11_DE_HPD_ISR		_MMIO(0x44470)
+#define GEN11_DE_HPD_IMR		_MMIO(0x44474)
+#define GEN11_DE_HPD_IIR		_MMIO(0x44478)
+#define GEN11_DE_HPD_IER		_MMIO(0x4447c)
+#define  GEN11_TC4_HOTPLUG			(1 << 19)
+#define  GEN11_TC3_HOTPLUG			(1 << 18)
+#define  GEN11_TC2_HOTPLUG			(1 << 17)
+#define  GEN11_TC1_HOTPLUG			(1 << 16)
+#define  GEN11_DE_TC_HOTPLUG_MASK		(GEN11_TC4_HOTPLU
 G | \
+						 GEN11_TC3_HOTPLUG
 | \
+						 GEN11_TC2_HOTPLUG
 | \
+						 GEN11_TC1_HOTPLUG

)

drivers/gpu/drm/i915/i915_reg.h +2 -0
+
+#define GEN11_TC_HOTPLUG_CTL				_MMIO(

0x44038)
+#define GEN11_HOTPLUG_CTL_ENABLE(tc_port) (8 <<
(tc_port) * 4)
+#define GEN11_HOTPLUG_CTL_LONG_DETECT(tc_port) (2
<< (tc_port) * 4)
+#define GEN11_HOTPLUG_CTL_SHORT_DETECT(tc_port) (1 <<
(tc_port) * 4)
+#define GEN11_HOTPLUG_CTL_NO_DETECT(tc_port) (0 <<
(tc_port) * 4)
+
#define GEN11_GT_INTR_DW0 _MMIO(0x190018)
#define GEN11_CSME (31)
#define GEN11_GUNIT (28)

Signature · 1 line
2.14.3
Quoted 4 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#19 lore raw

PATCH 5/24 drm/i915/icp: Add Interrupt Support

In reply to Paulo Zanoni

From: Anusha Srivatsa <[email protected]>

This patch addresses Interrupts from south display engine (SDE).

ICP has two registers - SHOTPLUG_CTL_DDI and SHOTPLUG_CTL_TC. Introduce these registers and their intended values.

Introduce icp_irq_handler().

Cc Paulo Zanoni <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
Cc Ville Syrjala <[email protected]>

[Paulo: coding style bikesheds and rebases].

---
 drivers/gpu/drm/i915/i915_irq.c | 134 +++++++++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h |  40 ++++++++++++
 2 files changed, 172 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +132 -2
index 9bcec5fdb9d0..6b109991786f 100644
@@ -122,6 +122,15 @@ static const u32 hpd_tc_gen11[HPD_NUM_PINS] = {
 	[HPD_PORT_F] = GEN11_TC4_HOTPLUG
 };
 
+static const u32 hpd_icp[HPD_NUM_PINS] = {
+	[HPD_PORT_A] = ICP_DDIA_HOTPLUG,
+	[HPD_PORT_B] = ICP_DDIB_HOTPLUG,
+	[HPD_PORT_C] = ICP_TC1_HOTPLUG,
+	[HPD_PORT_D] = ICP_TC2_HOTPLUG,
+	[HPD_PORT_E] = ICP_TC3_HOTPLUG,
+	[HPD_PORT_F] = ICP_TC4_HOTPLUG
+};
+
 /* IIR can theoretically queue up two events. Be paranoid. */
 #define GEN8_IRQ_RESET_NDX(type, which) do { \
 	I915_WRITE(GEN8_##type##_IMR(which), 0xffffffff); \
@@ -1586,6 +1595,34 @@ static bool bxt_port_hotplug_long_detect(enum port port, u32 val)
 	}
 }
 
+static bool icp_ddi_port_hotplug_long_detect(enum port port, u32 val)
+{
+	switch (port) {
+	case PORT_A:
+		return val & ICP_DDIA_HPD_LONG_DETECT;
+	case PORT_B:
+		return val & ICP_DDIB_HPD_LONG_DETECT;
+	default:
+		return false;
+	}
+}
+
+static bool icp_tc_port_hotplug_long_detect(enum port port, u32 val)
+{
+	switch (port) {
+	case PORT_C:
+		return val & ICP_TC_HPD_LONG_DETECT(PORT_TC1);
+	case PORT_D:
+		return val & ICP_TC_HPD_LONG_DETECT(PORT_TC2);
+	case PORT_E:
+		return val & ICP_TC_HPD_LONG_DETECT(PORT_TC3);
+	case PORT_F:
+		return val & ICP_TC_HPD_LONG_DETECT(PORT_TC4);
+	default:
+		return false;
+	}
+}
+
 static bool spt_port_hotplug2_long_detect(enum port port, u32 val)
 {
 	switch (port) {
@@ -2377,6 +2414,43 @@ static void cpt_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir)
 		cpt_serr_int_handler(dev_priv);
 }
 
+static void icp_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir)
+{
+	u32 ddi_hotplug_trigger = pch_iir & ICP_SDE_DDI_MASK;
+	u32 tc_hotplug_trigger = pch_iir & ICP_SDE_TC_MASK;
+	u32 pin_mask = 0, long_mask = 0;
+
+	if (ddi_hotplug_trigger) {
+		u32 dig_hotplug_reg;
+
+		dig_hotplug_reg = I915_READ(SHOTPLUG_CTL_DDI);
+		I915_WRITE(SHOTPLUG_CTL_DDI, dig_hotplug_reg);
+
+		intel_get_hpd_pins(dev_priv, &pin_mask, &long_mask,
+				   ddi_hotplug_trigger,
+				   dig_hotplug_reg, hpd_icp,
+				   icp_ddi_port_hotplug_long_detect);
+	}
+
+	if (tc_hotplug_trigger) {
+		u32 dig_hotplug_reg;
+
+		dig_hotplug_reg = I915_READ(SHOTPLUG_CTL_TC);
+		I915_WRITE(SHOTPLUG_CTL_TC, dig_hotplug_reg);
+
+		intel_get_hpd_pins(dev_priv, &pin_mask, &long_mask,
+				   tc_hotplug_trigger,
+				   dig_hotplug_reg, hpd_icp,
+				   icp_tc_port_hotplug_long_detect);
+	}
+
+	if (pin_mask)
+		intel_hpd_irq_handler(dev_priv, pin_mask, long_mask);
+
+	if (pch_iir & ICP_GMBUS)
+		gmbus_irq_handler(dev_priv);
+}
+
 static void spt_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir)
 {
 	u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_SPT &
@@ -2779,8 +2853,11 @@ gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl)
 			I915_WRITE(SDEIIR, iir);
 			ret = IRQ_HANDLED;
 
-			if (HAS_PCH_SPT(dev_priv) || HAS_PCH_KBP(dev_priv) ||
-			    HAS_PCH_CNP(dev_priv))
+			if (HAS_PCH_ICP(dev_priv))
+				icp_irq_handler(dev_priv, iir);
+			else if (HAS_PCH_SPT(dev_priv) ||
+				 HAS_PCH_KBP(dev_priv) ||
+				 HAS_PCH_CNP(dev_priv))
 				spt_irq_handler(dev_priv, iir);
 			else
 				cpt_irq_handler(dev_priv, iir);
@@ -3548,6 +3625,9 @@ static void gen11_irq_reset(struct drm_device *dev)
 	GEN3_IRQ_RESET(GEN11_DE_HPD_);
 	GEN3_IRQ_RESET(GEN11_GU_MISC_);
 	GEN3_IRQ_RESET(GEN8_PCU_);
+
+	if (HAS_PCH_ICP(dev_priv))
+		GEN3_IRQ_RESET(ICP_SDE_);
 }
 
 void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
@@ -3664,6 +3744,35 @@ static void ibx_hpd_irq_setup(struct drm_i915_private *dev_priv)
 	ibx_hpd_detection_setup(dev_priv);
 }
 
+static void icp_hpd_detection_setup(struct drm_i915_private *dev_priv)
+{
+	u32 hotplug;
+
+	hotplug = I915_READ(SHOTPLUG_CTL_DDI);
+	hotplug |= ICP_DDIA_HPD_ENABLE |
+		   ICP_DDIB_HPD_ENABLE;
+	I915_WRITE(SHOTPLUG_CTL_DDI, hotplug);
+
+	hotplug = I915_READ(SHOTPLUG_CTL_TC);
+	hotplug |= ICP_TC_HPD_ENABLE(PORT_TC1) |
+		   ICP_TC_HPD_ENABLE(PORT_TC2) |
+		   ICP_TC_HPD_ENABLE(PORT_TC3) |
+		   ICP_TC_HPD_ENABLE(PORT_TC4);
+	I915_WRITE(SHOTPLUG_CTL_TC, hotplug);
+}
+
+static void icp_hpd_irq_setup(struct drm_i915_private *dev_priv)
+{
+	u32 hotplug_irqs, enabled_irqs;
+
+	hotplug_irqs = ICP_SDE_DDI_MASK | ICP_SDE_TC_MASK;
+	enabled_irqs = intel_hpd_enabled_irqs(dev_priv, hpd_icp);
+
+	ibx_display_interrupt_update(dev_priv, hotplug_irqs, enabled_irqs);
+
+	icp_hpd_detection_setup(dev_priv);
+}
+
 static void gen11_hpd_detection_setup(struct drm_i915_private *dev_priv)
 {
 	u32 hotplug;
@@ -3690,6 +3799,9 @@ static void gen11_hpd_irq_setup(struct drm_i915_private *dev_priv)
 	POSTING_READ(GEN11_DE_HPD_IMR);
 
 	gen11_hpd_detection_setup(dev_priv);
+
+	if (HAS_PCH_ICP(dev_priv))
+		icp_hpd_irq_setup(dev_priv);
 }
 
 static void spt_hpd_detection_setup(struct drm_i915_private *dev_priv)
@@ -4121,11 +4233,29 @@ static void gen11_gt_irq_postinstall(struct drm_i915_private *dev_priv)
 	I915_WRITE(GEN11_GPM_WGBOXPERF_INTR_MASK,  ~0);
 }
 
+static void icp_irq_postinstall(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = to_i915(dev);
+	u32 mask = ICP_GMBUS;
+
+	WARN_ON(I915_READ(ICP_SDE_IER) != 0);
+	I915_WRITE(ICP_SDE_IER, 0xffffffff);
+	POSTING_READ(ICP_SDE_IER);
+
+	gen3_assert_iir_is_zero(dev_priv, ICP_SDE_IIR);
+	I915_WRITE(ICP_SDE_IMR, ~mask);
+
+	icp_hpd_detection_setup(dev_priv);
+}
+
 static int gen11_irq_postinstall(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	u32 gu_misc_masked = GEN11_GU_MISC_GSE;
 
+	if (HAS_PCH_ICP(dev_priv))
+		icp_irq_postinstall(dev);
+
 	gen11_gt_irq_postinstall(dev_priv);
 	gen8_de_irq_postinstall(dev_priv);
 
drivers/gpu/drm/i915/i915_reg.h +40 -0
index 19600097581f..28ce96ce0484 100644
@@ -7460,6 +7460,46 @@ enum {
 #define  PORTE_HOTPLUG_SHORT_DETECT	(1 << 0)
 #define  PORTE_HOTPLUG_LONG_DETECT	(2 << 0)
 
+/* ICP */
+#define ICP_SDE_ISR			_MMIO(0xc4000)
+#define ICP_SDE_IMR			_MMIO(0xc4004)
+#define ICP_SDE_IIR			_MMIO(0xc4008)
+#define ICP_SDE_IER			_MMIO(0xc400c)
+#define   ICP_TC4_HOTPLUG		(1 << 27)
+#define   ICP_TC3_HOTPLUG		(1 << 26)
+#define   ICP_TC2_HOTPLUG		(1 << 25)
+#define   ICP_TC1_HOTPLUG		(1 << 24)
+#define   ICP_GMBUS			(1 << 23)
+#define   ICP_DDIB_HOTPLUG		(1 << 17)
+#define   ICP_DDIA_HOTPLUG		(1 << 16)
+
+#define ICP_SDE_DDI_MASK		(ICP_DDIB_HOTPLUG |	\
+					 ICP_DDIA_HOTPLUG)
+
+#define ICP_SDE_TC_MASK			(ICP_TC4_HOTPLUG |	\
+					 ICP_TC3_HOTPLUG |	\
+					 ICP_TC2_HOTPLUG |	\
+					 ICP_TC1_HOTPLUG)
+
+#define SHOTPLUG_CTL_DDI			_MMIO(0xc4030)	/* SHOTPLUG_CTL */
+#define   ICP_DDIB_HPD_ENABLE			(1 << 7)
+#define   ICP_DDIB_HPD_STATUS_MASK		(3 << 4)
+#define   ICP_DDIB_HPD_NO_DETECT		(0 << 4)
+#define   ICP_DDIB_HPD_SHORT_DETECT		(1 << 4)
+#define   ICP_DDIB_HPD_LONG_DETECT		(2 << 4)
+#define   ICP_DDIB_HPD_SHORT_LONG_DETECT	(3 << 4)
+#define   ICP_DDIA_HPD_ENABLE			(1 << 3)
+#define   ICP_DDIA_HPD_STATUS_MASK		(3 << 0)
+#define   ICP_DDIA_HPD_NO_DETECT		(0 << 0)
+#define   ICP_DDIA_HPD_SHORT_DETECT		(1 << 0)
+#define   ICP_DDIA_HPD_LONG_DETECT		(2 << 0)
+#define   ICP_DDIA_HPD_SHORT_LONG_DETECT	(3 << 0)
+
+#define SHOTPLUG_CTL_TC				_MMIO(0xc4034)
+#define   ICP_TC_HPD_ENABLE(tc_port)		(8 << (tc_port) * 4)
+#define   ICP_TC_HPD_LONG_DETECT(tc_port)	(2 << (tc_port) * 4)
+#define   ICP_TC_HPD_SHORT_DETECT(tc_port)	(1 << (tc_port) * 4)
+
 #define PCH_GPIOA               _MMIO(0xc5010)
 #define PCH_GPIOB               _MMIO(0xc5014)
 #define PCH_GPIOC               _MMIO(0xc5018)
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#20 lore raw

Re: [PATCH 05/24] drm/i915/icp: Add Interrupt Support

Quoted 224 lines · Paulo Zanoni

From: Anusha Srivatsa <[email protected]>

This patch addresses Interrupts from south display engine (SDE).

ICP has two registers - SHOTPLUG_CTL_DDI and SHOTPLUG_CTL_TC. Introduce these registers and their intended values.

Introduce icp_irq_handler().

Cc Paulo Zanoni <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
Cc Ville Syrjala <[email protected]>

[Paulo: coding style bikesheds and rebases].

---
 drivers/gpu/drm/i915/i915_irq.c | 134 +++++++++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h |  40 ++++++++++++
 2 files changed, 172 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +132 -2
index 9bcec5fdb9d0..6b109991786f 100644
@@ -122,6 +122,15 @@ static const u32 hpd_tc_gen11[HPD_NUM_PINS] = {
 	[HPD_PORT_F] = GEN11_TC4_HOTPLUG
 };
 
+static const u32 hpd_icp[HPD_NUM_PINS] = {
+	[HPD_PORT_A] = ICP_DDIA_HOTPLUG,
+	[HPD_PORT_B] = ICP_DDIB_HOTPLUG,
+	[HPD_PORT_C] = ICP_TC1_HOTPLUG,
+	[HPD_PORT_D] = ICP_TC2_HOTPLUG,
+	[HPD_PORT_E] = ICP_TC3_HOTPLUG,
+	[HPD_PORT_F] = ICP_TC4_HOTPLUG
+};
+
 /* IIR can theoretically queue up two events. Be paranoid. */
 #define GEN8_IRQ_RESET_NDX(type, which) do { \
 	I915_WRITE(GEN8_##type##_IMR(which), 0xffffffff); \
@@ -1586,6 +1595,34 @@ static bool bxt_port_hotplug_long_detect(enum port port, u32 val)
 	}
 }
 
+static bool icp_ddi_port_hotplug_long_detect(enum port port, u32 val)
+{
+	switch (port) {
+	case PORT_A:
+		return val & ICP_DDIA_HPD_LONG_DETECT;
+	case PORT_B:
+		return val & ICP_DDIB_HPD_LONG_DETECT;
+	default:
+		return false;
+	}
+}
+
+static bool icp_tc_port_hotplug_long_detect(enum port port, u32 val)
+{
+	switch (port) {
+	case PORT_C:
+		return val & ICP_TC_HPD_LONG_DETECT(PORT_TC1);
+	case PORT_D:
+		return val & ICP_TC_HPD_LONG_DETECT(PORT_TC2);
+	case PORT_E:
+		return val & ICP_TC_HPD_LONG_DETECT(PORT_TC3);
+	case PORT_F:
+		return val & ICP_TC_HPD_LONG_DETECT(PORT_TC4);
+	default:
+		return false;
+	}
+}
+
 static bool spt_port_hotplug2_long_detect(enum port port, u32 val)
 {
 	switch (port) {
@@ -2377,6 +2414,43 @@ static void cpt_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir)
 		cpt_serr_int_handler(dev_priv);
 }
 
+static void icp_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir)
+{
+	u32 ddi_hotplug_trigger = pch_iir & ICP_SDE_DDI_MASK;
+	u32 tc_hotplug_trigger = pch_iir & ICP_SDE_TC_MASK;
+	u32 pin_mask = 0, long_mask = 0;
+
+	if (ddi_hotplug_trigger) {
+		u32 dig_hotplug_reg;
+
+		dig_hotplug_reg = I915_READ(SHOTPLUG_CTL_DDI);
+		I915_WRITE(SHOTPLUG_CTL_DDI, dig_hotplug_reg);
+
+		intel_get_hpd_pins(dev_priv, &pin_mask, &long_mask,
+				   ddi_hotplug_trigger,
+				   dig_hotplug_reg, hpd_icp,
+				   icp_ddi_port_hotplug_long_detect);
+	}
+
+	if (tc_hotplug_trigger) {
+		u32 dig_hotplug_reg;
+
+		dig_hotplug_reg = I915_READ(SHOTPLUG_CTL_TC);
+		I915_WRITE(SHOTPLUG_CTL_TC, dig_hotplug_reg);
+
+		intel_get_hpd_pins(dev_priv, &pin_mask, &long_mask,
+				   tc_hotplug_trigger,
+				   dig_hotplug_reg, hpd_icp,
+				   icp_tc_port_hotplug_long_detect);
+	}
+
+	if (pin_mask)
+		intel_hpd_irq_handler(dev_priv, pin_mask, long_mask);
+
+	if (pch_iir & ICP_GMBUS)
+		gmbus_irq_handler(dev_priv);
+}
+
 static void spt_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir)
 {
 	u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_SPT &
@@ -2779,8 +2853,11 @@ gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl)
 			I915_WRITE(SDEIIR, iir);
 			ret = IRQ_HANDLED;
 
-			if (HAS_PCH_SPT(dev_priv) || HAS_PCH_KBP(dev_priv) ||
-			    HAS_PCH_CNP(dev_priv))
+			if (HAS_PCH_ICP(dev_priv))
+				icp_irq_handler(dev_priv, iir);
+			else if (HAS_PCH_SPT(dev_priv) ||
+				 HAS_PCH_KBP(dev_priv) ||
+				 HAS_PCH_CNP(dev_priv))
 				spt_irq_handler(dev_priv, iir);
 			else
 				cpt_irq_handler(dev_priv, iir);
@@ -3548,6 +3625,9 @@ static void gen11_irq_reset(struct drm_device *dev)
 	GEN3_IRQ_RESET(GEN11_DE_HPD_);
 	GEN3_IRQ_RESET(GEN11_GU_MISC_);
 	GEN3_IRQ_RESET(GEN8_PCU_);
+
+	if (HAS_PCH_ICP(dev_priv))
+		GEN3_IRQ_RESET(ICP_SDE_);
 }
 
 void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,
@@ -3664,6 +3744,35 @@ static void ibx_hpd_irq_setup(struct drm_i915_private *dev_priv)
 	ibx_hpd_detection_setup(dev_priv);
 }
 
+static void icp_hpd_detection_setup(struct drm_i915_private *dev_priv)
+{
+	u32 hotplug;
+
+	hotplug = I915_READ(SHOTPLUG_CTL_DDI);
+	hotplug |= ICP_DDIA_HPD_ENABLE |
+		   ICP_DDIB_HPD_ENABLE;
+	I915_WRITE(SHOTPLUG_CTL_DDI, hotplug);
+
+	hotplug = I915_READ(SHOTPLUG_CTL_TC);
+	hotplug |= ICP_TC_HPD_ENABLE(PORT_TC1) |
+		   ICP_TC_HPD_ENABLE(PORT_TC2) |
+		   ICP_TC_HPD_ENABLE(PORT_TC3) |
+		   ICP_TC_HPD_ENABLE(PORT_TC4);
+	I915_WRITE(SHOTPLUG_CTL_TC, hotplug);
+}
+
+static void icp_hpd_irq_setup(struct drm_i915_private *dev_priv)
+{
+	u32 hotplug_irqs, enabled_irqs;
+
+	hotplug_irqs = ICP_SDE_DDI_MASK | ICP_SDE_TC_MASK;
+	enabled_irqs = intel_hpd_enabled_irqs(dev_priv, hpd_icp);
+
+	ibx_display_interrupt_update(dev_priv, hotplug_irqs, enabled_irqs);
+
+	icp_hpd_detection_setup(dev_priv);
+}
+
 static void gen11_hpd_detection_setup(struct drm_i915_private *dev_priv)
 {
 	u32 hotplug;
@@ -3690,6 +3799,9 @@ static void gen11_hpd_irq_setup(struct drm_i915_private *dev_priv)
 	POSTING_READ(GEN11_DE_HPD_IMR);
 
 	gen11_hpd_detection_setup(dev_priv);
+
+	if (HAS_PCH_ICP(dev_priv))
+		icp_hpd_irq_setup(dev_priv);
 }
 
 static void spt_hpd_detection_setup(struct drm_i915_private *dev_priv)
@@ -4121,11 +4233,29 @@ static void gen11_gt_irq_postinstall(struct drm_i915_private *dev_priv)
 	I915_WRITE(GEN11_GPM_WGBOXPERF_INTR_MASK,  ~0);
 }
 
+static void icp_irq_postinstall(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = to_i915(dev);
+	u32 mask = ICP_GMBUS;
+
+	WARN_ON(I915_READ(ICP_SDE_IER) != 0);
+	I915_WRITE(ICP_SDE_IER, 0xffffffff);
+	POSTING_READ(ICP_SDE_IER);
+
+	gen3_assert_iir_is_zero(dev_priv, ICP_SDE_IIR);
+	I915_WRITE(ICP_SDE_IMR, ~mask);
+
+	icp_hpd_detection_setup(dev_priv);
+}
+
 static int gen11_irq_postinstall(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	u32 gu_misc_masked = GEN11_GU_MISC_GSE;
 
+	if (HAS_PCH_ICP(dev_priv))
+		icp_irq_postinstall(dev);
+
 	gen11_gt_irq_postinstall(dev_priv);
 	gen8_de_irq_postinstall(dev_priv);
 
drivers/gpu/drm/i915/i915_reg.h +0 -0
index 19600097581f..28ce96ce0484 100644

drivers/gpu/drm/i915/i915_reg.h enum { · line 7467

Quoted 8 lines
drivers/gpu/drm/i915/i915_reg.h +5 -0
@@ -7460,6 +7460,46 @@ enum {
 #define  PORTE_HOTPLUG_SHORT_DETECT	(1 << 0)
 #define  PORTE_HOTPLUG_LONG_DETECT	(2 << 0)
 
+/* ICP */
+#define ICP_SDE_ISR			_MMIO(0xc4000)
+#define ICP_SDE_IMR			_MMIO(0xc4004)
+#define ICP_SDE_IIR			_MMIO(0xc4008)
+#define ICP_SDE_IER			_MMIO(0xc400c)

These are exactly the same registers as SDE{ISR,IMR,IIR,IER}. For all the other platforms what we do is rather postfix the platform name.

I think we should follow what they do here.

drivers/gpu/drm/i915/i915_reg.h enum { · line 7474

Quoted 7 lines
drivers/gpu/drm/i915/i915_reg.h +7 -0
+#define   ICP_TC4_HOTPLUG		(1 << 27)
+#define   ICP_TC3_HOTPLUG		(1 << 26)
+#define   ICP_TC2_HOTPLUG		(1 << 25)
+#define   ICP_TC1_HOTPLUG		(1 << 24)
+#define   ICP_GMBUS			(1 << 23)
+#define   ICP_DDIB_HOTPLUG		(1 << 17)
+#define   ICP_DDIA_HOTPLUG		(1 << 16)

so these would become SDE_TC4_HOTPLUG_ICP and so on.

drivers/gpu/drm/i915/i915_reg.h enum { · line 7484

Quoted 10 lines
drivers/gpu/drm/i915/i915_reg.h +10 -0
+
+#define ICP_SDE_DDI_MASK		(ICP_DDIB_HOTPLUG |	\
+					 ICP_DDIA_HOTPLUG)
+
+#define ICP_SDE_TC_MASK			(ICP_TC4_HOTPLUG |	\
+					 ICP_TC3_HOTPLUG |	\
+					 ICP_TC2_HOTPLUG |	\
+					 ICP_TC1_HOTPLUG)
+
+#define SHOTPLUG_CTL_DDI			_MMIO(0xc4030)	/* SHOTPLUG_CTL */

This also seems to reuse what we have defined as PCH_PORT_HOTPLUG with a comment to SHOTPLUG_CTL there, although here I tend to be in favor of using the current real name of the register (SHOTPLUG_CTL).

The rest looks good to me.

Lucas De Marchi

Quoted 28 lines
drivers/gpu/drm/i915/i915_reg.h +18 -0
+#define   ICP_DDIB_HPD_ENABLE			(1 << 7)
+#define   ICP_DDIB_HPD_STATUS_MASK		(3 << 4)
+#define   ICP_DDIB_HPD_NO_DETECT		(0 << 4)
+#define   ICP_DDIB_HPD_SHORT_DETECT		(1 << 4)
+#define   ICP_DDIB_HPD_LONG_DETECT		(2 << 4)
+#define   ICP_DDIB_HPD_SHORT_LONG_DETECT	(3 << 4)
+#define   ICP_DDIA_HPD_ENABLE			(1 << 3)
+#define   ICP_DDIA_HPD_STATUS_MASK		(3 << 0)
+#define   ICP_DDIA_HPD_NO_DETECT		(0 << 0)
+#define   ICP_DDIA_HPD_SHORT_DETECT		(1 << 0)
+#define   ICP_DDIA_HPD_LONG_DETECT		(2 << 0)
+#define   ICP_DDIA_HPD_SHORT_LONG_DETECT	(3 << 0)
+
+#define SHOTPLUG_CTL_TC				_MMIO(0xc4034)
+#define   ICP_TC_HPD_ENABLE(tc_port)		(8 << (tc_port) * 4)
+#define   ICP_TC_HPD_LONG_DETECT(tc_port)	(2 << (tc_port) * 4)
+#define   ICP_TC_HPD_SHORT_DETECT(tc_port)	(1 << (tc_port) * 4)
+
 #define PCH_GPIOA               _MMIO(0xc5010)
 #define PCH_GPIOB               _MMIO(0xc5014)
 #define PCH_GPIOC               _MMIO(0xc5018)
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#21 lore raw

Re: [PATCH 05/24] drm/i915/icp: Add Interrupt Support

Quoted 267 lines · Lucas De Marchi
Quoted 254 lines · Paulo Zanoni

From: Anusha Srivatsa <[email protected]>

This patch addresses Interrupts from south display engine (SDE).

ICP has two registers - SHOTPLUG_CTL_DDI and SHOTPLUG_CTL_TC. Introduce these registers and their intended values.

Introduce icp_irq_handler().

Cc Paulo Zanoni <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
Cc Ville Syrjala <[email protected]>

[Paulo: coding style bikesheds and rebases].

---
 drivers/gpu/drm/i915/i915_irq.c | 134
+++++++++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h |  40 ++++++++++++

 2 files changed, 172 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +0 -0
index 9bcec5fdb9d0..6b109991786f 100644
@@ -122,6 +122,15 @@ static const u32 hpd_tc_gen11[HPD_NUM_PINS] =
 {

  [HPD_PORT_F] = GEN11_TC4_HOTPLUG
 };

drivers/gpu/drm/i915/i915_irq.c +9 -0
+static const u32 hpd_icp[HPD_NUM_PINS] = {
+	[HPD_PORT_A] = ICP_DDIA_HOTPLUG,
+	[HPD_PORT_B] = ICP_DDIB_HOTPLUG,
+	[HPD_PORT_C] = ICP_TC1_HOTPLUG,
+	[HPD_PORT_D] = ICP_TC2_HOTPLUG,
+	[HPD_PORT_E] = ICP_TC3_HOTPLUG,
+	[HPD_PORT_F] = ICP_TC4_HOTPLUG
+};
+

 /* IIR can theoretically queue up two events. Be paranoid. */ #define GEN8_IRQ_RESET_NDX(type, which) do { \
  I915_WRITE(GEN8_##type##_IMR(which), 0xffffffff); \

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -1586,6 +1595,34 @@ static bool
 bxt_port_hotplug_long_detect(enum port port, u32 val)
  	}
  }


+static bool icp_ddi_port_hotplug_long_detect(enum port port, u32 val)

drivers/gpu/drm/i915/i915_irq.c +12 -0
+{
+	switch (port) {
+	case PORT_A:
+		return val & ICP_DDIA_HPD_LONG_DETECT;
+	case PORT_B:
+		return val & ICP_DDIB_HPD_LONG_DETECT;
+	default:
+		return false;
+	}
+}
+
+static bool icp_tc_port_hotplug_long_detect(enum port port, u32

val)

drivers/gpu/drm/i915/i915_irq.c +15 -0
+{
+	switch (port) {
+	case PORT_C:
+		return val & ICP_TC_HPD_LONG_DETECT(PORT_TC1);
+	case PORT_D:
+		return val & ICP_TC_HPD_LONG_DETECT(PORT_TC2);
+	case PORT_E:
+		return val & ICP_TC_HPD_LONG_DETECT(PORT_TC3);
+	case PORT_F:
+		return val & ICP_TC_HPD_LONG_DETECT(PORT_TC4);
+	default:
+		return false;
+	}
+}
+

 static bool spt_port_hotplug2_long_detect(enum port port, u32 val) {
  switch (port) {

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -2377,6 +2414,43 @@ static void cpt_irq_handler(struct
 drm_i915_private *dev_priv, u32 pch_iir)
  		cpt_serr_int_handler(dev_priv);
  }


+static void icp_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir)

drivers/gpu/drm/i915/i915_irq.c +12 -0
+{
+	u32 ddi_hotplug_trigger = pch_iir & ICP_SDE_DDI_MASK;
+	u32 tc_hotplug_trigger = pch_iir & ICP_SDE_TC_MASK;
+	u32 pin_mask = 0, long_mask = 0;
+
+	if (ddi_hotplug_trigger) {
+		u32 dig_hotplug_reg;
+
+		dig_hotplug_reg = I915_READ(SHOTPLUG_CTL_DDI);
+		I915_WRITE(SHOTPLUG_CTL_DDI, dig_hotplug_reg);
+
+		intel_get_hpd_pins(dev_priv, &pin_mask,

&long_mask,

drivers/gpu/drm/i915/i915_irq.c +3 -0
+				   ddi_hotplug_trigger,
+				   dig_hotplug_reg, hpd_icp,
+				   icp_ddi_port_hotplug_long_detec

t);

drivers/gpu/drm/i915/i915_irq.c +9 -0
+	}
+
+	if (tc_hotplug_trigger) {
+		u32 dig_hotplug_reg;
+
+		dig_hotplug_reg = I915_READ(SHOTPLUG_CTL_TC);
+		I915_WRITE(SHOTPLUG_CTL_TC, dig_hotplug_reg);
+
+		intel_get_hpd_pins(dev_priv, &pin_mask,

&long_mask,

drivers/gpu/drm/i915/i915_irq.c +3 -0
+				   tc_hotplug_trigger,
+				   dig_hotplug_reg, hpd_icp,
+				   icp_tc_port_hotplug_long_detect

);

drivers/gpu/drm/i915/i915_irq.c +4 -0
+	}
+
+	if (pin_mask)
+		intel_hpd_irq_handler(dev_priv, pin_mask,

long_mask);

drivers/gpu/drm/i915/i915_irq.c +5 -0
+
+	if (pch_iir & ICP_GMBUS)
+		gmbus_irq_handler(dev_priv);
+}
+

 static void spt_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir)
 {
  u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_SPT &

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -2779,8 +2853,11 @@ gen8_de_irq_handler(struct drm_i915_private
 *dev_priv, u32 master_ctl)
  			I915_WRITE(SDEIIR, iir);
  			ret = IRQ_HANDLED;

drivers/gpu/drm/i915/i915_irq.c +0 -1
-			if (HAS_PCH_SPT(dev_priv) ||

HAS_PCH_KBP(dev_priv) ||

drivers/gpu/drm/i915/i915_irq.c +5 -1
-			    HAS_PCH_CNP(dev_priv))
+			if (HAS_PCH_ICP(dev_priv))
+				icp_irq_handler(dev_priv, iir);
+			else if (HAS_PCH_SPT(dev_priv) ||
+				 HAS_PCH_KBP(dev_priv) ||
+				 HAS_PCH_CNP(dev_priv))

  spt_irq_handler(dev_priv, iir); else cpt_irq_handler(dev_priv, iir);

drivers/gpu/drm/i915/i915_irq.c +3 -0
@@ -3548,6 +3625,9 @@ static void gen11_irq_reset(struct drm_device
 *dev)
  	GEN3_IRQ_RESET(GEN11_DE_HPD_);
  	GEN3_IRQ_RESET(GEN11_GU_MISC_);
  	GEN3_IRQ_RESET(GEN8_PCU_);
+
+	if (HAS_PCH_ICP(dev_priv))
+		GEN3_IRQ_RESET(ICP_SDE_);
  }


 void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -3664,6 +3744,35 @@ static void ibx_hpd_irq_setup(struct
 drm_i915_private *dev_priv)
  	ibx_hpd_detection_setup(dev_priv);
  }


+static void icp_hpd_detection_setup(struct drm_i915_private *dev_priv)

drivers/gpu/drm/i915/i915_irq.c +24 -0
+{
+	u32 hotplug;
+
+	hotplug = I915_READ(SHOTPLUG_CTL_DDI);
+	hotplug |= ICP_DDIA_HPD_ENABLE |
+		   ICP_DDIB_HPD_ENABLE;
+	I915_WRITE(SHOTPLUG_CTL_DDI, hotplug);
+
+	hotplug = I915_READ(SHOTPLUG_CTL_TC);
+	hotplug |= ICP_TC_HPD_ENABLE(PORT_TC1) |
+		   ICP_TC_HPD_ENABLE(PORT_TC2) |
+		   ICP_TC_HPD_ENABLE(PORT_TC3) |
+		   ICP_TC_HPD_ENABLE(PORT_TC4);
+	I915_WRITE(SHOTPLUG_CTL_TC, hotplug);
+}
+
+static void icp_hpd_irq_setup(struct drm_i915_private *dev_priv)
+{
+	u32 hotplug_irqs, enabled_irqs;
+
+	hotplug_irqs = ICP_SDE_DDI_MASK | ICP_SDE_TC_MASK;
+	enabled_irqs = intel_hpd_enabled_irqs(dev_priv, hpd_icp);
+
+	ibx_display_interrupt_update(dev_priv, hotplug_irqs,

enabled_irqs);

drivers/gpu/drm/i915/i915_irq.c +4 -0
+
+	icp_hpd_detection_setup(dev_priv);
+}
+

 static void gen11_hpd_detection_setup(struct drm_i915_private *dev_priv)
 {
  u32 hotplug;

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -3690,6 +3799,9 @@ static void gen11_hpd_irq_setup(struct
 drm_i915_private *dev_priv)
  	POSTING_READ(GEN11_DE_HPD_IMR);


  gen11_hpd_detection_setup(dev_priv);

drivers/gpu/drm/i915/i915_irq.c +3 -0
+
+	if (HAS_PCH_ICP(dev_priv))
+		icp_hpd_irq_setup(dev_priv);

 }

 static void spt_hpd_detection_setup(struct drm_i915_private *dev_priv)

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -4121,11 +4233,29 @@ static void gen11_gt_irq_postinstall(struct
 drm_i915_private *dev_priv)
  	I915_WRITE(GEN11_GPM_WGBOXPERF_INTR_MASK,  ~0);
  }

drivers/gpu/drm/i915/i915_irq.c +15 -0
+static void icp_irq_postinstall(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = to_i915(dev);
+	u32 mask = ICP_GMBUS;
+
+	WARN_ON(I915_READ(ICP_SDE_IER) != 0);
+	I915_WRITE(ICP_SDE_IER, 0xffffffff);
+	POSTING_READ(ICP_SDE_IER);
+
+	gen3_assert_iir_is_zero(dev_priv, ICP_SDE_IIR);
+	I915_WRITE(ICP_SDE_IMR, ~mask);
+
+	icp_hpd_detection_setup(dev_priv);
+}
+

 static int gen11_irq_postinstall(struct drm_device *dev) {
  struct drm_i915_private *dev_priv = dev->dev_private; u32 gu_misc_masked = GEN11_GU_MISC_GSE;

drivers/gpu/drm/i915/i915_irq.c +3 -0
+	if (HAS_PCH_ICP(dev_priv))
+		icp_irq_postinstall(dev);
+

  gen11_gt_irq_postinstall(dev_priv);
  gen8_de_irq_postinstall(dev_priv);

drivers/gpu/drm/i915/i915_reg.h +0 -0
index 19600097581f..28ce96ce0484 100644
@@ -7460,6 +7460,46 @@ enum {
  #define  PORTE_HOTPLUG_SHORT_DETECT	(1 << 0)
  #define  PORTE_HOTPLUG_LONG_DETECT	(2 << 0)

drivers/gpu/drm/i915/i915_reg.h enum { · line 7467

Quoted 5 lines
drivers/gpu/drm/i915/i915_reg.h +5 -0
+/* ICP */
+#define ICP_SDE_ISR			_MMIO(0xc4000)
+#define ICP_SDE_IMR			_MMIO(0xc4004)
+#define ICP_SDE_IIR			_MMIO(0xc4008)
+#define ICP_SDE_IER			_MMIO(0xc400c)

These are exactly the same registers as SDE{ISR,IMR,IIR,IER}. For all the other platforms what we do is rather postfix the platform name.

I think we should follow what they do here.

Quoted 1 line
Quoted 9 lines

drivers/gpu/drm/i915/i915_reg.h enum { · line 7474

Quoted 7 lines
drivers/gpu/drm/i915/i915_reg.h +7 -0
+#define   ICP_TC4_HOTPLUG		(1 << 27)
+#define   ICP_TC3_HOTPLUG		(1 << 26)
+#define   ICP_TC2_HOTPLUG		(1 << 25)
+#define   ICP_TC1_HOTPLUG		(1 << 24)
+#define   ICP_GMBUS			(1 << 23)
+#define   ICP_DDIB_HOTPLUG		(1 << 17)
+#define   ICP_DDIA_HOTPLUG		(1 << 16)

so these would become SDE_TC4_HOTPLUG_ICP and so on.

The reason I preferred this naming for gen-11 is it is symmetric to the corresponding definitions in the north engine.

For example,
+#define GEN11_DE_HPD_ISR               _MMIO(0x44470) +#define GEN11_DE_HPD_IMR               _MMIO(0x44474) +#define GEN11_DE_HPD_IIR               _MMIO(0x44478) +#define GEN11_DE_HPD_IER               _MMIO(0x4447c) +#define  GEN11_TC4_HOTPLUG                     (1 << 19) +#define  GEN11_TC3_HOTPLUG                     (1 << 18) +#define  GEN11_TC2_HOTPLUG                     (1 << 17) +#define  GEN11_TC1_HOTPLUG                     (1 << 16)

With interrupts getting routed to north or south engines for the same port, this naming scheme makes the duality clearer IMO.

Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/i915/i915_reg.h +2 -0
+
+#define ICP_SDE_DDI_MASK		(ICP_DDIB_HOTPLUG |	

\

drivers/gpu/drm/i915/i915_reg.h +3 -0
+					 ICP_DDIA_HOTPLUG)
+
+#define ICP_SDE_TC_MASK			(ICP_TC4_HOTPLUG |	

\

drivers/gpu/drm/i915/i915_reg.h +1 -0
+					 ICP_TC3_HOTPLUG |	

\

drivers/gpu/drm/i915/i915_reg.h +1 -0
+					 ICP_TC2_HOTPLUG |	

\

Quoted 8 lines
Quoted 4 lines
drivers/gpu/drm/i915/i915_reg.h +3 -0
+					 ICP_TC1_HOTPLUG)
+
+#define SHOTPLUG_CTL_DDI			_MMIO(0xc4030)	

/* SHOTPLUG_CTL */

This also seems to reuse what we have defined as PCH_PORT_HOTPLUG with a
comment to SHOTPLUG_CTL there, although here I tend to be in favor of using the current real name of the register (SHOTPLUG_CTL).

The real name I see is SHOTPLUG_CTL_DDI for ICP.

I don't believe we should attempt to make these definitions consistent with previous platforms over making them consistent with each other.

Quoted 23 lines

The rest looks good to me.

Lucas De Marchi

Quoted 18 lines
drivers/gpu/drm/i915/i915_reg.h +14 -0
+#define   ICP_DDIB_HPD_ENABLE			(1 << 7)
+#define   ICP_DDIB_HPD_STATUS_MASK		(3 << 4)
+#define   ICP_DDIB_HPD_NO_DETECT		(0 << 4)
+#define   ICP_DDIB_HPD_SHORT_DETECT		(1 << 4)
+#define   ICP_DDIB_HPD_LONG_DETECT		(2 << 4)
+#define   ICP_DDIB_HPD_SHORT_LONG_DETECT	(3 << 4)
+#define   ICP_DDIA_HPD_ENABLE			(1 << 3)
+#define   ICP_DDIA_HPD_STATUS_MASK		(3 << 0)
+#define   ICP_DDIA_HPD_NO_DETECT		(0 << 0)
+#define   ICP_DDIA_HPD_SHORT_DETECT		(1 << 0)
+#define   ICP_DDIA_HPD_LONG_DETECT		(2 << 0)
+#define   ICP_DDIA_HPD_SHORT_LONG_DETECT	(3 << 0)
+
+#define SHOTPLUG_CTL_TC				_MMIO(0xc40

34)
+#define   ICP_TC_HPD_ENABLE(tc_port) (8 <<
(tc_port) * 4)

Quoted 8 lines
Quoted 8 lines

+#define   ICP_TC_HPD_LONG_DETECT(tc_port) (2 << (tc_port) *
4)
+#define   ICP_TC_HPD_SHORT_DETECT(tc_port) (1 << (tc_port)
* 4)
+
 #define PCH_GPIOA               _MMIO(0xc5010)
 #define PCH_GPIOB               _MMIO(0xc5014)
 #define PCH_GPIOC               _MMIO(0xc5018)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#22 lore raw

Re: [PATCH 05/24] drm/i915/icp: Add Interrupt Support

Quoted 291 lines · Dhinakaran Pandiyan
Quoted 267 lines · Lucas De Marchi
Quoted 254 lines · Paulo Zanoni

From: Anusha Srivatsa <[email protected]>

This patch addresses Interrupts from south display engine (SDE).

ICP has two registers - SHOTPLUG_CTL_DDI and SHOTPLUG_CTL_TC. Introduce these registers and their intended values.

Introduce icp_irq_handler().

Cc Paulo Zanoni <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
Cc Ville Syrjala <[email protected]>

[Paulo: coding style bikesheds and rebases].

---
 drivers/gpu/drm/i915/i915_irq.c | 134
+++++++++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h |  40 ++++++++++++

 2 files changed, 172 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +0 -0
index 9bcec5fdb9d0..6b109991786f 100644
@@ -122,6 +122,15 @@ static const u32 hpd_tc_gen11[HPD_NUM_PINS] =
 {

  [HPD_PORT_F] = GEN11_TC4_HOTPLUG
 };

drivers/gpu/drm/i915/i915_irq.c +9 -0
+static const u32 hpd_icp[HPD_NUM_PINS] = {
+	[HPD_PORT_A] = ICP_DDIA_HOTPLUG,
+	[HPD_PORT_B] = ICP_DDIB_HOTPLUG,
+	[HPD_PORT_C] = ICP_TC1_HOTPLUG,
+	[HPD_PORT_D] = ICP_TC2_HOTPLUG,
+	[HPD_PORT_E] = ICP_TC3_HOTPLUG,
+	[HPD_PORT_F] = ICP_TC4_HOTPLUG
+};
+

 /* IIR can theoretically queue up two events. Be paranoid. */ #define GEN8_IRQ_RESET_NDX(type, which) do { \
  I915_WRITE(GEN8_##type##_IMR(which), 0xffffffff); \

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -1586,6 +1595,34 @@ static bool
 bxt_port_hotplug_long_detect(enum port port, u32 val)
  	}
  }


+static bool icp_ddi_port_hotplug_long_detect(enum port port, u32 val)

drivers/gpu/drm/i915/i915_irq.c +12 -0
+{
+	switch (port) {
+	case PORT_A:
+		return val & ICP_DDIA_HPD_LONG_DETECT;
+	case PORT_B:
+		return val & ICP_DDIB_HPD_LONG_DETECT;
+	default:
+		return false;
+	}
+}
+
+static bool icp_tc_port_hotplug_long_detect(enum port port, u32

val)

drivers/gpu/drm/i915/i915_irq.c +15 -0
+{
+	switch (port) {
+	case PORT_C:
+		return val & ICP_TC_HPD_LONG_DETECT(PORT_TC1);
+	case PORT_D:
+		return val & ICP_TC_HPD_LONG_DETECT(PORT_TC2);
+	case PORT_E:
+		return val & ICP_TC_HPD_LONG_DETECT(PORT_TC3);
+	case PORT_F:
+		return val & ICP_TC_HPD_LONG_DETECT(PORT_TC4);
+	default:
+		return false;
+	}
+}
+

 static bool spt_port_hotplug2_long_detect(enum port port, u32 val) {
  switch (port) {

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -2377,6 +2414,43 @@ static void cpt_irq_handler(struct
 drm_i915_private *dev_priv, u32 pch_iir)
  		cpt_serr_int_handler(dev_priv);
  }


+static void icp_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir)

drivers/gpu/drm/i915/i915_irq.c +12 -0
+{
+	u32 ddi_hotplug_trigger = pch_iir & ICP_SDE_DDI_MASK;
+	u32 tc_hotplug_trigger = pch_iir & ICP_SDE_TC_MASK;
+	u32 pin_mask = 0, long_mask = 0;
+
+	if (ddi_hotplug_trigger) {
+		u32 dig_hotplug_reg;
+
+		dig_hotplug_reg = I915_READ(SHOTPLUG_CTL_DDI);
+		I915_WRITE(SHOTPLUG_CTL_DDI, dig_hotplug_reg);
+
+		intel_get_hpd_pins(dev_priv, &pin_mask,

&long_mask,

drivers/gpu/drm/i915/i915_irq.c +3 -0
+				   ddi_hotplug_trigger,
+				   dig_hotplug_reg, hpd_icp,
+				   icp_ddi_port_hotplug_long_detec

t);

drivers/gpu/drm/i915/i915_irq.c +9 -0
+	}
+
+	if (tc_hotplug_trigger) {
+		u32 dig_hotplug_reg;
+
+		dig_hotplug_reg = I915_READ(SHOTPLUG_CTL_TC);
+		I915_WRITE(SHOTPLUG_CTL_TC, dig_hotplug_reg);
+
+		intel_get_hpd_pins(dev_priv, &pin_mask,

&long_mask,

drivers/gpu/drm/i915/i915_irq.c +3 -0
+				   tc_hotplug_trigger,
+				   dig_hotplug_reg, hpd_icp,
+				   icp_tc_port_hotplug_long_detect

);

drivers/gpu/drm/i915/i915_irq.c +4 -0
+	}
+
+	if (pin_mask)
+		intel_hpd_irq_handler(dev_priv, pin_mask,

long_mask);

drivers/gpu/drm/i915/i915_irq.c +5 -0
+
+	if (pch_iir & ICP_GMBUS)
+		gmbus_irq_handler(dev_priv);
+}
+

 static void spt_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir)
 {
  u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_SPT &

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -2779,8 +2853,11 @@ gen8_de_irq_handler(struct drm_i915_private
 *dev_priv, u32 master_ctl)
  			I915_WRITE(SDEIIR, iir);
  			ret = IRQ_HANDLED;

drivers/gpu/drm/i915/i915_irq.c +0 -1
-			if (HAS_PCH_SPT(dev_priv) ||

HAS_PCH_KBP(dev_priv) ||

drivers/gpu/drm/i915/i915_irq.c +5 -1
-			    HAS_PCH_CNP(dev_priv))
+			if (HAS_PCH_ICP(dev_priv))
+				icp_irq_handler(dev_priv, iir);
+			else if (HAS_PCH_SPT(dev_priv) ||
+				 HAS_PCH_KBP(dev_priv) ||
+				 HAS_PCH_CNP(dev_priv))

  spt_irq_handler(dev_priv, iir); else cpt_irq_handler(dev_priv, iir);

drivers/gpu/drm/i915/i915_irq.c +3 -0
@@ -3548,6 +3625,9 @@ static void gen11_irq_reset(struct drm_device
 *dev)
  	GEN3_IRQ_RESET(GEN11_DE_HPD_);
  	GEN3_IRQ_RESET(GEN11_GU_MISC_);
  	GEN3_IRQ_RESET(GEN8_PCU_);
+
+	if (HAS_PCH_ICP(dev_priv))
+		GEN3_IRQ_RESET(ICP_SDE_);
  }


 void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -3664,6 +3744,35 @@ static void ibx_hpd_irq_setup(struct
 drm_i915_private *dev_priv)
  	ibx_hpd_detection_setup(dev_priv);
  }


+static void icp_hpd_detection_setup(struct drm_i915_private *dev_priv)

drivers/gpu/drm/i915/i915_irq.c +24 -0
+{
+	u32 hotplug;
+
+	hotplug = I915_READ(SHOTPLUG_CTL_DDI);
+	hotplug |= ICP_DDIA_HPD_ENABLE |
+		   ICP_DDIB_HPD_ENABLE;
+	I915_WRITE(SHOTPLUG_CTL_DDI, hotplug);
+
+	hotplug = I915_READ(SHOTPLUG_CTL_TC);
+	hotplug |= ICP_TC_HPD_ENABLE(PORT_TC1) |
+		   ICP_TC_HPD_ENABLE(PORT_TC2) |
+		   ICP_TC_HPD_ENABLE(PORT_TC3) |
+		   ICP_TC_HPD_ENABLE(PORT_TC4);
+	I915_WRITE(SHOTPLUG_CTL_TC, hotplug);
+}
+
+static void icp_hpd_irq_setup(struct drm_i915_private *dev_priv)
+{
+	u32 hotplug_irqs, enabled_irqs;
+
+	hotplug_irqs = ICP_SDE_DDI_MASK | ICP_SDE_TC_MASK;
+	enabled_irqs = intel_hpd_enabled_irqs(dev_priv, hpd_icp);
+
+	ibx_display_interrupt_update(dev_priv, hotplug_irqs,

enabled_irqs);

drivers/gpu/drm/i915/i915_irq.c +4 -0
+
+	icp_hpd_detection_setup(dev_priv);
+}
+

 static void gen11_hpd_detection_setup(struct drm_i915_private *dev_priv)
 {
  u32 hotplug;

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -3690,6 +3799,9 @@ static void gen11_hpd_irq_setup(struct
 drm_i915_private *dev_priv)
  	POSTING_READ(GEN11_DE_HPD_IMR);


  gen11_hpd_detection_setup(dev_priv);

drivers/gpu/drm/i915/i915_irq.c +3 -0
+
+	if (HAS_PCH_ICP(dev_priv))
+		icp_hpd_irq_setup(dev_priv);

 }

 static void spt_hpd_detection_setup(struct drm_i915_private *dev_priv)

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -4121,11 +4233,29 @@ static void gen11_gt_irq_postinstall(struct
 drm_i915_private *dev_priv)
  	I915_WRITE(GEN11_GPM_WGBOXPERF_INTR_MASK,  ~0);
  }

drivers/gpu/drm/i915/i915_irq.c +15 -0
+static void icp_irq_postinstall(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = to_i915(dev);
+	u32 mask = ICP_GMBUS;
+
+	WARN_ON(I915_READ(ICP_SDE_IER) != 0);
+	I915_WRITE(ICP_SDE_IER, 0xffffffff);
+	POSTING_READ(ICP_SDE_IER);
+
+	gen3_assert_iir_is_zero(dev_priv, ICP_SDE_IIR);
+	I915_WRITE(ICP_SDE_IMR, ~mask);
+
+	icp_hpd_detection_setup(dev_priv);
+}
+

 static int gen11_irq_postinstall(struct drm_device *dev) {
  struct drm_i915_private *dev_priv = dev->dev_private; u32 gu_misc_masked = GEN11_GU_MISC_GSE;

drivers/gpu/drm/i915/i915_irq.c +3 -0
+	if (HAS_PCH_ICP(dev_priv))
+		icp_irq_postinstall(dev);
+

  gen11_gt_irq_postinstall(dev_priv);
  gen8_de_irq_postinstall(dev_priv);

drivers/gpu/drm/i915/i915_reg.h +0 -0
index 19600097581f..28ce96ce0484 100644
@@ -7460,6 +7460,46 @@ enum {
  #define  PORTE_HOTPLUG_SHORT_DETECT	(1 << 0)
  #define  PORTE_HOTPLUG_LONG_DETECT	(2 << 0)

drivers/gpu/drm/i915/i915_reg.h enum { · line 7467

Quoted 5 lines
drivers/gpu/drm/i915/i915_reg.h +5 -0
+/* ICP */
+#define ICP_SDE_ISR			_MMIO(0xc4000)
+#define ICP_SDE_IMR			_MMIO(0xc4004)
+#define ICP_SDE_IIR			_MMIO(0xc4008)
+#define ICP_SDE_IER			_MMIO(0xc400c)

These are exactly the same registers as SDE{ISR,IMR,IIR,IER}. For all the other platforms what we do is rather postfix the platform name.

I think we should follow what they do here.

Quoted 1 line
Quoted 9 lines

drivers/gpu/drm/i915/i915_reg.h enum { · line 7474

Quoted 7 lines
drivers/gpu/drm/i915/i915_reg.h +7 -0
+#define   ICP_TC4_HOTPLUG		(1 << 27)
+#define   ICP_TC3_HOTPLUG		(1 << 26)
+#define   ICP_TC2_HOTPLUG		(1 << 25)
+#define   ICP_TC1_HOTPLUG		(1 << 24)
+#define   ICP_GMBUS			(1 << 23)
+#define   ICP_DDIB_HOTPLUG		(1 << 17)
+#define   ICP_DDIA_HOTPLUG		(1 << 16)

so these would become SDE_TC4_HOTPLUG_ICP and so on.

The reason I preferred this naming for gen-11 is it is symmetric to the corresponding definitions in the north engine.

For example,

(quoted diff) +8 -0
+#define GEN11_DE_HPD_ISR               _MMIO(0x44470)
+#define GEN11_DE_HPD_IMR               _MMIO(0x44474)
+#define GEN11_DE_HPD_IIR               _MMIO(0x44478)
+#define GEN11_DE_HPD_IER               _MMIO(0x4447c)
+#define  GEN11_TC4_HOTPLUG                     (1 << 19)
+#define  GEN11_TC3_HOTPLUG                     (1 << 18)
+#define  GEN11_TC2_HOTPLUG                     (1 << 17)
+#define  GEN11_TC1_HOTPLUG                     (1 << 16)
Quoted 2 lines

With interrupts getting routed to north or south engines for the same port, this naming scheme makes the duality clearer IMO.

Still the register is the same as SDEISR and there are places in which we read it expecting to be the same number.

Only the bits are different, so name the bits differently as it is for other platforms. I think of the symmetry here just and accident of life expecting to be different if north and south engines don't have the same ports.

Lucas De Marchi

Quoted 52 lines
Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/i915/i915_reg.h +2 -0
+
+#define ICP_SDE_DDI_MASK		(ICP_DDIB_HOTPLUG |	

\

drivers/gpu/drm/i915/i915_reg.h +3 -0
+					 ICP_DDIA_HOTPLUG)
+
+#define ICP_SDE_TC_MASK			(ICP_TC4_HOTPLUG |	

\

drivers/gpu/drm/i915/i915_reg.h +1 -0
+					 ICP_TC3_HOTPLUG |	

\

drivers/gpu/drm/i915/i915_reg.h +1 -0
+					 ICP_TC2_HOTPLUG |	

\

Quoted 8 lines
Quoted 4 lines
drivers/gpu/drm/i915/i915_reg.h +3 -0
+					 ICP_TC1_HOTPLUG)
+
+#define SHOTPLUG_CTL_DDI			_MMIO(0xc4030)	

/* SHOTPLUG_CTL */

This also seems to reuse what we have defined as PCH_PORT_HOTPLUG with a
comment to SHOTPLUG_CTL there, although here I tend to be in favor of using the current real name of the register (SHOTPLUG_CTL).

The real name I see is SHOTPLUG_CTL_DDI for ICP.

I don't believe we should attempt to make these definitions consistent with previous platforms over making them consistent with each other.

Quoted 23 lines

The rest looks good to me.

Lucas De Marchi

Quoted 18 lines
drivers/gpu/drm/i915/i915_reg.h +14 -0
+#define   ICP_DDIB_HPD_ENABLE			(1 << 7)
+#define   ICP_DDIB_HPD_STATUS_MASK		(3 << 4)
+#define   ICP_DDIB_HPD_NO_DETECT		(0 << 4)
+#define   ICP_DDIB_HPD_SHORT_DETECT		(1 << 4)
+#define   ICP_DDIB_HPD_LONG_DETECT		(2 << 4)
+#define   ICP_DDIB_HPD_SHORT_LONG_DETECT	(3 << 4)
+#define   ICP_DDIA_HPD_ENABLE			(1 << 3)
+#define   ICP_DDIA_HPD_STATUS_MASK		(3 << 0)
+#define   ICP_DDIA_HPD_NO_DETECT		(0 << 0)
+#define   ICP_DDIA_HPD_SHORT_DETECT		(1 << 0)
+#define   ICP_DDIA_HPD_LONG_DETECT		(2 << 0)
+#define   ICP_DDIA_HPD_SHORT_LONG_DETECT	(3 << 0)
+
+#define SHOTPLUG_CTL_TC				_MMIO(0xc40

34)
+#define   ICP_TC_HPD_ENABLE(tc_port) (8 <<
(tc_port) * 4)

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

+#define   ICP_TC_HPD_LONG_DETECT(tc_port) (2 << (tc_port) *
4)
+#define   ICP_TC_HPD_SHORT_DETECT(tc_port) (1 << (tc_port)
* 4)
+
 #define PCH_GPIOA               _MMIO(0xc5010)
 #define PCH_GPIOB               _MMIO(0xc5014)
 #define PCH_GPIOC               _MMIO(0xc5018)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#23 lore raw

Re: [PATCH 05/24] drm/i915/icp: Add Interrupt Support

Quoted 139 lines · Lucas De Marchi
Quoted 138 lines · Dhinakaran Pandiyan
Quoted 137 lines · Lucas De Marchi
Quoted 136 lines · Paulo Zanoni

From: Anusha Srivatsa <[email protected]>

This patch addresses Interrupts from south display engine (SDE).

ICP has two registers - SHOTPLUG_CTL_DDI and SHOTPLUG_CTL_TC. Introduce these registers and their intended values.

Introduce icp_irq_handler().

Cc Paulo Zanoni <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
Cc Ville Syrjala <[email protected]>

[Paulo: coding style bikesheds and rebases].

---
 drivers/gpu/drm/i915/i915_irq.c | 134
+++++++++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h |  40 ++++++++++++

 2 files changed, 172 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +0 -0
index 9bcec5fdb9d0..6b109991786f 100644
@@ -122,6 +122,15 @@ static const u32 hpd_tc_gen11[HPD_NUM_PINS] =
 {

  [HPD_PORT_F] = GEN11_TC4_HOTPLUG
 };

drivers/gpu/drm/i915/i915_irq.c +9 -0
+static const u32 hpd_icp[HPD_NUM_PINS] = {
+	[HPD_PORT_A] = ICP_DDIA_HOTPLUG,
+	[HPD_PORT_B] = ICP_DDIB_HOTPLUG,
+	[HPD_PORT_C] = ICP_TC1_HOTPLUG,
+	[HPD_PORT_D] = ICP_TC2_HOTPLUG,
+	[HPD_PORT_E] = ICP_TC3_HOTPLUG,
+	[HPD_PORT_F] = ICP_TC4_HOTPLUG
+};
+

 /* IIR can theoretically queue up two events. Be paranoid. */ #define GEN8_IRQ_RESET_NDX(type, which) do { \
  I915_WRITE(GEN8_##type##_IMR(which), 0xffffffff); \

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -1586,6 +1595,34 @@ static bool
 bxt_port_hotplug_long_detect(enum port port, u32 val)
  	}
  }


+static bool icp_ddi_port_hotplug_long_detect(enum port port, u32 val)

drivers/gpu/drm/i915/i915_irq.c +12 -0
+{
+	switch (port) {
+	case PORT_A:
+		return val & ICP_DDIA_HPD_LONG_DETECT;
+	case PORT_B:
+		return val & ICP_DDIB_HPD_LONG_DETECT;
+	default:
+		return false;
+	}
+}
+
+static bool icp_tc_port_hotplug_long_detect(enum port port, u32

val)

drivers/gpu/drm/i915/i915_irq.c +15 -0
+{
+	switch (port) {
+	case PORT_C:
+		return val & ICP_TC_HPD_LONG_DETECT(PORT_TC1);
+	case PORT_D:
+		return val & ICP_TC_HPD_LONG_DETECT(PORT_TC2);
+	case PORT_E:
+		return val & ICP_TC_HPD_LONG_DETECT(PORT_TC3);
+	case PORT_F:
+		return val & ICP_TC_HPD_LONG_DETECT(PORT_TC4);
+	default:
+		return false;
+	}
+}
+

 static bool spt_port_hotplug2_long_detect(enum port port, u32 val) {
  switch (port) {

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -2377,6 +2414,43 @@ static void cpt_irq_handler(struct
 drm_i915_private *dev_priv, u32 pch_iir)
  		cpt_serr_int_handler(dev_priv);
  }


+static void icp_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir)

drivers/gpu/drm/i915/i915_irq.c +12 -0
+{
+	u32 ddi_hotplug_trigger = pch_iir & ICP_SDE_DDI_MASK;
+	u32 tc_hotplug_trigger = pch_iir & ICP_SDE_TC_MASK;
+	u32 pin_mask = 0, long_mask = 0;
+
+	if (ddi_hotplug_trigger) {
+		u32 dig_hotplug_reg;
+
+		dig_hotplug_reg = I915_READ(SHOTPLUG_CTL_DDI);
+		I915_WRITE(SHOTPLUG_CTL_DDI, dig_hotplug_reg);
+
+		intel_get_hpd_pins(dev_priv, &pin_mask,

&long_mask,

drivers/gpu/drm/i915/i915_irq.c +3 -0
+				   ddi_hotplug_trigger,
+				   dig_hotplug_reg, hpd_icp,
+				   icp_ddi_port_hotplug_long_detec

t);

drivers/gpu/drm/i915/i915_irq.c +9 -0
+	}
+
+	if (tc_hotplug_trigger) {
+		u32 dig_hotplug_reg;
+
+		dig_hotplug_reg = I915_READ(SHOTPLUG_CTL_TC);
+		I915_WRITE(SHOTPLUG_CTL_TC, dig_hotplug_reg);
+
+		intel_get_hpd_pins(dev_priv, &pin_mask,

&long_mask,

drivers/gpu/drm/i915/i915_irq.c +3 -0
+				   tc_hotplug_trigger,
+				   dig_hotplug_reg, hpd_icp,
+				   icp_tc_port_hotplug_long_detect

);

drivers/gpu/drm/i915/i915_irq.c +4 -0
+	}
+
+	if (pin_mask)
+		intel_hpd_irq_handler(dev_priv, pin_mask,

long_mask);

drivers/gpu/drm/i915/i915_irq.c +5 -0
+
+	if (pch_iir & ICP_GMBUS)
+		gmbus_irq_handler(dev_priv);
+}
+

 static void spt_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir)
 {
  u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_SPT &

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -2779,8 +2853,11 @@ gen8_de_irq_handler(struct drm_i915_private
 *dev_priv, u32 master_ctl)
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/i915/i915_irq.c gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl) · line 2857

Quoted 8 lines
drivers/gpu/drm/i915/i915_irq.c +0 -0
  			I915_WRITE(SDEIIR, iir);
  			ret = IRQ_HANDLED;

drivers/gpu/drm/i915/i915_irq.c +0 -1
-			if (HAS_PCH_SPT(dev_priv) ||

HAS_PCH_KBP(dev_priv) ||

drivers/gpu/drm/i915/i915_irq.c +2 -1
-			    HAS_PCH_CNP(dev_priv))
+			if (HAS_PCH_ICP(dev_priv))
+				icp_irq_handler(dev_priv, iir);

to be clear on what I was saying... See the context just above: we read and write SDEIIR to get/clear the interrupt bits. Yet you are defining a ICP_SDE_IIR that has to be the same value. To avoid any confusion, I think it's better to stay with SDEIIR and just change the bit definition.

Quoted 151 lines
Quoted 145 lines
Quoted 122 lines
Quoted 110 lines
drivers/gpu/drm/i915/i915_irq.c +3 -0
+			else if (HAS_PCH_SPT(dev_priv) ||
+				 HAS_PCH_KBP(dev_priv) ||
+				 HAS_PCH_CNP(dev_priv))

  spt_irq_handler(dev_priv, iir); else cpt_irq_handler(dev_priv, iir);

drivers/gpu/drm/i915/i915_irq.c +3 -0
@@ -3548,6 +3625,9 @@ static void gen11_irq_reset(struct drm_device
 *dev)
  	GEN3_IRQ_RESET(GEN11_DE_HPD_);
  	GEN3_IRQ_RESET(GEN11_GU_MISC_);
  	GEN3_IRQ_RESET(GEN8_PCU_);
+
+	if (HAS_PCH_ICP(dev_priv))
+		GEN3_IRQ_RESET(ICP_SDE_);
  }


 void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -3664,6 +3744,35 @@ static void ibx_hpd_irq_setup(struct
 drm_i915_private *dev_priv)
  	ibx_hpd_detection_setup(dev_priv);
  }


+static void icp_hpd_detection_setup(struct drm_i915_private *dev_priv)

drivers/gpu/drm/i915/i915_irq.c +24 -0
+{
+	u32 hotplug;
+
+	hotplug = I915_READ(SHOTPLUG_CTL_DDI);
+	hotplug |= ICP_DDIA_HPD_ENABLE |
+		   ICP_DDIB_HPD_ENABLE;
+	I915_WRITE(SHOTPLUG_CTL_DDI, hotplug);
+
+	hotplug = I915_READ(SHOTPLUG_CTL_TC);
+	hotplug |= ICP_TC_HPD_ENABLE(PORT_TC1) |
+		   ICP_TC_HPD_ENABLE(PORT_TC2) |
+		   ICP_TC_HPD_ENABLE(PORT_TC3) |
+		   ICP_TC_HPD_ENABLE(PORT_TC4);
+	I915_WRITE(SHOTPLUG_CTL_TC, hotplug);
+}
+
+static void icp_hpd_irq_setup(struct drm_i915_private *dev_priv)
+{
+	u32 hotplug_irqs, enabled_irqs;
+
+	hotplug_irqs = ICP_SDE_DDI_MASK | ICP_SDE_TC_MASK;
+	enabled_irqs = intel_hpd_enabled_irqs(dev_priv, hpd_icp);
+
+	ibx_display_interrupt_update(dev_priv, hotplug_irqs,

enabled_irqs);

drivers/gpu/drm/i915/i915_irq.c +4 -0
+
+	icp_hpd_detection_setup(dev_priv);
+}
+

 static void gen11_hpd_detection_setup(struct drm_i915_private *dev_priv)
 {
  u32 hotplug;

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -3690,6 +3799,9 @@ static void gen11_hpd_irq_setup(struct
 drm_i915_private *dev_priv)
  	POSTING_READ(GEN11_DE_HPD_IMR);


  gen11_hpd_detection_setup(dev_priv);

drivers/gpu/drm/i915/i915_irq.c +3 -0
+
+	if (HAS_PCH_ICP(dev_priv))
+		icp_hpd_irq_setup(dev_priv);

 }

 static void spt_hpd_detection_setup(struct drm_i915_private *dev_priv)

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -4121,11 +4233,29 @@ static void gen11_gt_irq_postinstall(struct
 drm_i915_private *dev_priv)
  	I915_WRITE(GEN11_GPM_WGBOXPERF_INTR_MASK,  ~0);
  }

drivers/gpu/drm/i915/i915_irq.c +15 -0
+static void icp_irq_postinstall(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = to_i915(dev);
+	u32 mask = ICP_GMBUS;
+
+	WARN_ON(I915_READ(ICP_SDE_IER) != 0);
+	I915_WRITE(ICP_SDE_IER, 0xffffffff);
+	POSTING_READ(ICP_SDE_IER);
+
+	gen3_assert_iir_is_zero(dev_priv, ICP_SDE_IIR);
+	I915_WRITE(ICP_SDE_IMR, ~mask);
+
+	icp_hpd_detection_setup(dev_priv);
+}
+

 static int gen11_irq_postinstall(struct drm_device *dev) {
  struct drm_i915_private *dev_priv = dev->dev_private; u32 gu_misc_masked = GEN11_GU_MISC_GSE;

drivers/gpu/drm/i915/i915_irq.c +3 -0
+	if (HAS_PCH_ICP(dev_priv))
+		icp_irq_postinstall(dev);
+

  gen11_gt_irq_postinstall(dev_priv);
  gen8_de_irq_postinstall(dev_priv);

drivers/gpu/drm/i915/i915_reg.h +0 -0
index 19600097581f..28ce96ce0484 100644
@@ -7460,6 +7460,46 @@ enum {
  #define  PORTE_HOTPLUG_SHORT_DETECT	(1 << 0)
  #define  PORTE_HOTPLUG_LONG_DETECT	(2 << 0)

drivers/gpu/drm/i915/i915_reg.h enum { · line 7467

Quoted 5 lines
drivers/gpu/drm/i915/i915_reg.h +5 -0
+/* ICP */
+#define ICP_SDE_ISR			_MMIO(0xc4000)
+#define ICP_SDE_IMR			_MMIO(0xc4004)
+#define ICP_SDE_IIR			_MMIO(0xc4008)
+#define ICP_SDE_IER			_MMIO(0xc400c)

These are exactly the same registers as SDE{ISR,IMR,IIR,IER}. For all the other platforms what we do is rather postfix the platform name.

I think we should follow what they do here.

Quoted 1 line
Quoted 9 lines

drivers/gpu/drm/i915/i915_reg.h enum { · line 7474

Quoted 7 lines
drivers/gpu/drm/i915/i915_reg.h +7 -0
+#define   ICP_TC4_HOTPLUG		(1 << 27)
+#define   ICP_TC3_HOTPLUG		(1 << 26)
+#define   ICP_TC2_HOTPLUG		(1 << 25)
+#define   ICP_TC1_HOTPLUG		(1 << 24)
+#define   ICP_GMBUS			(1 << 23)
+#define   ICP_DDIB_HOTPLUG		(1 << 17)
+#define   ICP_DDIA_HOTPLUG		(1 << 16)

so these would become SDE_TC4_HOTPLUG_ICP and so on.

The reason I preferred this naming for gen-11 is it is symmetric to the corresponding definitions in the north engine.

For example,

(quoted diff) +8 -0
+#define GEN11_DE_HPD_ISR               _MMIO(0x44470)
+#define GEN11_DE_HPD_IMR               _MMIO(0x44474)
+#define GEN11_DE_HPD_IIR               _MMIO(0x44478)
+#define GEN11_DE_HPD_IER               _MMIO(0x4447c)
+#define  GEN11_TC4_HOTPLUG                     (1 << 19)
+#define  GEN11_TC3_HOTPLUG                     (1 << 18)
+#define  GEN11_TC2_HOTPLUG                     (1 << 17)
+#define  GEN11_TC1_HOTPLUG                     (1 << 16)
Quoted 2 lines

With interrupts getting routed to north or south engines for the same port, this naming scheme makes the duality clearer IMO.

Still the register is the same as SDEISR and there are places in which we read it expecting to be the same number.

Quoted 4 lines

Only the bits are different, so name the bits differently as it is for other platforms. I think of the symmetry here just and accident of life expecting to be different if north and south engines don't have the same ports.

This is on gen8_de_irq_handler() which is still used for gen11.

Lucas De Marchi

Quoted 55 lines

Lucas De Marchi

Quoted 52 lines
Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/i915/i915_reg.h +2 -0
+
+#define ICP_SDE_DDI_MASK		(ICP_DDIB_HOTPLUG |	

\

drivers/gpu/drm/i915/i915_reg.h +3 -0
+					 ICP_DDIA_HOTPLUG)
+
+#define ICP_SDE_TC_MASK			(ICP_TC4_HOTPLUG |	

\

drivers/gpu/drm/i915/i915_reg.h +1 -0
+					 ICP_TC3_HOTPLUG |	

\

drivers/gpu/drm/i915/i915_reg.h +1 -0
+					 ICP_TC2_HOTPLUG |	

\

Quoted 8 lines
Quoted 4 lines
drivers/gpu/drm/i915/i915_reg.h +3 -0
+					 ICP_TC1_HOTPLUG)
+
+#define SHOTPLUG_CTL_DDI			_MMIO(0xc4030)	

/* SHOTPLUG_CTL */

This also seems to reuse what we have defined as PCH_PORT_HOTPLUG with a
comment to SHOTPLUG_CTL there, although here I tend to be in favor of using the current real name of the register (SHOTPLUG_CTL).

The real name I see is SHOTPLUG_CTL_DDI for ICP.

I don't believe we should attempt to make these definitions consistent with previous platforms over making them consistent with each other.

Quoted 23 lines

The rest looks good to me.

Lucas De Marchi

Quoted 18 lines
drivers/gpu/drm/i915/i915_reg.h +14 -0
+#define   ICP_DDIB_HPD_ENABLE			(1 << 7)
+#define   ICP_DDIB_HPD_STATUS_MASK		(3 << 4)
+#define   ICP_DDIB_HPD_NO_DETECT		(0 << 4)
+#define   ICP_DDIB_HPD_SHORT_DETECT		(1 << 4)
+#define   ICP_DDIB_HPD_LONG_DETECT		(2 << 4)
+#define   ICP_DDIB_HPD_SHORT_LONG_DETECT	(3 << 4)
+#define   ICP_DDIA_HPD_ENABLE			(1 << 3)
+#define   ICP_DDIA_HPD_STATUS_MASK		(3 << 0)
+#define   ICP_DDIA_HPD_NO_DETECT		(0 << 0)
+#define   ICP_DDIA_HPD_SHORT_DETECT		(1 << 0)
+#define   ICP_DDIA_HPD_LONG_DETECT		(2 << 0)
+#define   ICP_DDIA_HPD_SHORT_LONG_DETECT	(3 << 0)
+
+#define SHOTPLUG_CTL_TC				_MMIO(0xc40

34)
+#define   ICP_TC_HPD_ENABLE(tc_port) (8 <<
(tc_port) * 4)

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

+#define   ICP_TC_HPD_LONG_DETECT(tc_port) (2 << (tc_port) *
4)
+#define   ICP_TC_HPD_SHORT_DETECT(tc_port) (1 << (tc_port)
* 4)
+
 #define PCH_GPIOA               _MMIO(0xc5010)
 #define PCH_GPIOB               _MMIO(0xc5014)
 #define PCH_GPIOC               _MMIO(0xc5018)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#24 lore raw

Re: [PATCH 05/24] drm/i915/icp: Add Interrupt Support

Quoted 146 lines · Lucas De Marchi
Quoted 145 lines · Lucas De Marchi
Quoted 144 lines · Dhinakaran Pandiyan
Quoted 143 lines · Lucas De Marchi
Quoted 142 lines · Paulo Zanoni

From: Anusha Srivatsa <[email protected]>

This patch addresses Interrupts from south display engine (SDE).

ICP has two registers - SHOTPLUG_CTL_DDI and SHOTPLUG_CTL_TC. Introduce these registers and their intended values.

Introduce icp_irq_handler().

Cc Paulo Zanoni <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
Cc Ville Syrjala <[email protected]>

[Paulo: coding style bikesheds and rebases].

---
 drivers/gpu/drm/i915/i915_irq.c | 134
+++++++++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h |  40 ++++++++++++

 2 files changed, 172 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +0 -0
index 9bcec5fdb9d0..6b109991786f 100644
@@ -122,6 +122,15 @@ static const u32 hpd_tc_gen11[HPD_NUM_PINS] =
 {

  [HPD_PORT_F] = GEN11_TC4_HOTPLUG
 };

drivers/gpu/drm/i915/i915_irq.c +9 -0
+static const u32 hpd_icp[HPD_NUM_PINS] = {
+	[HPD_PORT_A] = ICP_DDIA_HOTPLUG,
+	[HPD_PORT_B] = ICP_DDIB_HOTPLUG,
+	[HPD_PORT_C] = ICP_TC1_HOTPLUG,
+	[HPD_PORT_D] = ICP_TC2_HOTPLUG,
+	[HPD_PORT_E] = ICP_TC3_HOTPLUG,
+	[HPD_PORT_F] = ICP_TC4_HOTPLUG
+};
+

 /* IIR can theoretically queue up two events. Be paranoid. */ #define GEN8_IRQ_RESET_NDX(type, which) do { \
  I915_WRITE(GEN8_##type##_IMR(which), 0xffffffff); \

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -1586,6 +1595,34 @@ static bool
 bxt_port_hotplug_long_detect(enum port port, u32 val)
  	}
  }


+static bool icp_ddi_port_hotplug_long_detect(enum port port, u32 val)

drivers/gpu/drm/i915/i915_irq.c +12 -0
+{
+	switch (port) {
+	case PORT_A:
+		return val & ICP_DDIA_HPD_LONG_DETECT;
+	case PORT_B:
+		return val & ICP_DDIB_HPD_LONG_DETECT;
+	default:
+		return false;
+	}
+}
+
+static bool icp_tc_port_hotplug_long_detect(enum port port, u32

val)

drivers/gpu/drm/i915/i915_irq.c +15 -0
+{
+	switch (port) {
+	case PORT_C:
+		return val & ICP_TC_HPD_LONG_DETECT(PORT_TC1);
+	case PORT_D:
+		return val & ICP_TC_HPD_LONG_DETECT(PORT_TC2);
+	case PORT_E:
+		return val & ICP_TC_HPD_LONG_DETECT(PORT_TC3);
+	case PORT_F:
+		return val & ICP_TC_HPD_LONG_DETECT(PORT_TC4);
+	default:
+		return false;
+	}
+}
+

 static bool spt_port_hotplug2_long_detect(enum port port, u32 val) {
  switch (port) {

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -2377,6 +2414,43 @@ static void cpt_irq_handler(struct
 drm_i915_private *dev_priv, u32 pch_iir)
  		cpt_serr_int_handler(dev_priv);
  }


+static void icp_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir)

drivers/gpu/drm/i915/i915_irq.c +12 -0
+{
+	u32 ddi_hotplug_trigger = pch_iir & ICP_SDE_DDI_MASK;
+	u32 tc_hotplug_trigger = pch_iir & ICP_SDE_TC_MASK;
+	u32 pin_mask = 0, long_mask = 0;
+
+	if (ddi_hotplug_trigger) {
+		u32 dig_hotplug_reg;
+
+		dig_hotplug_reg = I915_READ(SHOTPLUG_CTL_DDI);
+		I915_WRITE(SHOTPLUG_CTL_DDI, dig_hotplug_reg);
+
+		intel_get_hpd_pins(dev_priv, &pin_mask,

&long_mask,

drivers/gpu/drm/i915/i915_irq.c +3 -0
+				   ddi_hotplug_trigger,
+				   dig_hotplug_reg, hpd_icp,
+				   icp_ddi_port_hotplug_long_detec

t);

drivers/gpu/drm/i915/i915_irq.c +9 -0
+	}
+
+	if (tc_hotplug_trigger) {
+		u32 dig_hotplug_reg;
+
+		dig_hotplug_reg = I915_READ(SHOTPLUG_CTL_TC);
+		I915_WRITE(SHOTPLUG_CTL_TC, dig_hotplug_reg);
+
+		intel_get_hpd_pins(dev_priv, &pin_mask,

&long_mask,

drivers/gpu/drm/i915/i915_irq.c +3 -0
+				   tc_hotplug_trigger,
+				   dig_hotplug_reg, hpd_icp,
+				   icp_tc_port_hotplug_long_detect

);

drivers/gpu/drm/i915/i915_irq.c +4 -0
+	}
+
+	if (pin_mask)
+		intel_hpd_irq_handler(dev_priv, pin_mask,

long_mask);

drivers/gpu/drm/i915/i915_irq.c +5 -0
+
+	if (pch_iir & ICP_GMBUS)
+		gmbus_irq_handler(dev_priv);
+}
+

 static void spt_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir)
 {
  u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_SPT &

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -2779,8 +2853,11 @@ gen8_de_irq_handler(struct drm_i915_private
 *dev_priv, u32 master_ctl)
  			I915_WRITE(SDEIIR, iir);
  			ret = IRQ_HANDLED;

drivers/gpu/drm/i915/i915_irq.c +0 -1
-			if (HAS_PCH_SPT(dev_priv) ||

HAS_PCH_KBP(dev_priv) ||

drivers/gpu/drm/i915/i915_irq.c +0 -1
-			    HAS_PCH_CNP(dev_priv))
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/i915/i915_irq.c gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl) · line 2857

Quoted 2 lines
drivers/gpu/drm/i915/i915_irq.c +2 -0
+			if (HAS_PCH_ICP(dev_priv))
+				icp_irq_handler(dev_priv, iir);

to be clear on what I was saying... See the context just above: we read and write SDEIIR to get/clear the interrupt bits. Yet you are defining a ICP_SDE_IIR that has to be the same value. To avoid any confusion, I think it's better to stay with SDEIIR and just change the bit definition.

Dk, any news on this?

Lucas De Marchi

Quoted 217 lines
Quoted 153 lines
Quoted 147 lines
Quoted 124 lines
Quoted 112 lines
drivers/gpu/drm/i915/i915_irq.c +3 -0
+			else if (HAS_PCH_SPT(dev_priv) ||
+				 HAS_PCH_KBP(dev_priv) ||
+				 HAS_PCH_CNP(dev_priv))

  spt_irq_handler(dev_priv, iir); else cpt_irq_handler(dev_priv, iir);

drivers/gpu/drm/i915/i915_irq.c +3 -0
@@ -3548,6 +3625,9 @@ static void gen11_irq_reset(struct drm_device
 *dev)
  	GEN3_IRQ_RESET(GEN11_DE_HPD_);
  	GEN3_IRQ_RESET(GEN11_GU_MISC_);
  	GEN3_IRQ_RESET(GEN8_PCU_);
+
+	if (HAS_PCH_ICP(dev_priv))
+		GEN3_IRQ_RESET(ICP_SDE_);
  }


 void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv,

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -3664,6 +3744,35 @@ static void ibx_hpd_irq_setup(struct
 drm_i915_private *dev_priv)
  	ibx_hpd_detection_setup(dev_priv);
  }


+static void icp_hpd_detection_setup(struct drm_i915_private *dev_priv)

drivers/gpu/drm/i915/i915_irq.c +24 -0
+{
+	u32 hotplug;
+
+	hotplug = I915_READ(SHOTPLUG_CTL_DDI);
+	hotplug |= ICP_DDIA_HPD_ENABLE |
+		   ICP_DDIB_HPD_ENABLE;
+	I915_WRITE(SHOTPLUG_CTL_DDI, hotplug);
+
+	hotplug = I915_READ(SHOTPLUG_CTL_TC);
+	hotplug |= ICP_TC_HPD_ENABLE(PORT_TC1) |
+		   ICP_TC_HPD_ENABLE(PORT_TC2) |
+		   ICP_TC_HPD_ENABLE(PORT_TC3) |
+		   ICP_TC_HPD_ENABLE(PORT_TC4);
+	I915_WRITE(SHOTPLUG_CTL_TC, hotplug);
+}
+
+static void icp_hpd_irq_setup(struct drm_i915_private *dev_priv)
+{
+	u32 hotplug_irqs, enabled_irqs;
+
+	hotplug_irqs = ICP_SDE_DDI_MASK | ICP_SDE_TC_MASK;
+	enabled_irqs = intel_hpd_enabled_irqs(dev_priv, hpd_icp);
+
+	ibx_display_interrupt_update(dev_priv, hotplug_irqs,

enabled_irqs);

drivers/gpu/drm/i915/i915_irq.c +4 -0
+
+	icp_hpd_detection_setup(dev_priv);
+}
+

 static void gen11_hpd_detection_setup(struct drm_i915_private *dev_priv)
 {
  u32 hotplug;

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -3690,6 +3799,9 @@ static void gen11_hpd_irq_setup(struct
 drm_i915_private *dev_priv)
  	POSTING_READ(GEN11_DE_HPD_IMR);


  gen11_hpd_detection_setup(dev_priv);

drivers/gpu/drm/i915/i915_irq.c +3 -0
+
+	if (HAS_PCH_ICP(dev_priv))
+		icp_hpd_irq_setup(dev_priv);

 }

 static void spt_hpd_detection_setup(struct drm_i915_private *dev_priv)

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -4121,11 +4233,29 @@ static void gen11_gt_irq_postinstall(struct
 drm_i915_private *dev_priv)
  	I915_WRITE(GEN11_GPM_WGBOXPERF_INTR_MASK,  ~0);
  }

drivers/gpu/drm/i915/i915_irq.c +15 -0
+static void icp_irq_postinstall(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = to_i915(dev);
+	u32 mask = ICP_GMBUS;
+
+	WARN_ON(I915_READ(ICP_SDE_IER) != 0);
+	I915_WRITE(ICP_SDE_IER, 0xffffffff);
+	POSTING_READ(ICP_SDE_IER);
+
+	gen3_assert_iir_is_zero(dev_priv, ICP_SDE_IIR);
+	I915_WRITE(ICP_SDE_IMR, ~mask);
+
+	icp_hpd_detection_setup(dev_priv);
+}
+

 static int gen11_irq_postinstall(struct drm_device *dev) {
  struct drm_i915_private *dev_priv = dev->dev_private; u32 gu_misc_masked = GEN11_GU_MISC_GSE;

drivers/gpu/drm/i915/i915_irq.c +3 -0
+	if (HAS_PCH_ICP(dev_priv))
+		icp_irq_postinstall(dev);
+

  gen11_gt_irq_postinstall(dev_priv);
  gen8_de_irq_postinstall(dev_priv);

drivers/gpu/drm/i915/i915_reg.h +0 -0
index 19600097581f..28ce96ce0484 100644
@@ -7460,6 +7460,46 @@ enum {
  #define  PORTE_HOTPLUG_SHORT_DETECT	(1 << 0)
  #define  PORTE_HOTPLUG_LONG_DETECT	(2 << 0)

drivers/gpu/drm/i915/i915_reg.h enum { · line 7467

Quoted 5 lines
drivers/gpu/drm/i915/i915_reg.h +5 -0
+/* ICP */
+#define ICP_SDE_ISR			_MMIO(0xc4000)
+#define ICP_SDE_IMR			_MMIO(0xc4004)
+#define ICP_SDE_IIR			_MMIO(0xc4008)
+#define ICP_SDE_IER			_MMIO(0xc400c)

These are exactly the same registers as SDE{ISR,IMR,IIR,IER}. For all the other platforms what we do is rather postfix the platform name.

I think we should follow what they do here.

Quoted 1 line
Quoted 9 lines

drivers/gpu/drm/i915/i915_reg.h enum { · line 7474

Quoted 7 lines
drivers/gpu/drm/i915/i915_reg.h +7 -0
+#define   ICP_TC4_HOTPLUG		(1 << 27)
+#define   ICP_TC3_HOTPLUG		(1 << 26)
+#define   ICP_TC2_HOTPLUG		(1 << 25)
+#define   ICP_TC1_HOTPLUG		(1 << 24)
+#define   ICP_GMBUS			(1 << 23)
+#define   ICP_DDIB_HOTPLUG		(1 << 17)
+#define   ICP_DDIA_HOTPLUG		(1 << 16)

so these would become SDE_TC4_HOTPLUG_ICP and so on.

The reason I preferred this naming for gen-11 is it is symmetric to the corresponding definitions in the north engine.

For example,

(quoted diff) +8 -0
+#define GEN11_DE_HPD_ISR               _MMIO(0x44470)
+#define GEN11_DE_HPD_IMR               _MMIO(0x44474)
+#define GEN11_DE_HPD_IIR               _MMIO(0x44478)
+#define GEN11_DE_HPD_IER               _MMIO(0x4447c)
+#define  GEN11_TC4_HOTPLUG                     (1 << 19)
+#define  GEN11_TC3_HOTPLUG                     (1 << 18)
+#define  GEN11_TC2_HOTPLUG                     (1 << 17)
+#define  GEN11_TC1_HOTPLUG                     (1 << 16)
Quoted 2 lines

With interrupts getting routed to north or south engines for the same port, this naming scheme makes the duality clearer IMO.

Still the register is the same as SDEISR and there are places in which we read it expecting to be the same number.

Quoted 4 lines

Only the bits are different, so name the bits differently as it is for other platforms. I think of the symmetry here just and accident of life expecting to be different if north and south engines don't have the same ports.

This is on gen8_de_irq_handler() which is still used for gen11.

Lucas De Marchi

Quoted 55 lines

Lucas De Marchi

Quoted 52 lines
Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/i915/i915_reg.h +2 -0
+
+#define ICP_SDE_DDI_MASK		(ICP_DDIB_HOTPLUG |	

\

drivers/gpu/drm/i915/i915_reg.h +3 -0
+					 ICP_DDIA_HOTPLUG)
+
+#define ICP_SDE_TC_MASK			(ICP_TC4_HOTPLUG |	

\

drivers/gpu/drm/i915/i915_reg.h +1 -0
+					 ICP_TC3_HOTPLUG |	

\

drivers/gpu/drm/i915/i915_reg.h +1 -0
+					 ICP_TC2_HOTPLUG |	

\

Quoted 8 lines
Quoted 4 lines
drivers/gpu/drm/i915/i915_reg.h +3 -0
+					 ICP_TC1_HOTPLUG)
+
+#define SHOTPLUG_CTL_DDI			_MMIO(0xc4030)	

/* SHOTPLUG_CTL */

This also seems to reuse what we have defined as PCH_PORT_HOTPLUG with a
comment to SHOTPLUG_CTL there, although here I tend to be in favor of using the current real name of the register (SHOTPLUG_CTL).

The real name I see is SHOTPLUG_CTL_DDI for ICP.

I don't believe we should attempt to make these definitions consistent with previous platforms over making them consistent with each other.

Quoted 23 lines

The rest looks good to me.

Lucas De Marchi

Quoted 18 lines
drivers/gpu/drm/i915/i915_reg.h +14 -0
+#define   ICP_DDIB_HPD_ENABLE			(1 << 7)
+#define   ICP_DDIB_HPD_STATUS_MASK		(3 << 4)
+#define   ICP_DDIB_HPD_NO_DETECT		(0 << 4)
+#define   ICP_DDIB_HPD_SHORT_DETECT		(1 << 4)
+#define   ICP_DDIB_HPD_LONG_DETECT		(2 << 4)
+#define   ICP_DDIB_HPD_SHORT_LONG_DETECT	(3 << 4)
+#define   ICP_DDIA_HPD_ENABLE			(1 << 3)
+#define   ICP_DDIA_HPD_STATUS_MASK		(3 << 0)
+#define   ICP_DDIA_HPD_NO_DETECT		(0 << 0)
+#define   ICP_DDIA_HPD_SHORT_DETECT		(1 << 0)
+#define   ICP_DDIA_HPD_LONG_DETECT		(2 << 0)
+#define   ICP_DDIA_HPD_SHORT_LONG_DETECT	(3 << 0)
+
+#define SHOTPLUG_CTL_TC				_MMIO(0xc40

34)
+#define   ICP_TC_HPD_ENABLE(tc_port) (8 <<
(tc_port) * 4)

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

+#define   ICP_TC_HPD_LONG_DETECT(tc_port) (2 << (tc_port) *
4)
+#define   ICP_TC_HPD_SHORT_DETECT(tc_port) (1 << (tc_port)
* 4)
+
 #define PCH_GPIOA               _MMIO(0xc5010)
 #define PCH_GPIOB               _MMIO(0xc5014)
 #define PCH_GPIOC               _MMIO(0xc5018)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#25 lore raw

Re: [PATCH 05/24] drm/i915/icp: Add Interrupt Support

Em Qua, 2018-06-13 às 15:23 -0700, Lucas De Marchi escreveu:

Quoted 187 lines · Lucas De Marchi
Quoted 170 lines · Lucas De Marchi
Quoted 169 lines
Quoted 167 lines · Dhinakaran Pandiyan
Quoted 166 lines · Lucas De Marchi
Quoted 165 lines · Paulo Zanoni

From: Anusha Srivatsa <[email protected]>

This patch addresses Interrupts from south display engine (SDE).

ICP has two registers - SHOTPLUG_CTL_DDI and SHOTPLUG_CTL_TC.
Introduce these registers and their intended values.

Introduce icp_irq_handler().

Cc Paulo Zanoni <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
Cc Ville Syrjala <[email protected]>

[Paulo: coding style bikesheds and rebases].

---
 drivers/gpu/drm/i915/i915_irq.c | 134
+++++++++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h |  40 ++++++++++++
 2 files changed, 172 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +0 -0
index 9bcec5fdb9d0..6b109991786f 100644
@@ -122,6 +122,15 @@ static const u32

hpd_tc_gen11[HPD_NUM_PINS] =
{

drivers/gpu/drm/i915/i915_irq.c +9 -0
 	[HPD_PORT_F] = GEN11_TC4_HOTPLUG
 };
 
+static const u32 hpd_icp[HPD_NUM_PINS] = {
+	[HPD_PORT_A] = ICP_DDIA_HOTPLUG,
+	[HPD_PORT_B] = ICP_DDIB_HOTPLUG,
+	[HPD_PORT_C] = ICP_TC1_HOTPLUG,
+	[HPD_PORT_D] = ICP_TC2_HOTPLUG,
+	[HPD_PORT_E] = ICP_TC3_HOTPLUG,
+	[HPD_PORT_F] = ICP_TC4_HOTPLUG
+};
+
 /* IIR can theoretically queue up two events. Be paranoid.

*/
#define GEN8_IRQ_RESET_NDX(type, which) do { \
I915_WRITE(GEN8_##type##_IMR(which), 0xffffffff);
\

drivers/gpu/drm/i915/i915_irq.c +1 -0
@@ -1586,6 +1595,34 @@ static bool
 bxt_port_hotplug_long_detect(enum port port, u32 val)
 	}
 }
 
+static bool icp_ddi_port_hotplug_long_detect(enum port

port, u32
val)

drivers/gpu/drm/i915/i915_irq.c +12 -0
+{
+	switch (port) {
+	case PORT_A:
+		return val & ICP_DDIA_HPD_LONG_DETECT;
+	case PORT_B:
+		return val & ICP_DDIB_HPD_LONG_DETECT;
+	default:
+		return false;
+	}
+}
+
+static bool icp_tc_port_hotplug_long_detect(enum port

port, u32
val)

drivers/gpu/drm/i915/i915_irq.c +4 -0
+{
+	switch (port) {
+	case PORT_C:
+		return val &

ICP_TC_HPD_LONG_DETECT(PORT_TC1);

drivers/gpu/drm/i915/i915_irq.c +2 -0
+	case PORT_D:
+		return val &

ICP_TC_HPD_LONG_DETECT(PORT_TC2);

drivers/gpu/drm/i915/i915_irq.c +2 -0
+	case PORT_E:
+		return val &

ICP_TC_HPD_LONG_DETECT(PORT_TC3);

drivers/gpu/drm/i915/i915_irq.c +2 -0
+	case PORT_F:
+		return val &

ICP_TC_HPD_LONG_DETECT(PORT_TC4);

drivers/gpu/drm/i915/i915_irq.c +5 -0
+	default:
+		return false;
+	}
+}
+
 static bool spt_port_hotplug2_long_detect(enum port port,

u32 val)
{

drivers/gpu/drm/i915/i915_irq.c +3 -0
 	switch (port) {
@@ -2377,6 +2414,43 @@ static void cpt_irq_handler(struct
 drm_i915_private *dev_priv, u32 pch_iir)
 		cpt_serr_int_handler(dev_priv);
 }
 
+static void icp_irq_handler(struct drm_i915_private
 *dev_priv, u32
 pch_iir)
+{
+	u32 ddi_hotplug_trigger = pch_iir &

ICP_SDE_DDI_MASK;

drivers/gpu/drm/i915/i915_irq.c +1 -0
+	u32 tc_hotplug_trigger = pch_iir &

ICP_SDE_TC_MASK;

drivers/gpu/drm/i915/i915_irq.c +6 -0
+	u32 pin_mask = 0, long_mask = 0;
+
+	if (ddi_hotplug_trigger) {
+		u32 dig_hotplug_reg;
+
+		dig_hotplug_reg =

I915_READ(SHOTPLUG_CTL_DDI);

drivers/gpu/drm/i915/i915_irq.c +1 -0
+		I915_WRITE(SHOTPLUG_CTL_DDI,

dig_hotplug_reg);

drivers/gpu/drm/i915/i915_irq.c +2 -0
+
+		intel_get_hpd_pins(dev_priv, &pin_mask,

&long_mask,

drivers/gpu/drm/i915/i915_irq.c +2 -0
+				   ddi_hotplug_trigger,
+				   dig_hotplug_reg,

hpd_icp,

drivers/gpu/drm/i915/i915_irq.c +1 -0
+				   icp_ddi_port_hotplug_lo

ng_detec
t);

drivers/gpu/drm/i915/i915_irq.c +6 -0
+	}
+
+	if (tc_hotplug_trigger) {
+		u32 dig_hotplug_reg;
+
+		dig_hotplug_reg =

I915_READ(SHOTPLUG_CTL_TC);

drivers/gpu/drm/i915/i915_irq.c +1 -0
+		I915_WRITE(SHOTPLUG_CTL_TC,

dig_hotplug_reg);

drivers/gpu/drm/i915/i915_irq.c +2 -0
+
+		intel_get_hpd_pins(dev_priv, &pin_mask,

&long_mask,

drivers/gpu/drm/i915/i915_irq.c +2 -0
+				   tc_hotplug_trigger,
+				   dig_hotplug_reg,

hpd_icp,

drivers/gpu/drm/i915/i915_irq.c +1 -0
+				   icp_tc_port_hotplug_lon

g_detect
);

drivers/gpu/drm/i915/i915_irq.c +4 -0
+	}
+
+	if (pin_mask)
+		intel_hpd_irq_handler(dev_priv, pin_mask,

long_mask);

drivers/gpu/drm/i915/i915_irq.c +5 -0
+
+	if (pch_iir & ICP_GMBUS)
+		gmbus_irq_handler(dev_priv);
+}
+
 static void spt_irq_handler(struct drm_i915_private

*dev_priv, u32
pch_iir)
{
u32 hotplug_trigger = pch_iir &
SDE_HOTPLUG_MASK_SPT &

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -2779,8 +2853,11 @@ gen8_de_irq_handler(struct

drm_i915_private
*dev_priv, u32 master_ctl)

drivers/gpu/drm/i915/i915_irq.c +0 -0
 			I915_WRITE(SDEIIR, iir);
 			ret = IRQ_HANDLED;
Quoted 15 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/i915/i915_irq.c +0 -1
-			if (HAS_PCH_SPT(dev_priv) ||

HAS_PCH_KBP(dev_priv) ||

drivers/gpu/drm/i915/i915_irq.c +2 -1
-			    HAS_PCH_CNP(dev_priv))
+			if (HAS_PCH_ICP(dev_priv))
+				icp_irq_handler(dev_priv,

iir);

to be clear on what I was saying... See the context just above: we read
and write SDEIIR to get/clear the interrupt bits. Yet you are defining a
ICP_SDE_IIR that has to be the same value. To avoid any confusion, I
think it's better to stay with SDEIIR and just change the bit definition.

Quoted 141 lines

Dk, any news on this?

Lucas De Marchi

Quoted 137 lines
Quoted 137 lines
Quoted 137 lines
Quoted 137 lines
Quoted 122 lines
drivers/gpu/drm/i915/i915_irq.c +3 -0
+			else if (HAS_PCH_SPT(dev_priv) ||
+				 HAS_PCH_KBP(dev_priv) ||
+				 HAS_PCH_CNP(dev_priv))
 				spt_irq_handler(dev_priv,

iir);

drivers/gpu/drm/i915/i915_irq.c +0 -0
 			else
 				cpt_irq_handler(dev_priv,

iir);

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -3548,6 +3625,9 @@ static void gen11_irq_reset(struct

drm_device
*dev)

drivers/gpu/drm/i915/i915_irq.c +3 -0
 	GEN3_IRQ_RESET(GEN11_DE_HPD_);
 	GEN3_IRQ_RESET(GEN11_GU_MISC_);
 	GEN3_IRQ_RESET(GEN8_PCU_);
+
+	if (HAS_PCH_ICP(dev_priv))
+		GEN3_IRQ_RESET(ICP_SDE_);
 }
 
 void gen8_irq_power_well_post_enable(struct

drm_i915_private
*dev_priv,

drivers/gpu/drm/i915/i915_irq.c +1 -0
@@ -3664,6 +3744,35 @@ static void ibx_hpd_irq_setup(struct
 drm_i915_private *dev_priv)
 	ibx_hpd_detection_setup(dev_priv);
 }
 
+static void icp_hpd_detection_setup(struct

drm_i915_private
*dev_priv)

drivers/gpu/drm/i915/i915_irq.c +17 -0
+{
+	u32 hotplug;
+
+	hotplug = I915_READ(SHOTPLUG_CTL_DDI);
+	hotplug |= ICP_DDIA_HPD_ENABLE |
+		   ICP_DDIB_HPD_ENABLE;
+	I915_WRITE(SHOTPLUG_CTL_DDI, hotplug);
+
+	hotplug = I915_READ(SHOTPLUG_CTL_TC);
+	hotplug |= ICP_TC_HPD_ENABLE(PORT_TC1) |
+		   ICP_TC_HPD_ENABLE(PORT_TC2) |
+		   ICP_TC_HPD_ENABLE(PORT_TC3) |
+		   ICP_TC_HPD_ENABLE(PORT_TC4);
+	I915_WRITE(SHOTPLUG_CTL_TC, hotplug);
+}
+
+static void icp_hpd_irq_setup(struct drm_i915_private

*dev_priv)

drivers/gpu/drm/i915/i915_irq.c +5 -0
+{
+	u32 hotplug_irqs, enabled_irqs;
+
+	hotplug_irqs = ICP_SDE_DDI_MASK | ICP_SDE_TC_MASK;
+	enabled_irqs = intel_hpd_enabled_irqs(dev_priv,

hpd_icp);

drivers/gpu/drm/i915/i915_irq.c +2 -0
+
+	ibx_display_interrupt_update(dev_priv,

hotplug_irqs,
enabled_irqs);

drivers/gpu/drm/i915/i915_irq.c +4 -0
+
+	icp_hpd_detection_setup(dev_priv);
+}
+
 static void gen11_hpd_detection_setup(struct

drm_i915_private
*dev_priv)
{

drivers/gpu/drm/i915/i915_irq.c +0 -0
 	u32 hotplug;
@@ -3690,6 +3799,9 @@ static void

gen11_hpd_irq_setup(struct
drm_i915_private *dev_priv)

drivers/gpu/drm/i915/i915_irq.c +3 -0
 	POSTING_READ(GEN11_DE_HPD_IMR);
 
 	gen11_hpd_detection_setup(dev_priv);
+
+	if (HAS_PCH_ICP(dev_priv))
+		icp_hpd_irq_setup(dev_priv);
 }
 
 static void spt_hpd_detection_setup(struct

drm_i915_private
*dev_priv)

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -4121,11 +4233,29 @@ static void

gen11_gt_irq_postinstall(struct
drm_i915_private *dev_priv)

drivers/gpu/drm/i915/i915_irq.c +15 -0
 	I915_WRITE(GEN11_GPM_WGBOXPERF_INTR_MASK,  ~0);
 }
 
+static void icp_irq_postinstall(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = to_i915(dev);
+	u32 mask = ICP_GMBUS;
+
+	WARN_ON(I915_READ(ICP_SDE_IER) != 0);
+	I915_WRITE(ICP_SDE_IER, 0xffffffff);
+	POSTING_READ(ICP_SDE_IER);
+
+	gen3_assert_iir_is_zero(dev_priv, ICP_SDE_IIR);
+	I915_WRITE(ICP_SDE_IMR, ~mask);
+
+	icp_hpd_detection_setup(dev_priv);
+}
+
 static int gen11_irq_postinstall(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev-
Quoted 1 line

dev_private;

drivers/gpu/drm/i915/i915_irq.c +3 -0
 	u32 gu_misc_masked = GEN11_GU_MISC_GSE;
 
+	if (HAS_PCH_ICP(dev_priv))
+		icp_irq_postinstall(dev);
+
 	gen11_gt_irq_postinstall(dev_priv);
 	gen8_de_irq_postinstall(dev_priv);
drivers/gpu/drm/i915/i915_reg.h +0 -0
index 19600097581f..28ce96ce0484 100644

drivers/gpu/drm/i915/i915_reg.h enum { · line 7467

Quoted 8 lines
drivers/gpu/drm/i915/i915_reg.h +5 -0
@@ -7460,6 +7460,46 @@ enum {
 #define  PORTE_HOTPLUG_SHORT_DETECT	(1 << 0)
 #define  PORTE_HOTPLUG_LONG_DETECT	(2 << 0)
 
+/* ICP */
+#define ICP_SDE_ISR			_MMIO(0xc4000)
+#define ICP_SDE_IMR			_MMIO(0xc4004)
+#define ICP_SDE_IIR			_MMIO(0xc4008)
+#define ICP_SDE_IER			_MMIO(0xc400c)

These are exactly the same registers as SDE{ISR,IMR,IIR,IER}. For all
the other platforms what we do is rather postfix the platform name.

I think we should follow what they do here.

I agree, there's no need to have an alias and this can indeed make the code harder to read. I'd vote to just remove it, but if we indeed to chose to do it, we can do something like:

#define ICP_SDE_ISR SDE_ISR

But I think it's worth keeping the bit definitions separate since they're very different. Perhaps we should keep the comment to explain that the ICP registers are below:

#define registers_from_before (x < y)
/* ICP: */
#define registers_from_icp (x < y)

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines

drivers/gpu/drm/i915/i915_reg.h enum { · line 7474

Quoted 10 lines
drivers/gpu/drm/i915/i915_reg.h +7 -0
+#define   ICP_TC4_HOTPLUG		(1 << 27)
+#define   ICP_TC3_HOTPLUG		(1 << 26)
+#define   ICP_TC2_HOTPLUG		(1 << 25)
+#define   ICP_TC1_HOTPLUG		(1 << 24)
+#define   ICP_GMBUS			(1 << 23)
+#define   ICP_DDIB_HOTPLUG		(1 << 17)
+#define   ICP_DDIA_HOTPLUG		(1 << 16)

so these would become SDE_TC4_HOTPLUG_ICP and so on.

I don't have strong opinions here, I'd go with whatever. Just a notice that ICP is an SDE, so we have some ugly redundancy here. But yeah, our
standard is weird: registers new to a platform have the platform name
as a prefix, bits new to a platform have the platform name as a suffix...

Quoted 69 lines
Quoted 69 lines
Quoted 23 lines
Quoted 15 lines

The reason I preferred this naming for gen-11 is it is symmetric to the
corresponding definitions in the north engine.

For example,

(quoted diff) +8 -0
+#define GEN11_DE_HPD_ISR               _MMIO(0x44470)
+#define GEN11_DE_HPD_IMR               _MMIO(0x44474)
+#define GEN11_DE_HPD_IIR               _MMIO(0x44478)
+#define GEN11_DE_HPD_IER               _MMIO(0x4447c)
+#define  GEN11_TC4_HOTPLUG                     (1 << 19)
+#define  GEN11_TC3_HOTPLUG                     (1 << 18)
+#define  GEN11_TC2_HOTPLUG                     (1 << 17)
+#define  GEN11_TC1_HOTPLUG                     (1 << 16)
Quoted 3 lines

With interrupts getting routed to north or south engines for the same
port, this naming scheme makes the duality clearer IMO.

Still the register is the same as SDEISR and there are places in which we
read it expecting to be the same number.

Quoted 7 lines

Only the bits are different, so name the bits differently as it is for
other platforms. I think of the symmetry here just and accident of
life expecting to be different if north and south engines don't have the
same ports.

This is on gen8_de_irq_handler() which is still used for gen11.

Lucas De Marchi

Quoted 34 lines

Lucas De Marchi

Quoted 31 lines
Quoted 30 lines
Quoted 21 lines
drivers/gpu/drm/i915/i915_reg.h +2 -0
+
+#define ICP_SDE_DDI_MASK		(ICP_DDIB_HOTPLUG

|
\

drivers/gpu/drm/i915/i915_reg.h +3 -0
+					 ICP_DDIA_HOTPLUG)
+
+#define ICP_SDE_TC_MASK			(ICP_TC4_HO

TPLUG |
\

drivers/gpu/drm/i915/i915_reg.h +1 -0
+					 ICP_TC3_HOTPLUG |

\

drivers/gpu/drm/i915/i915_reg.h +1 -0
+					 ICP_TC2_HOTPLUG |

\

drivers/gpu/drm/i915/i915_reg.h +3 -0
+					 ICP_TC1_HOTPLUG)
+
+#define SHOTPLUG_CTL_DDI			_MMIO(0xc4
Quoted 2 lines

030)
/* SHOTPLUG_CTL */

This also seems to reuse what we have defined as PCH_PORT_HOTPLUG
with a
comment to SHOTPLUG_CTL there, although here I tend to be in favor of
using the current real name of the register (SHOTPLUG_CTL).

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

The real name I see is SHOTPLUG_CTL_DDI for ICP.

I don't believe we should attempt to make these definitions consistent
with previous platforms over making them consistent with each other.

The thing to keep in mind here is that ICP split this register in two:
SHOTPLUG_CTL_DDI and SHOTPLUG_CTL_TC, so I'd be in favor of never using just SHOTPLUG_CTL.

Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines

The rest looks good to me.

Lucas De Marchi

Quoted 25 lines

+#define ICP_DDIB_HPD_ENABLE (1 <<
7)

drivers/gpu/drm/i915/i915_reg.h +3 -0
+#define   ICP_DDIB_HPD_STATUS_MASK		(3 << 4)
+#define   ICP_DDIB_HPD_NO_DETECT		(0 << 4)
+#define   ICP_DDIB_HPD_SHORT_DETECT		(1 <<

4)

drivers/gpu/drm/i915/i915_reg.h +3 -0
+#define   ICP_DDIB_HPD_LONG_DETECT		(2 << 4)
+#define   ICP_DDIB_HPD_SHORT_LONG_DETECT	(3 << 4)
+#define   ICP_DDIA_HPD_ENABLE			(1 <<

3)

drivers/gpu/drm/i915/i915_reg.h +3 -0
+#define   ICP_DDIA_HPD_STATUS_MASK		(3 << 0)
+#define   ICP_DDIA_HPD_NO_DETECT		(0 << 0)
+#define   ICP_DDIA_HPD_SHORT_DETECT		(1 <<

0)

drivers/gpu/drm/i915/i915_reg.h +4 -0
+#define   ICP_DDIA_HPD_LONG_DETECT		(2 << 0)
+#define   ICP_DDIA_HPD_SHORT_LONG_DETECT	(3 << 0)
+
+#define SHOTPLUG_CTL_TC				_MM

IO(0xc40
34)
+#define ICP_TC_HPD_ENABLE(tc_port) (8 <<
(tc_port) * 4)
+#define ICP_TC_HPD_LONG_DETECT(tc_port) (2 <<
(tc_port) *

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

4)
+#define ICP_TC_HPD_SHORT_DETECT(tc_port) (1 <<
(tc_port)
* 4)
+

 #define PCH_GPIOA               _MMIO(0xc5010)
 #define PCH_GPIOB               _MMIO(0xc5014)
 #define PCH_GPIOC               _MMIO(0xc5018)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#26 lore raw

Re: [PATCH 05/24] drm/i915/icp: Add Interrupt Support

In reply to Lucas De Marchi
Quoted 190 lines · Lucas De Marchi
Quoted 181 lines · Lucas De Marchi
Quoted 171 lines · Lucas De Marchi
Quoted 168 lines · Dhinakaran Pandiyan
Quoted 166 lines · Lucas De Marchi
Quoted 164 lines · Paulo Zanoni

From: Anusha Srivatsa <[email protected]>

This patch addresses Interrupts from south display engine (SDE).

ICP has two registers - SHOTPLUG_CTL_DDI and SHOTPLUG_CTL_TC.
Introduce these registers and their intended values.

Introduce icp_irq_handler().

Cc Paulo Zanoni <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
Cc Ville Syrjala <[email protected]>

[Paulo: coding style bikesheds and rebases].

---
 drivers/gpu/drm/i915/i915_irq.c | 134
+++++++++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h |  40 ++++++++++++

 2 files changed, 172 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +0 -0
index 9bcec5fdb9d0..6b109991786f 100644
@@ -122,6 +122,15 @@ static const u32

hpd_tc_gen11[HPD_NUM_PINS] =
{
  [HPD_PORT_F] = GEN11_TC4_HOTPLUG
 };

drivers/gpu/drm/i915/i915_irq.c +9 -0
+static const u32 hpd_icp[HPD_NUM_PINS] = {
+	[HPD_PORT_A] = ICP_DDIA_HOTPLUG,
+	[HPD_PORT_B] = ICP_DDIB_HOTPLUG,
+	[HPD_PORT_C] = ICP_TC1_HOTPLUG,
+	[HPD_PORT_D] = ICP_TC2_HOTPLUG,
+	[HPD_PORT_E] = ICP_TC3_HOTPLUG,
+	[HPD_PORT_F] = ICP_TC4_HOTPLUG
+};
+

 /* IIR can theoretically queue up two events. Be paranoid. */
 #define GEN8_IRQ_RESET_NDX(type, which) do { \
  I915_WRITE(GEN8_##type##_IMR(which), 0xffffffff); \

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -1586,6 +1595,34 @@ static bool
 bxt_port_hotplug_long_detect(enum port port, u32 val)
  	}
  }


+static bool icp_ddi_port_hotplug_long_detect(enum port port, u32
val)

drivers/gpu/drm/i915/i915_irq.c +12 -0
+{
+	switch (port) {
+	case PORT_A:
+		return val & ICP_DDIA_HPD_LONG_DETECT;
+	case PORT_B:
+		return val & ICP_DDIB_HPD_LONG_DETECT;
+	default:
+		return false;
+	}
+}
+
+static bool icp_tc_port_hotplug_long_detect(enum port

port, u32
val)

drivers/gpu/drm/i915/i915_irq.c +4 -0
+{
+	switch (port) {
+	case PORT_C:
+		return val &

ICP_TC_HPD_LONG_DETECT(PORT_TC1);

drivers/gpu/drm/i915/i915_irq.c +2 -0
+	case PORT_D:
+		return val &

ICP_TC_HPD_LONG_DETECT(PORT_TC2);

drivers/gpu/drm/i915/i915_irq.c +2 -0
+	case PORT_E:
+		return val &

ICP_TC_HPD_LONG_DETECT(PORT_TC3);

drivers/gpu/drm/i915/i915_irq.c +2 -0
+	case PORT_F:
+		return val &

ICP_TC_HPD_LONG_DETECT(PORT_TC4);

drivers/gpu/drm/i915/i915_irq.c +5 -0
+	default:
+		return false;
+	}
+}
+

 static bool spt_port_hotplug2_long_detect(enum port port, u32 val)
 {
  switch (port) {

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -2377,6 +2414,43 @@ static void cpt_irq_handler(struct
 drm_i915_private *dev_priv, u32 pch_iir)
  		cpt_serr_int_handler(dev_priv);
  }


+static void icp_irq_handler(struct drm_i915_private *dev_priv, u32
pch_iir)

drivers/gpu/drm/i915/i915_irq.c +2 -0
+{
+	u32 ddi_hotplug_trigger = pch_iir &

ICP_SDE_DDI_MASK;

drivers/gpu/drm/i915/i915_irq.c +1 -0
+	u32 tc_hotplug_trigger = pch_iir &

ICP_SDE_TC_MASK;

drivers/gpu/drm/i915/i915_irq.c +6 -0
+	u32 pin_mask = 0, long_mask = 0;
+
+	if (ddi_hotplug_trigger) {
+		u32 dig_hotplug_reg;
+
+		dig_hotplug_reg =

I915_READ(SHOTPLUG_CTL_DDI);

drivers/gpu/drm/i915/i915_irq.c +1 -0
+		I915_WRITE(SHOTPLUG_CTL_DDI,

dig_hotplug_reg);

drivers/gpu/drm/i915/i915_irq.c +2 -0
+
+		intel_get_hpd_pins(dev_priv, &pin_mask,

&long_mask,

drivers/gpu/drm/i915/i915_irq.c +2 -0
+				   ddi_hotplug_trigger,
+				   dig_hotplug_reg,

hpd_icp,

drivers/gpu/drm/i915/i915_irq.c +1 -0
+				   icp_ddi_port_hotplug_lo

ng_detec
t);

drivers/gpu/drm/i915/i915_irq.c +6 -0
+	}
+
+	if (tc_hotplug_trigger) {
+		u32 dig_hotplug_reg;
+
+		dig_hotplug_reg =

I915_READ(SHOTPLUG_CTL_TC);

drivers/gpu/drm/i915/i915_irq.c +1 -0
+		I915_WRITE(SHOTPLUG_CTL_TC,

dig_hotplug_reg);

drivers/gpu/drm/i915/i915_irq.c +2 -0
+
+		intel_get_hpd_pins(dev_priv, &pin_mask,

&long_mask,

drivers/gpu/drm/i915/i915_irq.c +2 -0
+				   tc_hotplug_trigger,
+				   dig_hotplug_reg,

hpd_icp,

drivers/gpu/drm/i915/i915_irq.c +1 -0
+				   icp_tc_port_hotplug_lon

g_detect
);

drivers/gpu/drm/i915/i915_irq.c +4 -0
+	}
+
+	if (pin_mask)
+		intel_hpd_irq_handler(dev_priv, pin_mask,

long_mask);

drivers/gpu/drm/i915/i915_irq.c +5 -0
+
+	if (pch_iir & ICP_GMBUS)
+		gmbus_irq_handler(dev_priv);
+}
+

 static void spt_irq_handler(struct drm_i915_private *dev_priv, u32
pch_iir)
 {
  u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_SPT &

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -2779,8 +2853,11 @@ gen8_de_irq_handler(struct

drm_i915_private
*dev_priv, u32 master_ctl)
  I915_WRITE(SDEIIR, iir);

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

  ret = IRQ_HANDLED;

drivers/gpu/drm/i915/i915_irq.c +0 -1
-			if (HAS_PCH_SPT(dev_priv) ||

HAS_PCH_KBP(dev_priv) ||

drivers/gpu/drm/i915/i915_irq.c +2 -1
-			    HAS_PCH_CNP(dev_priv))
+			if (HAS_PCH_ICP(dev_priv))
+				icp_irq_handler(dev_priv,

iir);

Quoted 8 lines

to be clear on what I was saying... See the context just above: we read
and write SDEIIR to get/clear the interrupt bits. Yet you are defining a
ICP_SDE_IIR that has to be the same value.  To avoid any confusion, I
think it's better to stay with SDEIIR and just change the bit definition.

Quoted 1 line

Dk, any news on this?

SDEIIR is fine by me. The patch author has to make the required changes, I just reviewed the patch :)

Quoted 232 lines

Lucas De Marchi

Quoted 229 lines
Quoted 175 lines
Quoted 168 lines
Quoted 145 lines
Quoted 130 lines
drivers/gpu/drm/i915/i915_irq.c +3 -0
+			else if (HAS_PCH_SPT(dev_priv) ||
+				 HAS_PCH_KBP(dev_priv) ||
+				 HAS_PCH_CNP(dev_priv))

  spt_irq_handler(dev_priv, iir);
  else cpt_irq_handler(dev_priv, iir);

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -3548,6 +3625,9 @@ static void gen11_irq_reset(struct

drm_device
*dev)
  GEN3_IRQ_RESET(GEN11_DE_HPD_);
  GEN3_IRQ_RESET(GEN11_GU_MISC_);
  GEN3_IRQ_RESET(GEN8_PCU_);

drivers/gpu/drm/i915/i915_irq.c +3 -0
+
+	if (HAS_PCH_ICP(dev_priv))
+		GEN3_IRQ_RESET(ICP_SDE_);

 }

 void gen8_irq_power_well_post_enable(struct
drm_i915_private
*dev_priv,

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -3664,6 +3744,35 @@ static void ibx_hpd_irq_setup(struct
 drm_i915_private *dev_priv)
  	ibx_hpd_detection_setup(dev_priv);
  }


+static void icp_hpd_detection_setup(struct
drm_i915_private
*dev_priv)

drivers/gpu/drm/i915/i915_irq.c +17 -0
+{
+	u32 hotplug;
+
+	hotplug = I915_READ(SHOTPLUG_CTL_DDI);
+	hotplug |= ICP_DDIA_HPD_ENABLE |
+		   ICP_DDIB_HPD_ENABLE;
+	I915_WRITE(SHOTPLUG_CTL_DDI, hotplug);
+
+	hotplug = I915_READ(SHOTPLUG_CTL_TC);
+	hotplug |= ICP_TC_HPD_ENABLE(PORT_TC1) |
+		   ICP_TC_HPD_ENABLE(PORT_TC2) |
+		   ICP_TC_HPD_ENABLE(PORT_TC3) |
+		   ICP_TC_HPD_ENABLE(PORT_TC4);
+	I915_WRITE(SHOTPLUG_CTL_TC, hotplug);
+}
+
+static void icp_hpd_irq_setup(struct drm_i915_private

*dev_priv)

drivers/gpu/drm/i915/i915_irq.c +5 -0
+{
+	u32 hotplug_irqs, enabled_irqs;
+
+	hotplug_irqs = ICP_SDE_DDI_MASK | ICP_SDE_TC_MASK;
+	enabled_irqs = intel_hpd_enabled_irqs(dev_priv,

hpd_icp);

drivers/gpu/drm/i915/i915_irq.c +2 -0
+
+	ibx_display_interrupt_update(dev_priv,

hotplug_irqs,
enabled_irqs);

drivers/gpu/drm/i915/i915_irq.c +4 -0
+
+	icp_hpd_detection_setup(dev_priv);
+}
+

 static void gen11_hpd_detection_setup(struct
drm_i915_private
*dev_priv)
 {
  u32 hotplug;

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -3690,6 +3799,9 @@ static void

gen11_hpd_irq_setup(struct
drm_i915_private *dev_priv)
  POSTING_READ(GEN11_DE_HPD_IMR);

  gen11_hpd_detection_setup(dev_priv);

drivers/gpu/drm/i915/i915_irq.c +3 -0
+
+	if (HAS_PCH_ICP(dev_priv))
+		icp_hpd_irq_setup(dev_priv);

 }

 static void spt_hpd_detection_setup(struct
drm_i915_private
*dev_priv)

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -4121,11 +4233,29 @@ static void

gen11_gt_irq_postinstall(struct drm_i915_private *dev_priv) I915_WRITE(GEN11_GPM_WGBOXPERF_INTR_MASK,  ~0); }

drivers/gpu/drm/i915/i915_irq.c +15 -0
+static void icp_irq_postinstall(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = to_i915(dev);
+	u32 mask = ICP_GMBUS;
+
+	WARN_ON(I915_READ(ICP_SDE_IER) != 0);
+	I915_WRITE(ICP_SDE_IER, 0xffffffff);
+	POSTING_READ(ICP_SDE_IER);
+
+	gen3_assert_iir_is_zero(dev_priv, ICP_SDE_IIR);
+	I915_WRITE(ICP_SDE_IMR, ~mask);
+
+	icp_hpd_detection_setup(dev_priv);
+}
+

 static int gen11_irq_postinstall(struct drm_device *dev) {
  struct drm_i915_private *dev_priv = dev-

Quoted 1 line

dev_private;

  u32 gu_misc_masked = GEN11_GU_MISC_GSE;

drivers/gpu/drm/i915/i915_irq.c +3 -0
+	if (HAS_PCH_ICP(dev_priv))
+		icp_irq_postinstall(dev);
+

  gen11_gt_irq_postinstall(dev_priv);
  gen8_de_irq_postinstall(dev_priv);

drivers/gpu/drm/i915/i915_reg.h +0 -0
index 19600097581f..28ce96ce0484 100644
@@ -7460,6 +7460,46 @@ enum {
  #define  PORTE_HOTPLUG_SHORT_DETECT	(1 << 0)
  #define  PORTE_HOTPLUG_LONG_DETECT	(2 << 0)

drivers/gpu/drm/i915/i915_reg.h enum { · line 7467

Quoted 5 lines
drivers/gpu/drm/i915/i915_reg.h +5 -0
+/* ICP */
+#define ICP_SDE_ISR			_MMIO(0xc4000)
+#define ICP_SDE_IMR			_MMIO(0xc4004)
+#define ICP_SDE_IIR			_MMIO(0xc4008)
+#define ICP_SDE_IER			_MMIO(0xc400c)

These are exactly the same registers as SDE{ISR,IMR,IIR,IER}. For all
the other platforms what we do is rather postfix the platform name.

I think we should follow what they do here.

Quoted 2 lines
Quoted 9 lines

drivers/gpu/drm/i915/i915_reg.h enum { · line 7474

Quoted 7 lines
drivers/gpu/drm/i915/i915_reg.h +7 -0
+#define   ICP_TC4_HOTPLUG		(1 << 27)
+#define   ICP_TC3_HOTPLUG		(1 << 26)
+#define   ICP_TC2_HOTPLUG		(1 << 25)
+#define   ICP_TC1_HOTPLUG		(1 << 24)
+#define   ICP_GMBUS			(1 << 23)
+#define   ICP_DDIB_HOTPLUG		(1 << 17)
+#define   ICP_DDIA_HOTPLUG		(1 << 16)

so these would become SDE_TC4_HOTPLUG_ICP and so on.

The reason I preferred this naming for gen-11 is it is symmetric to the
corresponding definitions in the north engine.

For example,

(quoted diff) +8 -0
+#define GEN11_DE_HPD_ISR               _MMIO(0x44470)
+#define GEN11_DE_HPD_IMR               _MMIO(0x44474)
+#define GEN11_DE_HPD_IIR               _MMIO(0x44478)
+#define GEN11_DE_HPD_IER               _MMIO(0x4447c)
+#define  GEN11_TC4_HOTPLUG                     (1 << 19)
+#define  GEN11_TC3_HOTPLUG                     (1 << 18)
+#define  GEN11_TC2_HOTPLUG                     (1 << 17)
+#define  GEN11_TC1_HOTPLUG                     (1 << 16)
Quoted 3 lines

With interrupts getting routed to north or south engines for the same
port, this naming scheme makes the duality clearer IMO.

Still the register is the same as SDEISR and there are places in which we
read it expecting to be the same number.

Quoted 7 lines

Only the bits are different, so name the bits differently as it is for
other platforms.  I think of the symmetry here just and accident of
life expecting to be different if north and south engines don't have the
same ports.

This is on gen8_de_irq_handler() which is still used for gen11.

Lucas De Marchi

Quoted 43 lines

Lucas De Marchi

Quoted 39 lines
Quoted 20 lines
Quoted 20 lines
drivers/gpu/drm/i915/i915_reg.h +2 -0
+
+#define ICP_SDE_DDI_MASK		(ICP_DDIB_HOTPLUG

|
\

drivers/gpu/drm/i915/i915_reg.h +3 -0
+					 ICP_DDIA_HOTPLUG)
+
+#define ICP_SDE_TC_MASK			(ICP_TC4_HO

TPLUG |
\

drivers/gpu/drm/i915/i915_reg.h +1 -0
+					 ICP_TC3_HOTPLUG |

\

drivers/gpu/drm/i915/i915_reg.h +1 -0
+					 ICP_TC2_HOTPLUG |
Quoted 12 lines
Quoted 6 lines

\

drivers/gpu/drm/i915/i915_reg.h +3 -0
+					 ICP_TC1_HOTPLUG)
+
+#define SHOTPLUG_CTL_DDI			_MMIO(0xc4

030)
/* SHOTPLUG_CTL */

This also seems to reuse what we have defined as PCH_PORT_HOTPLUG
with a
comment to SHOTPLUG_CTL there, although here I tend to be in favor of
using the current real name of the register (SHOTPLUG_CTL).

The real name I see is SHOTPLUG_CTL_DDI for ICP.

I don't believe we should attempt to make these definitions consistent
with previous platforms over making them consistent with each other.

If you want to retain the original definition PCH_HOTPLUG, appending to the existing comment that the register is called SHOTPLUG_CTL_DDI on ICP would be nice.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#27 lore raw

Re: [PATCH 05/24] drm/i915/icp: Add Interrupt Support

Quoted 191 lines · Dhinakaran Pandiyan
Quoted 190 lines · Lucas De Marchi
Quoted 189 lines · Lucas De Marchi
Quoted 171 lines · Lucas De Marchi
Quoted 168 lines · Dhinakaran Pandiyan
Quoted 166 lines · Lucas De Marchi
Quoted 164 lines · Paulo Zanoni

From: Anusha Srivatsa <[email protected]>

This patch addresses Interrupts from south display engine (SDE).

ICP has two registers - SHOTPLUG_CTL_DDI and SHOTPLUG_CTL_TC.
Introduce these registers and their intended values.

Introduce icp_irq_handler().

Cc Paulo Zanoni <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
Cc Ville Syrjala <[email protected]>

[Paulo: coding style bikesheds and rebases].

---
 drivers/gpu/drm/i915/i915_irq.c | 134
+++++++++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h |  40 ++++++++++++

 2 files changed, 172 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +0 -0
index 9bcec5fdb9d0..6b109991786f 100644
@@ -122,6 +122,15 @@ static const u32

hpd_tc_gen11[HPD_NUM_PINS] =
{
  [HPD_PORT_F] = GEN11_TC4_HOTPLUG
 };

drivers/gpu/drm/i915/i915_irq.c +9 -0
+static const u32 hpd_icp[HPD_NUM_PINS] = {
+	[HPD_PORT_A] = ICP_DDIA_HOTPLUG,
+	[HPD_PORT_B] = ICP_DDIB_HOTPLUG,
+	[HPD_PORT_C] = ICP_TC1_HOTPLUG,
+	[HPD_PORT_D] = ICP_TC2_HOTPLUG,
+	[HPD_PORT_E] = ICP_TC3_HOTPLUG,
+	[HPD_PORT_F] = ICP_TC4_HOTPLUG
+};
+

 /* IIR can theoretically queue up two events. Be paranoid. */
 #define GEN8_IRQ_RESET_NDX(type, which) do { \
  I915_WRITE(GEN8_##type##_IMR(which), 0xffffffff); \

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -1586,6 +1595,34 @@ static bool
 bxt_port_hotplug_long_detect(enum port port, u32 val)
  	}
  }


+static bool icp_ddi_port_hotplug_long_detect(enum port port, u32
val)

drivers/gpu/drm/i915/i915_irq.c +12 -0
+{
+	switch (port) {
+	case PORT_A:
+		return val & ICP_DDIA_HPD_LONG_DETECT;
+	case PORT_B:
+		return val & ICP_DDIB_HPD_LONG_DETECT;
+	default:
+		return false;
+	}
+}
+
+static bool icp_tc_port_hotplug_long_detect(enum port

port, u32
val)

drivers/gpu/drm/i915/i915_irq.c +4 -0
+{
+	switch (port) {
+	case PORT_C:
+		return val &

ICP_TC_HPD_LONG_DETECT(PORT_TC1);

drivers/gpu/drm/i915/i915_irq.c +2 -0
+	case PORT_D:
+		return val &

ICP_TC_HPD_LONG_DETECT(PORT_TC2);

drivers/gpu/drm/i915/i915_irq.c +2 -0
+	case PORT_E:
+		return val &

ICP_TC_HPD_LONG_DETECT(PORT_TC3);

drivers/gpu/drm/i915/i915_irq.c +2 -0
+	case PORT_F:
+		return val &

ICP_TC_HPD_LONG_DETECT(PORT_TC4);

drivers/gpu/drm/i915/i915_irq.c +5 -0
+	default:
+		return false;
+	}
+}
+

 static bool spt_port_hotplug2_long_detect(enum port port, u32 val)
 {
  switch (port) {

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -2377,6 +2414,43 @@ static void cpt_irq_handler(struct
 drm_i915_private *dev_priv, u32 pch_iir)
  		cpt_serr_int_handler(dev_priv);
  }


+static void icp_irq_handler(struct drm_i915_private *dev_priv, u32
pch_iir)

drivers/gpu/drm/i915/i915_irq.c +2 -0
+{
+	u32 ddi_hotplug_trigger = pch_iir &

ICP_SDE_DDI_MASK;

drivers/gpu/drm/i915/i915_irq.c +1 -0
+	u32 tc_hotplug_trigger = pch_iir &

ICP_SDE_TC_MASK;

drivers/gpu/drm/i915/i915_irq.c +6 -0
+	u32 pin_mask = 0, long_mask = 0;
+
+	if (ddi_hotplug_trigger) {
+		u32 dig_hotplug_reg;
+
+		dig_hotplug_reg =

I915_READ(SHOTPLUG_CTL_DDI);

drivers/gpu/drm/i915/i915_irq.c +1 -0
+		I915_WRITE(SHOTPLUG_CTL_DDI,

dig_hotplug_reg);

drivers/gpu/drm/i915/i915_irq.c +2 -0
+
+		intel_get_hpd_pins(dev_priv, &pin_mask,

&long_mask,

drivers/gpu/drm/i915/i915_irq.c +2 -0
+				   ddi_hotplug_trigger,
+				   dig_hotplug_reg,

hpd_icp,

drivers/gpu/drm/i915/i915_irq.c +1 -0
+				   icp_ddi_port_hotplug_lo

ng_detec
t);

drivers/gpu/drm/i915/i915_irq.c +6 -0
+	}
+
+	if (tc_hotplug_trigger) {
+		u32 dig_hotplug_reg;
+
+		dig_hotplug_reg =

I915_READ(SHOTPLUG_CTL_TC);

drivers/gpu/drm/i915/i915_irq.c +1 -0
+		I915_WRITE(SHOTPLUG_CTL_TC,

dig_hotplug_reg);

drivers/gpu/drm/i915/i915_irq.c +2 -0
+
+		intel_get_hpd_pins(dev_priv, &pin_mask,

&long_mask,

drivers/gpu/drm/i915/i915_irq.c +2 -0
+				   tc_hotplug_trigger,
+				   dig_hotplug_reg,

hpd_icp,

drivers/gpu/drm/i915/i915_irq.c +1 -0
+				   icp_tc_port_hotplug_lon

g_detect
);

drivers/gpu/drm/i915/i915_irq.c +4 -0
+	}
+
+	if (pin_mask)
+		intel_hpd_irq_handler(dev_priv, pin_mask,

long_mask);

drivers/gpu/drm/i915/i915_irq.c +5 -0
+
+	if (pch_iir & ICP_GMBUS)
+		gmbus_irq_handler(dev_priv);
+}
+

 static void spt_irq_handler(struct drm_i915_private *dev_priv, u32
pch_iir)
 {
  u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_SPT &

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -2779,8 +2853,11 @@ gen8_de_irq_handler(struct

drm_i915_private
*dev_priv, u32 master_ctl)
  I915_WRITE(SDEIIR, iir);

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

  ret = IRQ_HANDLED;

drivers/gpu/drm/i915/i915_irq.c +0 -1
-			if (HAS_PCH_SPT(dev_priv) ||

HAS_PCH_KBP(dev_priv) ||

drivers/gpu/drm/i915/i915_irq.c +2 -1
-			    HAS_PCH_CNP(dev_priv))
+			if (HAS_PCH_ICP(dev_priv))
+				icp_irq_handler(dev_priv,

iir);

to be clear on what I was saying... See the context just above: we read
and write SDEIIR to get/clear the interrupt bits. Yet you are defining a
ICP_SDE_IIR that has to be the same value.  To avoid any confusion, I
think it's better to stay with SDEIIR and just change the bit definition.

Quoted 1 line
Quoted 1 line

Dk, any news on this?

Lucas, Dk, thanks for the review.
Sorry for the late response.

Yes, i see that the registers are exactly the same. better to reuse the original SDE{} and have only new bit definitions in place.

I shall remove the ICP_SDE{} register defines.

Quoted 164 lines

SDEIIR is fine by me. The patch author has to make the required changes, I just reviewed the patch :)

Quoted 161 lines

Lucas De Marchi

Quoted 158 lines
Quoted 158 lines
Quoted 158 lines
Quoted 145 lines
Quoted 130 lines
drivers/gpu/drm/i915/i915_irq.c +3 -0
+			else if (HAS_PCH_SPT(dev_priv) ||
+				 HAS_PCH_KBP(dev_priv) ||
+				 HAS_PCH_CNP(dev_priv))

  spt_irq_handler(dev_priv, iir);
  else cpt_irq_handler(dev_priv, iir);

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -3548,6 +3625,9 @@ static void gen11_irq_reset(struct

drm_device
*dev)
  GEN3_IRQ_RESET(GEN11_DE_HPD_);
  GEN3_IRQ_RESET(GEN11_GU_MISC_);
  GEN3_IRQ_RESET(GEN8_PCU_);

drivers/gpu/drm/i915/i915_irq.c +3 -0
+
+	if (HAS_PCH_ICP(dev_priv))
+		GEN3_IRQ_RESET(ICP_SDE_);

 }

 void gen8_irq_power_well_post_enable(struct
drm_i915_private
*dev_priv,

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -3664,6 +3744,35 @@ static void ibx_hpd_irq_setup(struct
 drm_i915_private *dev_priv)
  	ibx_hpd_detection_setup(dev_priv);
  }


+static void icp_hpd_detection_setup(struct
drm_i915_private
*dev_priv)

drivers/gpu/drm/i915/i915_irq.c +17 -0
+{
+	u32 hotplug;
+
+	hotplug = I915_READ(SHOTPLUG_CTL_DDI);
+	hotplug |= ICP_DDIA_HPD_ENABLE |
+		   ICP_DDIB_HPD_ENABLE;
+	I915_WRITE(SHOTPLUG_CTL_DDI, hotplug);
+
+	hotplug = I915_READ(SHOTPLUG_CTL_TC);
+	hotplug |= ICP_TC_HPD_ENABLE(PORT_TC1) |
+		   ICP_TC_HPD_ENABLE(PORT_TC2) |
+		   ICP_TC_HPD_ENABLE(PORT_TC3) |
+		   ICP_TC_HPD_ENABLE(PORT_TC4);
+	I915_WRITE(SHOTPLUG_CTL_TC, hotplug);
+}
+
+static void icp_hpd_irq_setup(struct drm_i915_private

*dev_priv)

drivers/gpu/drm/i915/i915_irq.c +5 -0
+{
+	u32 hotplug_irqs, enabled_irqs;
+
+	hotplug_irqs = ICP_SDE_DDI_MASK | ICP_SDE_TC_MASK;
+	enabled_irqs = intel_hpd_enabled_irqs(dev_priv,

hpd_icp);

drivers/gpu/drm/i915/i915_irq.c +2 -0
+
+	ibx_display_interrupt_update(dev_priv,

hotplug_irqs,
enabled_irqs);

drivers/gpu/drm/i915/i915_irq.c +4 -0
+
+	icp_hpd_detection_setup(dev_priv);
+}
+

 static void gen11_hpd_detection_setup(struct
drm_i915_private
*dev_priv)
 {
  u32 hotplug;

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -3690,6 +3799,9 @@ static void

gen11_hpd_irq_setup(struct
drm_i915_private *dev_priv)
  POSTING_READ(GEN11_DE_HPD_IMR);

  gen11_hpd_detection_setup(dev_priv);

drivers/gpu/drm/i915/i915_irq.c +3 -0
+
+	if (HAS_PCH_ICP(dev_priv))
+		icp_hpd_irq_setup(dev_priv);

 }

 static void spt_hpd_detection_setup(struct
drm_i915_private
*dev_priv)

drivers/gpu/drm/i915/i915_irq.c +0 -0
@@ -4121,11 +4233,29 @@ static void

gen11_gt_irq_postinstall(struct drm_i915_private *dev_priv) I915_WRITE(GEN11_GPM_WGBOXPERF_INTR_MASK,  ~0); }

drivers/gpu/drm/i915/i915_irq.c +15 -0
+static void icp_irq_postinstall(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = to_i915(dev);
+	u32 mask = ICP_GMBUS;
+
+	WARN_ON(I915_READ(ICP_SDE_IER) != 0);
+	I915_WRITE(ICP_SDE_IER, 0xffffffff);
+	POSTING_READ(ICP_SDE_IER);
+
+	gen3_assert_iir_is_zero(dev_priv, ICP_SDE_IIR);
+	I915_WRITE(ICP_SDE_IMR, ~mask);
+
+	icp_hpd_detection_setup(dev_priv);
+}
+

 static int gen11_irq_postinstall(struct drm_device *dev) {
  struct drm_i915_private *dev_priv = dev-

Quoted 1 line

dev_private;

  u32 gu_misc_masked = GEN11_GU_MISC_GSE;

drivers/gpu/drm/i915/i915_irq.c +3 -0
+	if (HAS_PCH_ICP(dev_priv))
+		icp_irq_postinstall(dev);
+

  gen11_gt_irq_postinstall(dev_priv);
  gen8_de_irq_postinstall(dev_priv);

drivers/gpu/drm/i915/i915_reg.h +0 -0
index 19600097581f..28ce96ce0484 100644
@@ -7460,6 +7460,46 @@ enum {
  #define  PORTE_HOTPLUG_SHORT_DETECT	(1 << 0)
  #define  PORTE_HOTPLUG_LONG_DETECT	(2 << 0)

drivers/gpu/drm/i915/i915_reg.h

Quoted 5 lines
drivers/gpu/drm/i915/i915_reg.h +5 -0
+/* ICP */
+#define ICP_SDE_ISR			_MMIO(0xc4000)
+#define ICP_SDE_IMR			_MMIO(0xc4004)
+#define ICP_SDE_IIR			_MMIO(0xc4008)
+#define ICP_SDE_IER			_MMIO(0xc400c)

These are exactly the same registers as SDE{ISR,IMR,IIR,IER}. For all
the other platforms what we do is rather postfix the platform name.

I think we should follow what they do here.

Quoted 2 lines
Quoted 9 lines

drivers/gpu/drm/i915/i915_reg.h

Quoted 7 lines
drivers/gpu/drm/i915/i915_reg.h +7 -0
+#define   ICP_TC4_HOTPLUG		(1 << 27)
+#define   ICP_TC3_HOTPLUG		(1 << 26)
+#define   ICP_TC2_HOTPLUG		(1 << 25)
+#define   ICP_TC1_HOTPLUG		(1 << 24)
+#define   ICP_GMBUS			(1 << 23)
+#define   ICP_DDIB_HOTPLUG		(1 << 17)
+#define   ICP_DDIA_HOTPLUG		(1 << 16)

so these would become SDE_TC4_HOTPLUG_ICP and so on.

The reason I preferred this naming for gen-11 is it is symmetric to the
corresponding definitions in the north engine.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

Review

Quoted 9 lines

For example,

(quoted diff) +8 -0
+#define GEN11_DE_HPD_ISR               _MMIO(0x44470)
+#define GEN11_DE_HPD_IMR               _MMIO(0x44474)
+#define GEN11_DE_HPD_IIR               _MMIO(0x44478)
+#define GEN11_DE_HPD_IER               _MMIO(0x4447c)
+#define  GEN11_TC4_HOTPLUG                     (1 << 19)
+#define  GEN11_TC3_HOTPLUG                     (1 << 18)
+#define  GEN11_TC2_HOTPLUG                     (1 << 17)
+#define  GEN11_TC1_HOTPLUG                     (1 << 16)

I see that changing ICP_TC4_HOTPLUG to SDE_TC4_HOTPLUG_ICP will align it with rest of platform. looking at BSpec though the bitfield is named "Hotplug TypeC Port n". Following that maybe SDE_HOTPLUG_TC4_ICP will be a good option.
This will break the symmetry with the registers in north display though....

Quoted 54 lines
Quoted 54 lines
Quoted 54 lines
Quoted 7 lines
Quoted 3 lines

With interrupts getting routed to north or south engines for the same
port, this naming scheme makes the duality clearer IMO.

Still the register is the same as SDEISR and there are places in which we
read it expecting to be the same number.

Quoted 7 lines

Only the bits are different, so name the bits differently as it is for
other platforms.  I think of the symmetry here just and accident of
life expecting to be different if north and south engines don't have the
same ports.

This is on gen8_de_irq_handler() which is still used for gen11.

Lucas De Marchi

Quoted 36 lines

Lucas De Marchi

Quoted 32 lines
Quoted 32 lines
Quoted 24 lines
drivers/gpu/drm/i915/i915_reg.h +2 -0
+
+#define ICP_SDE_DDI_MASK		(ICP_DDIB_HOTPLUG

|
\

drivers/gpu/drm/i915/i915_reg.h +3 -0
+					 ICP_DDIA_HOTPLUG)
+
+#define ICP_SDE_TC_MASK			(ICP_TC4_HO

TPLUG |
\

drivers/gpu/drm/i915/i915_reg.h +1 -0
+					 ICP_TC3_HOTPLUG |

\

drivers/gpu/drm/i915/i915_reg.h +1 -0
+					 ICP_TC2_HOTPLUG |

\

drivers/gpu/drm/i915/i915_reg.h +3 -0
+					 ICP_TC1_HOTPLUG)
+
+#define SHOTPLUG_CTL_DDI			_MMIO(0xc4
Quoted 2 lines

030)
/* SHOTPLUG_CTL */

This also seems to reuse what we have defined as PCH_PORT_HOTPLUG
with a
comment to SHOTPLUG_CTL there, although here I tend to be in favor of
using the current real name of the register (SHOTPLUG_CTL).

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

The real name I see is SHOTPLUG_CTL_DDI for ICP.

That is correct.

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

I don't believe we should attempt to make these definitions consistent
with previous platforms over making them consistent with each other.

If you want to retain the original definition PCH_HOTPLUG, appending to the existing comment that the register is called SHOTPLUG_CTL_DDI on ICP would be nice.

So have the PCH_HOTPLUG define and the new SHOTPLUG_CTL_DDI with comment addressing that they are the same registers but keeping the name consistent with BSpec should suffice?

Thanks,
Anusha

__ _______________________________________________

Quoted 3 lines

Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 5 lines
Anusha Srivatsa
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#28 lore raw

PATCH 6/24 drm/i915/ICL: Add register definition for DFLEXDPMLE

In reply to Paulo Zanoni

From: Manasi Navare <[email protected]>

DFLEXDPMLE register is required to tell the FIA hardware which main links of DP are enabled on TCC Connectors. FIA uses this information to program PHY to Controller signal mapping. This register is applicable in both TC connector's Alternate mode as well as DP connector mode.

Cc Jani Nikula <[email protected]>
Cc Animesh Manna <[email protected]>
Cc Madhav Chauhan <[email protected]>
Cc Anusha Srivatsa <[email protected]>
Cc Paulo Zanoni <[email protected]>
---
 drivers/gpu/drm/i915/i915_reg.h | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +5 -0
index 28ce96ce0484..7f27fe2e38c7 100644
@@ -1990,6 +1990,11 @@ enum i915_power_well_id {
 						   _ICL_PORT_COMP_DW10_A, \
 						   _ICL_PORT_COMP_DW10_B)
 
+/* ICL PHY DFLEX registers */
+#define ICL_PORT_TX_DFLEXDPMLE1		_MMIO(0x1638C0)
+#define   DFLEXDPMLE1_DPMLETC_MASK(n)	(0xf << (4 * (n)))
+#define   DFLEXDPMLE1_DPMLETC(n, x)	((x) << (4 * (n)))
+
 /* BXT PHY Ref registers */
 #define _PORT_REF_DW3_A			0x16218C
 #define _PORT_REF_DW3_BC		0x6C18C
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author Reviewed-by on v1 6/24
#29 lore raw

Re: [PATCH 06/24] drm/i915/ICL: Add register definition for DFLEXDPMLE

Em Seg, 2018-05-21 às 17:25 -0700, Paulo Zanoni escreveu:

Quoted 24 lines

From: Manasi Navare <[email protected]>

DFLEXDPMLE register is required to tell the FIA hardware which main links of DP are enabled on TCC Connectors. FIA uses this information to program PHY to Controller signal mapping. This register is applicable in both TC connector's Alternate mode as well as DP connector mode.

Cc Jani Nikula <[email protected]>
Cc Animesh Manna <[email protected]>
Cc Madhav Chauhan <[email protected]>
Cc Anusha Srivatsa <[email protected]>
Cc Paulo Zanoni <[email protected]>
---
 drivers/gpu/drm/i915/i915_reg.h | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +0 -0
index 28ce96ce0484..7f27fe2e38c7 100644

drivers/gpu/drm/i915/i915_reg.h enum i915_power_well_id { · line 1996

Quoted 7 lines
drivers/gpu/drm/i915/i915_reg.h +2 -0
@@ -1990,6 +1990,11 @@ enum i915_power_well_id {
 						   _ICL_PORT_COMP_DW
 10_A, \
 						   _ICL_PORT_COMP_DW
 10_B)
 
+/* ICL PHY DFLEX registers */
+#define ICL_PORT_TX_DFLEXDPMLE1		_MMIO(0x1638C0)

We can probably remove the ICL_ prefix since the register did not exist before.

With or without that:

Note: the patch that uses the register was removed from the series due to some problems identified. Will be upstreamed as soon as it's fixed.

Quoted 6 lines
drivers/gpu/drm/i915/i915_reg.h +3 -0
+#define   DFLEXDPMLE1_DPMLETC_MASK(n)	(0xf << (4 * (n)))
+#define   DFLEXDPMLE1_DPMLETC(n, x)	((x) << (4 * (n)))
+
 /* BXT PHY Ref registers */

#define _PORT_REF_DW3_A 0x16218C
#define _PORT_REF_DW3_BC 0x6C18C

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#30 lore raw

Re: [PATCH 06/24] drm/i915/ICL: Add register definition for DFLEXDPMLE

Quoted 30 lines · Paulo Zanoni

Em Seg, 2018-05-21 às 17:25 -0700, Paulo Zanoni escreveu:

Quoted 29 lines

From: Manasi Navare <[email protected]>

DFLEXDPMLE register is required to tell the FIA hardware which main links of DP are enabled on TCC Connectors. FIA uses this information to program PHY to Controller signal mapping. This register is applicable in both TC connector's Alternate mode as well as DP connector mode.

Cc Jani Nikula <[email protected]>
Cc Animesh Manna <[email protected]>
Cc Madhav Chauhan <[email protected]>
Cc Anusha Srivatsa <[email protected]>
Cc Paulo Zanoni <[email protected]>
---
 drivers/gpu/drm/i915/i915_reg.h | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +0 -0
index 28ce96ce0484..7f27fe2e38c7 100644
@@ -1990,6 +1990,11 @@ enum i915_power_well_id {
 						   _ICL_PORT_COMP_DW
 10_A, \
 						   _ICL_PORT_COMP_DW
 10_B)
 
Quoted 5 lines

drivers/gpu/drm/i915/i915_reg.h enum i915_power_well_id { · line 1994

Quoted 2 lines
drivers/gpu/drm/i915/i915_reg.h +2 -0
+/* ICL PHY DFLEX registers */
+#define ICL_PORT_TX_DFLEXDPMLE1		_MMIO(0x1638C0)

We can probably remove the ICL_ prefix since the register did not exist before.

And while at it s/ICL/icl/ in the commit message?

Lucas De Marchi

Quoted 7 lines

With or without that:

Note: the patch that uses the register was removed from the series due to some problems identified. Will be upstreamed as soon as it's fixed.

Quoted 10 lines
Quoted 6 lines
drivers/gpu/drm/i915/i915_reg.h +3 -0
+#define   DFLEXDPMLE1_DPMLETC_MASK(n)	(0xf << (4 * (n)))
+#define   DFLEXDPMLE1_DPMLETC(n, x)	((x) << (4 * (n)))
+
 /* BXT PHY Ref registers */

#define _PORT_REF_DW3_A 0x16218C
#define _PORT_REF_DW3_BC 0x6C18C

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#31 lore raw

Re: [PATCH 06/24] drm/i915/ICL: Add register definition for DFLEXDPMLE

Quoted 31 lines · Lucas De Marchi
Quoted 30 lines · Paulo Zanoni

Em Seg, 2018-05-21 às 17:25 -0700, Paulo Zanoni escreveu:

Quoted 29 lines

From: Manasi Navare <[email protected]>

DFLEXDPMLE register is required to tell the FIA hardware which main links of DP are enabled on TCC Connectors. FIA uses this information to program PHY to Controller signal mapping. This register is applicable in both TC connector's Alternate mode as well as DP connector mode.

Cc Jani Nikula <[email protected]>
Cc Animesh Manna <[email protected]>
Cc Madhav Chauhan <[email protected]>
Cc Anusha Srivatsa <[email protected]>
Cc Paulo Zanoni <[email protected]>
---
 drivers/gpu/drm/i915/i915_reg.h | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +0 -0
index 28ce96ce0484..7f27fe2e38c7 100644
@@ -1990,6 +1990,11 @@ enum i915_power_well_id {
 						   _ICL_PORT_COMP_DW
 10_A, \
 						   _ICL_PORT_COMP_DW
 10_B)
 
Quoted 6 lines
Quoted 5 lines

drivers/gpu/drm/i915/i915_reg.h enum i915_power_well_id { · line 1994

Quoted 2 lines
drivers/gpu/drm/i915/i915_reg.h +2 -0
+/* ICL PHY DFLEX registers */
+#define ICL_PORT_TX_DFLEXDPMLE1		_MMIO(0x1638C0)

We can probably remove the ICL_ prefix since the register did not exist before.

Yes I agree this ICL prefix should be removed like I did for all the MG PHY regs too.

Quoted 4 lines

And while at it s/ICL/icl/ in the commit message?

Lucas De Marchi

And yes will change this as well in the commit message. Thanks for the review.

Manasi

Quoted 17 lines
Quoted 7 lines

With or without that:

Note: the patch that uses the register was removed from the series due to some problems identified. Will be upstreamed as soon as it's fixed.

Quoted 10 lines
Quoted 6 lines
drivers/gpu/drm/i915/i915_reg.h +3 -0
+#define   DFLEXDPMLE1_DPMLETC_MASK(n)	(0xf << (4 * (n)))
+#define   DFLEXDPMLE1_DPMLETC(n, x)	((x) << (4 * (n)))
+
 /* BXT PHY Ref registers */

#define _PORT_REF_DW3_A 0x16218C
#define _PORT_REF_DW3_BC 0x6C18C

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#32 lore raw

PATCH v2 6/24 drm/i915/ICL: Add register definition for DFLEXDPMLE

In reply to Paulo Zanoni

DFLEXDPMLE register is required to tell the FIA hardware which main links of DP are enabled on TCC Connectors. FIA uses this information to program PHY to Controller signal mapping. This register is applicable in both TC connector's Alternate mode as well as DP connector mode.

v2:
* Remove _ICL prefix since the reg is first introduced in ICL (Paulo)
* s/ICL/icl in commit message (Lucas)

Cc Jani Nikula <[email protected]>
Cc Animesh Manna <[email protected]>
Cc Madhav Chauhan <[email protected]>
Cc Anusha Srivatsa <[email protected]>
Cc Paulo Zanoni <[email protected]>
---
 drivers/gpu/drm/i915/i915_reg.h | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +5 -0
index 6953419..01573e8 100644
@@ -1990,6 +1990,11 @@ enum i915_power_well_id {
 						   _ICL_PORT_COMP_DW10_A, \
 						   _ICL_PORT_COMP_DW10_B)
 
+/* ICL PHY DFLEX registers */
+#define PORT_TX_DFLEXDPMLE1		_MMIO(0x1638C0)
+#define   DFLEXDPMLE1_DPMLETC_MASK(n)	(0xf << (4 * (n)))
+#define   DFLEXDPMLE1_DPMLETC(n, x)	((x) << (4 * (n)))
+
 /* BXT PHY Ref registers */
 #define _PORT_REF_DW3_A			0x16218C
 #define _PORT_REF_DW3_BC		0x6C18C
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#33 lore raw

PATCH v3 6/24 drm/i915/icl: Add register definition for DFLEXDPMLE

In reply to Paulo Zanoni

DFLEXDPMLE register is required to tell the FIA hardware which main links of DP are enabled on TCC Connectors. FIA uses this information to program PHY to Controller signal mapping. This register is applicable in both TC connector's Alternate mode as well as DP connector mode.

v2:
* Remove _ICL prefix since the reg is first introduced in ICL (Paulo)
* s/ICL/icl in commit message (Lucas)

Cc Jani Nikula <[email protected]>
Cc Animesh Manna <[email protected]>
Cc Madhav Chauhan <[email protected]>
Cc Anusha Srivatsa <[email protected]>
Cc Paulo Zanoni <[email protected]>
---
 drivers/gpu/drm/i915/i915_reg.h | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +5 -0
index 6953419..01573e8 100644
@@ -1990,6 +1990,11 @@ enum i915_power_well_id {
 						   _ICL_PORT_COMP_DW10_A, \
 						   _ICL_PORT_COMP_DW10_B)
 
+/* ICL PHY DFLEX registers */
+#define PORT_TX_DFLEXDPMLE1		_MMIO(0x1638C0)
+#define   DFLEXDPMLE1_DPMLETC_MASK(n)	(0xf << (4 * (n)))
+#define   DFLEXDPMLE1_DPMLETC(n, x)	((x) << (4 * (n)))
+
 /* BXT PHY Ref registers */
 #define _PORT_REF_DW3_A			0x16218C
 #define _PORT_REF_DW3_BC		0x6C18C
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#34 lore raw

PATCH 7/24 drm/i915/icl: Add DDI HDMI level selection for ICL

In reply to Paulo Zanoni

From: Manasi Navare <[email protected]>

This patch adds a proper HDMI DDI entry level for vswing programming sequences on ICL.

Spec doesn't specify any default for HDMI tables, so let's pick the last entry as the default for now to stay consistent with older platform like CNL.

Cc Paulo Zanoni <[email protected]>
Cc Rakshmi Bhatia <[email protected]>
Cc Rodrigo Vivi <[email protected]>
---
 drivers/gpu/drm/i915/intel_ddi.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_ddi.c +8 -1
index 1665bc588241..d8ae82001f83 100644
@@ -915,7 +915,14 @@ static int intel_ddi_hdmi_level(struct drm_i915_private *dev_priv, enum port por
 
 	level = dev_priv->vbt.ddi_port_info[port].hdmi_level_shift;
 
-	if (IS_CANNONLAKE(dev_priv)) {
+	if (IS_ICELAKE(dev_priv)) {
+		if (port == PORT_A || port == PORT_B)
+			icl_get_combo_buf_trans(dev_priv, port,
+						INTEL_OUTPUT_HDMI, &n_entries);
+		else
+			n_entries = ARRAY_SIZE(icl_mg_phy_ddi_translations);
+		default_entry = n_entries - 1;
+	} else if (IS_CANNONLAKE(dev_priv)) {
 		cnl_get_buf_trans_hdmi(dev_priv, &n_entries);
 		default_entry = n_entries - 1;
 	} else if (IS_GEN9_LP(dev_priv)) {
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 7/24
#35 lore raw

Re: [PATCH 07/24] drm/i915/icl: Add DDI HDMI level selection for ICL

Quoted 22 lines · Paulo Zanoni

From: Manasi Navare <[email protected]>

This patch adds a proper HDMI DDI entry level for vswing programming sequences on ICL.

Spec doesn't specify any default for HDMI tables, so let's pick the last entry as the default for now to stay consistent with older platform like CNL.

Cc Paulo Zanoni <[email protected]>
Cc Rakshmi Bhatia <[email protected]>
Cc Rodrigo Vivi <[email protected]>
---
 drivers/gpu/drm/i915/intel_ddi.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_ddi.c +0 -0
index 1665bc588241..d8ae82001f83 100644

drivers/gpu/drm/i915/intel_ddi.c static int intel_ddi_hdmi_level(struct drm_i915_private *dev_priv, enum port por · line 919

Quoted 6 lines
drivers/gpu/drm/i915/intel_ddi.c +2 -1
@@ -915,7 +915,14 @@ static int intel_ddi_hdmi_level(struct drm_i915_private *dev_priv, enum port por
 
 	level = dev_priv->vbt.ddi_port_info[port].hdmi_level_shift;
 
-	if (IS_CANNONLAKE(dev_priv)) {
+	if (IS_ICELAKE(dev_priv)) {
+		if (port == PORT_A || port == PORT_B)

This should be using the helper you introduced in patch 3. Either a 'if (!intel_port_is_tc()' or add a 'if (intel_port_is_combo)'.

With that,

Lucas De Marchi

Quoted 16 lines
drivers/gpu/drm/i915/intel_ddi.c +6 -0
+			icl_get_combo_buf_trans(dev_priv, port,
+						INTEL_OUTPUT_HDMI, &n_entries);
+		else
+			n_entries = ARRAY_SIZE(icl_mg_phy_ddi_translations);
+		default_entry = n_entries - 1;
+	} else if (IS_CANNONLAKE(dev_priv)) {
 		cnl_get_buf_trans_hdmi(dev_priv, &n_entries);
 		default_entry = n_entries - 1;
 	} else if (IS_GEN9_LP(dev_priv)) {
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#36 lore raw

Re: [PATCH 07/24] drm/i915/icl: Add DDI HDMI level selection for ICL

Em Sex, 2018-05-25 às 09:26 -0700, Lucas De Marchi escreveu:

Quoted 36 lines · Paulo Zanoni
Quoted 28 lines

From: Manasi Navare <[email protected]>

This patch adds a proper HDMI DDI entry level for vswing programming sequences on ICL.

Spec doesn't specify any default for HDMI tables, so let's pick the last entry as the default for now to stay consistent with older platform like CNL.

Cc Paulo Zanoni <[email protected]>
Cc Rakshmi Bhatia <[email protected]>
Cc Rodrigo Vivi <[email protected]>
---
 drivers/gpu/drm/i915/intel_ddi.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_ddi.c +0 -0
index 1665bc588241..d8ae82001f83 100644
@@ -915,7 +915,14 @@ static int intel_ddi_hdmi_level(struct

drm_i915_private *dev_priv, enum port por

level = dev_priv-

Quoted 1 line

vbt.ddi_port_info[port].hdmi_level_shift;

drivers/gpu/drm/i915/intel_ddi.c static int intel_ddi_hdmi_level(struct drm_i915_private *dev_priv, enum port por · line 919

Quoted 3 lines
drivers/gpu/drm/i915/intel_ddi.c +2 -1
-	if (IS_CANNONLAKE(dev_priv)) {
+	if (IS_ICELAKE(dev_priv)) {
+		if (port == PORT_A || port == PORT_B)

This should be using the helper you introduced in patch 3. Either a 'if (!intel_port_is_tc()' or add a 'if (intel_port_is_combo)'.

Quoted 3 lines

With that,

I don't think the !intel_port_is_tc() is a good call, and we don't have the intel_port_is_combo() as part of the ICL series, although we could have done it. Perhaps when we actually submit the patch adding intel_port_is_combo() then we can fix this issue on that patch? It would also help justifying the patch's existence.

Quoted 17 lines

Lucas De Marchi

Quoted 14 lines
drivers/gpu/drm/i915/intel_ddi.c +2 -0
+			icl_get_combo_buf_trans(dev_priv, port,
+						INTEL_OUTPUT_HDMI,

&n_entries);

drivers/gpu/drm/i915/intel_ddi.c +2 -0
+		else
+			n_entries =

ARRAY_SIZE(icl_mg_phy_ddi_translations);

drivers/gpu/drm/i915/intel_ddi.c +2 -0
+		default_entry = n_entries - 1;
+	} else if (IS_CANNONLAKE(dev_priv)) {
 		cnl_get_buf_trans_hdmi(dev_priv, &n_entries);
 		default_entry = n_entries - 1;
 	} else if (IS_GEN9_LP(dev_priv)) {
Signature · 1 line
2.14.3
Quoted 4 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#37 lore raw

Re: [PATCH 07/24] drm/i915/icl: Add DDI HDMI level selection for ICL

Quoted 38 lines · Paulo Zanoni

Em Sex, 2018-05-25 às 09:26 -0700, Lucas De Marchi escreveu:

Quoted 36 lines · Paulo Zanoni
Quoted 28 lines

From: Manasi Navare <[email protected]>

This patch adds a proper HDMI DDI entry level for vswing programming sequences on ICL.

Spec doesn't specify any default for HDMI tables, so let's pick the last entry as the default for now to stay consistent with older platform like CNL.

Cc Paulo Zanoni <[email protected]>
Cc Rakshmi Bhatia <[email protected]>
Cc Rodrigo Vivi <[email protected]>
---
 drivers/gpu/drm/i915/intel_ddi.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_ddi.c +0 -0
index 1665bc588241..d8ae82001f83 100644
@@ -915,7 +915,14 @@ static int intel_ddi_hdmi_level(struct

drm_i915_private *dev_priv, enum port por

level = dev_priv-

Quoted 1 line

vbt.ddi_port_info[port].hdmi_level_shift;

drivers/gpu/drm/i915/intel_ddi.c static int intel_ddi_hdmi_level(struct drm_i915_private *dev_priv, enum port por · line 919

Quoted 3 lines
drivers/gpu/drm/i915/intel_ddi.c +2 -1
-   if (IS_CANNONLAKE(dev_priv)) {
+   if (IS_ICELAKE(dev_priv)) {
+           if (port == PORT_A || port == PORT_B)

This should be using the helper you introduced in patch 3. Either a 'if (!intel_port_is_tc()' or add a 'if (intel_port_is_combo)'.

Quoted 8 lines
Quoted 3 lines

With that,

I don't think the !intel_port_is_tc() is a good call, and we don't have the intel_port_is_combo() as part of the ICL series, although we could have done it. Perhaps when we actually submit the patch adding intel_port_is_combo() then we can fix this issue on that patch? It

ok, I stand my r-b without it.

Lucas De Marchi

Quoted 23 lines

would also help justifying the patch's existence.

Quoted 21 lines

Lucas De Marchi

Quoted 18 lines
drivers/gpu/drm/i915/intel_ddi.c +2 -0
+                   icl_get_combo_buf_trans(dev_priv, port,
+                                           INTEL_OUTPUT_HDMI,

&n_entries);

drivers/gpu/drm/i915/intel_ddi.c +2 -0
+           else
+                   n_entries =

ARRAY_SIZE(icl_mg_phy_ddi_translations);

drivers/gpu/drm/i915/intel_ddi.c +2 -1
+           default_entry = n_entries - 1;
+   } else if (IS_CANNONLAKE(dev_priv)) {
            cnl_get_buf_trans_hdmi(dev_priv, &n_entries);
            default_entry = n_entries - 1;
    } else if (IS_GEN9_LP(dev_priv)) {
--

2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 5 lines
Lucas De Marchi
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#38 lore raw

PATCH 8/24 drm/i915/icl: Map VBT DDC Pin to BSpec DDC Pin

In reply to Paulo Zanoni

From: "Sripada, Radhakrishna" <[email protected]>

On ICL we need to map VBT DDC Pin to BSpec DDC Pin. Adding ICL Pin Values.

According to VBT
Block 2 (General Bytes Definition)
DDC Bus

+----------+-----------+--------------------+
| DDI Type | VBT Value | BSpec Mapped Value |
+----------+-----------+--------------------+
| DDI-A    | 0x1       | 0x1                |
| DDI-B    | 0x2       | 0x2                |
| PORT-1   | 0x4       | 0x9                |
| PORT-2   | 0x5       | 0xA                |
| PORT-3   | 0x6       | 0xB                |
| PORT-4   | 0x7       | 0xC                |
+----------+-----------+--------------------+
Cc James Ausmus <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Anusha Srivatsa <[email protected]>
Cc Clinton Taylor <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Rodrigo Vivi <[email protected]>
Cc Paulo Zanoni <[email protected]>
[Paulo: checkpatch fixes.]
---
 drivers/gpu/drm/i915/intel_bios.c     | 35 +++++++++++++++++++++++++++--------
 drivers/gpu/drm/i915/intel_vbt_defs.h |  6 ++++++
 2 files changed, 33 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_bios.c +27 -8
index 54270bdde100..34e9bca36c14 100644
@@ -1197,18 +1197,37 @@ static const u8 cnp_ddc_pin_map[] = {
 	[DDC_BUS_DDI_F] = GMBUS_PIN_3_BXT, /* sic */
 };
 
+static const u8 icp_ddc_pin_map[] = {
+	[ICL_DDC_BUS_DDI_A] = GMBUS_PIN_1_BXT,
+	[ICL_DDC_BUS_DDI_B] = GMBUS_PIN_2_BXT,
+	[ICL_DDC_BUS_PORT_1] = GMBUS_PIN_9_TC1_ICP,
+	[ICL_DDC_BUS_PORT_2] = GMBUS_PIN_10_TC2_ICP,
+	[ICL_DDC_BUS_PORT_3] = GMBUS_PIN_11_TC3_ICP,
+	[ICL_DDC_BUS_PORT_4] = GMBUS_PIN_12_TC4_ICP,
+};
+
 static u8 map_ddc_pin(struct drm_i915_private *dev_priv, u8 vbt_pin)
 {
-	if (HAS_PCH_CNP(dev_priv)) {
-		if (vbt_pin < ARRAY_SIZE(cnp_ddc_pin_map)) {
-			return cnp_ddc_pin_map[vbt_pin];
-		} else {
-			DRM_DEBUG_KMS("Ignoring alternate pin: VBT claims DDC pin %d, which is not valid for this platform\n", vbt_pin);
-			return 0;
-		}
+	const u8 *ddc_pin_map;
+	int n_entries;
+
+	if (HAS_PCH_ICP(dev_priv)) {
+		ddc_pin_map = icp_ddc_pin_map;
+		n_entries = ARRAY_SIZE(icp_ddc_pin_map);
+	} else if (HAS_PCH_CNP(dev_priv)) {
+		ddc_pin_map = cnp_ddc_pin_map;
+		n_entries = ARRAY_SIZE(cnp_ddc_pin_map);
+	} else {
+		/* Assuming direct map */
+		return vbt_pin;
 	}
 
-	return vbt_pin;
+	if (vbt_pin < n_entries && ddc_pin_map[vbt_pin] != 0)
+		return ddc_pin_map[vbt_pin];
+
+	DRM_DEBUG_KMS("Ignoring alternate pin: VBT claims DDC pin %d, which is not valid for this platform\n",
+		      vbt_pin);
+	return 0;
 }
 
 static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
drivers/gpu/drm/i915/intel_vbt_defs.h +6 -0
index 458468237b5f..7c798c18600e 100644
@@ -318,6 +318,12 @@ enum vbt_gmbus_ddi {
 	DDC_BUS_DDI_C,
 	DDC_BUS_DDI_D,
 	DDC_BUS_DDI_F,
+	ICL_DDC_BUS_DDI_A = 0x1,
+	ICL_DDC_BUS_DDI_B,
+	ICL_DDC_BUS_PORT_1 = 0x4,
+	ICL_DDC_BUS_PORT_2,
+	ICL_DDC_BUS_PORT_3,
+	ICL_DDC_BUS_PORT_4,
 };
 
 #define VBT_DP_MAX_LINK_RATE_HBR3	0
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 8/24
#39 lore raw

Re: [PATCH 08/24] drm/i915/icl: Map VBT DDC Pin to BSpec DDC Pin

Quoted 20 lines · Paulo Zanoni

From: "Sripada, Radhakrishna" <[email protected]>

On ICL we need to map VBT DDC Pin to BSpec DDC Pin. Adding ICL Pin Values.

According to VBT
Block 2 (General Bytes Definition)
DDC Bus

+----------+-----------+--------------------+
| DDI Type | VBT Value | BSpec Mapped Value |
+----------+-----------+--------------------+
| DDI-A    | 0x1       | 0x1                |
| DDI-B    | 0x2       | 0x2                |
| PORT-1   | 0x4       | 0x9                |
| PORT-2   | 0x5       | 0xA                |
| PORT-3   | 0x6       | 0xB                |
| PORT-4   | 0x7       | 0xC                |
+----------+-----------+--------------------+
Quoted 11 lines
Cc James Ausmus <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Anusha Srivatsa <[email protected]>
Cc Clinton Taylor <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Rodrigo Vivi <[email protected]>
Cc Paulo Zanoni <[email protected]>
[Paulo: checkpatch fixes.]

Matches BSpec, looks good!

Quoted 75 lines
---
 drivers/gpu/drm/i915/intel_bios.c     | 35 +++++++++++++++++++++++++++--------
 drivers/gpu/drm/i915/intel_vbt_defs.h |  6 ++++++
 2 files changed, 33 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_bios.c +27 -8
index 54270bdde100..34e9bca36c14 100644
@@ -1197,18 +1197,37 @@ static const u8 cnp_ddc_pin_map[] = {
 	[DDC_BUS_DDI_F] = GMBUS_PIN_3_BXT, /* sic */
 };
 
+static const u8 icp_ddc_pin_map[] = {
+	[ICL_DDC_BUS_DDI_A] = GMBUS_PIN_1_BXT,
+	[ICL_DDC_BUS_DDI_B] = GMBUS_PIN_2_BXT,
+	[ICL_DDC_BUS_PORT_1] = GMBUS_PIN_9_TC1_ICP,
+	[ICL_DDC_BUS_PORT_2] = GMBUS_PIN_10_TC2_ICP,
+	[ICL_DDC_BUS_PORT_3] = GMBUS_PIN_11_TC3_ICP,
+	[ICL_DDC_BUS_PORT_4] = GMBUS_PIN_12_TC4_ICP,
+};
+
 static u8 map_ddc_pin(struct drm_i915_private *dev_priv, u8 vbt_pin)
 {
-	if (HAS_PCH_CNP(dev_priv)) {
-		if (vbt_pin < ARRAY_SIZE(cnp_ddc_pin_map)) {
-			return cnp_ddc_pin_map[vbt_pin];
-		} else {
-			DRM_DEBUG_KMS("Ignoring alternate pin: VBT claims DDC pin %d, which is not valid for this platform\n", vbt_pin);
-			return 0;
-		}
+	const u8 *ddc_pin_map;
+	int n_entries;
+
+	if (HAS_PCH_ICP(dev_priv)) {
+		ddc_pin_map = icp_ddc_pin_map;
+		n_entries = ARRAY_SIZE(icp_ddc_pin_map);
+	} else if (HAS_PCH_CNP(dev_priv)) {
+		ddc_pin_map = cnp_ddc_pin_map;
+		n_entries = ARRAY_SIZE(cnp_ddc_pin_map);
+	} else {
+		/* Assuming direct map */
+		return vbt_pin;
 	}
 
-	return vbt_pin;
+	if (vbt_pin < n_entries && ddc_pin_map[vbt_pin] != 0)
+		return ddc_pin_map[vbt_pin];
+
+	DRM_DEBUG_KMS("Ignoring alternate pin: VBT claims DDC pin %d, which is not valid for this platform\n",
+		      vbt_pin);
+	return 0;
 }
 
 static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
drivers/gpu/drm/i915/intel_vbt_defs.h +6 -0
index 458468237b5f..7c798c18600e 100644
@@ -318,6 +318,12 @@ enum vbt_gmbus_ddi {
 	DDC_BUS_DDI_C,
 	DDC_BUS_DDI_D,
 	DDC_BUS_DDI_F,
+	ICL_DDC_BUS_DDI_A = 0x1,
+	ICL_DDC_BUS_DDI_B,
+	ICL_DDC_BUS_PORT_1 = 0x4,
+	ICL_DDC_BUS_PORT_2,
+	ICL_DDC_BUS_PORT_3,
+	ICL_DDC_BUS_PORT_4,
 };
 
 #define VBT_DP_MAX_LINK_RATE_HBR3	0
Signature · 1 line
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#40 lore raw

PATCH 9/24 drm/i915/icl: Add Icelake PCH detection

In reply to Paulo Zanoni

From: Anusha Srivatsa <[email protected]>

This patch adds the support to detect PCH_ICP.

---
 drivers/gpu/drm/i915/i915_drv.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +2 -0
index 9c449b8d8eab..7b6f64321f11 100644
@@ -233,6 +233,8 @@ intel_virt_detect_pch(const struct drm_i915_private *dev_priv)
 		id = INTEL_PCH_SPT_DEVICE_ID_TYPE;
 	else if (IS_COFFEELAKE(dev_priv) || IS_CANNONLAKE(dev_priv))
 		id = INTEL_PCH_CNP_DEVICE_ID_TYPE;
+	else if (IS_ICELAKE(dev_priv))
+		id = INTEL_PCH_ICP_DEVICE_ID_TYPE;
 
 	if (id)
 		DRM_DEBUG_KMS("Assuming PCH ID %04x\n", id);
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author Reviewed-by on v1 9/24
#41 lore raw

Re: [PATCH 09/24] drm/i915/icl: Add Icelake PCH detection

Em Seg, 2018-05-21 às 17:25 -0700, Paulo Zanoni escreveu:

Quoted 5 lines

From: Anusha Srivatsa <[email protected]>

This patch adds the support to detect PCH_ICP.

Quoted 20 lines
---
 drivers/gpu/drm/i915/i915_drv.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +2 -0
index 9c449b8d8eab..7b6f64321f11 100644
@@ -233,6 +233,8 @@ intel_virt_detect_pch(const struct
 drm_i915_private *dev_priv)
 		id = INTEL_PCH_SPT_DEVICE_ID_TYPE;
 	else if (IS_COFFEELAKE(dev_priv) || IS_CANNONLAKE(dev_priv))
 		id = INTEL_PCH_CNP_DEVICE_ID_TYPE;
+	else if (IS_ICELAKE(dev_priv))
+		id = INTEL_PCH_ICP_DEVICE_ID_TYPE;
 
 	if (id)
Quoted 1 line

DRM_DEBUG_KMS("Assuming PCH ID %04x\n", id);

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#42 lore raw

PATCH 10/24 drm/i915/icl: add icelake_get_ddi_pll()

In reply to Paulo Zanoni

Implement the hardware state readout code.

Thanks to Animesh Manna for spotting this problem.

Cc: Animesh Manna <[email protected]>
Credits-to: Animesh Manna <[email protected]>

---
 drivers/gpu/drm/i915/intel_display.c | 42 +++++++++++++++++++++++++++++++++++-
 1 file changed, 41 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +41 -1
index 64593b0fbebd..d5a19c1b3b20 100644
@@ -9146,6 +9146,44 @@ static void cannonlake_get_ddi_pll(struct drm_i915_private *dev_priv,
 	pipe_config->shared_dpll = intel_get_shared_dpll_by_id(dev_priv, id);
 }
 
+static void icelake_get_ddi_pll(struct drm_i915_private *dev_priv,
+				enum port port,
+				struct intel_crtc_state *pipe_config)
+{
+	enum intel_dpll_id id;
+	u32 temp;
+
+	/* TODO: TBT pll not implemented. */
+	switch (port) {
+	case PORT_A:
+	case PORT_B:
+		temp = I915_READ(DPCLKA_CFGCR0_ICL) &
+		       DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(port);
+		id = temp >> DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(port);
+
+		if (WARN_ON(id != DPLL_ID_ICL_DPLL0 && id != DPLL_ID_ICL_DPLL1))
+			return;
+		break;
+	case PORT_C:
+		id = DPLL_ID_ICL_MGPLL1;
+		break;
+	case PORT_D:
+		id = DPLL_ID_ICL_MGPLL2;
+		break;
+	case PORT_E:
+		id = DPLL_ID_ICL_MGPLL3;
+		break;
+	case PORT_F:
+		id = DPLL_ID_ICL_MGPLL4;
+		break;
+	default:
+		MISSING_CASE(port);
+		return;
+	}
+
+	pipe_config->shared_dpll = intel_get_shared_dpll_by_id(dev_priv, id);
+}
+
 static void bxt_get_ddi_pll(struct drm_i915_private *dev_priv,
 				enum port port,
 				struct intel_crtc_state *pipe_config)
@@ -9333,7 +9371,9 @@ static void haswell_get_ddi_port_state(struct intel_crtc *crtc,
 
 	port = (tmp & TRANS_DDI_PORT_MASK) >> TRANS_DDI_PORT_SHIFT;
 
-	if (IS_CANNONLAKE(dev_priv))
+	if (IS_ICELAKE(dev_priv))
+		icelake_get_ddi_pll(dev_priv, port, pipe_config);
+	else if (IS_CANNONLAKE(dev_priv))
 		cannonlake_get_ddi_pll(dev_priv, port, pipe_config);
 	else if (IS_GEN9_BC(dev_priv))
 		skylake_get_ddi_pll(dev_priv, port, pipe_config);
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 10/24
#43 lore raw

Re: [PATCH 10/24] drm/i915/icl: add icelake_get_ddi_pll()

Quoted 23 lines · Paulo Zanoni

Implement the hardware state readout code.

Thanks to Animesh Manna for spotting this problem.

Cc: Animesh Manna <[email protected]>
Credits-to: Animesh Manna <[email protected]>

---
 drivers/gpu/drm/i915/intel_display.c | 42 +++++++++++++++++++++++++++++++++++-
 1 file changed, 41 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +4 -0
index 64593b0fbebd..d5a19c1b3b20 100644
@@ -9146,6 +9146,44 @@ static void cannonlake_get_ddi_pll(struct drm_i915_private *dev_priv,
 	pipe_config->shared_dpll = intel_get_shared_dpll_by_id(dev_priv, id);
 }
 
+static void icelake_get_ddi_pll(struct drm_i915_private *dev_priv,
+				enum port port,
+				struct intel_crtc_state *pipe_config)
+{

drivers/gpu/drm/i915/intel_display.c static void cannonlake_get_ddi_pll(struct drm_i915_private *dev_priv, · line 9162

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10 -0
+	enum intel_dpll_id id;
+	u32 temp;
+
+	/* TODO: TBT pll not implemented. */
+	switch (port) {
+	case PORT_A:
+	case PORT_B:
+		temp = I915_READ(DPCLKA_CFGCR0_ICL) &
+		       DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(port);
+		id = temp >> DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(port);

This could be simpler:

	temp = I915_READ(DPCLKA_CFGCR0_ICL) >> DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(port);
	id = temp & DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(0);

But this ship has sailed, aka MASK above requires the port and hardcoding 0 doesn't make it better IMO.

Lucas De Marchi

Quoted 45 lines
drivers/gpu/drm/i915/intel_display.c +27 -1
+
+		if (WARN_ON(id != DPLL_ID_ICL_DPLL0 && id != DPLL_ID_ICL_DPLL1))
+			return;
+		break;
+	case PORT_C:
+		id = DPLL_ID_ICL_MGPLL1;
+		break;
+	case PORT_D:
+		id = DPLL_ID_ICL_MGPLL2;
+		break;
+	case PORT_E:
+		id = DPLL_ID_ICL_MGPLL3;
+		break;
+	case PORT_F:
+		id = DPLL_ID_ICL_MGPLL4;
+		break;
+	default:
+		MISSING_CASE(port);
+		return;
+	}
+
+	pipe_config->shared_dpll = intel_get_shared_dpll_by_id(dev_priv, id);
+}
+
 static void bxt_get_ddi_pll(struct drm_i915_private *dev_priv,
 				enum port port,
 				struct intel_crtc_state *pipe_config)
@@ -9333,7 +9371,9 @@ static void haswell_get_ddi_port_state(struct intel_crtc *crtc,
 
 	port = (tmp & TRANS_DDI_PORT_MASK) >> TRANS_DDI_PORT_SHIFT;
 
-	if (IS_CANNONLAKE(dev_priv))
+	if (IS_ICELAKE(dev_priv))
+		icelake_get_ddi_pll(dev_priv, port, pipe_config);
+	else if (IS_CANNONLAKE(dev_priv))
 		cannonlake_get_ddi_pll(dev_priv, port, pipe_config);
 	else if (IS_GEN9_BC(dev_priv))
 		skylake_get_ddi_pll(dev_priv, port, pipe_config);
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#44 lore raw

Re: [PATCH 10/24] drm/i915/icl: add icelake_get_ddi_pll()

Em Qua, 2018-06-13 às 16:15 -0700, Lucas De Marchi escreveu:

Quoted 43 lines · Paulo Zanoni
Quoted 38 lines

Implement the hardware state readout code.

Thanks to Animesh Manna for spotting this problem.

Cc: Animesh Manna <[email protected]>
Credits-to: Animesh Manna <[email protected]>

---
 drivers/gpu/drm/i915/intel_display.c | 42
+++++++++++++++++++++++++++++++++++-
 1 file changed, 41 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +14 -0
index 64593b0fbebd..d5a19c1b3b20 100644
@@ -9146,6 +9146,44 @@ static void cannonlake_get_ddi_pll(struct
 drm_i915_private *dev_priv,
 	pipe_config->shared_dpll =
 intel_get_shared_dpll_by_id(dev_priv, id);
 }
 
+static void icelake_get_ddi_pll(struct drm_i915_private *dev_priv,
+				enum port port,
+				struct intel_crtc_state
 *pipe_config)
+{
+	enum intel_dpll_id id;
+	u32 temp;
+
+	/* TODO: TBT pll not implemented. */
+	switch (port) {
+	case PORT_A:
+	case PORT_B:
+		temp = I915_READ(DPCLKA_CFGCR0_ICL) &
+		       DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(port);
+		id = temp >>
Quoted 1 line

DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(port);

This could be simpler:

Quoted 3 lines
	temp = I915_READ(DPCLKA_CFGCR0_ICL) >>
DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(port);
	id = temp & DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(0);

I fail to understand why this is simpler... The same operations, just on a different order.

Quoted 7 lines

But this ship has sailed, aka MASK above requires the port and hardcoding 0 doesn't make it better IMO.

Thanks!

Quoted 50 lines

Lucas De Marchi

Quoted 47 lines
drivers/gpu/drm/i915/intel_display.c +2 -0
+
+		if (WARN_ON(id != DPLL_ID_ICL_DPLL0 && id !=

DPLL_ID_ICL_DPLL1))

drivers/gpu/drm/i915/intel_display.c +20 -0
+			return;
+		break;
+	case PORT_C:
+		id = DPLL_ID_ICL_MGPLL1;
+		break;
+	case PORT_D:
+		id = DPLL_ID_ICL_MGPLL2;
+		break;
+	case PORT_E:
+		id = DPLL_ID_ICL_MGPLL3;
+		break;
+	case PORT_F:
+		id = DPLL_ID_ICL_MGPLL4;
+		break;
+	default:
+		MISSING_CASE(port);
+		return;
+	}
+
+	pipe_config->shared_dpll =

intel_get_shared_dpll_by_id(dev_priv, id);

drivers/gpu/drm/i915/intel_display.c +2 -0
+}
+
 static void bxt_get_ddi_pll(struct drm_i915_private *dev_priv,
 				enum port port,
 				struct intel_crtc_state

*pipe_config)

drivers/gpu/drm/i915/intel_display.c +3 -1
@@ -9333,7 +9371,9 @@ static void haswell_get_ddi_port_state(struct
 intel_crtc *crtc,
 
 	port = (tmp & TRANS_DDI_PORT_MASK) >>
 TRANS_DDI_PORT_SHIFT;
 
-	if (IS_CANNONLAKE(dev_priv))
+	if (IS_ICELAKE(dev_priv))
+		icelake_get_ddi_pll(dev_priv, port, pipe_config);
+	else if (IS_CANNONLAKE(dev_priv))
 		cannonlake_get_ddi_pll(dev_priv, port,

pipe_config);

drivers/gpu/drm/i915/intel_display.c +0 -0
 	else if (IS_GEN9_BC(dev_priv))
 		skylake_get_ddi_pll(dev_priv, port, pipe_config);
Signature · 1 line
2.14.3
Quoted 4 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#45 lore raw

Re: [PATCH 10/24] drm/i915/icl: add icelake_get_ddi_pll()

Quoted 44 lines · Paulo Zanoni

Em Qua, 2018-06-13 às 16:15 -0700, Lucas De Marchi escreveu:

Quoted 43 lines · Paulo Zanoni
Quoted 38 lines

Implement the hardware state readout code.

Thanks to Animesh Manna for spotting this problem.

Cc: Animesh Manna <[email protected]>
Credits-to: Animesh Manna <[email protected]>

---
 drivers/gpu/drm/i915/intel_display.c | 42
+++++++++++++++++++++++++++++++++++-
 1 file changed, 41 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +14 -0
index 64593b0fbebd..d5a19c1b3b20 100644
@@ -9146,6 +9146,44 @@ static void cannonlake_get_ddi_pll(struct
 drm_i915_private *dev_priv,
 	pipe_config->shared_dpll =
 intel_get_shared_dpll_by_id(dev_priv, id);
 }
 
+static void icelake_get_ddi_pll(struct drm_i915_private *dev_priv,
+				enum port port,
+				struct intel_crtc_state
 *pipe_config)
+{
+	enum intel_dpll_id id;
+	u32 temp;
+
+	/* TODO: TBT pll not implemented. */
+	switch (port) {
+	case PORT_A:
+	case PORT_B:
+		temp = I915_READ(DPCLKA_CFGCR0_ICL) &
+		       DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(port);
+		id = temp >>
Quoted 1 line

DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(port);

This could be simpler:

Quoted 6 lines
Quoted 3 lines
	temp = I915_READ(DPCLKA_CFGCR0_ICL) >>
DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(port);
	id = temp & DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(0);

I fail to understand why this is simpler... The same operations, just on a different order.

If you open up the macros you will see there are more operations on what we are doing right now... and we wouldn't need to depend on the port for this if we had done this way. However we already depend on having the port as an argument in other places, so there's nothing to do differently on this particular patch.

Lucas De Marchi

Quoted 62 lines
Quoted 9 lines

But this ship has sailed, aka MASK above requires the port and hardcoding 0 doesn't make it better IMO.

Thanks!

Quoted 50 lines

Lucas De Marchi

Quoted 47 lines
drivers/gpu/drm/i915/intel_display.c +2 -0
+
+		if (WARN_ON(id != DPLL_ID_ICL_DPLL0 && id !=

DPLL_ID_ICL_DPLL1))

drivers/gpu/drm/i915/intel_display.c +20 -0
+			return;
+		break;
+	case PORT_C:
+		id = DPLL_ID_ICL_MGPLL1;
+		break;
+	case PORT_D:
+		id = DPLL_ID_ICL_MGPLL2;
+		break;
+	case PORT_E:
+		id = DPLL_ID_ICL_MGPLL3;
+		break;
+	case PORT_F:
+		id = DPLL_ID_ICL_MGPLL4;
+		break;
+	default:
+		MISSING_CASE(port);
+		return;
+	}
+
+	pipe_config->shared_dpll =

intel_get_shared_dpll_by_id(dev_priv, id);

drivers/gpu/drm/i915/intel_display.c +2 -0
+}
+
 static void bxt_get_ddi_pll(struct drm_i915_private *dev_priv,
 				enum port port,
 				struct intel_crtc_state

*pipe_config)

drivers/gpu/drm/i915/intel_display.c +3 -1
@@ -9333,7 +9371,9 @@ static void haswell_get_ddi_port_state(struct
 intel_crtc *crtc,
 
 	port = (tmp & TRANS_DDI_PORT_MASK) >>
 TRANS_DDI_PORT_SHIFT;
 
-	if (IS_CANNONLAKE(dev_priv))
+	if (IS_ICELAKE(dev_priv))
+		icelake_get_ddi_pll(dev_priv, port, pipe_config);
+	else if (IS_CANNONLAKE(dev_priv))
 		cannonlake_get_ddi_pll(dev_priv, port,

pipe_config);

drivers/gpu/drm/i915/intel_display.c +0 -0
 	else if (IS_GEN9_BC(dev_priv))
 		skylake_get_ddi_pll(dev_priv, port, pipe_config);
Signature · 1 line
2.14.3
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#46 lore raw

PATCH 11/24 drm/i915/icl: Get DDI clock for ICL based on PLLs.

In reply to Paulo Zanoni

From: Manasi Navare <[email protected]>

PLLs are the source clocks for the DDIs so in order to determine the ddi clock we need to check the PLL configuration.

This gets a little tricky for ICL since there is
no register bit that maps directly to the link clock. So this patch creates a separate function in intel_dpll_mgr.c to obtain the write array PLL Params and compares the set pll_params with the table to get the corresponding link clock.

---
 drivers/gpu/drm/i915/i915_reg.h       |  3 ++
 drivers/gpu/drm/i915/intel_ddi.c      | 26 ++++++++++++++
 drivers/gpu/drm/i915/intel_dpll_mgr.c | 66 +++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_dpll_mgr.h |  2 ++
 4 files changed, 97 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +3 -0
index 7f27fe2e38c7..26903cffabf6 100644
@@ -9182,13 +9182,16 @@ enum skl_power_gate {
 #define  DPLL_CFGCR1_QDIV_RATIO_MASK	(0xff << 10)
 #define  DPLL_CFGCR1_QDIV_RATIO_SHIFT	(10)
 #define  DPLL_CFGCR1_QDIV_RATIO(x)	((x) << 10)
+#define  DPLL_CFGCR1_QDIV_MODE_SHIFT	(9)
 #define  DPLL_CFGCR1_QDIV_MODE(x)	((x) << 9)
 #define  DPLL_CFGCR1_KDIV_MASK		(7 << 6)
+#define  DPLL_CFGCR1_KDIV_SHIFT		(6)
 #define  DPLL_CFGCR1_KDIV(x)		((x) << 6)
 #define  DPLL_CFGCR1_KDIV_1		(1 << 6)
 #define  DPLL_CFGCR1_KDIV_2		(2 << 6)
 #define  DPLL_CFGCR1_KDIV_4		(4 << 6)
 #define  DPLL_CFGCR1_PDIV_MASK		(0xf << 2)
+#define  DPLL_CFGCR1_PDIV_SHIFT		(2)
 #define  DPLL_CFGCR1_PDIV(x)		((x) << 2)
 #define  DPLL_CFGCR1_PDIV_2		(1 << 2)
 #define  DPLL_CFGCR1_PDIV_3		(2 << 2)
drivers/gpu/drm/i915/intel_ddi.c +26 -0
index d8ae82001f83..0d8bed8e2200 100644
@@ -1458,6 +1458,30 @@ static void ddi_dotclock_get(struct intel_crtc_state *pipe_config)
 	pipe_config->base.adjusted_mode.crtc_clock = dotclock;
 }
 
+static void icl_ddi_clock_get(struct intel_encoder *encoder,
+			      struct intel_crtc_state *pipe_config)
+{
+	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	enum port port = encoder->port;
+	int link_clock = 0;
+	uint32_t pll_id;
+
+	pll_id = intel_get_shared_dpll_id(dev_priv, pipe_config->shared_dpll);
+	if (port == PORT_A || port == PORT_B) {
+		if (encoder->type == INTEL_OUTPUT_HDMI)
+			link_clock = cnl_calc_wrpll_link(dev_priv, pll_id);
+		else
+			link_clock = icl_calc_dp_combo_pll_link(dev_priv,
+								pll_id);
+	} else {
+		/* FIXME - Add for MG PLL */
+		WARN(1, "MG PLL clock_get code not implemented yet\n");
+	}
+
+	pipe_config->port_clock = link_clock;
+	ddi_dotclock_get(pipe_config);
+}
+
 static void cnl_ddi_clock_get(struct intel_encoder *encoder,
 			      struct intel_crtc_state *pipe_config)
 {
@@ -1651,6 +1675,8 @@ static void intel_ddi_clock_get(struct intel_encoder *encoder,
 		bxt_ddi_clock_get(encoder, pipe_config);
 	else if (IS_CANNONLAKE(dev_priv))
 		cnl_ddi_clock_get(encoder, pipe_config);
+	else if (IS_ICELAKE(dev_priv))
+		icl_ddi_clock_get(encoder, pipe_config);
 }
 
 void intel_ddi_set_pipe_settings(const struct intel_crtc_state *crtc_state)
drivers/gpu/drm/i915/intel_dpll_mgr.c +66 -0

72 lines not on this page · raw message

drivers/gpu/drm/i915/intel_dpll_mgr.h +2 -0
index 7a0cd564a9ee..78915057d2e6 100644
@@ -336,5 +336,7 @@ void intel_shared_dpll_init(struct drm_device *dev);
 
 void intel_dpll_dump_hw_state(struct drm_i915_private *dev_priv,
 			      struct intel_dpll_hw_state *hw_state);
+int icl_calc_dp_combo_pll_link(struct drm_i915_private *dev_priv,
+			       uint32_t pll_id);
 
 #endif /* _INTEL_DPLL_MGR_H_ */
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#47 lore raw

Re: [PATCH 11/24] drm/i915/icl: Get DDI clock for ICL based on PLLs.

Quoted 167 lines · Paulo Zanoni

From: Manasi Navare <[email protected]>

PLLs are the source clocks for the DDIs so in order to determine the ddi clock we need to check the PLL configuration.

This gets a little tricky for ICL since there is
no register bit that maps directly to the link clock. So this patch creates a separate function in intel_dpll_mgr.c to obtain the write array PLL Params and compares the set pll_params with the table to get the corresponding link clock.

---
 drivers/gpu/drm/i915/i915_reg.h       |  3 ++ drivers/gpu/drm/i915/intel_ddi.c      | 26 ++++++++++++++ drivers/gpu/drm/i915/intel_dpll_mgr.c | 66
+++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_dpll_mgr.h |  2 ++

 4 files changed, 97 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +3 -0
index 7f27fe2e38c7..26903cffabf6 100644
@@ -9182,13 +9182,16 @@ enum skl_power_gate {
  #define  DPLL_CFGCR1_QDIV_RATIO_MASK	(0xff << 10)
  #define  DPLL_CFGCR1_QDIV_RATIO_SHIFT	(10)
  #define  DPLL_CFGCR1_QDIV_RATIO(x)	((x) << 10)
+#define  DPLL_CFGCR1_QDIV_MODE_SHIFT	(9)
  #define  DPLL_CFGCR1_QDIV_MODE(x)	((x) << 9)
  #define  DPLL_CFGCR1_KDIV_MASK		(7 << 6)
+#define  DPLL_CFGCR1_KDIV_SHIFT		(6)
  #define  DPLL_CFGCR1_KDIV(x)		((x) << 6)
  #define  DPLL_CFGCR1_KDIV_1		(1 << 6)
  #define  DPLL_CFGCR1_KDIV_2		(2 << 6)
  #define  DPLL_CFGCR1_KDIV_4		(4 << 6)
  #define  DPLL_CFGCR1_PDIV_MASK		(0xf << 2)
+#define  DPLL_CFGCR1_PDIV_SHIFT		(2)
  #define  DPLL_CFGCR1_PDIV(x)		((x) << 2)
  #define  DPLL_CFGCR1_PDIV_2		(1 << 2)
  #define  DPLL_CFGCR1_PDIV_3		(2 << 2)
drivers/gpu/drm/i915/intel_ddi.c +0 -0
index d8ae82001f83..0d8bed8e2200 100644
@@ -1458,6 +1458,30 @@ static void ddi_dotclock_get(struct
 intel_crtc_state *pipe_config)
  	pipe_config->base.adjusted_mode.crtc_clock = dotclock;
  }

drivers/gpu/drm/i915/intel_ddi.c +4 -0
+static void icl_ddi_clock_get(struct intel_encoder *encoder,
+			      struct intel_crtc_state *pipe_config)
+{
+	struct drm_i915_private *dev_priv = to_i915(encoder-
Quoted 1 line

base.dev);

drivers/gpu/drm/i915/intel_ddi.c +5 -0
+	enum port port = encoder->port;
+	int link_clock = 0;
+	uint32_t pll_id;
+
+	pll_id = intel_get_shared_dpll_id(dev_priv, pipe_config-
Quoted 1 line

shared_dpll);

drivers/gpu/drm/i915/intel_ddi.c +3 -0
+	if (port == PORT_A || port == PORT_B) {
+		if (encoder->type == INTEL_OUTPUT_HDMI)
+			link_clock = cnl_calc_wrpll_link(dev_priv,

pll_id);

drivers/gpu/drm/i915/intel_ddi.c +2 -0
+		else
+			link_clock =

icl_calc_dp_combo_pll_link(dev_priv,

drivers/gpu/drm/i915/intel_ddi.c +1 -0
+								pll_

id);

drivers/gpu/drm/i915/intel_ddi.c +3 -0
+	} else {
+		/* FIXME - Add for MG PLL */
+		WARN(1, "MG PLL clock_get code not implemented

yet\n");

drivers/gpu/drm/i915/intel_ddi.c +6 -0
+	}
+
+	pipe_config->port_clock = link_clock;
+	ddi_dotclock_get(pipe_config);
+}
+

 static void cnl_ddi_clock_get(struct intel_encoder *encoder, struct intel_crtc_state *pipe_config) {

drivers/gpu/drm/i915/intel_ddi.c +2 -0
@@ -1651,6 +1675,8 @@ static void intel_ddi_clock_get(struct
 intel_encoder *encoder,
  		bxt_ddi_clock_get(encoder, pipe_config);
  	else if (IS_CANNONLAKE(dev_priv))
  		cnl_ddi_clock_get(encoder, pipe_config);
+	else if (IS_ICELAKE(dev_priv))
+		icl_ddi_clock_get(encoder, pipe_config);
  }


 void intel_ddi_set_pipe_settings(const struct intel_crtc_state *crtc_state)

drivers/gpu/drm/i915/intel_dpll_mgr.c +0 -0
index 383fbc15113d..3cc837f74ffb 100644
@@ -2525,6 +2525,72 @@ static bool icl_calc_dpll_state(struct
 intel_crtc_state *crtc_state,
  	return true;
  }

drivers/gpu/drm/i915/intel_dpll_mgr.c +5 -0
+int icl_calc_dp_combo_pll_link(struct drm_i915_private *dev_priv,
+			       uint32_t pll_id)
+{
+	uint32_t cfgcr0, cfgcr1;
+	uint32_t pdiv, kdiv, qdiv_mode, qdiv_ratio, dco_integer,

dco_fraction;

drivers/gpu/drm/i915/intel_dpll_mgr.c +11 -0
+	const struct skl_wrpll_params *params;
+	int index, n_entries, link_clock = 0;
+
+	/* Read back values from DPLL CFGCR registers */
+	cfgcr0 = I915_READ(ICL_DPLL_CFGCR0(pll_id));
+	cfgcr1 = I915_READ(ICL_DPLL_CFGCR1(pll_id));
+
+	dco_integer = cfgcr0 & DPLL_CFGCR0_DCO_INTEGER_MASK;
+	dco_fraction = (cfgcr0 & DPLL_CFGCR0_DCO_FRACTION_MASK) >>
+		DPLL_CFGCR0_DCO_FRACTION_SHIFT;
+	pdiv = (cfgcr1 & DPLL_CFGCR1_PDIV_MASK) >>

DPLL_CFGCR1_PDIV_SHIFT;

drivers/gpu/drm/i915/intel_dpll_mgr.c +1 -0
+	kdiv = (cfgcr1 & DPLL_CFGCR1_KDIV_MASK) >>

DPLL_CFGCR1_KDIV_SHIFT;

drivers/gpu/drm/i915/intel_dpll_mgr.c +34 -0
+	qdiv_mode = (cfgcr1 & DPLL_CFGCR1_QDIV_MODE(1)) >>
+		DPLL_CFGCR1_QDIV_MODE_SHIFT;
+	qdiv_ratio = (cfgcr1 & DPLL_CFGCR1_QDIV_RATIO_MASK) >>
+		DPLL_CFGCR1_QDIV_RATIO_SHIFT;
+
+	params = dev_priv->cdclk.hw.ref == 24000 ?
+		icl_dp_combo_pll_24MHz_values :
+		icl_dp_combo_pll_19_2MHz_values;
+	n_entries = ARRAY_SIZE(icl_dp_combo_pll_24MHz_values);
+
+	for (index = 0; index < n_entries; index++) {
+		if (dco_integer == params[index].dco_integer &&
+		    dco_fraction == params[index].dco_fraction &&
+		    pdiv == params[index].pdiv &&
+		    kdiv == params[index].kdiv &&
+		    qdiv_mode == params[index].qdiv_mode &&
+		    qdiv_ratio == params[index].qdiv_ratio)
+			break;
+	}
+	WARN(index == n_entries, "Invalid PLL Parameters");
+
+	/* Map PLL Index to Link Clock */
+	switch (index) {
+	case 0:
+		link_clock = 540000;
+		break;
+	case 1:
+		link_clock = 270000;
+		break;
+	case 2:
+		link_clock = 162000;
+		break;
+	case 3:
+		link_clock = 324000;

drivers/gpu/drm/i915/intel_dpll_mgr.c static bool icl_calc_dpll_state(struct intel_crtc_state *crtc_state, · line 2588

Quoted 10 lines
drivers/gpu/drm/i915/intel_dpll_mgr.c +10 -0
+		break;
+	case 4:
+		link_clock = 432000;
+		break;
+	case 5:
+		link_clock = 432000;
+		break;
+	case 6:
+		link_clock = 810000;
+		break;

Just to play it safe, we could add

	default:
		MISSING_CASE();
	}

here and return with some default link clock value.

Quoted 21 lines
drivers/gpu/drm/i915/intel_dpll_mgr.c +4 -0
+
+	return link_clock;
+}
+

 static enum port icl_mg_pll_id_to_port(enum intel_dpll_id id) {
  return id - DPLL_ID_ICL_MGPLL1 + PORT_C;

drivers/gpu/drm/i915/intel_dpll_mgr.h +0 -0
index 7a0cd564a9ee..78915057d2e6 100644
@@ -336,5 +336,7 @@ void intel_shared_dpll_init(struct drm_device
 *dev);


 void intel_dpll_dump_hw_state(struct drm_i915_private *dev_priv, struct intel_dpll_hw_state *hw_state);

drivers/gpu/drm/i915/intel_dpll_mgr.h +2 -0
+int icl_calc_dp_combo_pll_link(struct drm_i915_private *dev_priv,
+			       uint32_t pll_id);


 #endif /* _INTEL_DPLL_MGR_H_ */

Signature · 6 lines
Mika Kahola - Intel OTC

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by
#48 lore raw

Re: [PATCH 11/24] drm/i915/icl: Get DDI clock for ICL based on PLLs.

Quoted 14 lines · Mika Kahola
Quoted 13 lines · Paulo Zanoni

From: Manasi Navare <[email protected]>

PLLs are the source clocks for the DDIs so in order to determine the ddi clock we need to check the PLL configuration.

This gets a little tricky for ICL since there is
no register bit that maps directly to the link clock. So this patch creates a separate function in intel_dpll_mgr.c to obtain the write array PLL Params and compares the set pll_params with the table to get the corresponding link clock.

Quoted 5 lines
Quoted 5 lines
Quoted 161 lines
Quoted 149 lines

---
 drivers/gpu/drm/i915/i915_reg.h       |  3 ++ drivers/gpu/drm/i915/intel_ddi.c      | 26 ++++++++++++++ drivers/gpu/drm/i915/intel_dpll_mgr.c | 66
+++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_dpll_mgr.h |  2 ++

 4 files changed, 97 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +3 -0
index 7f27fe2e38c7..26903cffabf6 100644
@@ -9182,13 +9182,16 @@ enum skl_power_gate {
  #define  DPLL_CFGCR1_QDIV_RATIO_MASK	(0xff << 10)
  #define  DPLL_CFGCR1_QDIV_RATIO_SHIFT	(10)
  #define  DPLL_CFGCR1_QDIV_RATIO(x)	((x) << 10)
+#define  DPLL_CFGCR1_QDIV_MODE_SHIFT	(9)
  #define  DPLL_CFGCR1_QDIV_MODE(x)	((x) << 9)
  #define  DPLL_CFGCR1_KDIV_MASK		(7 << 6)
+#define  DPLL_CFGCR1_KDIV_SHIFT		(6)
  #define  DPLL_CFGCR1_KDIV(x)		((x) << 6)
  #define  DPLL_CFGCR1_KDIV_1		(1 << 6)
  #define  DPLL_CFGCR1_KDIV_2		(2 << 6)
  #define  DPLL_CFGCR1_KDIV_4		(4 << 6)
  #define  DPLL_CFGCR1_PDIV_MASK		(0xf << 2)
+#define  DPLL_CFGCR1_PDIV_SHIFT		(2)
  #define  DPLL_CFGCR1_PDIV(x)		((x) << 2)
  #define  DPLL_CFGCR1_PDIV_2		(1 << 2)
  #define  DPLL_CFGCR1_PDIV_3		(2 << 2)
drivers/gpu/drm/i915/intel_ddi.c +0 -0
index d8ae82001f83..0d8bed8e2200 100644
@@ -1458,6 +1458,30 @@ static void ddi_dotclock_get(struct
 intel_crtc_state *pipe_config)
  	pipe_config->base.adjusted_mode.crtc_clock = dotclock;
  }

drivers/gpu/drm/i915/intel_ddi.c +4 -0
+static void icl_ddi_clock_get(struct intel_encoder *encoder,
+			      struct intel_crtc_state *pipe_config)
+{
+	struct drm_i915_private *dev_priv = to_i915(encoder-
Quoted 1 line

base.dev);

drivers/gpu/drm/i915/intel_ddi.c +5 -0
+	enum port port = encoder->port;
+	int link_clock = 0;
+	uint32_t pll_id;
+
+	pll_id = intel_get_shared_dpll_id(dev_priv, pipe_config-
Quoted 1 line

shared_dpll);

drivers/gpu/drm/i915/intel_ddi.c +3 -0
+	if (port == PORT_A || port == PORT_B) {
+		if (encoder->type == INTEL_OUTPUT_HDMI)
+			link_clock = cnl_calc_wrpll_link(dev_priv,

pll_id);

drivers/gpu/drm/i915/intel_ddi.c +2 -0
+		else
+			link_clock =

icl_calc_dp_combo_pll_link(dev_priv,

drivers/gpu/drm/i915/intel_ddi.c +1 -0
+								pll_

id);

drivers/gpu/drm/i915/intel_ddi.c +3 -0
+	} else {
+		/* FIXME - Add for MG PLL */
+		WARN(1, "MG PLL clock_get code not implemented

yet\n");

drivers/gpu/drm/i915/intel_ddi.c +6 -0
+	}
+
+	pipe_config->port_clock = link_clock;
+	ddi_dotclock_get(pipe_config);
+}
+

 static void cnl_ddi_clock_get(struct intel_encoder *encoder, struct intel_crtc_state *pipe_config) {

drivers/gpu/drm/i915/intel_ddi.c +2 -0
@@ -1651,6 +1675,8 @@ static void intel_ddi_clock_get(struct
 intel_encoder *encoder,
  		bxt_ddi_clock_get(encoder, pipe_config);
  	else if (IS_CANNONLAKE(dev_priv))
  		cnl_ddi_clock_get(encoder, pipe_config);
+	else if (IS_ICELAKE(dev_priv))
+		icl_ddi_clock_get(encoder, pipe_config);
  }


 void intel_ddi_set_pipe_settings(const struct intel_crtc_state *crtc_state)

drivers/gpu/drm/i915/intel_dpll_mgr.c +0 -0
index 383fbc15113d..3cc837f74ffb 100644
@@ -2525,6 +2525,72 @@ static bool icl_calc_dpll_state(struct
 intel_crtc_state *crtc_state,
  	return true;
  }

drivers/gpu/drm/i915/intel_dpll_mgr.c +5 -0
+int icl_calc_dp_combo_pll_link(struct drm_i915_private *dev_priv,
+			       uint32_t pll_id)
+{
+	uint32_t cfgcr0, cfgcr1;
+	uint32_t pdiv, kdiv, qdiv_mode, qdiv_ratio, dco_integer,

dco_fraction;

drivers/gpu/drm/i915/intel_dpll_mgr.c +11 -0
+	const struct skl_wrpll_params *params;
+	int index, n_entries, link_clock = 0;
+
+	/* Read back values from DPLL CFGCR registers */
+	cfgcr0 = I915_READ(ICL_DPLL_CFGCR0(pll_id));
+	cfgcr1 = I915_READ(ICL_DPLL_CFGCR1(pll_id));
+
+	dco_integer = cfgcr0 & DPLL_CFGCR0_DCO_INTEGER_MASK;
+	dco_fraction = (cfgcr0 & DPLL_CFGCR0_DCO_FRACTION_MASK) >>
+		DPLL_CFGCR0_DCO_FRACTION_SHIFT;
+	pdiv = (cfgcr1 & DPLL_CFGCR1_PDIV_MASK) >>

DPLL_CFGCR1_PDIV_SHIFT;

drivers/gpu/drm/i915/intel_dpll_mgr.c +1 -0
+	kdiv = (cfgcr1 & DPLL_CFGCR1_KDIV_MASK) >>

DPLL_CFGCR1_KDIV_SHIFT;

drivers/gpu/drm/i915/intel_dpll_mgr.c +34 -0
+	qdiv_mode = (cfgcr1 & DPLL_CFGCR1_QDIV_MODE(1)) >>
+		DPLL_CFGCR1_QDIV_MODE_SHIFT;
+	qdiv_ratio = (cfgcr1 & DPLL_CFGCR1_QDIV_RATIO_MASK) >>
+		DPLL_CFGCR1_QDIV_RATIO_SHIFT;
+
+	params = dev_priv->cdclk.hw.ref == 24000 ?
+		icl_dp_combo_pll_24MHz_values :
+		icl_dp_combo_pll_19_2MHz_values;
+	n_entries = ARRAY_SIZE(icl_dp_combo_pll_24MHz_values);
+
+	for (index = 0; index < n_entries; index++) {
+		if (dco_integer == params[index].dco_integer &&
+		    dco_fraction == params[index].dco_fraction &&
+		    pdiv == params[index].pdiv &&
+		    kdiv == params[index].kdiv &&
+		    qdiv_mode == params[index].qdiv_mode &&
+		    qdiv_ratio == params[index].qdiv_ratio)
+			break;
+	}
+	WARN(index == n_entries, "Invalid PLL Parameters");
+
+	/* Map PLL Index to Link Clock */
+	switch (index) {
+	case 0:
+		link_clock = 540000;
+		break;
+	case 1:
+		link_clock = 270000;
+		break;
+	case 2:
+		link_clock = 162000;
+		break;
+	case 3:
+		link_clock = 324000;

drivers/gpu/drm/i915/intel_dpll_mgr.c static bool icl_calc_dpll_state(struct intel_crtc_state *crtc_state, · line 2588

Quoted 10 lines
drivers/gpu/drm/i915/intel_dpll_mgr.c +10 -0
+		break;
+	case 4:
+		link_clock = 432000;
+		break;
+	case 5:
+		link_clock = 432000;
+		break;
+	case 6:
+		link_clock = 810000;
+		break;

Just to play it safe, we could add

Quoted 5 lines
	default:
		MISSING_CASE();
	}

here and return with some default link clock value.

There will already be a warning above when index == n_entries. And then we will return 0.

Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/i915/intel_dpll_mgr.c +4 -0
+
+	return link_clock;
+}
+

 static enum port icl_mg_pll_id_to_port(enum intel_dpll_id id) {
  return id - DPLL_ID_ICL_MGPLL1 + PORT_C;

drivers/gpu/drm/i915/intel_dpll_mgr.h +0 -0
index 7a0cd564a9ee..78915057d2e6 100644
@@ -336,5 +336,7 @@ void intel_shared_dpll_init(struct drm_device
Quoted 11 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_dpll_mgr.h +0 -0
 *dev);


 void intel_dpll_dump_hw_state(struct drm_i915_private *dev_priv, struct intel_dpll_hw_state *hw_state);

drivers/gpu/drm/i915/intel_dpll_mgr.h +2 -0
+int icl_calc_dp_combo_pll_link(struct drm_i915_private *dev_priv,
+			       uint32_t pll_id);


 #endif /* _INTEL_DPLL_MGR_H_ */

Signature · 1 line
Mika Kahola - Intel OTC

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#49 lore raw

Re: [PATCH 11/24] drm/i915/icl: Get DDI clock for ICL based on PLLs.

In reply to Mika Kahola

Em Ter, 2018-05-22 às 14:44 +0300, Mika Kahola escreveu:

Quoted 186 lines · Paulo Zanoni
Quoted 172 lines

From: Manasi Navare <[email protected]>

PLLs are the source clocks for the DDIs so in order to determine the ddi clock we need to check the PLL configuration.

This gets a little tricky for ICL since there is
no register bit that maps directly to the link clock. So this patch creates a separate function in intel_dpll_mgr.c to obtain the write array PLL Params and compares the set pll_params with the table to get the corresponding link clock.

---
 drivers/gpu/drm/i915/i915_reg.h       |  3 ++
 drivers/gpu/drm/i915/intel_ddi.c      | 26 ++++++++++++++
 drivers/gpu/drm/i915/intel_dpll_mgr.c | 66
+++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_dpll_mgr.h |  2 ++
 4 files changed, 97 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +3 -0
index 7f27fe2e38c7..26903cffabf6 100644
@@ -9182,13 +9182,16 @@ enum skl_power_gate {
 #define  DPLL_CFGCR1_QDIV_RATIO_MASK	(0xff << 10)
 #define  DPLL_CFGCR1_QDIV_RATIO_SHIFT	(10)
 #define  DPLL_CFGCR1_QDIV_RATIO(x)	((x) << 10)
+#define  DPLL_CFGCR1_QDIV_MODE_SHIFT	(9)
 #define  DPLL_CFGCR1_QDIV_MODE(x)	((x) << 9)
 #define  DPLL_CFGCR1_KDIV_MASK		(7 << 6)
+#define  DPLL_CFGCR1_KDIV_SHIFT		(6)
 #define  DPLL_CFGCR1_KDIV(x)		((x) << 6)
 #define  DPLL_CFGCR1_KDIV_1		(1 << 6)
 #define  DPLL_CFGCR1_KDIV_2		(2 << 6)
 #define  DPLL_CFGCR1_KDIV_4		(4 << 6)
 #define  DPLL_CFGCR1_PDIV_MASK		(0xf << 2)
+#define  DPLL_CFGCR1_PDIV_SHIFT		(2)
 #define  DPLL_CFGCR1_PDIV(x)		((x) << 2)
 #define  DPLL_CFGCR1_PDIV_2		(1 << 2)
 #define  DPLL_CFGCR1_PDIV_3		(2 << 2)
drivers/gpu/drm/i915/intel_ddi.c +9 -0
index d8ae82001f83..0d8bed8e2200 100644
@@ -1458,6 +1458,30 @@ static void ddi_dotclock_get(struct
 intel_crtc_state *pipe_config)
 	pipe_config->base.adjusted_mode.crtc_clock = dotclock;
 }
 
+static void icl_ddi_clock_get(struct intel_encoder *encoder,
+			      struct intel_crtc_state
 *pipe_config)
+{
+	struct drm_i915_private *dev_priv = to_i915(encoder-
 > base.dev);
 
+	enum port port = encoder->port;
+	int link_clock = 0;
+	uint32_t pll_id;
+
+	pll_id = intel_get_shared_dpll_id(dev_priv, pipe_config-
Quoted 1 line

shared_dpll);

drivers/gpu/drm/i915/intel_ddi.c +3 -0
+	if (port == PORT_A || port == PORT_B) {
+		if (encoder->type == INTEL_OUTPUT_HDMI)
+			link_clock = cnl_calc_wrpll_link(dev_priv,

pll_id);

drivers/gpu/drm/i915/intel_ddi.c +2 -0
+		else
+			link_clock =

icl_calc_dp_combo_pll_link(dev_priv,

drivers/gpu/drm/i915/intel_ddi.c +1 -0
+								pl

l_
id);

drivers/gpu/drm/i915/intel_ddi.c +3 -0
+	} else {
+		/* FIXME - Add for MG PLL */
+		WARN(1, "MG PLL clock_get code not implemented

yet\n");

drivers/gpu/drm/i915/intel_ddi.c +6 -0
+	}
+
+	pipe_config->port_clock = link_clock;
+	ddi_dotclock_get(pipe_config);
+}
+
 static void cnl_ddi_clock_get(struct intel_encoder *encoder,
 			      struct intel_crtc_state

*pipe_config)
{

drivers/gpu/drm/i915/intel_ddi.c +2 -0
@@ -1651,6 +1675,8 @@ static void intel_ddi_clock_get(struct
 intel_encoder *encoder,
 		bxt_ddi_clock_get(encoder, pipe_config);
 	else if (IS_CANNONLAKE(dev_priv))
 		cnl_ddi_clock_get(encoder, pipe_config);
+	else if (IS_ICELAKE(dev_priv))
+		icl_ddi_clock_get(encoder, pipe_config);
 }
 

void intel_ddi_set_pipe_settings(const struct intel_crtc_state
*crtc_state)

drivers/gpu/drm/i915/intel_dpll_mgr.c +17 -0
index 383fbc15113d..3cc837f74ffb 100644
@@ -2525,6 +2525,72 @@ static bool icl_calc_dpll_state(struct
 intel_crtc_state *crtc_state,
 	return true;
 }
 
+int icl_calc_dp_combo_pll_link(struct drm_i915_private *dev_priv,
+			       uint32_t pll_id)
+{
+	uint32_t cfgcr0, cfgcr1;
+	uint32_t pdiv, kdiv, qdiv_mode, qdiv_ratio, dco_integer,
 dco_fraction;
+	const struct skl_wrpll_params *params;
+	int index, n_entries, link_clock = 0;
+
+	/* Read back values from DPLL CFGCR registers */
+	cfgcr0 = I915_READ(ICL_DPLL_CFGCR0(pll_id));
+	cfgcr1 = I915_READ(ICL_DPLL_CFGCR1(pll_id));
+
+	dco_integer = cfgcr0 & DPLL_CFGCR0_DCO_INTEGER_MASK;
+	dco_fraction = (cfgcr0 & DPLL_CFGCR0_DCO_FRACTION_MASK) >>
+		DPLL_CFGCR0_DCO_FRACTION_SHIFT;
+	pdiv = (cfgcr1 & DPLL_CFGCR1_PDIV_MASK) >>
 DPLL_CFGCR1_PDIV_SHIFT;
+	kdiv = (cfgcr1 & DPLL_CFGCR1_KDIV_MASK) >>

DPLL_CFGCR1_KDIV_SHIFT;

drivers/gpu/drm/i915/intel_dpll_mgr.c +34 -0
+	qdiv_mode = (cfgcr1 & DPLL_CFGCR1_QDIV_MODE(1)) >>
+		DPLL_CFGCR1_QDIV_MODE_SHIFT;
+	qdiv_ratio = (cfgcr1 & DPLL_CFGCR1_QDIV_RATIO_MASK) >>
+		DPLL_CFGCR1_QDIV_RATIO_SHIFT;
+
+	params = dev_priv->cdclk.hw.ref == 24000 ?
+		icl_dp_combo_pll_24MHz_values :
+		icl_dp_combo_pll_19_2MHz_values;
+	n_entries = ARRAY_SIZE(icl_dp_combo_pll_24MHz_values);
+
+	for (index = 0; index < n_entries; index++) {
+		if (dco_integer == params[index].dco_integer &&
+		    dco_fraction == params[index].dco_fraction &&
+		    pdiv == params[index].pdiv &&
+		    kdiv == params[index].kdiv &&
+		    qdiv_mode == params[index].qdiv_mode &&
+		    qdiv_ratio == params[index].qdiv_ratio)
+			break;
+	}
+	WARN(index == n_entries, "Invalid PLL Parameters");
+
+	/* Map PLL Index to Link Clock */
+	switch (index) {
+	case 0:
+		link_clock = 540000;
+		break;
+	case 1:
+		link_clock = 270000;
+		break;
+	case 2:
+		link_clock = 162000;
+		break;
+	case 3:
+		link_clock = 324000;

drivers/gpu/drm/i915/intel_dpll_mgr.c static bool icl_calc_dpll_state(struct intel_crtc_state *crtc_state, · line 2588

Quoted 10 lines
drivers/gpu/drm/i915/intel_dpll_mgr.c +10 -0
+		break;
+	case 4:
+		link_clock = 432000;
+		break;
+	case 5:
+		link_clock = 432000;
+		break;
+	case 6:
+		link_clock = 810000;
+		break;

Just to play it safe, we could add

Quoted 5 lines
	default:
		MISSING_CASE();
	}

here and return with some default link clock value.

In this case the WARN above should be triggered and we'll return 0 (due
to link_clock being initialized to 0 at definition), but I would
prefer if our code was a little more explicit like you're suggesting, especially removing the zero initialization, which only serves to hide details like that.

Also, the table is wrong: it has 432 twice and is missing 216 and 648.

Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/i915/intel_dpll_mgr.c +4 -0
+
+	return link_clock;
+}
+
 static enum port icl_mg_pll_id_to_port(enum intel_dpll_id id)
 {
 	return id - DPLL_ID_ICL_MGPLL1 + PORT_C;
drivers/gpu/drm/i915/intel_dpll_mgr.h +0 -0
index 7a0cd564a9ee..78915057d2e6 100644
@@ -336,5 +336,7 @@ void intel_shared_dpll_init(struct drm_device
 *dev);
 
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/i915/intel_dpll_mgr.h +2 -0
 void intel_dpll_dump_hw_state(struct drm_i915_private *dev_priv,
 			      struct intel_dpll_hw_state
 *hw_state);
+int icl_calc_dp_combo_pll_link(struct drm_i915_private *dev_priv,
+			       uint32_t pll_id);

#endif /* _INTEL_DPLL_MGR_H_ */

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#50 lore raw

Re: [PATCH 11/24] drm/i915/icl: Get DDI clock for ICL based on PLLs.

In reply to Paulo Zanoni

Em Seg, 2018-05-21 às 17:25 -0700, Paulo Zanoni escreveu:

Quoted 62 lines

From: Manasi Navare <[email protected]>

PLLs are the source clocks for the DDIs so in order to determine the ddi clock we need to check the PLL configuration.

This gets a little tricky for ICL since there is
no register bit that maps directly to the link clock. So this patch creates a separate function in intel_dpll_mgr.c to obtain the write array PLL Params and compares the set pll_params with the table to get the corresponding link clock.

---
 drivers/gpu/drm/i915/i915_reg.h       |  3 ++
 drivers/gpu/drm/i915/intel_ddi.c      | 26 ++++++++++++++
 drivers/gpu/drm/i915/intel_dpll_mgr.c | 66
+++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_dpll_mgr.h |  2 ++
 4 files changed, 97 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +3 -0
index 7f27fe2e38c7..26903cffabf6 100644
@@ -9182,13 +9182,16 @@ enum skl_power_gate {
 #define  DPLL_CFGCR1_QDIV_RATIO_MASK	(0xff << 10)
 #define  DPLL_CFGCR1_QDIV_RATIO_SHIFT	(10)
 #define  DPLL_CFGCR1_QDIV_RATIO(x)	((x) << 10)
+#define  DPLL_CFGCR1_QDIV_MODE_SHIFT	(9)
 #define  DPLL_CFGCR1_QDIV_MODE(x)	((x) << 9)
 #define  DPLL_CFGCR1_KDIV_MASK		(7 << 6)
+#define  DPLL_CFGCR1_KDIV_SHIFT		(6)
 #define  DPLL_CFGCR1_KDIV(x)		((x) << 6)
 #define  DPLL_CFGCR1_KDIV_1		(1 << 6)
 #define  DPLL_CFGCR1_KDIV_2		(2 << 6)
 #define  DPLL_CFGCR1_KDIV_4		(4 << 6)
 #define  DPLL_CFGCR1_PDIV_MASK		(0xf << 2)
+#define  DPLL_CFGCR1_PDIV_SHIFT		(2)
 #define  DPLL_CFGCR1_PDIV(x)		((x) << 2)
 #define  DPLL_CFGCR1_PDIV_2		(1 << 2)
 #define  DPLL_CFGCR1_PDIV_3		(2 << 2)
drivers/gpu/drm/i915/intel_ddi.c +3 -0
index d8ae82001f83..0d8bed8e2200 100644
@@ -1458,6 +1458,30 @@ static void ddi_dotclock_get(struct
 intel_crtc_state *pipe_config)
 	pipe_config->base.adjusted_mode.crtc_clock = dotclock;
 }
 
+static void icl_ddi_clock_get(struct intel_encoder *encoder,
+			      struct intel_crtc_state *pipe_config)
+{

drivers/gpu/drm/i915/intel_ddi.c static void ddi_dotclock_get(struct · line 1474

Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +8 -0
+	struct drm_i915_private *dev_priv = to_i915(encoder-
 >base.dev);
+	enum port port = encoder->port;
+	int link_clock = 0;
+	uint32_t pll_id;
+
+	pll_id = intel_get_shared_dpll_id(dev_priv, pipe_config-
 >shared_dpll);
+	if (port == PORT_A || port == PORT_B) {
+		if (encoder->type == INTEL_OUTPUT_HDMI)

I just found that some time ago DK had spotted this check is wrong and intel_crtc_has_type() should be used here. New version will be sent.

Quoted 126 lines
drivers/gpu/drm/i915/intel_ddi.c +1 -0
+			link_clock = cnl_calc_wrpll_link(dev_priv,

pll_id);

drivers/gpu/drm/i915/intel_ddi.c +2 -0
+		else
+			link_clock =

icl_calc_dp_combo_pll_link(dev_priv,

drivers/gpu/drm/i915/intel_ddi.c +1 -0
+								pll_

id);

drivers/gpu/drm/i915/intel_ddi.c +3 -0
+	} else {
+		/* FIXME - Add for MG PLL */
+		WARN(1, "MG PLL clock_get code not implemented

yet\n");

drivers/gpu/drm/i915/intel_ddi.c +8 -0
+	}
+
+	pipe_config->port_clock = link_clock;
+	ddi_dotclock_get(pipe_config);
+}
+
 static void cnl_ddi_clock_get(struct intel_encoder *encoder,
 			      struct intel_crtc_state *pipe_config)
 {
@@ -1651,6 +1675,8 @@ static void intel_ddi_clock_get(struct
 intel_encoder *encoder,
 		bxt_ddi_clock_get(encoder, pipe_config);
 	else if (IS_CANNONLAKE(dev_priv))
 		cnl_ddi_clock_get(encoder, pipe_config);
+	else if (IS_ICELAKE(dev_priv))
+		icl_ddi_clock_get(encoder, pipe_config);
 }
 

void intel_ddi_set_pipe_settings(const struct intel_crtc_state
*crtc_state)

drivers/gpu/drm/i915/intel_dpll_mgr.c +17 -0
index 383fbc15113d..3cc837f74ffb 100644
@@ -2525,6 +2525,72 @@ static bool icl_calc_dpll_state(struct
 intel_crtc_state *crtc_state,
 	return true;
 }
 
+int icl_calc_dp_combo_pll_link(struct drm_i915_private *dev_priv,
+			       uint32_t pll_id)
+{
+	uint32_t cfgcr0, cfgcr1;
+	uint32_t pdiv, kdiv, qdiv_mode, qdiv_ratio, dco_integer,
 dco_fraction;
+	const struct skl_wrpll_params *params;
+	int index, n_entries, link_clock = 0;
+
+	/* Read back values from DPLL CFGCR registers */
+	cfgcr0 = I915_READ(ICL_DPLL_CFGCR0(pll_id));
+	cfgcr1 = I915_READ(ICL_DPLL_CFGCR1(pll_id));
+
+	dco_integer = cfgcr0 & DPLL_CFGCR0_DCO_INTEGER_MASK;
+	dco_fraction = (cfgcr0 & DPLL_CFGCR0_DCO_FRACTION_MASK) >>
+		DPLL_CFGCR0_DCO_FRACTION_SHIFT;
+	pdiv = (cfgcr1 & DPLL_CFGCR1_PDIV_MASK) >>
 DPLL_CFGCR1_PDIV_SHIFT;
+	kdiv = (cfgcr1 & DPLL_CFGCR1_KDIV_MASK) >>

DPLL_CFGCR1_KDIV_SHIFT;

drivers/gpu/drm/i915/intel_dpll_mgr.c +49 -0
+	qdiv_mode = (cfgcr1 & DPLL_CFGCR1_QDIV_MODE(1)) >>
+		DPLL_CFGCR1_QDIV_MODE_SHIFT;
+	qdiv_ratio = (cfgcr1 & DPLL_CFGCR1_QDIV_RATIO_MASK) >>
+		DPLL_CFGCR1_QDIV_RATIO_SHIFT;
+
+	params = dev_priv->cdclk.hw.ref == 24000 ?
+		icl_dp_combo_pll_24MHz_values :
+		icl_dp_combo_pll_19_2MHz_values;
+	n_entries = ARRAY_SIZE(icl_dp_combo_pll_24MHz_values);
+
+	for (index = 0; index < n_entries; index++) {
+		if (dco_integer == params[index].dco_integer &&
+		    dco_fraction == params[index].dco_fraction &&
+		    pdiv == params[index].pdiv &&
+		    kdiv == params[index].kdiv &&
+		    qdiv_mode == params[index].qdiv_mode &&
+		    qdiv_ratio == params[index].qdiv_ratio)
+			break;
+	}
+	WARN(index == n_entries, "Invalid PLL Parameters");
+
+	/* Map PLL Index to Link Clock */
+	switch (index) {
+	case 0:
+		link_clock = 540000;
+		break;
+	case 1:
+		link_clock = 270000;
+		break;
+	case 2:
+		link_clock = 162000;
+		break;
+	case 3:
+		link_clock = 324000;
+		break;
+	case 4:
+		link_clock = 432000;
+		break;
+	case 5:
+		link_clock = 432000;
+		break;
+	case 6:
+		link_clock = 810000;
+		break;
+	}
+
+	return link_clock;
+}
+
 static enum port icl_mg_pll_id_to_port(enum intel_dpll_id id)
 {
 	return id - DPLL_ID_ICL_MGPLL1 + PORT_C;
drivers/gpu/drm/i915/intel_dpll_mgr.h +2 -0
index 7a0cd564a9ee..78915057d2e6 100644
@@ -336,5 +336,7 @@ void intel_shared_dpll_init(struct drm_device
 *dev);
 
 void intel_dpll_dump_hw_state(struct drm_i915_private *dev_priv,
 			      struct intel_dpll_hw_state *hw_state);
+int icl_calc_dp_combo_pll_link(struct drm_i915_private *dev_priv,
+			       uint32_t pll_id);
 
Quoted 1 line

#endif /* _INTEL_DPLL_MGR_H_ */

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#51 lore raw

PATCH v2 11/24 drm/i915/icl: Get DDI clock for ICL based on PLLs.

In reply to Paulo Zanoni

From: Manasi Navare <[email protected]>

PLLs are the source clocks for the DDIs so in order to determine the ddi clock we need to check the PLL configuration.

This gets a little tricky for ICL since there is
no register bit that maps directly to the link clock. So this patch creates a separate function in intel_dpll_mgr.c to obtain the write array PLL Params and compares the set pll_params with the table to get the corresponding link clock.

v2:
- Fix the encoder type check (DK).
- Improve our error checking, return a sane value (Mika, Paulo).
- Fix table entries (Paulo).

Cc Rodrigo Vivi <[email protected]>
Cc Mika Kahola <[email protected]>
Cc Paulo Zanoni <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
[Paulo: implement v2]
---
 drivers/gpu/drm/i915/i915_reg.h       |  3 ++
 drivers/gpu/drm/i915/intel_ddi.c      | 26 +++++++++++++
 drivers/gpu/drm/i915/intel_dpll_mgr.c | 70 +++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_dpll_mgr.h |  2 +
 4 files changed, 101 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +3 -0
index de6fcdb4948f..7c6346542a52 100644
@@ -9174,13 +9174,16 @@ enum skl_power_gate {
 #define  DPLL_CFGCR1_QDIV_RATIO_MASK	(0xff << 10)
 #define  DPLL_CFGCR1_QDIV_RATIO_SHIFT	(10)
 #define  DPLL_CFGCR1_QDIV_RATIO(x)	((x) << 10)
+#define  DPLL_CFGCR1_QDIV_MODE_SHIFT	(9)
 #define  DPLL_CFGCR1_QDIV_MODE(x)	((x) << 9)
 #define  DPLL_CFGCR1_KDIV_MASK		(7 << 6)
+#define  DPLL_CFGCR1_KDIV_SHIFT		(6)
 #define  DPLL_CFGCR1_KDIV(x)		((x) << 6)
 #define  DPLL_CFGCR1_KDIV_1		(1 << 6)
 #define  DPLL_CFGCR1_KDIV_2		(2 << 6)
 #define  DPLL_CFGCR1_KDIV_4		(4 << 6)
 #define  DPLL_CFGCR1_PDIV_MASK		(0xf << 2)
+#define  DPLL_CFGCR1_PDIV_SHIFT		(2)
 #define  DPLL_CFGCR1_PDIV(x)		((x) << 2)
 #define  DPLL_CFGCR1_PDIV_2		(1 << 2)
 #define  DPLL_CFGCR1_PDIV_3		(2 << 2)
drivers/gpu/drm/i915/intel_ddi.c +26 -0
index f6b2c0ec4e97..0e0b726e3a49 100644
@@ -1429,6 +1429,30 @@ static void ddi_dotclock_get(struct intel_crtc_state *pipe_config)
 	pipe_config->base.adjusted_mode.crtc_clock = dotclock;
 }
 
+static void icl_ddi_clock_get(struct intel_encoder *encoder,
+			      struct intel_crtc_state *pipe_config)
+{
+	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	enum port port = encoder->port;
+	int link_clock = 0;
+	uint32_t pll_id;
+
+	pll_id = intel_get_shared_dpll_id(dev_priv, pipe_config->shared_dpll);
+	if (port == PORT_A || port == PORT_B) {
+		if (intel_crtc_has_type(pipe_config, INTEL_OUTPUT_HDMI))
+			link_clock = cnl_calc_wrpll_link(dev_priv, pll_id);
+		else
+			link_clock = icl_calc_dp_combo_pll_link(dev_priv,
+								pll_id);
+	} else {
+		/* FIXME - Add for MG PLL */
+		WARN(1, "MG PLL clock_get code not implemented yet\n");
+	}
+
+	pipe_config->port_clock = link_clock;
+	ddi_dotclock_get(pipe_config);
+}
+
 static void cnl_ddi_clock_get(struct intel_encoder *encoder,
 			      struct intel_crtc_state *pipe_config)
 {
@@ -1622,6 +1646,8 @@ static void intel_ddi_clock_get(struct intel_encoder *encoder,
 		bxt_ddi_clock_get(encoder, pipe_config);
 	else if (IS_CANNONLAKE(dev_priv))
 		cnl_ddi_clock_get(encoder, pipe_config);
+	else if (IS_ICELAKE(dev_priv))
+		icl_ddi_clock_get(encoder, pipe_config);
 }
 
 void intel_ddi_set_pipe_settings(const struct intel_crtc_state *crtc_state)
drivers/gpu/drm/i915/intel_dpll_mgr.c +70 -0

76 lines not on this page · raw message

drivers/gpu/drm/i915/intel_dpll_mgr.h +2 -0
index 7a0cd564a9ee..78915057d2e6 100644
@@ -336,5 +336,7 @@ void intel_shared_dpll_init(struct drm_device *dev);
 
 void intel_dpll_dump_hw_state(struct drm_i915_private *dev_priv,
 			      struct intel_dpll_hw_state *hw_state);
+int icl_calc_dp_combo_pll_link(struct drm_i915_private *dev_priv,
+			       uint32_t pll_id);
 
 #endif /* _INTEL_DPLL_MGR_H_ */
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v2 11/24
#52 lore raw

Re: [PATCH v2 11/24] drm/i915/icl: Get DDI clock for ICL based on PLLs.

Patch look ok to me.

Quoted 211 lines · Paulo Zanoni

From: Manasi Navare <[email protected]>

PLLs are the source clocks for the DDIs so in order to determine the ddi clock we need to check the PLL configuration.

This gets a little tricky for ICL since there is
no register bit that maps directly to the link clock. So this patch creates a separate function in intel_dpll_mgr.c to obtain the write array PLL Params and compares the set pll_params with the table to get the corresponding link clock.

v2:
  - Fix the encoder type check (DK).
  - Improve our error checking, return a sane value (Mika, Paulo).
  - Fix table entries (Paulo).

Cc Rodrigo Vivi <[email protected]>
Cc Mika Kahola <[email protected]>
Cc Paulo Zanoni <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
[Paulo: implement v2]

---
 drivers/gpu/drm/i915/i915_reg.h       |  3 ++ drivers/gpu/drm/i915/intel_ddi.c      | 26 +++++++++++++ drivers/gpu/drm/i915/intel_dpll_mgr.c | 70
+++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_dpll_mgr.h |  2 +

 4 files changed, 101 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +3 -0
index de6fcdb4948f..7c6346542a52 100644
@@ -9174,13 +9174,16 @@ enum skl_power_gate {
  #define  DPLL_CFGCR1_QDIV_RATIO_MASK	(0xff << 10)
  #define  DPLL_CFGCR1_QDIV_RATIO_SHIFT	(10)
  #define  DPLL_CFGCR1_QDIV_RATIO(x)	((x) << 10)
+#define  DPLL_CFGCR1_QDIV_MODE_SHIFT	(9)
  #define  DPLL_CFGCR1_QDIV_MODE(x)	((x) << 9)
  #define  DPLL_CFGCR1_KDIV_MASK		(7 << 6)
+#define  DPLL_CFGCR1_KDIV_SHIFT		(6)
  #define  DPLL_CFGCR1_KDIV(x)		((x) << 6)
  #define  DPLL_CFGCR1_KDIV_1		(1 << 6)
  #define  DPLL_CFGCR1_KDIV_2		(2 << 6)
  #define  DPLL_CFGCR1_KDIV_4		(4 << 6)
  #define  DPLL_CFGCR1_PDIV_MASK		(0xf << 2)
+#define  DPLL_CFGCR1_PDIV_SHIFT		(2)
  #define  DPLL_CFGCR1_PDIV(x)		((x) << 2)
  #define  DPLL_CFGCR1_PDIV_2		(1 << 2)
  #define  DPLL_CFGCR1_PDIV_3		(2 << 2)
drivers/gpu/drm/i915/intel_ddi.c +0 -0
index f6b2c0ec4e97..0e0b726e3a49 100644
@@ -1429,6 +1429,30 @@ static void ddi_dotclock_get(struct
 intel_crtc_state *pipe_config)
  	pipe_config->base.adjusted_mode.crtc_clock = dotclock;
  }

drivers/gpu/drm/i915/intel_ddi.c +4 -0
+static void icl_ddi_clock_get(struct intel_encoder *encoder,
+			      struct intel_crtc_state *pipe_config)
+{
+	struct drm_i915_private *dev_priv = to_i915(encoder-
Quoted 1 line

base.dev);

drivers/gpu/drm/i915/intel_ddi.c +5 -0
+	enum port port = encoder->port;
+	int link_clock = 0;
+	uint32_t pll_id;
+
+	pll_id = intel_get_shared_dpll_id(dev_priv, pipe_config-
Quoted 1 line

shared_dpll);

drivers/gpu/drm/i915/intel_ddi.c +2 -0
+	if (port == PORT_A || port == PORT_B) {
+		if (intel_crtc_has_type(pipe_config,

INTEL_OUTPUT_HDMI))

drivers/gpu/drm/i915/intel_ddi.c +1 -0
+			link_clock = cnl_calc_wrpll_link(dev_priv,

pll_id);

drivers/gpu/drm/i915/intel_ddi.c +2 -0
+		else
+			link_clock =

icl_calc_dp_combo_pll_link(dev_priv,

drivers/gpu/drm/i915/intel_ddi.c +1 -0
+								pll_

id);

drivers/gpu/drm/i915/intel_ddi.c +3 -0
+	} else {
+		/* FIXME - Add for MG PLL */
+		WARN(1, "MG PLL clock_get code not implemented

yet\n");

drivers/gpu/drm/i915/intel_ddi.c +6 -0
+	}
+
+	pipe_config->port_clock = link_clock;
+	ddi_dotclock_get(pipe_config);
+}
+

 static void cnl_ddi_clock_get(struct intel_encoder *encoder, struct intel_crtc_state *pipe_config) {

drivers/gpu/drm/i915/intel_ddi.c +2 -0
@@ -1622,6 +1646,8 @@ static void intel_ddi_clock_get(struct
 intel_encoder *encoder,
  		bxt_ddi_clock_get(encoder, pipe_config);
  	else if (IS_CANNONLAKE(dev_priv))
  		cnl_ddi_clock_get(encoder, pipe_config);
+	else if (IS_ICELAKE(dev_priv))
+		icl_ddi_clock_get(encoder, pipe_config);
  }


 void intel_ddi_set_pipe_settings(const struct intel_crtc_state *crtc_state)

drivers/gpu/drm/i915/intel_dpll_mgr.c +0 -0
index 383fbc15113d..07bdbf2582ba 100644
@@ -2525,6 +2525,76 @@ static bool icl_calc_dpll_state(struct
 intel_crtc_state *crtc_state,
  	return true;
  }

drivers/gpu/drm/i915/intel_dpll_mgr.c +5 -0
+int icl_calc_dp_combo_pll_link(struct drm_i915_private *dev_priv,
+			       uint32_t pll_id)
+{
+	uint32_t cfgcr0, cfgcr1;
+	uint32_t pdiv, kdiv, qdiv_mode, qdiv_ratio, dco_integer,

dco_fraction;

drivers/gpu/drm/i915/intel_dpll_mgr.c +11 -0
+	const struct skl_wrpll_params *params;
+	int index, n_entries, link_clock;
+
+	/* Read back values from DPLL CFGCR registers */
+	cfgcr0 = I915_READ(ICL_DPLL_CFGCR0(pll_id));
+	cfgcr1 = I915_READ(ICL_DPLL_CFGCR1(pll_id));
+
+	dco_integer = cfgcr0 & DPLL_CFGCR0_DCO_INTEGER_MASK;
+	dco_fraction = (cfgcr0 & DPLL_CFGCR0_DCO_FRACTION_MASK) >>
+		DPLL_CFGCR0_DCO_FRACTION_SHIFT;
+	pdiv = (cfgcr1 & DPLL_CFGCR1_PDIV_MASK) >>

DPLL_CFGCR1_PDIV_SHIFT;

drivers/gpu/drm/i915/intel_dpll_mgr.c +1 -0
+	kdiv = (cfgcr1 & DPLL_CFGCR1_KDIV_MASK) >>

DPLL_CFGCR1_KDIV_SHIFT;

drivers/gpu/drm/i915/intel_dpll_mgr.c +53 -0
+	qdiv_mode = (cfgcr1 & DPLL_CFGCR1_QDIV_MODE(1)) >>
+		DPLL_CFGCR1_QDIV_MODE_SHIFT;
+	qdiv_ratio = (cfgcr1 & DPLL_CFGCR1_QDIV_RATIO_MASK) >>
+		DPLL_CFGCR1_QDIV_RATIO_SHIFT;
+
+	params = dev_priv->cdclk.hw.ref == 24000 ?
+		icl_dp_combo_pll_24MHz_values :
+		icl_dp_combo_pll_19_2MHz_values;
+	n_entries = ARRAY_SIZE(icl_dp_combo_pll_24MHz_values);
+
+	for (index = 0; index < n_entries; index++) {
+		if (dco_integer == params[index].dco_integer &&
+		    dco_fraction == params[index].dco_fraction &&
+		    pdiv == params[index].pdiv &&
+		    kdiv == params[index].kdiv &&
+		    qdiv_mode == params[index].qdiv_mode &&
+		    qdiv_ratio == params[index].qdiv_ratio)
+			break;
+	}
+
+	/* Map PLL Index to Link Clock */
+	switch (index) {
+	default:
+		MISSING_CASE(index);
+	case 0:
+		link_clock = 540000;
+		break;
+	case 1:
+		link_clock = 270000;
+		break;
+	case 2:
+		link_clock = 162000;
+		break;
+	case 3:
+		link_clock = 324000;
+		break;
+	case 4:
+		link_clock = 216000;
+		break;
+	case 5:
+		link_clock = 432000;
+		break;
+	case 6:
+		link_clock = 648000;
+		break;
+	case 7:
+		link_clock = 810000;
+		break;
+	}
+
+	return link_clock;
+}
+

 static enum port icl_mg_pll_id_to_port(enum intel_dpll_id id) {
  return id - DPLL_ID_ICL_MGPLL1 + PORT_C;

drivers/gpu/drm/i915/intel_dpll_mgr.h +0 -0
index 7a0cd564a9ee..78915057d2e6 100644
@@ -336,5 +336,7 @@ void intel_shared_dpll_init(struct drm_device
 *dev);


 void intel_dpll_dump_hw_state(struct drm_i915_private *dev_priv, struct intel_dpll_hw_state *hw_state);

drivers/gpu/drm/i915/intel_dpll_mgr.h +2 -0
+int icl_calc_dp_combo_pll_link(struct drm_i915_private *dev_priv,
+			       uint32_t pll_id);


 #endif /* _INTEL_DPLL_MGR_H_ */

Signature · 6 lines
Mika Kahola - Intel OTC

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#53 lore raw

PATCH 12/24 drm/i915/icl: Calculate link clock using the new registers

In reply to Paulo Zanoni

From: Arkadiusz Hiler <[email protected]>

Start using the new registers for ICL and on.

Cc Manasi Navare <[email protected]>
Cc Rodrigo Vivi <[email protected]>
Cc Paulo Zanoni <[email protected]>
---
 drivers/gpu/drm/i915/intel_ddi.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +7 -2
index 0d8bed8e2200..32e7482b64dd 100644
@@ -1381,8 +1381,13 @@ static int cnl_calc_wrpll_link(struct drm_i915_private *dev_priv,
 	uint32_t cfgcr0, cfgcr1;
 	uint32_t p0, p1, p2, dco_freq, ref_clock;
 
-	cfgcr0 = I915_READ(CNL_DPLL_CFGCR0(pll_id));
-	cfgcr1 = I915_READ(CNL_DPLL_CFGCR1(pll_id));
+	if (INTEL_GEN(dev_priv) >= 11) {
+		cfgcr0 = I915_READ(ICL_DPLL_CFGCR0(pll_id));
+		cfgcr1 = I915_READ(ICL_DPLL_CFGCR1(pll_id));
+	} else {
+		cfgcr0 = I915_READ(CNL_DPLL_CFGCR0(pll_id));
+		cfgcr1 = I915_READ(CNL_DPLL_CFGCR1(pll_id));
+	}
 
 	p0 = cfgcr1 & DPLL_CFGCR1_PDIV_MASK;
 	p2 = cfgcr1 & DPLL_CFGCR1_KDIV_MASK;
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author Reviewed-by on v1 12/24
#54 lore raw

Re: [PATCH 12/24] drm/i915/icl: Calculate link clock using the new registers

Em Seg, 2018-05-21 às 17:25 -0700, Paulo Zanoni escreveu:

Quoted 3 lines

From: Arkadiusz Hiler <[email protected]>

Start using the new registers for ICL and on.

I previously put this patch in a series that did not make use of cnl_calc_wrpll_link() for ICL yet. This series makes ICL run cnl_calc_wrpll_link(), so this patch makes sense now.

Quoted 30 lines
Cc Manasi Navare <[email protected]>
Cc Rodrigo Vivi <[email protected]>
Cc Paulo Zanoni <[email protected]>
---
 drivers/gpu/drm/i915/intel_ddi.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +7 -2
index 0d8bed8e2200..32e7482b64dd 100644
@@ -1381,8 +1381,13 @@ static int cnl_calc_wrpll_link(struct
 drm_i915_private *dev_priv,
 	uint32_t cfgcr0, cfgcr1;
 	uint32_t p0, p1, p2, dco_freq, ref_clock;
 
-	cfgcr0 = I915_READ(CNL_DPLL_CFGCR0(pll_id));
-	cfgcr1 = I915_READ(CNL_DPLL_CFGCR1(pll_id));
+	if (INTEL_GEN(dev_priv) >= 11) {
+		cfgcr0 = I915_READ(ICL_DPLL_CFGCR0(pll_id));
+		cfgcr1 = I915_READ(ICL_DPLL_CFGCR1(pll_id));
+	} else {
+		cfgcr0 = I915_READ(CNL_DPLL_CFGCR0(pll_id));
+		cfgcr1 = I915_READ(CNL_DPLL_CFGCR1(pll_id));
+	}
 
 	p0 = cfgcr1 & DPLL_CFGCR1_PDIV_MASK;
Quoted 1 line

p2 = cfgcr1 & DPLL_CFGCR1_KDIV_MASK;

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#55 lore raw

PATCH 13/24 drm/i915/icl: unconditionally init DDI for every port

In reply to Paulo Zanoni

On ICP, port present straps are no longer supported. Software should determine the presence through BIOS VBT, hotplug or other mechanisms.

---
 drivers/gpu/drm/i915/intel_display.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +8 -1
index d5a19c1b3b20..528d9f9c456d 100644
@@ -13965,7 +13965,14 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
 	if (intel_crt_present(dev_priv))
 		intel_crt_init(dev_priv);
 
-	if (IS_GEN9_LP(dev_priv)) {
+	if (IS_ICELAKE(dev_priv)) {
+		intel_ddi_init(dev_priv, PORT_A);
+		intel_ddi_init(dev_priv, PORT_B);
+		intel_ddi_init(dev_priv, PORT_C);
+		intel_ddi_init(dev_priv, PORT_D);
+		intel_ddi_init(dev_priv, PORT_E);
+		intel_ddi_init(dev_priv, PORT_F);
+	} else if (IS_GEN9_LP(dev_priv)) {
 		/*
 		 * FIXME: Broxton doesn't support port detection via the
 		 * DDI_BUF_CTL_A or SFUSE_STRAP registers, find another way to
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 13/24
#56 lore raw

Re: [PATCH 13/24] drm/i915/icl: unconditionally init DDI for every port

Quoted 1 line · Paulo Zanoni

On ICP, port present straps are no longer supported. Software should

ICP?? Doesn't it make more sense to say on ICL here?

Quoted 3 lines

determine the presence through BIOS VBT, hotplug or other mechanisms.

Lucas De Marchi

Quoted 31 lines
---
 drivers/gpu/drm/i915/intel_display.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +8 -1
index d5a19c1b3b20..528d9f9c456d 100644
@@ -13965,7 +13965,14 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
 	if (intel_crt_present(dev_priv))
 		intel_crt_init(dev_priv);
 
-	if (IS_GEN9_LP(dev_priv)) {
+	if (IS_ICELAKE(dev_priv)) {
+		intel_ddi_init(dev_priv, PORT_A);
+		intel_ddi_init(dev_priv, PORT_B);
+		intel_ddi_init(dev_priv, PORT_C);
+		intel_ddi_init(dev_priv, PORT_D);
+		intel_ddi_init(dev_priv, PORT_E);
+		intel_ddi_init(dev_priv, PORT_F);
+	} else if (IS_GEN9_LP(dev_priv)) {
 		/*
 		 * FIXME: Broxton doesn't support port detection via the
 		 * DDI_BUF_CTL_A or SFUSE_STRAP registers, find another way to
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#57 lore raw

Re: [PATCH 13/24] drm/i915/icl: unconditionally init DDI for every port

Em Qua, 2018-06-13 às 16:34 -0700, Lucas De Marchi escreveu:

Quoted 5 lines · Paulo Zanoni
Quoted 2 lines

On ICP, port present straps are no longer supported. Software should

ICP?? Doesn't it make more sense to say on ICL here?

The register that used to have the port present straps was in the PCH, it's SFUSE_STRAP. I'll reword the commit message to explicitly mention it, since the wording on the commit message is basically what's written on the SFUSE_TRAP page.

Quoted 8 lines
Quoted 5 lines

determine the presence through BIOS VBT, hotplug or other mechanisms.

Thanks a lot,
Paulo

Quoted 33 lines

Lucas De Marchi

Quoted 31 lines
---
 drivers/gpu/drm/i915/intel_display.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +8 -1
index d5a19c1b3b20..528d9f9c456d 100644
@@ -13965,7 +13965,14 @@ static void intel_setup_outputs(struct
 drm_i915_private *dev_priv)
 	if (intel_crt_present(dev_priv))
 		intel_crt_init(dev_priv);
 
-	if (IS_GEN9_LP(dev_priv)) {
+	if (IS_ICELAKE(dev_priv)) {
+		intel_ddi_init(dev_priv, PORT_A);
+		intel_ddi_init(dev_priv, PORT_B);
+		intel_ddi_init(dev_priv, PORT_C);
+		intel_ddi_init(dev_priv, PORT_D);
+		intel_ddi_init(dev_priv, PORT_E);
+		intel_ddi_init(dev_priv, PORT_F);
+	} else if (IS_GEN9_LP(dev_priv)) {
 		/*
 		 * FIXME: Broxton doesn't support port detection

via the
* DDI_BUF_CTL_A or SFUSE_STRAP registers, find
another way to

Signature · 1 line
2.14.3
Quoted 4 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#58 lore raw

PATCH 14/24 drm/i915/icl: start adding the TBT pll

In reply to Paulo Zanoni

This commit just adds the register addresses and the basic skeleton of the code. The next commits will expand on more specific functions.

---
 drivers/gpu/drm/i915/i915_reg.h       |  6 ++++++
 drivers/gpu/drm/i915/intel_ddi.c      | 16 ++++++++++++++++
 drivers/gpu/drm/i915/intel_dpll_mgr.c | 20 ++++++++++++++++----
 drivers/gpu/drm/i915/intel_dpll_mgr.h | 14 +++++++++-----
 4 files changed, 47 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +6 -0
index 26903cffabf6..ce79913466a7 100644
@@ -8878,6 +8878,10 @@ enum skl_power_gate {
 #define DDI_CLK_SEL(port)		PORT_CLK_SEL(port)
 #define  DDI_CLK_SEL_NONE		(0x0 << 28)
 #define  DDI_CLK_SEL_MG			(0x8 << 28)
+#define  DDI_CLK_SEL_TBT_162		(0xC << 28)
+#define  DDI_CLK_SEL_TBT_270		(0xD << 28)
+#define  DDI_CLK_SEL_TBT_540		(0xE << 28)
+#define  DDI_CLK_SEL_TBT_810		(0xF << 28)
 #define  DDI_CLK_SEL_MASK		(0xF << 28)
 
 /* Transcoder clock selection */
@@ -9027,6 +9031,8 @@ enum skl_power_gate {
 #define  PLL_POWER_STATE	(1 << 26)
 #define CNL_DPLL_ENABLE(pll)	_MMIO_PLL(pll, DPLL0_ENABLE, DPLL1_ENABLE)
 
+#define TBT_PLL_ENABLE		_MMIO(0x46020)
+
 #define _MG_PLL1_ENABLE		0x46030
 #define _MG_PLL2_ENABLE		0x46034
 #define _MG_PLL3_ENABLE		0x46038
drivers/gpu/drm/i915/intel_ddi.c +16 -0
index 32e7482b64dd..1d5bfec57c33 100644
@@ -1062,6 +1062,8 @@ static uint32_t hsw_pll_to_ddi_pll_sel(const struct intel_shared_dpll *pll)
 static uint32_t icl_pll_to_ddi_pll_sel(struct intel_encoder *encoder,
 				       const struct intel_shared_dpll *pll)
 {
+	struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
+	int clock = crtc->config->port_clock;
 	const enum intel_dpll_id id = pll->info->id;
 
 	switch (id) {
@@ -1070,6 +1072,20 @@ static uint32_t icl_pll_to_ddi_pll_sel(struct intel_encoder *encoder,
 	case DPLL_ID_ICL_DPLL0:
 	case DPLL_ID_ICL_DPLL1:
 		return DDI_CLK_SEL_NONE;
+	case DPLL_ID_ICL_TBTPLL:
+		switch (clock) {
+		case 162000:
+			return DDI_CLK_SEL_TBT_162;
+		case 270000:
+			return DDI_CLK_SEL_TBT_270;
+		case 540000:
+			return DDI_CLK_SEL_TBT_540;
+		case 810000:
+			return DDI_CLK_SEL_TBT_810;
+		default:
+			MISSING_CASE(clock);
+			break;
+		}
 	case DPLL_ID_ICL_MGPLL1:
 	case DPLL_ID_ICL_MGPLL2:
 	case DPLL_ID_ICL_MGPLL3:
drivers/gpu/drm/i915/intel_dpll_mgr.c +16 -4
index 3cc837f74ffb..72f15e727d07 100644
@@ -2853,10 +2853,17 @@ icl_get_dpll(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state,
 	case PORT_D:
 	case PORT_E:
 	case PORT_F:
-		min = icl_port_to_mg_pll_id(port);
-		max = min;
-		ret = icl_calc_mg_pll_state(crtc_state, encoder, clock,
-					    &pll_state);
+		if (0 /* TODO: TBT PLLs */) {
+			min = DPLL_ID_ICL_TBTPLL;
+			max = min;
+			ret = icl_calc_dpll_state(crtc_state, encoder, clock,
+						  &pll_state);
+		} else {
+			min = icl_port_to_mg_pll_id(port);
+			max = min;
+			ret = icl_calc_mg_pll_state(crtc_state, encoder, clock,
+						    &pll_state);
+		}
 		break;
 	default:
 		MISSING_CASE(port);
@@ -2889,6 +2896,8 @@ static i915_reg_t icl_pll_id_to_enable_reg(enum intel_dpll_id id)
 	case DPLL_ID_ICL_DPLL0:
 	case DPLL_ID_ICL_DPLL1:
 		return CNL_DPLL_ENABLE(id);
+	case DPLL_ID_ICL_TBTPLL:
+		return TBT_PLL_ENABLE;
 	case DPLL_ID_ICL_MGPLL1:
 	case DPLL_ID_ICL_MGPLL2:
 	case DPLL_ID_ICL_MGPLL3:
@@ -2916,6 +2925,7 @@ static bool icl_pll_get_hw_state(struct drm_i915_private *dev_priv,
 	switch (id) {
 	case DPLL_ID_ICL_DPLL0:
 	case DPLL_ID_ICL_DPLL1:
+	case DPLL_ID_ICL_TBTPLL:
 		hw_state->cfgcr0 = I915_READ(ICL_DPLL_CFGCR0(id));
 		hw_state->cfgcr1 = I915_READ(ICL_DPLL_CFGCR1(id));
 		break;
@@ -3002,6 +3012,7 @@ static void icl_pll_enable(struct drm_i915_private *dev_priv,
 	switch (id) {
 	case DPLL_ID_ICL_DPLL0:
 	case DPLL_ID_ICL_DPLL1:
+	case DPLL_ID_ICL_TBTPLL:
 		icl_dpll_write(dev_priv, pll);
 		break;
 	case DPLL_ID_ICL_MGPLL1:
@@ -3100,6 +3111,7 @@ static const struct intel_shared_dpll_funcs icl_pll_funcs = {
 static const struct dpll_info icl_plls[] = {
 	{ "DPLL 0",   &icl_pll_funcs, DPLL_ID_ICL_DPLL0,  0 },
 	{ "DPLL 1",   &icl_pll_funcs, DPLL_ID_ICL_DPLL1,  0 },
+	{ "TBT PLL",  &icl_pll_funcs, DPLL_ID_ICL_TBTPLL, 0 },
 	{ "MG PLL 1", &icl_pll_funcs, DPLL_ID_ICL_MGPLL1, 0 },
 	{ "MG PLL 2", &icl_pll_funcs, DPLL_ID_ICL_MGPLL2, 0 },
 	{ "MG PLL 3", &icl_pll_funcs, DPLL_ID_ICL_MGPLL3, 0 },
drivers/gpu/drm/i915/intel_dpll_mgr.h +9 -5
index 78915057d2e6..ba925c7ee482 100644
@@ -113,24 +113,28 @@ enum intel_dpll_id {
 	 * @DPLL_ID_ICL_DPLL1: ICL combo PHY DPLL1
 	 */
 	DPLL_ID_ICL_DPLL1 = 1,
+	/**
+	 * @DPLL_ID_ICL_TBTPLL: ICL TBT PLL
+	 */
+	DPLL_ID_ICL_TBTPLL = 2,
 	/**
 	 * @DPLL_ID_ICL_MGPLL1: ICL MG PLL 1 port 1 (C)
 	 */
-	DPLL_ID_ICL_MGPLL1 = 2,
+	DPLL_ID_ICL_MGPLL1 = 3,
 	/**
 	 * @DPLL_ID_ICL_MGPLL2: ICL MG PLL 1 port 2 (D)
 	 */
-	DPLL_ID_ICL_MGPLL2 = 3,
+	DPLL_ID_ICL_MGPLL2 = 4,
 	/**
 	 * @DPLL_ID_ICL_MGPLL3: ICL MG PLL 1 port 3 (E)
 	 */
-	DPLL_ID_ICL_MGPLL3 = 4,
+	DPLL_ID_ICL_MGPLL3 = 5,
 	/**
 	 * @DPLL_ID_ICL_MGPLL4: ICL MG PLL 1 port 4 (F)
 	 */
-	DPLL_ID_ICL_MGPLL4 = 5,
+	DPLL_ID_ICL_MGPLL4 = 6,
 };
-#define I915_NUM_PLLS 6
+#define I915_NUM_PLLS 7
 
 struct intel_dpll_hw_state {
 	/* i9xx, pch plls */
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 14/24
#59 lore raw

Re: [PATCH 14/24] drm/i915/icl: start adding the TBT pll

Quoted 4 lines · Paulo Zanoni

This commit just adds the register addresses and the basic skeleton of the code. The next commits will expand on more specific functions.

Lucas De Marchi

Quoted 169 lines
---
 drivers/gpu/drm/i915/i915_reg.h       |  6 ++++++
 drivers/gpu/drm/i915/intel_ddi.c      | 16 ++++++++++++++++
 drivers/gpu/drm/i915/intel_dpll_mgr.c | 20 ++++++++++++++++----
 drivers/gpu/drm/i915/intel_dpll_mgr.h | 14 +++++++++-----
 4 files changed, 47 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +6 -0
index 26903cffabf6..ce79913466a7 100644
@@ -8878,6 +8878,10 @@ enum skl_power_gate {
 #define DDI_CLK_SEL(port)		PORT_CLK_SEL(port)
 #define  DDI_CLK_SEL_NONE		(0x0 << 28)
 #define  DDI_CLK_SEL_MG			(0x8 << 28)
+#define  DDI_CLK_SEL_TBT_162		(0xC << 28)
+#define  DDI_CLK_SEL_TBT_270		(0xD << 28)
+#define  DDI_CLK_SEL_TBT_540		(0xE << 28)
+#define  DDI_CLK_SEL_TBT_810		(0xF << 28)
 #define  DDI_CLK_SEL_MASK		(0xF << 28)
 
 /* Transcoder clock selection */
@@ -9027,6 +9031,8 @@ enum skl_power_gate {
 #define  PLL_POWER_STATE	(1 << 26)
 #define CNL_DPLL_ENABLE(pll)	_MMIO_PLL(pll, DPLL0_ENABLE, DPLL1_ENABLE)
 
+#define TBT_PLL_ENABLE		_MMIO(0x46020)
+
 #define _MG_PLL1_ENABLE		0x46030
 #define _MG_PLL2_ENABLE		0x46034
 #define _MG_PLL3_ENABLE		0x46038
drivers/gpu/drm/i915/intel_ddi.c +16 -0
index 32e7482b64dd..1d5bfec57c33 100644
@@ -1062,6 +1062,8 @@ static uint32_t hsw_pll_to_ddi_pll_sel(const struct intel_shared_dpll *pll)
 static uint32_t icl_pll_to_ddi_pll_sel(struct intel_encoder *encoder,
 				       const struct intel_shared_dpll *pll)
 {
+	struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
+	int clock = crtc->config->port_clock;
 	const enum intel_dpll_id id = pll->info->id;
 
 	switch (id) {
@@ -1070,6 +1072,20 @@ static uint32_t icl_pll_to_ddi_pll_sel(struct intel_encoder *encoder,
 	case DPLL_ID_ICL_DPLL0:
 	case DPLL_ID_ICL_DPLL1:
 		return DDI_CLK_SEL_NONE;
+	case DPLL_ID_ICL_TBTPLL:
+		switch (clock) {
+		case 162000:
+			return DDI_CLK_SEL_TBT_162;
+		case 270000:
+			return DDI_CLK_SEL_TBT_270;
+		case 540000:
+			return DDI_CLK_SEL_TBT_540;
+		case 810000:
+			return DDI_CLK_SEL_TBT_810;
+		default:
+			MISSING_CASE(clock);
+			break;
+		}
 	case DPLL_ID_ICL_MGPLL1:
 	case DPLL_ID_ICL_MGPLL2:
 	case DPLL_ID_ICL_MGPLL3:
drivers/gpu/drm/i915/intel_dpll_mgr.c +16 -4
index 3cc837f74ffb..72f15e727d07 100644
@@ -2853,10 +2853,17 @@ icl_get_dpll(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state,
 	case PORT_D:
 	case PORT_E:
 	case PORT_F:
-		min = icl_port_to_mg_pll_id(port);
-		max = min;
-		ret = icl_calc_mg_pll_state(crtc_state, encoder, clock,
-					    &pll_state);
+		if (0 /* TODO: TBT PLLs */) {
+			min = DPLL_ID_ICL_TBTPLL;
+			max = min;
+			ret = icl_calc_dpll_state(crtc_state, encoder, clock,
+						  &pll_state);
+		} else {
+			min = icl_port_to_mg_pll_id(port);
+			max = min;
+			ret = icl_calc_mg_pll_state(crtc_state, encoder, clock,
+						    &pll_state);
+		}
 		break;
 	default:
 		MISSING_CASE(port);
@@ -2889,6 +2896,8 @@ static i915_reg_t icl_pll_id_to_enable_reg(enum intel_dpll_id id)
 	case DPLL_ID_ICL_DPLL0:
 	case DPLL_ID_ICL_DPLL1:
 		return CNL_DPLL_ENABLE(id);
+	case DPLL_ID_ICL_TBTPLL:
+		return TBT_PLL_ENABLE;
 	case DPLL_ID_ICL_MGPLL1:
 	case DPLL_ID_ICL_MGPLL2:
 	case DPLL_ID_ICL_MGPLL3:
@@ -2916,6 +2925,7 @@ static bool icl_pll_get_hw_state(struct drm_i915_private *dev_priv,
 	switch (id) {
 	case DPLL_ID_ICL_DPLL0:
 	case DPLL_ID_ICL_DPLL1:
+	case DPLL_ID_ICL_TBTPLL:
 		hw_state->cfgcr0 = I915_READ(ICL_DPLL_CFGCR0(id));
 		hw_state->cfgcr1 = I915_READ(ICL_DPLL_CFGCR1(id));
 		break;
@@ -3002,6 +3012,7 @@ static void icl_pll_enable(struct drm_i915_private *dev_priv,
 	switch (id) {
 	case DPLL_ID_ICL_DPLL0:
 	case DPLL_ID_ICL_DPLL1:
+	case DPLL_ID_ICL_TBTPLL:
 		icl_dpll_write(dev_priv, pll);
 		break;
 	case DPLL_ID_ICL_MGPLL1:
@@ -3100,6 +3111,7 @@ static const struct intel_shared_dpll_funcs icl_pll_funcs = {
 static const struct dpll_info icl_plls[] = {
 	{ "DPLL 0",   &icl_pll_funcs, DPLL_ID_ICL_DPLL0,  0 },
 	{ "DPLL 1",   &icl_pll_funcs, DPLL_ID_ICL_DPLL1,  0 },
+	{ "TBT PLL",  &icl_pll_funcs, DPLL_ID_ICL_TBTPLL, 0 },
 	{ "MG PLL 1", &icl_pll_funcs, DPLL_ID_ICL_MGPLL1, 0 },
 	{ "MG PLL 2", &icl_pll_funcs, DPLL_ID_ICL_MGPLL2, 0 },
 	{ "MG PLL 3", &icl_pll_funcs, DPLL_ID_ICL_MGPLL3, 0 },
drivers/gpu/drm/i915/intel_dpll_mgr.h +9 -5
index 78915057d2e6..ba925c7ee482 100644
@@ -113,24 +113,28 @@ enum intel_dpll_id {
 	 * @DPLL_ID_ICL_DPLL1: ICL combo PHY DPLL1
 	 */
 	DPLL_ID_ICL_DPLL1 = 1,
+	/**
+	 * @DPLL_ID_ICL_TBTPLL: ICL TBT PLL
+	 */
+	DPLL_ID_ICL_TBTPLL = 2,
 	/**
 	 * @DPLL_ID_ICL_MGPLL1: ICL MG PLL 1 port 1 (C)
 	 */
-	DPLL_ID_ICL_MGPLL1 = 2,
+	DPLL_ID_ICL_MGPLL1 = 3,
 	/**
 	 * @DPLL_ID_ICL_MGPLL2: ICL MG PLL 1 port 2 (D)
 	 */
-	DPLL_ID_ICL_MGPLL2 = 3,
+	DPLL_ID_ICL_MGPLL2 = 4,
 	/**
 	 * @DPLL_ID_ICL_MGPLL3: ICL MG PLL 1 port 3 (E)
 	 */
-	DPLL_ID_ICL_MGPLL3 = 4,
+	DPLL_ID_ICL_MGPLL3 = 5,
 	/**
 	 * @DPLL_ID_ICL_MGPLL4: ICL MG PLL 1 port 4 (F)
 	 */
-	DPLL_ID_ICL_MGPLL4 = 5,
+	DPLL_ID_ICL_MGPLL4 = 6,
 };
-#define I915_NUM_PLLS 6
+#define I915_NUM_PLLS 7
 
 struct intel_dpll_hw_state {
 	/* i9xx, pch plls */
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#60 lore raw

PATCH 15/24 drm/i915/icl: compute the TBT PLL registers

In reply to Paulo Zanoni

Use the hardcoded tables provided by our spec.

---
 drivers/gpu/drm/i915/intel_dpll_mgr.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dpll_mgr.c +24 -1
index 72f15e727d07..8a34733de1ea 100644
@@ -2452,6 +2452,16 @@ static const struct skl_wrpll_params icl_dp_combo_pll_19_2MHz_values[] = {
 	  .pdiv = 0x1 /* 2 */, .kdiv = 1, .qdiv_mode = 0, .qdiv_ratio = 0},
 };
 
+static const struct skl_wrpll_params icl_tbt_pll_24MHz_values = {
+	.dco_integer = 0x151, .dco_fraction = 0x4000,
+	.pdiv = 0x4 /* 5 */, .kdiv = 1, .qdiv_mode = 0, .qdiv_ratio = 0,
+};
+
+static const struct skl_wrpll_params icl_tbt_pll_19_2MHz_values = {
+	.dco_integer = 0x1A5, .dco_fraction = 0x7000,
+	.pdiv = 0x4 /* 5 */, .kdiv = 1, .qdiv_mode = 0, .qdiv_ratio = 0,
+};
+
 static bool icl_calc_dp_combo_pll(struct drm_i915_private *dev_priv, int clock,
 				  struct skl_wrpll_params *pll_params)
 {
@@ -2494,6 +2504,14 @@ static bool icl_calc_dp_combo_pll(struct drm_i915_private *dev_priv, int clock,
 	return true;
 }
 
+static bool icl_calc_tbt_pll(struct drm_i915_private *dev_priv, int clock,
+			     struct skl_wrpll_params *pll_params)
+{
+	*pll_params = dev_priv->cdclk.hw.ref == 24000 ?
+			icl_tbt_pll_24MHz_values : icl_tbt_pll_19_2MHz_values;
+	return true;
+}
+
 static bool icl_calc_dpll_state(struct intel_crtc_state *crtc_state,
 				struct intel_encoder *encoder, int clock,
 				struct intel_dpll_hw_state *pll_state)
@@ -2501,9 +2519,12 @@ static bool icl_calc_dpll_state(struct intel_crtc_state *crtc_state,
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	uint32_t cfgcr0, cfgcr1;
 	struct skl_wrpll_params pll_params = { 0 };
+	bool is_tbt = encoder->port >= PORT_C;
 	bool ret;
 
-	if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI))
+	if (is_tbt)
+		ret = icl_calc_tbt_pll(dev_priv, clock, &pll_params);
+	else if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI))
 		ret = cnl_ddi_calculate_wrpll(clock, dev_priv, &pll_params);
 	else
 		ret = icl_calc_dp_combo_pll(dev_priv, clock, &pll_params);
@@ -2513,6 +2534,8 @@ static bool icl_calc_dpll_state(struct intel_crtc_state *crtc_state,
 
 	cfgcr0 = DPLL_CFGCR0_DCO_FRACTION(pll_params.dco_fraction) |
 		 pll_params.dco_integer;
+	if (is_tbt)
+		cfgcr0 |= DPLL_CFGCR0_SSC_ENABLE_ICL;
 
 	cfgcr1 = DPLL_CFGCR1_QDIV_RATIO(pll_params.qdiv_ratio) |
 		 DPLL_CFGCR1_QDIV_MODE(pll_params.qdiv_mode) |
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#61 lore raw

Re: [PATCH 15/24] drm/i915/icl: compute the TBT PLL registers

Quoted 71 lines

-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Paulo Zanoni
Sent: Monday, May 21, 2018 5:26 PM
To: [email protected]
Cc: Zanoni, Paulo R <[email protected]>
Subject: [Intel-gfx] [PATCH 15/24] drm/i915/icl: compute the TBT PLL registers

Use the hardcoded tables provided by our spec.

---
drivers/gpu/drm/i915/intel_dpll_mgr.c | 25 ++++++++++++++++++++++++-

1 file changed, 24 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dpll_mgr.c +8 -0
index 72f15e727d07..8a34733de1ea 100644
@@ -2452,6 +2452,16 @@ static const struct skl_wrpll_params
 icl_dp_combo_pll_19_2MHz_values[] = {
 	  .pdiv = 0x1 /* 2 */, .kdiv = 1, .qdiv_mode = 0, .qdiv_ratio = 0},  };
 
+static const struct skl_wrpll_params icl_tbt_pll_24MHz_values = {
+	.dco_integer = 0x151, .dco_fraction = 0x4000,
+	.pdiv = 0x4 /* 5 */, .kdiv = 1, .qdiv_mode = 0, .qdiv_ratio = 0, };
+
+static const struct skl_wrpll_params icl_tbt_pll_19_2MHz_values = {
+	.dco_integer = 0x1A5, .dco_fraction = 0x7000,
+	.pdiv = 0x4 /* 5 */, .kdiv = 1, .qdiv_mode = 0, .qdiv_ratio = 0, };
+
 static bool icl_calc_dp_combo_pll(struct drm_i915_private *dev_priv, int clock,
 				  struct skl_wrpll_params *pll_params)  { @@ -

2494,6 +2504,14 @@ static bool icl_calc_dp_combo_pll(struct drm_i915_private *dev_priv, int clock,

	return true;
}
drivers/gpu/drm/i915/intel_dpll_mgr.c +7 -0
+static bool icl_calc_tbt_pll(struct drm_i915_private *dev_priv, int clock,
+			     struct skl_wrpll_params *pll_params) {
+	*pll_params = dev_priv->cdclk.hw.ref == 24000 ?
+			icl_tbt_pll_24MHz_values : icl_tbt_pll_19_2MHz_values;
+	return true;
+}
+

static bool icl_calc_dpll_state(struct intel_crtc_state *crtc_state,
struct intel_encoder *encoder, int clock, struct intel_dpll_hw_state *pll_state) @@ -
2501,9 +2519,12 @@ static bool icl_calc_dpll_state(struct intel_crtc_state *crtc_state,

	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
	uint32_t cfgcr0, cfgcr1;
	struct skl_wrpll_params pll_params = { 0 };
drivers/gpu/drm/i915/intel_dpll_mgr.c +1 -0
+	bool is_tbt = encoder->port >= PORT_C;
	bool ret;
drivers/gpu/drm/i915/intel_dpll_mgr.c +3 -1
-	if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI))
+	if (is_tbt)
+		ret = icl_calc_tbt_pll(dev_priv, clock, &pll_params);
+	else if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI))
		ret = cnl_ddi_calculate_wrpll(clock, dev_priv, &pll_params);
	else
		ret = icl_calc_dp_combo_pll(dev_priv, clock, &pll_params); @@ -

2513,6 +2534,8 @@ static bool icl_calc_dpll_state(struct intel_crtc_state *crtc_state,

	cfgcr0 = DPLL_CFGCR0_DCO_FRACTION(pll_params.dco_fraction) |
		 pll_params.dco_integer;

drivers/gpu/drm/i915/intel_dpll_mgr.c static bool icl_calc_dpll_state(struct intel_crtc_state *crtc_state, · line 2538

Quoted 2 lines
drivers/gpu/drm/i915/intel_dpll_mgr.c +2 -0
+	if (is_tbt)
+		cfgcr0 |= DPLL_CFGCR0_SSC_ENABLE_ICL;

Paulo,
TBT has some TBT specific CFGCR0 registers which needs to be configured here.

Anusha

Quoted 9 lines

cfgcr1 = DPLL_CFGCR1_QDIV_RATIO(pll_params.qdiv_ratio) |
DPLL_CFGCR1_QDIV_MODE(pll_params.qdiv_mode) |
--
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#62 lore raw

Re: [PATCH 15/24] drm/i915/icl: compute the TBT PLL registers

Em Sex, 2018-06-08 às 13:19 -0700, Srivatsa, Anusha escreveu:

Quoted 89 lines
Quoted 89 lines

-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of
Paulo Zanoni
Sent: Monday, May 21, 2018 5:26 PM
To: [email protected]
Cc: Zanoni, Paulo R <[email protected]>
Subject: [Intel-gfx] [PATCH 15/24] drm/i915/icl: compute the TBT PLL registers

Use the hardcoded tables provided by our spec.

---
drivers/gpu/drm/i915/intel_dpll_mgr.c | 25
++++++++++++++++++++++++-

1 file changed, 24 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dpll_mgr.c +7 -0
index 72f15e727d07..8a34733de1ea 100644
@@ -2452,6 +2452,16 @@ static const struct skl_wrpll_params
 icl_dp_combo_pll_19_2MHz_values[] = {
 	  .pdiv = 0x1 /* 2 */, .kdiv = 1, .qdiv_mode = 0, .qdiv_ratio =
 0},  };
 
+static const struct skl_wrpll_params icl_tbt_pll_24MHz_values = {
+	.dco_integer = 0x151, .dco_fraction = 0x4000,
+	.pdiv = 0x4 /* 5 */, .kdiv = 1, .qdiv_mode = 0,
 .qdiv_ratio = 0, };
+
+static const struct skl_wrpll_params icl_tbt_pll_19_2MHz_values =
 {
+	.dco_integer = 0x1A5, .dco_fraction = 0x7000,
+	.pdiv = 0x4 /* 5 */, .kdiv = 1, .qdiv_mode = 0,

.qdiv_ratio = 0, };
+
static bool icl_calc_dp_combo_pll(struct drm_i915_private *dev_priv, int clock,
struct skl_wrpll_params
*pll_params) { @@ -
2494,6 +2504,14 @@ static bool icl_calc_dp_combo_pll(struct drm_i915_private
*dev_priv, int clock,

	return true;
}

+static bool icl_calc_tbt_pll(struct drm_i915_private *dev_priv, int clock,

drivers/gpu/drm/i915/intel_dpll_mgr.c +1 -0
+			     struct skl_wrpll_params *pll_params)

{

drivers/gpu/drm/i915/intel_dpll_mgr.c +2 -0
+	*pll_params = dev_priv->cdclk.hw.ref == 24000 ?
+			icl_tbt_pll_24MHz_values :

icl_tbt_pll_19_2MHz_values;

drivers/gpu/drm/i915/intel_dpll_mgr.c +3 -0
+	return true;
+}
+

static bool icl_calc_dpll_state(struct intel_crtc_state *crtc_state,
struct intel_encoder *encoder, int
clock,
struct intel_dpll_hw_state *pll_state)
@@ -
2501,9 +2519,12 @@ static bool icl_calc_dpll_state(struct intel_crtc_state
*crtc_state,

	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
	uint32_t cfgcr0, cfgcr1;
	struct skl_wrpll_params pll_params = { 0 };
drivers/gpu/drm/i915/intel_dpll_mgr.c +1 -0
+	bool is_tbt = encoder->port >= PORT_C;
	bool ret;
drivers/gpu/drm/i915/intel_dpll_mgr.c +2 -1
-	if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI))
+	if (is_tbt)
+		ret = icl_calc_tbt_pll(dev_priv, clock,

&pll_params);

drivers/gpu/drm/i915/intel_dpll_mgr.c +1 -0
+	else if (intel_crtc_has_type(crtc_state,

INTEL_OUTPUT_HDMI))
ret = cnl_ddi_calculate_wrpll(clock, dev_priv,
&pll_params);
else
ret = icl_calc_dp_combo_pll(dev_priv, clock,
&pll_params); @@ -
2513,6 +2534,8 @@ static bool icl_calc_dpll_state(struct intel_crtc_state
*crtc_state,

Quoted 8 lines

drivers/gpu/drm/i915/intel_dpll_mgr.c static bool icl_calc_dpll_state(struct intel_crtc_state *crtc_state, · line 2538

Quoted 4 lines
	cfgcr0 = DPLL_CFGCR0_DCO_FRACTION(pll_params.dco_fraction) |
		 pll_params.dco_integer;
drivers/gpu/drm/i915/intel_dpll_mgr.c +2 -0
+	if (is_tbt)
+		cfgcr0 |= DPLL_CFGCR0_SSC_ENABLE_ICL;

Paulo,
TBT has some TBT specific CFGCR0 registers which needs to be configured here.

I did recheck the spec and it says to disable SSC, so the line above is clearly wrong (did it change since I wrote it?), but I don't see anything we're failing to set on CFGCR0. Can you please clarify what you think is missing? Maybe you're referring to something that's on patch 14?

Thanks,
Paulo

Quoted 11 lines

Anusha

Quoted 9 lines

cfgcr1 = DPLL_CFGCR1_QDIV_RATIO(pll_params.qdiv_ratio) |
DPLL_CFGCR1_QDIV_MODE(pll_params.qdiv_mode) |
--
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#63 lore raw

Re: [PATCH 15/24] drm/i915/icl: compute the TBT PLL registers

Quoted 103 lines

-----Original Message-----
From: Zanoni, Paulo R
Sent: Wednesday, June 13, 2018 2:19 PM
To: Srivatsa, Anusha <[email protected]>; intel- [email protected]
Subject: Re: [Intel-gfx] [PATCH 15/24] drm/i915/icl: compute the TBT PLL registers

Em Sex, 2018-06-08 às 13:19 -0700, Srivatsa, Anusha escreveu:

Quoted 83 lines
Quoted 83 lines

-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Paulo Zanoni
Sent: Monday, May 21, 2018 5:26 PM
To: [email protected]
Cc: Zanoni, Paulo R <[email protected]>
Subject: [Intel-gfx] [PATCH 15/24] drm/i915/icl: compute the TBT PLL registers

Use the hardcoded tables provided by our spec.

---
drivers/gpu/drm/i915/intel_dpll_mgr.c | 25
++++++++++++++++++++++++-

1 file changed, 24 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dpll_mgr.c +7 -0
index 72f15e727d07..8a34733de1ea 100644
@@ -2452,6 +2452,16 @@ static const struct skl_wrpll_params
 icl_dp_combo_pll_19_2MHz_values[] = {
 	  .pdiv = 0x1 /* 2 */, .kdiv = 1, .qdiv_mode = 0, .qdiv_ratio = 0},
 };
 
+static const struct skl_wrpll_params icl_tbt_pll_24MHz_values = {
+	.dco_integer = 0x151, .dco_fraction = 0x4000,
+	.pdiv = 0x4 /* 5 */, .kdiv = 1, .qdiv_mode = 0,
 .qdiv_ratio = 0, };
+
+static const struct skl_wrpll_params icl_tbt_pll_19_2MHz_values =
 {
+	.dco_integer = 0x1A5, .dco_fraction = 0x7000,
+	.pdiv = 0x4 /* 5 */, .kdiv = 1, .qdiv_mode = 0,

.qdiv_ratio = 0, };
+
static bool icl_calc_dp_combo_pll(struct drm_i915_private *dev_priv, int clock,
struct skl_wrpll_params
*pll_params) { @@ -
2494,6 +2504,14 @@ static bool icl_calc_dp_combo_pll(struct drm_i915_private *dev_priv, int clock,

	return true;
}

+static bool icl_calc_tbt_pll(struct drm_i915_private *dev_priv, int clock,

drivers/gpu/drm/i915/intel_dpll_mgr.c +1 -0
+			     struct skl_wrpll_params *pll_params)

{

drivers/gpu/drm/i915/intel_dpll_mgr.c +2 -0
+	*pll_params = dev_priv->cdclk.hw.ref == 24000 ?
+			icl_tbt_pll_24MHz_values :

icl_tbt_pll_19_2MHz_values;

drivers/gpu/drm/i915/intel_dpll_mgr.c +3 -0
+	return true;
+}
+

static bool icl_calc_dpll_state(struct intel_crtc_state *crtc_state,
struct intel_encoder *encoder, int clock, struct intel_dpll_hw_state *pll_state) @@ -
2501,9 +2519,12 @@ static bool icl_calc_dpll_state(struct intel_crtc_state *crtc_state,

	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
	uint32_t cfgcr0, cfgcr1;
	struct skl_wrpll_params pll_params = { 0 };
drivers/gpu/drm/i915/intel_dpll_mgr.c +1 -0
+	bool is_tbt = encoder->port >= PORT_C;
	bool ret;
drivers/gpu/drm/i915/intel_dpll_mgr.c +2 -1
-	if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI))
+	if (is_tbt)
+		ret = icl_calc_tbt_pll(dev_priv, clock,

&pll_params);

drivers/gpu/drm/i915/intel_dpll_mgr.c +1 -0
+	else if (intel_crtc_has_type(crtc_state,

INTEL_OUTPUT_HDMI))
ret = cnl_ddi_calculate_wrpll(clock, dev_priv,
&pll_params);
else
ret = icl_calc_dp_combo_pll(dev_priv, clock,
&pll_params); @@ -
2513,6 +2534,8 @@ static bool icl_calc_dpll_state(struct intel_crtc_state
*crtc_state,

Quoted 8 lines

drivers/gpu/drm/i915/intel_dpll_mgr.c static bool icl_calc_dpll_state(struct intel_crtc_state *crtc_state, · line 2538

Quoted 4 lines
	cfgcr0 = DPLL_CFGCR0_DCO_FRACTION(pll_params.dco_fraction) |
		 pll_params.dco_integer;
drivers/gpu/drm/i915/intel_dpll_mgr.c +2 -0
+	if (is_tbt)
+		cfgcr0 |= DPLL_CFGCR0_SSC_ENABLE_ICL;

Paulo,
TBT has some TBT specific CFGCR0 registers which needs to be configured here.

Quoted 5 lines

I did recheck the spec and it says to disable SSC, so the line above is clearly wrong (did it change since I wrote it?), but I don't see anything we're failing to set on CFGCR0. Can you please clarify what you think is missing? Maybe you're referring to something that's on patch 14?

Sorry, my mistake. The cfgcro0 registers are being configured here. But yes, like you pointed out, the TBT cfgcr0 register has to be configured by disabling the DDC and enabling dco frequency.

Anusha

Quoted 14 lines

Thanks,
Paulo

Quoted 11 lines

Anusha

Quoted 9 lines

cfgcr1 = DPLL_CFGCR1_QDIV_RATIO(pll_params.qdiv_ratio) |
DPLL_CFGCR1_QDIV_MODE(pll_params.qdiv_mode) |
--
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#64 lore raw

PATCH v2 15/24 drm/i915/icl: compute the TBT PLL registers

In reply to Paulo Zanoni

Use the hardcoded tables provided by our spec.

v2:
- SSC stays disabled.
- Use intel_port_is_tc().

---
 drivers/gpu/drm/i915/intel_dpll_mgr.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dpll_mgr.c +21 -1
index 132fe63e042a..205cc723fb26 100644
@@ -2452,6 +2452,16 @@ static const struct skl_wrpll_params icl_dp_combo_pll_19_2MHz_values[] = {
 	  .pdiv = 0x1 /* 2 */, .kdiv = 1, .qdiv_mode = 0, .qdiv_ratio = 0},
 };
 
+static const struct skl_wrpll_params icl_tbt_pll_24MHz_values = {
+	.dco_integer = 0x151, .dco_fraction = 0x4000,
+	.pdiv = 0x4 /* 5 */, .kdiv = 1, .qdiv_mode = 0, .qdiv_ratio = 0,
+};
+
+static const struct skl_wrpll_params icl_tbt_pll_19_2MHz_values = {
+	.dco_integer = 0x1A5, .dco_fraction = 0x7000,
+	.pdiv = 0x4 /* 5 */, .kdiv = 1, .qdiv_mode = 0, .qdiv_ratio = 0,
+};
+
 static bool icl_calc_dp_combo_pll(struct drm_i915_private *dev_priv, int clock,
 				  struct skl_wrpll_params *pll_params)
 {
@@ -2494,6 +2504,14 @@ static bool icl_calc_dp_combo_pll(struct drm_i915_private *dev_priv, int clock,
 	return true;
 }
 
+static bool icl_calc_tbt_pll(struct drm_i915_private *dev_priv, int clock,
+			     struct skl_wrpll_params *pll_params)
+{
+	*pll_params = dev_priv->cdclk.hw.ref == 24000 ?
+			icl_tbt_pll_24MHz_values : icl_tbt_pll_19_2MHz_values;
+	return true;
+}
+
 static bool icl_calc_dpll_state(struct intel_crtc_state *crtc_state,
 				struct intel_encoder *encoder, int clock,
 				struct intel_dpll_hw_state *pll_state)
@@ -2503,7 +2521,9 @@ static bool icl_calc_dpll_state(struct intel_crtc_state *crtc_state,
 	struct skl_wrpll_params pll_params = { 0 };
 	bool ret;
 
-	if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI))
+	if (intel_port_is_tc(dev_priv, encoder->port))
+		ret = icl_calc_tbt_pll(dev_priv, clock, &pll_params);
+	else if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI))
 		ret = cnl_ddi_calculate_wrpll(clock, dev_priv, &pll_params);
 	else
 		ret = icl_calc_dp_combo_pll(dev_priv, clock, &pll_params);
Signature · 6 lines
2.14.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#65 lore raw

PATCH 16/24 drm/i915/icl: Handle hotplug interrupts for DP over TBT

In reply to Paulo Zanoni

From: Dhinakaran Pandiyan <[email protected]>

This patch enables hotplug interrupts for DP over TBT output on TC ports. The TBT interrupts are enabled and handled irrespective of the actual output type which could be DP Alternate, DP over TBT, native DP or native HDMI.

Cc Animesh Manna <[email protected]>
Cc Paulo Zanoni <[email protected]>
Cc Anusha Srivatsa <[email protected]>
Cc Manasi Navare <[email protected]>
---
 drivers/gpu/drm/i915/i915_irq.c | 49 ++++++++++++++++++++++++++++++-----------
 drivers/gpu/drm/i915/i915_reg.h | 11 ++++++++-
 2 files changed, 46 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +36 -13
index 6b109991786f..9f1b01ca4ed1 100644
@@ -115,11 +115,11 @@ static const u32 hpd_bxt[HPD_NUM_PINS] = {
 	[HPD_PORT_C] = BXT_DE_PORT_HP_DDIC
 };
 
-static const u32 hpd_tc_gen11[HPD_NUM_PINS] = {
-	[HPD_PORT_C] = GEN11_TC1_HOTPLUG,
-	[HPD_PORT_D] = GEN11_TC2_HOTPLUG,
-	[HPD_PORT_E] = GEN11_TC3_HOTPLUG,
-	[HPD_PORT_F] = GEN11_TC4_HOTPLUG
+static const u32 hpd_gen11[HPD_NUM_PINS] = {
+	[HPD_PORT_C] = GEN11_TC1_HOTPLUG | GEN11_TBT1_HOTPLUG,
+	[HPD_PORT_D] = GEN11_TC2_HOTPLUG | GEN11_TBT2_HOTPLUG,
+	[HPD_PORT_E] = GEN11_TC3_HOTPLUG | GEN11_TBT3_HOTPLUG,
+	[HPD_PORT_F] = GEN11_TC4_HOTPLUG | GEN11_TBT4_HOTPLUG
 };
 
 static const u32 hpd_icp[HPD_NUM_PINS] = {
@@ -2690,20 +2690,35 @@ static void bxt_hpd_irq_handler(struct drm_i915_private *dev_priv,
 static void gen11_hpd_irq_handler(struct drm_i915_private *dev_priv, u32 iir)
 {
 	u32 pin_mask = 0, long_mask = 0;
-	u32 trigger_tc, dig_hotplug_reg;
+	u32 trigger_tc = iir & GEN11_DE_TC_HOTPLUG_MASK;
+	u32 trigger_tbt = iir & GEN11_DE_TBT_HOTPLUG_MASK;
 
-	trigger_tc = iir & GEN11_DE_TC_HOTPLUG_MASK;
 	if (trigger_tc) {
+		u32 dig_hotplug_reg;
+
 		dig_hotplug_reg = I915_READ(GEN11_TC_HOTPLUG_CTL);
 		I915_WRITE(GEN11_TC_HOTPLUG_CTL, dig_hotplug_reg);
 
 		intel_get_hpd_pins(dev_priv, &pin_mask, &long_mask, trigger_tc,
-				   dig_hotplug_reg, hpd_tc_gen11,
+				   dig_hotplug_reg, hpd_gen11,
+				   gen11_port_hotplug_long_detect);
+	}
+
+	if (trigger_tbt) {
+		u32 dig_hotplug_reg;
+
+		dig_hotplug_reg = I915_READ(GEN11_TBT_HOTPLUG_CTL);
+		I915_WRITE(GEN11_TBT_HOTPLUG_CTL, dig_hotplug_reg);
+
+		intel_get_hpd_pins(dev_priv, &pin_mask, &long_mask, trigger_tbt,
+				   dig_hotplug_reg, hpd_gen11,
 				   gen11_port_hotplug_long_detect);
+	}
+
+	if (pin_mask)
 		intel_hpd_irq_handler(dev_priv, pin_mask, long_mask);
-	} else {
+	else
 		DRM_ERROR("Unexpected DE HPD interrupt 0x%08x\n", iir);
-	}
 }
 
 static irqreturn_t
@@ -3783,6 +3798,13 @@ static void gen11_hpd_detection_setup(struct drm_i915_private *dev_priv)
 		   GEN11_HOTPLUG_CTL_ENABLE(PORT_TC3) |
 		   GEN11_HOTPLUG_CTL_ENABLE(PORT_TC4);
 	I915_WRITE(GEN11_TC_HOTPLUG_CTL, hotplug);
+
+	hotplug = I915_READ(GEN11_TBT_HOTPLUG_CTL);
+	hotplug |= GEN11_HOTPLUG_CTL_ENABLE(PORT_TC1) |
+		   GEN11_HOTPLUG_CTL_ENABLE(PORT_TC2) |
+		   GEN11_HOTPLUG_CTL_ENABLE(PORT_TC3) |
+		   GEN11_HOTPLUG_CTL_ENABLE(PORT_TC4);
+	I915_WRITE(GEN11_TBT_HOTPLUG_CTL, hotplug);
 }
 
 static void gen11_hpd_irq_setup(struct drm_i915_private *dev_priv)
@@ -3790,8 +3812,8 @@ static void gen11_hpd_irq_setup(struct drm_i915_private *dev_priv)
 	u32 hotplug_irqs, enabled_irqs;
 	u32 val;
 
-	enabled_irqs = intel_hpd_enabled_irqs(dev_priv, hpd_tc_gen11);
-	hotplug_irqs = GEN11_DE_TC_HOTPLUG_MASK;
+	enabled_irqs = intel_hpd_enabled_irqs(dev_priv, hpd_gen11);
+	hotplug_irqs = GEN11_DE_TC_HOTPLUG_MASK | GEN11_DE_TBT_HOTPLUG_MASK;
 
 	val = I915_READ(GEN11_DE_HPD_IMR);
 	val &= ~hotplug_irqs;
@@ -4176,7 +4198,8 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)
 
 	if (INTEL_GEN(dev_priv) >= 11) {
 		u32 de_hpd_masked = 0;
-		u32 de_hpd_enables = GEN11_DE_TC_HOTPLUG_MASK;
+		u32 de_hpd_enables = GEN11_DE_TC_HOTPLUG_MASK |
+				     GEN11_DE_TBT_HOTPLUG_MASK;
 
 		GEN3_IRQ_INIT(GEN11_DE_HPD_, ~de_hpd_masked, de_hpd_enables);
 		gen11_hpd_detection_setup(dev_priv);
drivers/gpu/drm/i915/i915_reg.h +10 -1
index ce79913466a7..49a72320e794 100644
@@ -7059,7 +7059,16 @@ enum {
 						 GEN11_TC3_HOTPLUG | \
 						 GEN11_TC2_HOTPLUG | \
 						 GEN11_TC1_HOTPLUG)
-
+#define  GEN11_TBT4_HOTPLUG			(1 << 3)
+#define  GEN11_TBT3_HOTPLUG			(1 << 2)
+#define  GEN11_TBT2_HOTPLUG			(1 << 1)
+#define  GEN11_TBT1_HOTPLUG			(1 << 0)
+#define  GEN11_DE_TBT_HOTPLUG_MASK		(GEN11_TBT4_HOTPLUG | \
+						 GEN11_TBT3_HOTPLUG | \
+						 GEN11_TBT2_HOTPLUG | \
+						 GEN11_TBT1_HOTPLUG)
+
+#define GEN11_TBT_HOTPLUG_CTL				_MMIO(0x44030)
 #define GEN11_TC_HOTPLUG_CTL				_MMIO(0x44038)
 #define  GEN11_HOTPLUG_CTL_ENABLE(tc_port)		(8 << (tc_port) * 4)
 #define  GEN11_HOTPLUG_CTL_LONG_DETECT(tc_port)		(2 << (tc_port) * 4)
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 16/24
#66 lore raw

Re: [PATCH 16/24] drm/i915/icl: Handle hotplug interrupts for DP over TBT

Quoted 7 lines · Paulo Zanoni

From: Dhinakaran Pandiyan <[email protected]>

This patch enables hotplug interrupts for DP over TBT output on TC ports. The TBT interrupts are enabled and handled irrespective of the actual output type which could be DP Alternate, DP over TBT, native DP or native HDMI.

Quoted 6 lines
Cc Animesh Manna <[email protected]>
Cc Paulo Zanoni <[email protected]>
Cc Anusha Srivatsa <[email protected]>
Cc Manasi Navare <[email protected]>

Lucas De Marchi

Quoted 131 lines
---
 drivers/gpu/drm/i915/i915_irq.c | 49 ++++++++++++++++++++++++++++++-----------
 drivers/gpu/drm/i915/i915_reg.h | 11 ++++++++-
 2 files changed, 46 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +36 -13
index 6b109991786f..9f1b01ca4ed1 100644
@@ -115,11 +115,11 @@ static const u32 hpd_bxt[HPD_NUM_PINS] = {
 	[HPD_PORT_C] = BXT_DE_PORT_HP_DDIC
 };
 
-static const u32 hpd_tc_gen11[HPD_NUM_PINS] = {
-	[HPD_PORT_C] = GEN11_TC1_HOTPLUG,
-	[HPD_PORT_D] = GEN11_TC2_HOTPLUG,
-	[HPD_PORT_E] = GEN11_TC3_HOTPLUG,
-	[HPD_PORT_F] = GEN11_TC4_HOTPLUG
+static const u32 hpd_gen11[HPD_NUM_PINS] = {
+	[HPD_PORT_C] = GEN11_TC1_HOTPLUG | GEN11_TBT1_HOTPLUG,
+	[HPD_PORT_D] = GEN11_TC2_HOTPLUG | GEN11_TBT2_HOTPLUG,
+	[HPD_PORT_E] = GEN11_TC3_HOTPLUG | GEN11_TBT3_HOTPLUG,
+	[HPD_PORT_F] = GEN11_TC4_HOTPLUG | GEN11_TBT4_HOTPLUG
 };
 
 static const u32 hpd_icp[HPD_NUM_PINS] = {
@@ -2690,20 +2690,35 @@ static void bxt_hpd_irq_handler(struct drm_i915_private *dev_priv,
 static void gen11_hpd_irq_handler(struct drm_i915_private *dev_priv, u32 iir)
 {
 	u32 pin_mask = 0, long_mask = 0;
-	u32 trigger_tc, dig_hotplug_reg;
+	u32 trigger_tc = iir & GEN11_DE_TC_HOTPLUG_MASK;
+	u32 trigger_tbt = iir & GEN11_DE_TBT_HOTPLUG_MASK;
 
-	trigger_tc = iir & GEN11_DE_TC_HOTPLUG_MASK;
 	if (trigger_tc) {
+		u32 dig_hotplug_reg;
+
 		dig_hotplug_reg = I915_READ(GEN11_TC_HOTPLUG_CTL);
 		I915_WRITE(GEN11_TC_HOTPLUG_CTL, dig_hotplug_reg);
 
 		intel_get_hpd_pins(dev_priv, &pin_mask, &long_mask, trigger_tc,
-				   dig_hotplug_reg, hpd_tc_gen11,
+				   dig_hotplug_reg, hpd_gen11,
+				   gen11_port_hotplug_long_detect);
+	}
+
+	if (trigger_tbt) {
+		u32 dig_hotplug_reg;
+
+		dig_hotplug_reg = I915_READ(GEN11_TBT_HOTPLUG_CTL);
+		I915_WRITE(GEN11_TBT_HOTPLUG_CTL, dig_hotplug_reg);
+
+		intel_get_hpd_pins(dev_priv, &pin_mask, &long_mask, trigger_tbt,
+				   dig_hotplug_reg, hpd_gen11,
 				   gen11_port_hotplug_long_detect);
+	}
+
+	if (pin_mask)
 		intel_hpd_irq_handler(dev_priv, pin_mask, long_mask);
-	} else {
+	else
 		DRM_ERROR("Unexpected DE HPD interrupt 0x%08x\n", iir);
-	}
 }
 
 static irqreturn_t
@@ -3783,6 +3798,13 @@ static void gen11_hpd_detection_setup(struct drm_i915_private *dev_priv)
 		   GEN11_HOTPLUG_CTL_ENABLE(PORT_TC3) |
 		   GEN11_HOTPLUG_CTL_ENABLE(PORT_TC4);
 	I915_WRITE(GEN11_TC_HOTPLUG_CTL, hotplug);
+
+	hotplug = I915_READ(GEN11_TBT_HOTPLUG_CTL);
+	hotplug |= GEN11_HOTPLUG_CTL_ENABLE(PORT_TC1) |
+		   GEN11_HOTPLUG_CTL_ENABLE(PORT_TC2) |
+		   GEN11_HOTPLUG_CTL_ENABLE(PORT_TC3) |
+		   GEN11_HOTPLUG_CTL_ENABLE(PORT_TC4);
+	I915_WRITE(GEN11_TBT_HOTPLUG_CTL, hotplug);
 }
 
 static void gen11_hpd_irq_setup(struct drm_i915_private *dev_priv)
@@ -3790,8 +3812,8 @@ static void gen11_hpd_irq_setup(struct drm_i915_private *dev_priv)
 	u32 hotplug_irqs, enabled_irqs;
 	u32 val;
 
-	enabled_irqs = intel_hpd_enabled_irqs(dev_priv, hpd_tc_gen11);
-	hotplug_irqs = GEN11_DE_TC_HOTPLUG_MASK;
+	enabled_irqs = intel_hpd_enabled_irqs(dev_priv, hpd_gen11);
+	hotplug_irqs = GEN11_DE_TC_HOTPLUG_MASK | GEN11_DE_TBT_HOTPLUG_MASK;
 
 	val = I915_READ(GEN11_DE_HPD_IMR);
 	val &= ~hotplug_irqs;
@@ -4176,7 +4198,8 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)
 
 	if (INTEL_GEN(dev_priv) >= 11) {
 		u32 de_hpd_masked = 0;
-		u32 de_hpd_enables = GEN11_DE_TC_HOTPLUG_MASK;
+		u32 de_hpd_enables = GEN11_DE_TC_HOTPLUG_MASK |
+				     GEN11_DE_TBT_HOTPLUG_MASK;
 
 		GEN3_IRQ_INIT(GEN11_DE_HPD_, ~de_hpd_masked, de_hpd_enables);
 		gen11_hpd_detection_setup(dev_priv);
drivers/gpu/drm/i915/i915_reg.h +10 -1
index ce79913466a7..49a72320e794 100644
@@ -7059,7 +7059,16 @@ enum {
 						 GEN11_TC3_HOTPLUG | \
 						 GEN11_TC2_HOTPLUG | \
 						 GEN11_TC1_HOTPLUG)
-
+#define  GEN11_TBT4_HOTPLUG			(1 << 3)
+#define  GEN11_TBT3_HOTPLUG			(1 << 2)
+#define  GEN11_TBT2_HOTPLUG			(1 << 1)
+#define  GEN11_TBT1_HOTPLUG			(1 << 0)
+#define  GEN11_DE_TBT_HOTPLUG_MASK		(GEN11_TBT4_HOTPLUG | \
+						 GEN11_TBT3_HOTPLUG | \
+						 GEN11_TBT2_HOTPLUG | \
+						 GEN11_TBT1_HOTPLUG)
+
+#define GEN11_TBT_HOTPLUG_CTL				_MMIO(0x44030)
 #define GEN11_TC_HOTPLUG_CTL				_MMIO(0x44038)
 #define  GEN11_HOTPLUG_CTL_ENABLE(tc_port)		(8 << (tc_port) * 4)
 #define  GEN11_HOTPLUG_CTL_LONG_DETECT(tc_port)		(2 << (tc_port) * 4)
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#67 lore raw

PATCH 17/24 drm/i915/icl: Add 10-bit support for hdmi

In reply to Paulo Zanoni

From: "Sripada, Radhakrishna" <[email protected]>

Starting Icelake silicon supports 10-bpc hdmi to support certain media workloads. Currently hdmi supports 8 and 12 bpc. Plumbed in support for 10 bit hdmi.

Cc James Ausmus <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Paulo Zanoni <[email protected]>
Cc Manasi Navare <[email protected]>
Cc Rodrigo Vivi <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_hdmi.c | 64 +++++++++++++++++++++++++++++----------
 1 file changed, 48 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_hdmi.c +48 -16
index 0ca4cc877520..53ac8bb85218 100644
@@ -1561,14 +1561,23 @@ intel_hdmi_mode_valid(struct drm_connector *connector,
 	/* check if we can do 8bpc */
 	status = hdmi_port_clock_valid(hdmi, clock, true, force_dvi);
 
-	/* if we can't do 8bpc we may still be able to do 12bpc */
-	if (!HAS_GMCH_DISPLAY(dev_priv) && status != MODE_OK && hdmi->has_hdmi_sink && !force_dvi)
-		status = hdmi_port_clock_valid(hdmi, clock * 3 / 2, true, force_dvi);
+	if (hdmi->has_hdmi_sink && !force_dvi) {
+		/* if we can't do 8bpc we may still be able to do 12bpc */
+		if (status != MODE_OK && !HAS_GMCH_DISPLAY(dev_priv))
+			status = hdmi_port_clock_valid(hdmi, clock * 3 / 2,
+						       true, force_dvi);
+
+		/* if we can't do 8,12bpc we may still be able to do 10bpc */
+		if (status != MODE_OK && INTEL_GEN(dev_priv) >= 11)
+			status = hdmi_port_clock_valid(hdmi, clock * 5 / 4,
+						       true, force_dvi);
+	}
 
 	return status;
 }
 
-static bool hdmi_12bpc_possible(const struct intel_crtc_state *crtc_state)
+static bool hdmi_deep_color_possible(const struct intel_crtc_state *crtc_state,
+				     int bpc)
 {
 	struct drm_i915_private *dev_priv =
 		to_i915(crtc_state->base.crtc->dev);
@@ -1580,6 +1589,9 @@ static bool hdmi_12bpc_possible(const struct intel_crtc_state *crtc_state)
 	if (HAS_GMCH_DISPLAY(dev_priv))
 		return false;
 
+	if (bpc == 10 && INTEL_GEN(dev_priv) < 11)
+		return false;
+
 	if (crtc_state->pipe_bpp <= 8*3)
 		return false;
 
@@ -1587,7 +1599,7 @@ static bool hdmi_12bpc_possible(const struct intel_crtc_state *crtc_state)
 		return false;
 
 	/*
-	 * HDMI 12bpc affects the clocks, so it's only possible
+	 * HDMI deep color affects the clocks, so it's only possible
 	 * when not cloning with other encoder types.
 	 */
 	if (crtc_state->output_types != 1 << INTEL_OUTPUT_HDMI)
@@ -1602,16 +1614,24 @@ static bool hdmi_12bpc_possible(const struct intel_crtc_state *crtc_state)
 		if (crtc_state->ycbcr420) {
 			const struct drm_hdmi_info *hdmi = &info->hdmi;
 
-			if (!(hdmi->y420_dc_modes & DRM_EDID_YCBCR420_DC_36))
+			if (bpc == 12 && !(hdmi->y420_dc_modes &
+					   DRM_EDID_YCBCR420_DC_36))
+				return false;
+			else if (bpc == 10 && !(hdmi->y420_dc_modes &
+						DRM_EDID_YCBCR420_DC_30))
 				return false;
 		} else {
-			if (!(info->edid_hdmi_dc_modes & DRM_EDID_HDMI_DC_36))
+			if (bpc == 12 && !(info->edid_hdmi_dc_modes &
+					   DRM_EDID_HDMI_DC_36))
+				return false;
+			else if (bpc == 10 && !(info->edid_hdmi_dc_modes &
+						DRM_EDID_HDMI_DC_30))
 				return false;
 		}
 	}
 
 	/* Display WA #1139: glk */
-	if (IS_GLK_REVID(dev_priv, 0, GLK_REVID_A1) &&
+	if (bpc == 12 && IS_GLK_REVID(dev_priv, 0, GLK_REVID_A1) &&
 	    crtc_state->base.adjusted_mode.htotal > 5460)
 		return false;
 
@@ -1621,7 +1641,8 @@ static bool hdmi_12bpc_possible(const struct intel_crtc_state *crtc_state)
 static bool
 intel_hdmi_ycbcr420_config(struct drm_connector *connector,
 			   struct intel_crtc_state *config,
-			   int *clock_12bpc, int *clock_8bpc)
+			   int *clock_12bpc, int *clock_10bpc,
+			   int *clock_8bpc)
 {
 	struct intel_crtc *intel_crtc = to_intel_crtc(config->base.crtc);
 
@@ -1633,6 +1654,7 @@ intel_hdmi_ycbcr420_config(struct drm_connector *connector,
 	/* YCBCR420 TMDS rate requirement is half the pixel clock */
 	config->port_clock /= 2;
 	*clock_12bpc /= 2;
+	*clock_10bpc /= 2;
 	*clock_8bpc /= 2;
 	config->ycbcr420 = true;
 
@@ -1660,6 +1682,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
 	struct intel_digital_connector_state *intel_conn_state =
 		to_intel_digital_connector_state(conn_state);
 	int clock_8bpc = pipe_config->base.adjusted_mode.crtc_clock;
+	int clock_10bpc = clock_8bpc * 5 / 4;
 	int clock_12bpc = clock_8bpc * 3 / 2;
 	int desired_bpp;
 	bool force_dvi = intel_conn_state->force_audio == HDMI_AUDIO_OFF_DVI;
@@ -1683,12 +1706,14 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK) {
 		pipe_config->pixel_multiplier = 2;
 		clock_8bpc *= 2;
+		clock_10bpc *= 2;
 		clock_12bpc *= 2;
 	}
 
 	if (drm_mode_is_420_only(&connector->display_info, adjusted_mode)) {
 		if (!intel_hdmi_ycbcr420_config(connector, pipe_config,
-						&clock_12bpc, &clock_8bpc)) {
+						&clock_12bpc, &clock_10bpc,
+						&clock_8bpc)) {
 			DRM_ERROR("Can't support YCBCR420 output\n");
 			return false;
 		}
@@ -1706,18 +1731,25 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
 	}
 
 	/*
-	 * HDMI is either 12 or 8, so if the display lets 10bpc sneak
-	 * through, clamp it down. Note that g4x/vlv don't support 12bpc hdmi
-	 * outputs. We also need to check that the higher clock still fits
-	 * within limits.
+	 * Note that g4x/vlv don't support 12bpc hdmi outputs. We also need
+	 * to check that the higher clock still fits within limits.
 	 */
-	if (hdmi_12bpc_possible(pipe_config) &&
-	    hdmi_port_clock_valid(intel_hdmi, clock_12bpc, true, force_dvi) == MODE_OK) {
+	if (hdmi_deep_color_possible(pipe_config, 12) &&
+	    hdmi_port_clock_valid(intel_hdmi, clock_12bpc,
+				  true, force_dvi) == MODE_OK) {
 		DRM_DEBUG_KMS("picking bpc to 12 for HDMI output\n");
 		desired_bpp = 12*3;
 
 		/* Need to adjust the port link by 1.5x for 12bpc. */
 		pipe_config->port_clock = clock_12bpc;
+	} else if (hdmi_deep_color_possible(pipe_config, 10) &&
+		   hdmi_port_clock_valid(intel_hdmi, clock_10bpc,
+					 true, force_dvi) == MODE_OK) {
+		DRM_DEBUG_KMS("picking bpc to 10 for HDMI output\n");
+		desired_bpp = 10 * 3;
+
+		/* Need to adjust the port link by 1.25x for 10bpc. */
+		pipe_config->port_clock = clock_10bpc;
 	} else {
 		DRM_DEBUG_KMS("picking bpc to 8 for HDMI output\n");
 		desired_bpp = 8*3;
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 17/24
#68 lore raw

Re: [PATCH 17/24] drm/i915/icl: Add 10-bit support for hdmi

Quoted 6 lines · Paulo Zanoni

From: "Sripada, Radhakrishna" <[email protected]>

Starting Icelake silicon supports 10-bpc hdmi to support certain media workloads. Currently hdmi supports 8 and 12 bpc. Plumbed in support for 10 bit hdmi.

Quoted 7 lines
Cc James Ausmus <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Paulo Zanoni <[email protected]>
Cc Manasi Navare <[email protected]>
Cc Rodrigo Vivi <[email protected]>
Cc Ville Syrjälä <[email protected]>

Still looks reasoanble to me so

Quoted 159 lines
---
 drivers/gpu/drm/i915/intel_hdmi.c | 64 +++++++++++++++++++++++++++++----------
 1 file changed, 48 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_hdmi.c +48 -16
index 0ca4cc877520..53ac8bb85218 100644
@@ -1561,14 +1561,23 @@ intel_hdmi_mode_valid(struct drm_connector *connector,
 	/* check if we can do 8bpc */
 	status = hdmi_port_clock_valid(hdmi, clock, true, force_dvi);
 
-	/* if we can't do 8bpc we may still be able to do 12bpc */
-	if (!HAS_GMCH_DISPLAY(dev_priv) && status != MODE_OK && hdmi->has_hdmi_sink && !force_dvi)
-		status = hdmi_port_clock_valid(hdmi, clock * 3 / 2, true, force_dvi);
+	if (hdmi->has_hdmi_sink && !force_dvi) {
+		/* if we can't do 8bpc we may still be able to do 12bpc */
+		if (status != MODE_OK && !HAS_GMCH_DISPLAY(dev_priv))
+			status = hdmi_port_clock_valid(hdmi, clock * 3 / 2,
+						       true, force_dvi);
+
+		/* if we can't do 8,12bpc we may still be able to do 10bpc */
+		if (status != MODE_OK && INTEL_GEN(dev_priv) >= 11)
+			status = hdmi_port_clock_valid(hdmi, clock * 5 / 4,
+						       true, force_dvi);
+	}
 
 	return status;
 }
 
-static bool hdmi_12bpc_possible(const struct intel_crtc_state *crtc_state)
+static bool hdmi_deep_color_possible(const struct intel_crtc_state *crtc_state,
+				     int bpc)
 {
 	struct drm_i915_private *dev_priv =
 		to_i915(crtc_state->base.crtc->dev);
@@ -1580,6 +1589,9 @@ static bool hdmi_12bpc_possible(const struct intel_crtc_state *crtc_state)
 	if (HAS_GMCH_DISPLAY(dev_priv))
 		return false;
 
+	if (bpc == 10 && INTEL_GEN(dev_priv) < 11)
+		return false;
+
 	if (crtc_state->pipe_bpp <= 8*3)
 		return false;
 
@@ -1587,7 +1599,7 @@ static bool hdmi_12bpc_possible(const struct intel_crtc_state *crtc_state)
 		return false;
 
 	/*
-	 * HDMI 12bpc affects the clocks, so it's only possible
+	 * HDMI deep color affects the clocks, so it's only possible
 	 * when not cloning with other encoder types.
 	 */
 	if (crtc_state->output_types != 1 << INTEL_OUTPUT_HDMI)
@@ -1602,16 +1614,24 @@ static bool hdmi_12bpc_possible(const struct intel_crtc_state *crtc_state)
 		if (crtc_state->ycbcr420) {
 			const struct drm_hdmi_info *hdmi = &info->hdmi;
 
-			if (!(hdmi->y420_dc_modes & DRM_EDID_YCBCR420_DC_36))
+			if (bpc == 12 && !(hdmi->y420_dc_modes &
+					   DRM_EDID_YCBCR420_DC_36))
+				return false;
+			else if (bpc == 10 && !(hdmi->y420_dc_modes &
+						DRM_EDID_YCBCR420_DC_30))
 				return false;
 		} else {
-			if (!(info->edid_hdmi_dc_modes & DRM_EDID_HDMI_DC_36))
+			if (bpc == 12 && !(info->edid_hdmi_dc_modes &
+					   DRM_EDID_HDMI_DC_36))
+				return false;
+			else if (bpc == 10 && !(info->edid_hdmi_dc_modes &
+						DRM_EDID_HDMI_DC_30))
 				return false;
 		}
 	}
 
 	/* Display WA #1139: glk */
-	if (IS_GLK_REVID(dev_priv, 0, GLK_REVID_A1) &&
+	if (bpc == 12 && IS_GLK_REVID(dev_priv, 0, GLK_REVID_A1) &&
 	    crtc_state->base.adjusted_mode.htotal > 5460)
 		return false;
 
@@ -1621,7 +1641,8 @@ static bool hdmi_12bpc_possible(const struct intel_crtc_state *crtc_state)
 static bool
 intel_hdmi_ycbcr420_config(struct drm_connector *connector,
 			   struct intel_crtc_state *config,
-			   int *clock_12bpc, int *clock_8bpc)
+			   int *clock_12bpc, int *clock_10bpc,
+			   int *clock_8bpc)
 {
 	struct intel_crtc *intel_crtc = to_intel_crtc(config->base.crtc);
 
@@ -1633,6 +1654,7 @@ intel_hdmi_ycbcr420_config(struct drm_connector *connector,
 	/* YCBCR420 TMDS rate requirement is half the pixel clock */
 	config->port_clock /= 2;
 	*clock_12bpc /= 2;
+	*clock_10bpc /= 2;
 	*clock_8bpc /= 2;
 	config->ycbcr420 = true;
 
@@ -1660,6 +1682,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
 	struct intel_digital_connector_state *intel_conn_state =
 		to_intel_digital_connector_state(conn_state);
 	int clock_8bpc = pipe_config->base.adjusted_mode.crtc_clock;
+	int clock_10bpc = clock_8bpc * 5 / 4;
 	int clock_12bpc = clock_8bpc * 3 / 2;
 	int desired_bpp;
 	bool force_dvi = intel_conn_state->force_audio == HDMI_AUDIO_OFF_DVI;
@@ -1683,12 +1706,14 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK) {
 		pipe_config->pixel_multiplier = 2;
 		clock_8bpc *= 2;
+		clock_10bpc *= 2;
 		clock_12bpc *= 2;
 	}
 
 	if (drm_mode_is_420_only(&connector->display_info, adjusted_mode)) {
 		if (!intel_hdmi_ycbcr420_config(connector, pipe_config,
-						&clock_12bpc, &clock_8bpc)) {
+						&clock_12bpc, &clock_10bpc,
+						&clock_8bpc)) {
 			DRM_ERROR("Can't support YCBCR420 output\n");
 			return false;
 		}
@@ -1706,18 +1731,25 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
 	}
 
 	/*
-	 * HDMI is either 12 or 8, so if the display lets 10bpc sneak
-	 * through, clamp it down. Note that g4x/vlv don't support 12bpc hdmi
-	 * outputs. We also need to check that the higher clock still fits
-	 * within limits.
+	 * Note that g4x/vlv don't support 12bpc hdmi outputs. We also need
+	 * to check that the higher clock still fits within limits.
 	 */
-	if (hdmi_12bpc_possible(pipe_config) &&
-	    hdmi_port_clock_valid(intel_hdmi, clock_12bpc, true, force_dvi) == MODE_OK) {
+	if (hdmi_deep_color_possible(pipe_config, 12) &&
+	    hdmi_port_clock_valid(intel_hdmi, clock_12bpc,
+				  true, force_dvi) == MODE_OK) {
 		DRM_DEBUG_KMS("picking bpc to 12 for HDMI output\n");
 		desired_bpp = 12*3;
 
 		/* Need to adjust the port link by 1.5x for 12bpc. */
 		pipe_config->port_clock = clock_12bpc;
+	} else if (hdmi_deep_color_possible(pipe_config, 10) &&
+		   hdmi_port_clock_valid(intel_hdmi, clock_10bpc,
+					 true, force_dvi) == MODE_OK) {
+		DRM_DEBUG_KMS("picking bpc to 10 for HDMI output\n");
+		desired_bpp = 10 * 3;
+
+		/* Need to adjust the port link by 1.25x for 10bpc. */
+		pipe_config->port_clock = clock_10bpc;
 	} else {
 		DRM_DEBUG_KMS("picking bpc to 8 for HDMI output\n");
 		desired_bpp = 8*3;
Signature · 1 line
2.14.3
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#69 lore raw

PATCH 18/24 drm/i915/icl: implement icl_digital_port_connected()

In reply to Paulo Zanoni

Do like the other functions and check for the ISR bits. We have plans to add a few more checks in this code in the next patches, that's why it's a little more verbose than it could be.

---
 drivers/gpu/drm/i915/i915_reg.h |  5 ++++
 drivers/gpu/drm/i915/intel_dp.c | 57 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +5 -0
index 49a72320e794..24308d4435f5 100644
@@ -7055,6 +7055,7 @@ enum {
 #define  GEN11_TC3_HOTPLUG			(1 << 18)
 #define  GEN11_TC2_HOTPLUG			(1 << 17)
 #define  GEN11_TC1_HOTPLUG			(1 << 16)
+#define  GEN11_TC_HOTPLUG(tc_port)		(1 << ((tc_port) + 16))
 #define  GEN11_DE_TC_HOTPLUG_MASK		(GEN11_TC4_HOTPLUG | \
 						 GEN11_TC3_HOTPLUG | \
 						 GEN11_TC2_HOTPLUG | \
@@ -7063,6 +7064,7 @@ enum {
 #define  GEN11_TBT3_HOTPLUG			(1 << 2)
 #define  GEN11_TBT2_HOTPLUG			(1 << 1)
 #define  GEN11_TBT1_HOTPLUG			(1 << 0)
+#define  GEN11_TBT_HOTPLUG(tc_port)		(1 << (tc_port))
 #define  GEN11_DE_TBT_HOTPLUG_MASK		(GEN11_TBT4_HOTPLUG | \
 						 GEN11_TBT3_HOTPLUG | \
 						 GEN11_TBT2_HOTPLUG | \
@@ -7486,6 +7488,9 @@ enum {
 #define   ICP_GMBUS			(1 << 23)
 #define   ICP_DDIB_HOTPLUG		(1 << 17)
 #define   ICP_DDIA_HOTPLUG		(1 << 16)
+#define ICP_TC_HOTPLUG(tc_port)		(1 << ((tc_port) + 24))
+#define ICP_DDI_HOTPLUG(port)		(1 << ((port) + 16))
+
 
 #define ICP_SDE_DDI_MASK		(ICP_DDIB_HOTPLUG |	\
 					 ICP_DDIA_HOTPLUG)
drivers/gpu/drm/i915/intel_dp.c +57 -0

69 lines not on this page · raw message

Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 18/24
#70 lore raw

Re: [PATCH 18/24] drm/i915/icl: implement icl_digital_port_connected()

Quoted 58 lines · Paulo Zanoni

Do like the other functions and check for the ISR bits. We have plans to add a few more checks in this code in the next patches, that's why it's a little more verbose than it could be.

---
 drivers/gpu/drm/i915/i915_reg.h |  5 ++++
 drivers/gpu/drm/i915/intel_dp.c | 57 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +5 -0
index 49a72320e794..24308d4435f5 100644
@@ -7055,6 +7055,7 @@ enum {
 #define  GEN11_TC3_HOTPLUG			(1 << 18)
 #define  GEN11_TC2_HOTPLUG			(1 << 17)
 #define  GEN11_TC1_HOTPLUG			(1 << 16)
+#define  GEN11_TC_HOTPLUG(tc_port)		(1 << ((tc_port) + 16))
 #define  GEN11_DE_TC_HOTPLUG_MASK		(GEN11_TC4_HOTPLUG | \
 						 GEN11_TC3_HOTPLUG | \
 						 GEN11_TC2_HOTPLUG | \
@@ -7063,6 +7064,7 @@ enum {
 #define  GEN11_TBT3_HOTPLUG			(1 << 2)
 #define  GEN11_TBT2_HOTPLUG			(1 << 1)
 #define  GEN11_TBT1_HOTPLUG			(1 << 0)
+#define  GEN11_TBT_HOTPLUG(tc_port)		(1 << (tc_port))
 #define  GEN11_DE_TBT_HOTPLUG_MASK		(GEN11_TBT4_HOTPLUG | \
 						 GEN11_TBT3_HOTPLUG | \
 						 GEN11_TBT2_HOTPLUG | \
@@ -7486,6 +7488,9 @@ enum {
 #define   ICP_GMBUS			(1 << 23)
 #define   ICP_DDIB_HOTPLUG		(1 << 17)
 #define   ICP_DDIA_HOTPLUG		(1 << 16)
+#define ICP_TC_HOTPLUG(tc_port)		(1 << ((tc_port) + 24))
+#define ICP_DDI_HOTPLUG(port)		(1 << ((port) + 16))
+
 
 #define ICP_SDE_DDI_MASK		(ICP_DDIB_HOTPLUG |	\
 					 ICP_DDIA_HOTPLUG)
drivers/gpu/drm/i915/intel_dp.c +8 -0
index 102070940095..b477124717e7 100644
@@ -4722,6 +4722,61 @@ static bool bxt_digital_port_connected(struct intel_encoder *encoder)
 	return I915_READ(GEN8_DE_PORT_ISR) & bit;
 }
 
+static bool icl_combo_port_connected(struct drm_i915_private *dev_priv,
+				     struct intel_digital_port *intel_dig_port)
+{
+	enum port port = intel_dig_port->base.port;
+
+	return I915_READ(ICP_SDE_ISR) & ICP_DDI_HOTPLUG(port);
+}
+

drivers/gpu/drm/i915/intel_dp.c static bool bxt_digital_port_connected(struct intel_encoder *encoder) · line 4742

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +10 -0
+static bool icl_tc_port_connected(struct drm_i915_private *dev_priv,
+				  struct intel_digital_port *intel_dig_port)
+{
+	enum port port = intel_dig_port->base.port;
+	enum tc_port tc_port = intel_port_to_tc(dev_priv, port);
+	u32 legacy_bit = ICP_TC_HOTPLUG(tc_port);
+	u32 typec_bit = GEN11_TC_HOTPLUG(tc_port);
+	u32 tbt_bit = GEN11_TBT_HOTPLUG(tc_port);
+	bool is_legacy = false, is_typec = false, is_tbt = false;
+	u32 cpu_isr;

why *cpu*_isr? hpd_isr, isr or val would be better IMO

Quoted 5 lines
drivers/gpu/drm/i915/intel_dp.c +5 -0
+
+	if (I915_READ(ICP_SDE_ISR) & legacy_bit)
+		is_legacy = true;
+
+	cpu_isr = I915_READ(GEN11_DE_HPD_ISR);

drivers/gpu/drm/i915/intel_dp.c static bool bxt_digital_port_connected(struct intel_encoder *encoder) · line 4757

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +10 -0
+	if (cpu_isr & typec_bit)
+		is_typec = true;
+	if (cpu_isr & tbt_bit)
+		is_tbt = true;
+
+	WARN_ON(is_legacy + is_typec + is_tbt > 1);
+	if (!is_legacy && !is_typec && !is_tbt)
+		return false;
+
+	return true;

you know you could "return is_legacy + is_typec + is_tbt;", right? you are already doing it above, it may make sense to remove the extra branch. Or not.

Feel free to disagree and push.

Lucas De Marchi

Quoted 41 lines
drivers/gpu/drm/i915/intel_dp.c +24 -0
+}
+
+static bool icl_digital_port_connected(struct intel_encoder *encoder)
+{
+	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
+
+	switch (encoder->hpd_pin) {
+	case HPD_PORT_A:
+	case HPD_PORT_B:
+		return icl_combo_port_connected(dev_priv, dig_port);
+	case HPD_PORT_C:
+	case HPD_PORT_D:
+	case HPD_PORT_E:
+	case HPD_PORT_F:
+		return icl_tc_port_connected(dev_priv, dig_port);
+	default:
+		MISSING_CASE(encoder->hpd_pin);
+		return false;
+	}
+}
+
 /*
  * intel_digital_port_connected - is the specified port connected?
  * @encoder: intel_encoder
@@ -4749,6 +4804,8 @@ bool intel_digital_port_connected(struct intel_encoder *encoder)
 		return bdw_digital_port_connected(encoder);
 	else if (IS_GEN9_LP(dev_priv))
 		return bxt_digital_port_connected(encoder);
+	else if (IS_ICELAKE(dev_priv))
+		return icl_digital_port_connected(encoder);
 	else
 		return spt_digital_port_connected(encoder);
 }
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#71 lore raw

Re: [PATCH 18/24] drm/i915/icl: implement icl_digital_port_connected()

Em Ter, 2018-06-19 às 15:28 -0700, Lucas De Marchi escreveu:

Quoted 83 lines · Paulo Zanoni
Quoted 82 lines

Do like the other functions and check for the ISR bits. We have plans
to add a few more checks in this code in the next patches, that's why
it's a little more verbose than it could be.

---
 drivers/gpu/drm/i915/i915_reg.h |  5 ++++
 drivers/gpu/drm/i915/intel_dp.c | 57
+++++++++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +2 -0
index 49a72320e794..24308d4435f5 100644
@@ -7055,6 +7055,7 @@ enum {
 #define  GEN11_TC3_HOTPLUG			(1 << 18)
 #define  GEN11_TC2_HOTPLUG			(1 << 17)
 #define  GEN11_TC1_HOTPLUG			(1 << 16)
+#define  GEN11_TC_HOTPLUG(tc_port)		(1 << ((tc_port)
+ 16))
 #define  GEN11_DE_TC_HOTPLUG_MASK		(GEN11_TC4_HOTPLU
 G | \
 						 GEN11_TC3_HOTPLUG

| \
GEN11_TC2_HOTPLUG
| \

drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -7063,6 +7064,7 @@ enum {
 #define  GEN11_TBT3_HOTPLUG			(1 << 2)
 #define  GEN11_TBT2_HOTPLUG			(1 << 1)
 #define  GEN11_TBT1_HOTPLUG			(1 << 0)
+#define  GEN11_TBT_HOTPLUG(tc_port)		(1 <<
 (tc_port))
 #define  GEN11_DE_TBT_HOTPLUG_MASK		(GEN11_TBT4_HOTP
 LUG | \

GEN11_TBT3_HOTPLU
G | \
GEN11_TBT2_HOTPLU
G | \

drivers/gpu/drm/i915/i915_reg.h +3 -0
@@ -7486,6 +7488,9 @@ enum {
 #define   ICP_GMBUS			(1 << 23)
 #define   ICP_DDIB_HOTPLUG		(1 << 17)
 #define   ICP_DDIA_HOTPLUG		(1 << 16)
+#define ICP_TC_HOTPLUG(tc_port)		(1 << ((tc_port) +
 24))
+#define ICP_DDI_HOTPLUG(port)		(1 << ((port) + 16))
+
 
 #define ICP_SDE_DDI_MASK		(ICP_DDIB_HOTPLUG |	

\

drivers/gpu/drm/i915/i915_reg.h +0 -0
 					 ICP_DDIA_HOTPLUG)
drivers/gpu/drm/i915/intel_dp.c +9 -0
index 102070940095..b477124717e7 100644
@@ -4722,6 +4722,61 @@ static bool
 bxt_digital_port_connected(struct intel_encoder *encoder)
 	return I915_READ(GEN8_DE_PORT_ISR) & bit;
 }
 
+static bool icl_combo_port_connected(struct drm_i915_private
 *dev_priv,
+				     struct intel_digital_port
 *intel_dig_port)
+{
+	enum port port = intel_dig_port->base.port;
+
+	return I915_READ(ICP_SDE_ISR) & ICP_DDI_HOTPLUG(port);
+}
+
+static bool icl_tc_port_connected(struct drm_i915_private

*dev_priv,

drivers/gpu/drm/i915/intel_dp.c +1 -0
+				  struct intel_digital_port

*intel_dig_port)

drivers/gpu/drm/i915/intel_dp.c +2 -0
+{
+	enum port port = intel_dig_port->base.port;
Quoted 8 lines

drivers/gpu/drm/i915/intel_dp.c static bool bxt_digital_port_connected(struct intel_encoder *encoder) · line 4742

Quoted 6 lines
drivers/gpu/drm/i915/intel_dp.c +6 -0
+	enum tc_port tc_port = intel_port_to_tc(dev_priv, port);
+	u32 legacy_bit = ICP_TC_HOTPLUG(tc_port);
+	u32 typec_bit = GEN11_TC_HOTPLUG(tc_port);
+	u32 tbt_bit = GEN11_TBT_HOTPLUG(tc_port);
+	bool is_legacy = false, is_typec = false, is_tbt = false;
+	u32 cpu_isr;

why *cpu*_isr? hpd_isr, isr or val would be better IMO

Because we have 2 ISR registers we check, one is on the CPU and the other is on the PCH. We just don't have a variable for pch_isr because we don't need. Jusc alling it "isr" or "hpd_isr" would be misleading.

Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/i915/intel_dp.c +12 -0
+
+	if (I915_READ(ICP_SDE_ISR) & legacy_bit)
+		is_legacy = true;
+
+	cpu_isr = I915_READ(GEN11_DE_HPD_ISR);
+	if (cpu_isr & typec_bit)
+		is_typec = true;
+	if (cpu_isr & tbt_bit)
+		is_tbt = true;
+
+	WARN_ON(is_legacy + is_typec + is_tbt > 1);
+	if (!is_legacy && !is_typec && !is_tbt)
Quoted 8 lines

drivers/gpu/drm/i915/intel_dp.c static bool bxt_digital_port_connected(struct intel_encoder *encoder) · line 4757

Quoted 3 lines
drivers/gpu/drm/i915/intel_dp.c +3 -0
+		return false;
+
+	return true;

you know you could "return is_legacy + is_typec + is_tbt;", right? you
are already doing it above, it may make sense to remove the extra branch. Or not.

Because the next patch adds code between the "return false" and the last return, so I'd have to change it there.

Quoted 5 lines

Feel free to disagree and push.

Thanks,
Paulo

Quoted 46 lines

Lucas De Marchi

Quoted 42 lines
drivers/gpu/drm/i915/intel_dp.c +3 -0
+}
+
+static bool icl_digital_port_connected(struct intel_encoder

*encoder)

drivers/gpu/drm/i915/intel_dp.c +2 -0
+{
+	struct drm_i915_private *dev_priv = to_i915(encoder-
Quoted 1 line

base.dev);

drivers/gpu/drm/i915/intel_dp.c +1 -0
+	struct intel_digital_port *dig_port =

enc_to_dig_port(&encoder->base);

drivers/gpu/drm/i915/intel_dp.c +5 -0
+
+	switch (encoder->hpd_pin) {
+	case HPD_PORT_A:
+	case HPD_PORT_B:
+		return icl_combo_port_connected(dev_priv,

dig_port);

drivers/gpu/drm/i915/intel_dp.c +13 -0
+	case HPD_PORT_C:
+	case HPD_PORT_D:
+	case HPD_PORT_E:
+	case HPD_PORT_F:
+		return icl_tc_port_connected(dev_priv, dig_port);
+	default:
+		MISSING_CASE(encoder->hpd_pin);
+		return false;
+	}
+}
+
 /*
  * intel_digital_port_connected - is the specified port connected?
  * @encoder: intel_encoder
@@ -4749,6 +4804,8 @@ bool intel_digital_port_connected(struct
 intel_encoder *encoder)
 		return bdw_digital_port_connected(encoder);
 	else if (IS_GEN9_LP(dev_priv))
 		return bxt_digital_port_connected(encoder);
+	else if (IS_ICELAKE(dev_priv))
+		return icl_digital_port_connected(encoder);
 	else
 		return spt_digital_port_connected(encoder);

}

Signature · 1 line
2.14.3
Quoted 4 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#72 lore raw

PATCH 19/24 drm/i915/icl: store the port type for TC ports

In reply to Paulo Zanoni

The type is detected based on the interrupt ISR bit. Once detected, it's not supposed to be changed, so we have some sanity checks for that.

---
 drivers/gpu/drm/i915/intel_display.h |  7 +++++++
 drivers/gpu/drm/i915/intel_dp.c      | 36 +++++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/intel_drv.h     |  1 +
 3 files changed, 43 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.h +7 -0
index c88185ed7594..fcedc600706b 100644
@@ -137,6 +137,13 @@ enum tc_port {
 	I915_MAX_TC_PORTS
 };
 
+enum tc_port_type {
+	TC_PORT_UNKNOWN = 0,
+	TC_PORT_TYPEC,
+	TC_PORT_TBT,
+	TC_PORT_LEGACY,
+};
+
 enum dpio_channel {
 	DPIO_CH0,
 	DPIO_CH1
drivers/gpu/drm/i915/intel_dp.c +35 -1
index b477124717e7..f3d5b9eed625 100644
@@ -4730,6 +4730,38 @@ static bool icl_combo_port_connected(struct drm_i915_private *dev_priv,
 	return I915_READ(ICP_SDE_ISR) & ICP_DDI_HOTPLUG(port);
 }
 
+static void icl_update_tc_port_type(struct drm_i915_private *dev_priv,
+				    struct intel_digital_port *intel_dig_port,
+				    bool is_legacy, bool is_typec, bool is_tbt)
+{
+	enum port port = intel_dig_port->base.port;
+	enum tc_port_type old_type = intel_dig_port->tc_type;
+	const char *type_str;
+
+	WARN_ON(is_legacy + is_typec + is_tbt != 1);
+
+	if (is_legacy) {
+		intel_dig_port->tc_type = TC_PORT_LEGACY;
+		type_str = "legacy";
+	} else if (is_typec) {
+		intel_dig_port->tc_type = TC_PORT_TYPEC;
+		type_str = "typec";
+	} else if (is_tbt) {
+		intel_dig_port->tc_type = TC_PORT_TBT;
+		type_str = "tbt";
+	} else {
+		return;
+	}
+
+	/* Types are not supposed to be changed at runtime. */
+	WARN_ON(old_type != TC_PORT_UNKNOWN &&
+		old_type != intel_dig_port->tc_type);
+
+	if (old_type != intel_dig_port->tc_type)
+		DRM_DEBUG_KMS("Port %c has TC type %s\n", port_name(port),
+			      type_str);
+}
+
 static bool icl_tc_port_connected(struct drm_i915_private *dev_priv,
 				  struct intel_digital_port *intel_dig_port)
 {
@@ -4750,10 +4782,12 @@ static bool icl_tc_port_connected(struct drm_i915_private *dev_priv,
 	if (cpu_isr & tbt_bit)
 		is_tbt = true;
 
-	WARN_ON(is_legacy + is_typec + is_tbt > 1);
 	if (!is_legacy && !is_typec && !is_tbt)
 		return false;
 
+	icl_update_tc_port_type(dev_priv, intel_dig_port, is_legacy, is_typec,
+				is_tbt);
+
 	return true;
 }
 
drivers/gpu/drm/i915/intel_drv.h +1 -0
index a54232c270e1..8602f2e17d86 100644
@@ -1169,6 +1169,7 @@ struct intel_digital_port {
 	bool release_cl2_override;
 	uint8_t max_lanes;
 	enum intel_display_power_domain ddi_io_power_domain;
+	enum tc_port_type tc_type;
 
 	void (*write_infoframe)(struct drm_encoder *encoder,
 				const struct intel_crtc_state *crtc_state,
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer
#73 lore raw

Re: [PATCH 19/24] drm/i915/icl: store the port type for TC ports

Quoted 75 lines · Paulo Zanoni

The type is detected based on the interrupt ISR bit. Once detected, it's not supposed to be changed, so we have some sanity checks for that.

---
 drivers/gpu/drm/i915/intel_display.h |  7 +++++++
 drivers/gpu/drm/i915/intel_dp.c      | 36 +++++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/intel_drv.h     |  1 +
 3 files changed, 43 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.h +7 -0
index c88185ed7594..fcedc600706b 100644
@@ -137,6 +137,13 @@ enum tc_port {
 	I915_MAX_TC_PORTS
 };
 
+enum tc_port_type {
+	TC_PORT_UNKNOWN = 0,
+	TC_PORT_TYPEC,
+	TC_PORT_TBT,
+	TC_PORT_LEGACY,
+};
+
 enum dpio_channel {
 	DPIO_CH0,
 	DPIO_CH1
drivers/gpu/drm/i915/intel_dp.c +32 -0
index b477124717e7..f3d5b9eed625 100644
@@ -4730,6 +4730,38 @@ static bool icl_combo_port_connected(struct drm_i915_private *dev_priv,
 	return I915_READ(ICP_SDE_ISR) & ICP_DDI_HOTPLUG(port);
 }
 
+static void icl_update_tc_port_type(struct drm_i915_private *dev_priv,
+				    struct intel_digital_port *intel_dig_port,
+				    bool is_legacy, bool is_typec, bool is_tbt)
+{
+	enum port port = intel_dig_port->base.port;
+	enum tc_port_type old_type = intel_dig_port->tc_type;
+	const char *type_str;
+
+	WARN_ON(is_legacy + is_typec + is_tbt != 1);
+
+	if (is_legacy) {
+		intel_dig_port->tc_type = TC_PORT_LEGACY;
+		type_str = "legacy";
+	} else if (is_typec) {
+		intel_dig_port->tc_type = TC_PORT_TYPEC;
+		type_str = "typec";
+	} else if (is_tbt) {
+		intel_dig_port->tc_type = TC_PORT_TBT;
+		type_str = "tbt";
+	} else {
+		return;
+	}
+
+	/* Types are not supposed to be changed at runtime. */
+	WARN_ON(old_type != TC_PORT_UNKNOWN &&
+		old_type != intel_dig_port->tc_type);
+
+	if (old_type != intel_dig_port->tc_type)
+		DRM_DEBUG_KMS("Port %c has TC type %s\n", port_name(port),
+			      type_str);
+}
+
 static bool icl_tc_port_connected(struct drm_i915_private *dev_priv,
 				  struct intel_digital_port *intel_dig_port)
 {

drivers/gpu/drm/i915/intel_dp.c static bool icl_tc_port_connected(struct drm_i915_private *dev_priv, · line 4789

Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +2 -1
@@ -4750,10 +4782,12 @@ static bool icl_tc_port_connected(struct drm_i915_private *dev_priv,
 	if (cpu_isr & tbt_bit)
 		is_tbt = true;
 
-	WARN_ON(is_legacy + is_typec + is_tbt > 1);
 	if (!is_legacy && !is_typec && !is_tbt)
 		return false;
 
+	icl_update_tc_port_type(dev_priv, intel_dig_port, is_legacy, is_typec,
+				is_tbt);

I really don't like the new chain of functions this patch here starts.

for all other platforms the function is_port_connect returns true or false immediately. For this TC/TBT design this start a new chain that not only check if it is connected but it also updates the status... and all in a chain of function calls....

I didn't check the code now actually. I just remember for one rebase change that I did a while ago and saw these patches. Unfortunately I had no better idea on when exactly call the current status when I looked.

Probably a totally separated function that is called outside right always along with is_port_connected

update_tc_port()
is_port_connected()

just to keep is_port_connect as simple as it is on any other platform and this new meaning of status update in a separated block.

Thanks,
Rodrigo.

Quoted 23 lines
drivers/gpu/drm/i915/intel_dp.c +1 -0
+
 	return true;
 }
 
drivers/gpu/drm/i915/intel_drv.h +1 -0
index a54232c270e1..8602f2e17d86 100644
@@ -1169,6 +1169,7 @@ struct intel_digital_port {
 	bool release_cl2_override;
 	uint8_t max_lanes;
 	enum intel_display_power_domain ddi_io_power_domain;
+	enum tc_port_type tc_type;
 
 	void (*write_infoframe)(struct drm_encoder *encoder,
 				const struct intel_crtc_state *crtc_state,
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#74 lore raw

Re: [PATCH 19/24] drm/i915/icl: store the port type for TC ports

Em Qui, 2018-06-14 às 12:59 -0700, Rodrigo Vivi escreveu:

Quoted 94 lines · Paulo Zanoni
Quoted 93 lines

The type is detected based on the interrupt ISR bit. Once detected, it's not supposed to be changed, so we have some sanity checks for that.

---
 drivers/gpu/drm/i915/intel_display.h |  7 +++++++
 drivers/gpu/drm/i915/intel_dp.c      | 36
+++++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/intel_drv.h     |  1 +
 3 files changed, 43 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.h +7 -0
index c88185ed7594..fcedc600706b 100644
@@ -137,6 +137,13 @@ enum tc_port {
 	I915_MAX_TC_PORTS
 };
 
+enum tc_port_type {
+	TC_PORT_UNKNOWN = 0,
+	TC_PORT_TYPEC,
+	TC_PORT_TBT,
+	TC_PORT_LEGACY,
+};
+
 enum dpio_channel {
 	DPIO_CH0,
 	DPIO_CH1
drivers/gpu/drm/i915/intel_dp.c +3 -0
index b477124717e7..f3d5b9eed625 100644
@@ -4730,6 +4730,38 @@ static bool icl_combo_port_connected(struct
 drm_i915_private *dev_priv,
 	return I915_READ(ICP_SDE_ISR) & ICP_DDI_HOTPLUG(port);
 }
 
+static void icl_update_tc_port_type(struct drm_i915_private
 *dev_priv,
+				    struct intel_digital_port
 *intel_dig_port,
+				    bool is_legacy, bool is_typec,

bool is_tbt)

drivers/gpu/drm/i915/intel_dp.c +26 -0
+{
+	enum port port = intel_dig_port->base.port;
+	enum tc_port_type old_type = intel_dig_port->tc_type;
+	const char *type_str;
+
+	WARN_ON(is_legacy + is_typec + is_tbt != 1);
+
+	if (is_legacy) {
+		intel_dig_port->tc_type = TC_PORT_LEGACY;
+		type_str = "legacy";
+	} else if (is_typec) {
+		intel_dig_port->tc_type = TC_PORT_TYPEC;
+		type_str = "typec";
+	} else if (is_tbt) {
+		intel_dig_port->tc_type = TC_PORT_TBT;
+		type_str = "tbt";
+	} else {
+		return;
+	}
+
+	/* Types are not supposed to be changed at runtime. */
+	WARN_ON(old_type != TC_PORT_UNKNOWN &&
+		old_type != intel_dig_port->tc_type);
+
+	if (old_type != intel_dig_port->tc_type)
+		DRM_DEBUG_KMS("Port %c has TC type %s\n",

port_name(port),

drivers/gpu/drm/i915/intel_dp.c +3 -0
+			      type_str);
+}
+
 static bool icl_tc_port_connected(struct drm_i915_private

*dev_priv,
struct intel_digital_port
*intel_dig_port)
{

drivers/gpu/drm/i915/intel_dp.c +0 -1
@@ -4750,10 +4782,12 @@ static bool icl_tc_port_connected(struct
 drm_i915_private *dev_priv,
 	if (cpu_isr & tbt_bit)
 		is_tbt = true;
 
-	WARN_ON(is_legacy + is_typec + is_tbt > 1);
 	if (!is_legacy && !is_typec && !is_tbt)
 		return false;
 
Quoted 6 lines

drivers/gpu/drm/i915/intel_dp.c static bool icl_tc_port_connected(struct · line 4791

Quoted 3 lines
drivers/gpu/drm/i915/intel_dp.c +2 -0
+	icl_update_tc_port_type(dev_priv, intel_dig_port,
 is_legacy, is_typec,
+				is_tbt);

I really don't like the new chain of functions this patch here starts.

I don't like it either, but the hardware changed in a way that is different from every previous platform.

Quoted 8 lines

for all other platforms the function is_port_connect returns true or false
immediately. For this TC/TBT design this start a new chain that not only
check if it is connected but it also updates the status... and all in a
chain of function calls....

We have to figure out the port type (in case it's tc) during the hotplug anyway since that's part of the hotplug sequence, for the DFLEXDP* dance. If we keep passing it as a local variable and opt to do later, we'll have to re-read the ISR bits anyway and we'll have to do it right after. I don't see how that would actually help anything: it could only increase the risk of de-sync when functions get moved around.

Quoted 6 lines

I didn't check the code now actually. I just remember for one rebase change that I did a while ago and saw these patches. Unfortunately I had no better idea on when exactly call the current status when I looked.

Quoted 6 lines

Probably a totally separated function that is called outside right always
along with is_port_connected

update_tc_port()
is_port_connected()

This would need to be in the inverse order and it would pretty much just re-read the ISR bits again. Doable, but wouldn't solve the main problem you complain about: is_connected() would still do a lot more than just reading the ISR bits, in fact it would look exactly the same as right now except it wouldn't set dig_port->tc_type.

Quoted 3 lines

just to keep is_port_connect as simple as it is on any other platform and this new meaning of status update in a separated block.

This is not possible due to the DFLEXDP* dance. I think you're mad at the DFLEXDP* dance and is unleashing your rage at poor dig_port-

Quoted 1 line

tc_type.

Please read the rest of the series and tell me what you think should really be done here. Open review comments like "this is bad but I haven't read the other patches in order to formulate a proper suggestion" don't help very much.

Thanks,
Paulo

Quoted 25 lines

Thanks,
Rodrigo.

Quoted 21 lines
drivers/gpu/drm/i915/intel_dp.c +1 -0
+
 	return true;

}

drivers/gpu/drm/i915/intel_drv.h +1 -0
index a54232c270e1..8602f2e17d86 100644
@@ -1169,6 +1169,7 @@ struct intel_digital_port {
 	bool release_cl2_override;
 	uint8_t max_lanes;
 	enum intel_display_power_domain ddi_io_power_domain;
+	enum tc_port_type tc_type;
 
 	void (*write_infoframe)(struct drm_encoder *encoder,
 				const struct intel_crtc_state

*crtc_state,

Signature · 1 line
2.14.3
Quoted 4 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#75 lore raw

PATCH 20/24 drm/i915/icl: implement the tc/legacy HPD {dis, }connect flow for DP

In reply to Paulo Zanoni

Implement the DFLEXDPPMS/DFLEXDPCSSS dance for DisplayPort. These functions need to be called during HPD assert/deassert, but due to how our driver works it's much simpler if we always call them when icl_digital_port_connected() is called, which means we won't call them exactly once per HPD event. This should also cover the connected boot case, whatever the BIOS does.

We're still missing the HDMI case, which should be implemented in the next patch.

Also notice that, today, the BSpec pages for the DFLEXDPPMS and DFLEXDPCSSS registers are wrong, so you should only trust the flows described by the "Gen11 TypeC Programming" page in our spec.

---
 drivers/gpu/drm/i915/i915_reg.h |  6 +++++
 drivers/gpu/drm/i915/intel_dp.c | 57 ++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 62 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_reg.h +6 -0
index 24308d4435f5..42cbace4c61e 100644
@@ -10027,4 +10027,10 @@ enum skl_power_gate {
 						 _ICL_PHY_MISC_B)
 #define  ICL_PHY_MISC_DE_IO_COMP_PWR_DOWN	(1 << 23)
 
+#define PORT_TX_DFLEXDPPMS				_MMIO(0x163890)
+#define   DP_PHY_MODE_STATUS_COMPLETED(tc_port)		(1 << (tc_port))
+
+#define PORT_TX_DFLEXDPCSSS				_MMIO(0x163894)
+#define   DP_PHY_MODE_STATUS_NOT_SAFE(tc_port)		(1 << (tc_port))
+
 #endif /* _I915_REG_H_ */
drivers/gpu/drm/i915/intel_dp.c +56 -1

74 lines not on this page · raw message

Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#76 lore raw

Re: [PATCH 20/24] drm/i915/icl: implement the tc/legacy HPD {dis, }connect flow for DP

Quoted 57 lines

-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Paulo Zanoni
Sent: Monday, May 21, 2018 5:26 PM
To: [email protected]
Cc: Zanoni, Paulo R <[email protected]>
Subject: [Intel-gfx] [PATCH 20/24] drm/i915/icl: implement the tc/legacy HPD {dis, }connect flow for DP

Implement the DFLEXDPPMS/DFLEXDPCSSS dance for DisplayPort. These functions need to be called during HPD assert/deassert, but due to how our driver works it's much simpler if we always call them when icl_digital_port_connected() is called, which means we won't call them exactly once per HPD event. This should also cover the connected boot case, whatever the BIOS does.

We're still missing the HDMI case, which should be implemented in the next patch.

Also notice that, today, the BSpec pages for the DFLEXDPPMS and DFLEXDPCSSS registers are wrong, so you should only trust the flows described by the "Gen11 TypeC Programming" page in our spec.

---
drivers/gpu/drm/i915/i915_reg.h | 6 +++++ drivers/gpu/drm/i915/intel_dp.c | 57 ++++++++++++++++++++++++++++++++++++++++-

2 files changed, 62 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_reg.h +2 -0
index 24308d4435f5..42cbace4c61e 100644
@@ -10027,4 +10027,10 @@ enum skl_power_gate {
 						 _ICL_PHY_MISC_B)
 #define  ICL_PHY_MISC_DE_IO_COMP_PWR_DOWN	(1 << 23)
 
+#define PORT_TX_DFLEXDPPMS
 	_MMIO(0x163890)
+#define   DP_PHY_MODE_STATUS_COMPLETED(tc_port)		(1 <<

(tc_port))

drivers/gpu/drm/i915/i915_reg.h +2 -0
+
+#define PORT_TX_DFLEXDPCSSS
	_MMIO(0x163894)
drivers/gpu/drm/i915/i915_reg.h +2 -0
+#define   DP_PHY_MODE_STATUS_NOT_SAFE(tc_port)		(1 << (tc_port))
+

#endif /* _I915_REG_H_ */

drivers/gpu/drm/i915/intel_dp.c +0 -0
index f3d5b9eed625..f25f871e7c22 100644
@@ -4762,6 +4762,56 @@ static void icl_update_tc_port_type(struct
 drm_i915_private *dev_priv,
 			      type_str);

drivers/gpu/drm/i915/intel_dp.c static void icl_update_tc_port_type(struct · line 4773

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +8 -0
 }
 
+static bool icl_tc_phy_mode_status_connect(struct drm_i915_private *dev_priv,
+					   struct intel_digital_port *dig_port) {
+	enum tc_port tc_port = intel_port_to_tc(dev_priv, dig_port->base.port);
+	u32 val;
+
+	if (dig_port->tc_type != TC_PORT_LEGACY &&
+	    dig_port->tc_type != TC_PORT_TYPEC)
+		return true;

Shouldn’t this return false?

Quoted 23 lines
drivers/gpu/drm/i915/intel_dp.c +22 -0
+	val = I915_READ(PORT_TX_DFLEXDPPMS);
+	if (!(val & DP_PHY_MODE_STATUS_COMPLETED(tc_port))) {
+		DRM_ERROR("DP PHY for TC port %d not ready\n", tc_port);
+		return false;
+	}
+
+	/*
+	 * This function may be called many times in a row without an HPD event
+	 * in between, so try to avoid the write when we can.
+	 */
+	val = I915_READ(PORT_TX_DFLEXDPCSSS);
+	if (!(val & DP_PHY_MODE_STATUS_NOT_SAFE(tc_port))) {
+		val |= DP_PHY_MODE_STATUS_NOT_SAFE(tc_port);
+		I915_WRITE(PORT_TX_DFLEXDPCSSS, val);
+	}
+
+	return true;
+}
+
+static void icl_tc_phy_mode_status_disconnect(struct drm_i915_private
 *dev_priv,
+					      struct intel_digital_port *dig_port) {
+	enum tc_port tc_port = intel_port_to_tc(dev_priv, dig_port->base.port);

drivers/gpu/drm/i915/intel_dp.c static void icl_update_tc_port_type(struct drm_i915_private *dev_priv, · line 4807

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +10 -0
+	u32 val;
+
+	if (dig_port->tc_type != TC_PORT_LEGACY &&
+	    dig_port->tc_type != TC_PORT_TYPEC)
+		return;
+
+	/*
+	 * This function may be called many times in a row without an HPD event
+	 * in between, so try to avoid the write when we can.
+	 */

So, in the sequences to enable, it does tell that enabling suitable aux power domains is optional. But in the disable sequence, disable AUX_PWR is mentioned as a non-optional step. In which case it has to be before we set DFLEXDPCSSS register to 0.

Is it being addressed in another patch?

The rest of the patch looks good.

Anusha

Quoted 29 lines
drivers/gpu/drm/i915/intel_dp.c +7 -0
+	val = I915_READ(PORT_TX_DFLEXDPCSSS);
+	if (val & DP_PHY_MODE_STATUS_NOT_SAFE(tc_port)) {
+		val &= ~DP_PHY_MODE_STATUS_NOT_SAFE(tc_port);
+		I915_WRITE(PORT_TX_DFLEXDPCSSS, val);
+	}
+}
+
 static bool icl_tc_port_connected(struct drm_i915_private *dev_priv,

struct intel_digital_port *intel_dig_port) { @@
-4782,12 +4832,17 @@ static bool icl_tc_port_connected(struct drm_i915_private *dev_priv,

	if (cpu_isr & tbt_bit)
		is_tbt = true;
drivers/gpu/drm/i915/intel_dp.c +2 -1
-	if (!is_legacy && !is_typec && !is_tbt)
+	if (!is_legacy && !is_typec && !is_tbt) {
+		icl_tc_phy_mode_status_disconnect(dev_priv, intel_dig_port);
		return false;
drivers/gpu/drm/i915/intel_dp.c +1 -0
+	}
	icl_update_tc_port_type(dev_priv, intel_dig_port, is_legacy, is_typec,
				is_tbt);
drivers/gpu/drm/i915/intel_dp.c +3 -0
+	if (!icl_tc_phy_mode_status_connect(dev_priv, intel_dig_port))
+		return false;
+
	return true;
}
Quoted 7 lines

--
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#77 lore raw

Re: [PATCH 20/24] drm/i915/icl: implement the tc/legacy HPD {dis, }connect flow for DP

Em Qui, 2018-06-21 às 15:04 -0700, Srivatsa, Anusha escreveu:

Quoted 70 lines
Quoted 70 lines

-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of
Paulo Zanoni
Sent: Monday, May 21, 2018 5:26 PM
To: [email protected]
Cc: Zanoni, Paulo R <[email protected]>
Subject: [Intel-gfx] [PATCH 20/24] drm/i915/icl: implement the tc/legacy HPD
{dis, }connect flow for DP

Implement the DFLEXDPPMS/DFLEXDPCSSS dance for DisplayPort. These functions need to be called during HPD assert/deassert, but due to how our driver
works it's much simpler if we always call them when icl_digital_port_connected() is called, which means we won't call them exactly
once per HPD event. This should also cover the connected boot case, whatever
the BIOS does.

We're still missing the HDMI case, which should be implemented in the next
patch.

Also notice that, today, the BSpec pages for the DFLEXDPPMS and DFLEXDPCSSS
registers are wrong, so you should only trust the flows described by the "Gen11
TypeC Programming" page in our spec.

---
drivers/gpu/drm/i915/i915_reg.h | 6
+++++ drivers/gpu/drm/i915/intel_dp.c |
57 ++++++++++++++++++++++++++++++++++++++++-

2 files changed, 62 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_reg.h +2 -0
index 24308d4435f5..42cbace4c61e 100644
@@ -10027,4 +10027,10 @@ enum skl_power_gate {
 						 _ICL_PHY_MISC_B)
 #define  ICL_PHY_MISC_DE_IO_COMP_PWR_DOWN	(1 << 23)
 
+#define PORT_TX_DFLEXDPPMS
 	_MMIO(0x163890)
+#define   DP_PHY_MODE_STATUS_COMPLETED(tc_port)		(1

<<
(tc_port))

drivers/gpu/drm/i915/i915_reg.h +2 -0
+
+#define PORT_TX_DFLEXDPCSSS
	_MMIO(0x163894)

+#define DP_PHY_MODE_STATUS_NOT_SAFE(tc_port) (1
<< (tc_port))
+
#endif /* _I915_REG_H_ */

drivers/gpu/drm/i915/intel_dp.c +0 -0
index f3d5b9eed625..f25f871e7c22 100644
@@ -4762,6 +4762,56 @@ static void icl_update_tc_port_type(struct
 drm_i915_private *dev_priv,
 			      type_str);
 }
 
Quoted 13 lines

drivers/gpu/drm/i915/intel_dp.c static void icl_update_tc_port_type(struct drm_i915_private *dev_priv, · line 4773

Quoted 11 lines
drivers/gpu/drm/i915/intel_dp.c +3 -0
+static bool icl_tc_phy_mode_status_connect(struct drm_i915_private
 *dev_priv,
+					   struct
 intel_digital_port *dig_port) {
+	enum tc_port tc_port = intel_port_to_tc(dev_priv,

dig_port->base.port);

drivers/gpu/drm/i915/intel_dp.c +5 -0
+	u32 val;
+
+	if (dig_port->tc_type != TC_PORT_LEGACY &&
+	    dig_port->tc_type != TC_PORT_TYPEC)
+		return true;

Shouldn’t this return false?

Types that don't need to run this sequence can be considered connected, so we return true.

Quoted 46 lines
Quoted 38 lines
drivers/gpu/drm/i915/intel_dp.c +3 -0
+	val = I915_READ(PORT_TX_DFLEXDPPMS);
+	if (!(val & DP_PHY_MODE_STATUS_COMPLETED(tc_port))) {
+		DRM_ERROR("DP PHY for TC port %d not ready\n",

tc_port);

drivers/gpu/drm/i915/intel_dp.c +5 -0
+		return false;
+	}
+
+	/*
+	 * This function may be called many times in a row without

an HPD event

drivers/gpu/drm/i915/intel_dp.c +12 -0
+	 * in between, so try to avoid the write when we can.
+	 */
+	val = I915_READ(PORT_TX_DFLEXDPCSSS);
+	if (!(val & DP_PHY_MODE_STATUS_NOT_SAFE(tc_port))) {
+		val |= DP_PHY_MODE_STATUS_NOT_SAFE(tc_port);
+		I915_WRITE(PORT_TX_DFLEXDPCSSS, val);
+	}
+
+	return true;
+}
+
+static void icl_tc_phy_mode_status_disconnect(struct

drm_i915_private
*dev_priv,

drivers/gpu/drm/i915/intel_dp.c +1 -0
+					      struct

intel_digital_port *dig_port) {

drivers/gpu/drm/i915/intel_dp.c +1 -0
+	enum tc_port tc_port = intel_port_to_tc(dev_priv,

dig_port->base.port);

drivers/gpu/drm/i915/intel_dp.c +8 -0
+	u32 val;
+
+	if (dig_port->tc_type != TC_PORT_LEGACY &&
+	    dig_port->tc_type != TC_PORT_TYPEC)
+		return;
+
+	/*
+	 * This function may be called many times in a row without

an HPD event

drivers/gpu/drm/i915/intel_dp.c

Quoted 2 lines
drivers/gpu/drm/i915/intel_dp.c +2 -0
+	 * in between, so try to avoid the write when we can.
+	 */

So, in the sequences to enable, it does tell that enabling suitable aux power domains is optional. But in the disable sequence, disable AUX_PWR is mentioned as a non-optional step.
In which case it has to be before we set DFLEXDPCSSS register to 0.

Quoted 1 line

Is it being addressed in another patch?

It should be disabled here because we're not using the port anymore at this point.

Quoted 39 lines

The rest of the patch looks good.

Anusha

Quoted 34 lines
drivers/gpu/drm/i915/intel_dp.c +7 -0
+	val = I915_READ(PORT_TX_DFLEXDPCSSS);
+	if (val & DP_PHY_MODE_STATUS_NOT_SAFE(tc_port)) {
+		val &= ~DP_PHY_MODE_STATUS_NOT_SAFE(tc_port);
+		I915_WRITE(PORT_TX_DFLEXDPCSSS, val);
+	}
+}
+

static bool icl_tc_port_connected(struct drm_i915_private *dev_priv,
struct intel_digital_port
*intel_dig_port) { @@
-4782,12 +4832,17 @@ static bool icl_tc_port_connected(struct drm_i915_private *dev_priv,

	if (cpu_isr & tbt_bit)
		is_tbt = true;
drivers/gpu/drm/i915/intel_dp.c +2 -1
-	if (!is_legacy && !is_typec && !is_tbt)
+	if (!is_legacy && !is_typec && !is_tbt) {
+		icl_tc_phy_mode_status_disconnect(dev_priv,
intel_dig_port);
		return false;
drivers/gpu/drm/i915/intel_dp.c +1 -0
+	}

icl_update_tc_port_type(dev_priv, intel_dig_port, is_legacy,
is_typec,

				is_tbt);
drivers/gpu/drm/i915/intel_dp.c +1 -0
+	if (!icl_tc_phy_mode_status_connect(dev_priv,

intel_dig_port))

drivers/gpu/drm/i915/intel_dp.c +2 -0
+		return false;
+
	return true;
}
Quoted 7 lines
Quoted 7 lines

--
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#78 lore raw

PATCH 21/24 drm/i915/icl: implement the legacy HPD {dis, }connect flow for HDMI

In reply to Paulo Zanoni

Just like DP, HDMI needs to implement these flows. The side effect is that HDMI is now going to rely on the ISR bits, just like DP.

[Rodrigo: non-trivial rebase.]
---
 drivers/gpu/drm/i915/intel_hdmi.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_hdmi.c +8 -3
index 53ac8bb85218..75f02a0e7d39 100644
@@ -1893,21 +1893,26 @@ intel_hdmi_set_edid(struct drm_connector *connector)
 static enum drm_connector_status
 intel_hdmi_detect(struct drm_connector *connector, bool force)
 {
-	enum drm_connector_status status;
+	enum drm_connector_status status = connector_status_disconnected;
 	struct drm_i915_private *dev_priv = to_i915(connector->dev);
+	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
+	struct intel_encoder *encoder = &hdmi_to_dig_port(intel_hdmi)->base;
 
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
 		      connector->base.id, connector->name);
 
 	intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
 
+	if (IS_ICELAKE(dev_priv) &&
+	    !intel_digital_port_connected(encoder))
+		goto out;
+
 	intel_hdmi_unset_edid(connector);
 
 	if (intel_hdmi_set_edid(connector))
 		status = connector_status_connected;
-	else
-		status = connector_status_disconnected;
 
+out:
 	intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
 
 	return status;
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 21/24
#79 lore raw

Re: [PATCH 21/24] drm/i915/icl: implement the legacy HPD {dis, }connect flow for HDMI

the patch looks fine to me.

Quoted 3 lines · Paulo Zanoni

Just like DP, HDMI needs to implement these flows. The side effect is that HDMI is now going to rely on the ISR bits, just like DP.

Quoted 46 lines
[Rodrigo: non-trivial rebase.]

---
 drivers/gpu/drm/i915/intel_hdmi.c | 11 ++++++++---

 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_hdmi.c +0 -0
index 53ac8bb85218..75f02a0e7d39 100644
@@ -1893,21 +1893,26 @@ intel_hdmi_set_edid(struct drm_connector
 *connector)

 static enum drm_connector_status intel_hdmi_detect(struct drm_connector *connector, bool force) {

drivers/gpu/drm/i915/intel_hdmi.c +1 -1
-	enum drm_connector_status status;
+	enum drm_connector_status status =

connector_status_disconnected;
  struct drm_i915_private *dev_priv = to_i915(connector->dev);

drivers/gpu/drm/i915/intel_hdmi.c +1 -0
+	struct intel_hdmi *intel_hdmi =

intel_attached_hdmi(connector);

drivers/gpu/drm/i915/intel_hdmi.c +1 -0
+	struct intel_encoder *encoder =

&hdmi_to_dig_port(intel_hdmi)->base;

  DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id, connector->name);
  intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);

drivers/gpu/drm/i915/intel_hdmi.c +4 -0
+	if (IS_ICELAKE(dev_priv) &&
+	    !intel_digital_port_connected(encoder))
+		goto out;
+

  intel_hdmi_unset_edid(connector);

  if (intel_hdmi_set_edid(connector)) status = connector_status_connected;

drivers/gpu/drm/i915/intel_hdmi.c +0 -2
-	else
-		status = connector_status_disconnected;


+out:
  intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
  return status;

Signature · 6 lines
Mika Kahola - Intel OTC

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#80 lore raw

PATCH 22/24 drm/i915/icl: Update FIA supported lane count for hpd.

In reply to Paulo Zanoni

From: Animesh Manna <[email protected]>

In ICL, Flexible IO Adapter (FIA) muxes data and clocks of USB 3.1, tbt and display controller. In DP alt mode FIA configure the number of lanes and will be used apart from DPCD read to calculate max available lanes for DP enablement.

[Paulo: significant rewrite of the patch.]
---
 drivers/gpu/drm/i915/i915_reg.h |  5 +++++
 drivers/gpu/drm/i915/intel_dp.c | 33 ++++++++++++++++++++++++++++++++-
 2 files changed, 37 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_reg.h +5 -0
index 42cbace4c61e..2a501e7590bf 100644
@@ -10033,4 +10033,9 @@ enum skl_power_gate {
 #define PORT_TX_DFLEXDPCSSS				_MMIO(0x163894)
 #define   DP_PHY_MODE_STATUS_NOT_SAFE(tc_port)		(1 << (tc_port))
 
+#define PORT_TX_DFLEXDPSP			_MMIO(0x1638A0)
+#define   DP_LANE_ASSIGNMENT_SHIFT(tc_port)	((tc_port) * 8)
+#define   DP_LANE_ASSIGNMENT_MASK(tc_port)	(0xf << ((tc_port) * 8))
+#define   DP_LANE_ASSIGNMENT(tc_port, x)	((x) << ((tc_port) * 8))
+
 #endif /* _I915_REG_H_ */
drivers/gpu/drm/i915/intel_dp.c +32 -1
index f25f871e7c22..a883a3264e56 100644
@@ -176,14 +176,45 @@ static int intel_dp_max_common_rate(struct intel_dp *intel_dp)
 	return intel_dp->common_rates[intel_dp->num_common_rates - 1];
 }
 
+static int intel_dp_get_fia_supported_lane_count(struct intel_dp *intel_dp)
+{
+	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
+	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
+	enum tc_port tc_port = intel_port_to_tc(dev_priv, dig_port->base.port);
+	u32 lane_info;
+
+	if (tc_port == PORT_TC_NONE || dig_port->tc_type != TC_PORT_TYPEC)
+		return 4;
+
+	lane_info = (I915_READ(PORT_TX_DFLEXDPSP) &
+		     DP_LANE_ASSIGNMENT_MASK(tc_port)) >>
+		    DP_LANE_ASSIGNMENT_SHIFT(tc_port);
+
+	switch (lane_info) {
+	default:
+		MISSING_CASE(lane_info);
+	case 1:
+	case 2:
+	case 4:
+	case 8:
+		return 1;
+	case 3:
+	case 12:
+		return 2;
+	case 15:
+		return 4;
+	}
+}
+
 /* Theoretical max between source and sink */
 static int intel_dp_max_common_lane_count(struct intel_dp *intel_dp)
 {
 	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
 	int source_max = intel_dig_port->max_lanes;
 	int sink_max = drm_dp_max_lane_count(intel_dp->dpcd);
+	int fia_max = intel_dp_get_fia_supported_lane_count(intel_dp);
 
-	return min(source_max, sink_max);
+	return min3(source_max, sink_max, fia_max);
 }
 
 int intel_dp_max_lane_count(struct intel_dp *intel_dp)
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 22/24
#81 lore raw

Re: [PATCH 22/24] drm/i915/icl: Update FIA supported lane count for hpd.

Quoted 12 lines

-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Paulo Zanoni
Sent: Monday, May 21, 2018 5:26 PM
To: [email protected]
Cc: Zanoni, Paulo R <[email protected]>
Subject: [Intel-gfx] [PATCH 22/24] drm/i915/icl: Update FIA supported lane count for hpd.

From: Animesh Manna <[email protected]>

Quoted 7 lines

In ICL, Flexible IO Adapter (FIA) muxes data and clocks of USB 3.1, tbt and display controller. In DP alt mode FIA configure the number of lanes and will be used apart from DPCD read to calculate max available lanes for DP enablement.

[Paulo: significant rewrite of the patch.]

Looks good.

Quoted 72 lines

---
drivers/gpu/drm/i915/i915_reg.h | 5 +++++ drivers/gpu/drm/i915/intel_dp.c | 33 ++++++++++++++++++++++++++++++++-

2 files changed, 37 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_reg.h +5 -0
index 42cbace4c61e..2a501e7590bf 100644
@@ -10033,4 +10033,9 @@ enum skl_power_gate {
 #define PORT_TX_DFLEXDPCSSS				_MMIO(0x163894)
 #define   DP_PHY_MODE_STATUS_NOT_SAFE(tc_port)		(1 << (tc_port))
 
+#define PORT_TX_DFLEXDPSP			_MMIO(0x1638A0)
+#define   DP_LANE_ASSIGNMENT_SHIFT(tc_port)	((tc_port) * 8)
+#define   DP_LANE_ASSIGNMENT_MASK(tc_port)	(0xf << ((tc_port) * 8))
+#define   DP_LANE_ASSIGNMENT(tc_port, x)	((x) << ((tc_port) * 8))
+
 #endif /* _I915_REG_H_ */
drivers/gpu/drm/i915/intel_dp.c +32 -2
index f25f871e7c22..a883a3264e56 100644
@@ -176,14 +176,45 @@ static int intel_dp_max_common_rate(struct intel_dp
 *intel_dp)
 	return intel_dp->common_rates[intel_dp->num_common_rates - 1];  }
 
+static int intel_dp_get_fia_supported_lane_count(struct intel_dp
+*intel_dp) {
+	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
+	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
+	enum tc_port tc_port = intel_port_to_tc(dev_priv, dig_port->base.port);
+	u32 lane_info;
+
+	if (tc_port == PORT_TC_NONE || dig_port->tc_type != TC_PORT_TYPEC)
+		return 4;
+
+	lane_info = (I915_READ(PORT_TX_DFLEXDPSP) &
+		     DP_LANE_ASSIGNMENT_MASK(tc_port)) >>
+		    DP_LANE_ASSIGNMENT_SHIFT(tc_port);
+
+	switch (lane_info) {
+	default:
+		MISSING_CASE(lane_info);
+	case 1:
+	case 2:
+	case 4:
+	case 8:
+		return 1;
+	case 3:
+	case 12:
+		return 2;
+	case 15:
+		return 4;
+	}
+}
+
 /* Theoretical max between source and sink */  static int
 intel_dp_max_common_lane_count(struct intel_dp *intel_dp)  {
 	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
 	int source_max = intel_dig_port->max_lanes;
 	int sink_max = drm_dp_max_lane_count(intel_dp->dpcd);
+	int fia_max = intel_dp_get_fia_supported_lane_count(intel_dp);
 
-	return min(source_max, sink_max);
+	return min3(source_max, sink_max, fia_max);
 }
 
 int intel_dp_max_lane_count(struct intel_dp *intel_dp)
--

2.14.3

Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#82 lore raw

PATCH 23/24 drm/i915/icl: program MG_DP_MODE

In reply to Paulo Zanoni

Programming this register is part of the Enable Sequence for DisplayPort on ICL. Do as the spec says.

Cc Animesh Manna <[email protected]>
Cc Manasi Navare <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
---
 drivers/gpu/drm/i915/i915_reg.h  | 15 +++++++++
 drivers/gpu/drm/i915/intel_ddi.c |  2 ++
 drivers/gpu/drm/i915/intel_dp.c  | 66 ++++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h |  1 +
 4 files changed, 84 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +15 -0
index 2a501e7590bf..2ccae6c3e905 100644
@@ -1943,6 +1943,21 @@ enum i915_power_well_id {
 #define CRI_TXDEEMPH_OVERRIDE_5_0(x)			((x) << 16)
 #define CRI_TXDEEMPH_OVERRIDE_5_0_MASK			(0x3F << 16)
 
+#define _MG_DP_MODE_LN0_ACU_PORT1			0x1683A0
+#define _MG_DP_MODE_LN1_ACU_PORT1			0x1687A0
+#define _MG_DP_MODE_LN0_ACU_PORT2			0x1693A0
+#define _MG_DP_MODE_LN1_ACU_PORT2			0x1697A0
+#define _MG_DP_MODE_LN0_ACU_PORT3			0x16A3A0
+#define _MG_DP_MODE_LN1_ACU_PORT3			0x16A7A0
+#define _MG_DP_MODE_LN0_ACU_PORT4			0x16B3A0
+#define _MG_DP_MODE_LN1_ACU_PORT4			0x16B7A0
+#define MG_DP_MODE(port, ln)	\
+	_ICL_MG_PHY_PORT_LN(port, ln, _MG_DP_MODE_LN0_ACU_PORT1, \
+				      _MG_DP_MODE_LN0_ACU_PORT2, \
+				      _MG_DP_MODE_LN1_ACU_PORT1)
+#define   MG_DP_MODE_CFG_DP_X2_MODE			(1 << 7)
+#define   MG_DP_MODE_CFG_DP_X1_MODE			(1 << 6)
+
 /* The spec defines this only for BXT PHY0, but lets assume that this
  * would exist for PHY1 too if it had a second channel.
  */
drivers/gpu/drm/i915/intel_ddi.c +2 -0
index 1d5bfec57c33..c3c29565b863 100644
@@ -2667,6 +2667,8 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 
 	intel_display_power_get(dev_priv, dig_port->ddi_io_power_domain);
 
+	icl_program_mg_dp_mode(intel_dp);
+
 	if (IS_ICELAKE(dev_priv))
 		icl_ddi_vswing_sequence(encoder, level, encoder->type);
 	else if (IS_CANNONLAKE(dev_priv))
drivers/gpu/drm/i915/intel_dp.c +66 -0

72 lines not on this page · raw message

drivers/gpu/drm/i915/intel_drv.h +1 -0
index 8602f2e17d86..d04be4c1f30e 100644
@@ -1702,6 +1702,7 @@ void intel_edp_drrs_invalidate(struct drm_i915_private *dev_priv,
 			       unsigned int frontbuffer_bits);
 void intel_edp_drrs_flush(struct drm_i915_private *dev_priv,
 			  unsigned int frontbuffer_bits);
+void icl_program_mg_dp_mode(struct intel_dp *intel_dp);
 
 void
 intel_dp_program_link_training_pattern(struct intel_dp *intel_dp,
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#83 lore raw

Re: [PATCH 23/24] drm/i915/icl: program MG_DP_MODE

Op 22-05-18 om 02:25 schreef Paulo Zanoni:

Quoted 78 lines

Programming this register is part of the Enable Sequence for DisplayPort on ICL. Do as the spec says.

Cc Animesh Manna <[email protected]>
Cc Manasi Navare <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
---
 drivers/gpu/drm/i915/i915_reg.h  | 15 +++++++++
 drivers/gpu/drm/i915/intel_ddi.c |  2 ++
 drivers/gpu/drm/i915/intel_dp.c  | 66 ++++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h |  1 +
 4 files changed, 84 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +15 -0
index 2a501e7590bf..2ccae6c3e905 100644
@@ -1943,6 +1943,21 @@ enum i915_power_well_id {
 #define CRI_TXDEEMPH_OVERRIDE_5_0(x)			((x) << 16)
 #define CRI_TXDEEMPH_OVERRIDE_5_0_MASK			(0x3F << 16)
 
+#define _MG_DP_MODE_LN0_ACU_PORT1			0x1683A0
+#define _MG_DP_MODE_LN1_ACU_PORT1			0x1687A0
+#define _MG_DP_MODE_LN0_ACU_PORT2			0x1693A0
+#define _MG_DP_MODE_LN1_ACU_PORT2			0x1697A0
+#define _MG_DP_MODE_LN0_ACU_PORT3			0x16A3A0
+#define _MG_DP_MODE_LN1_ACU_PORT3			0x16A7A0
+#define _MG_DP_MODE_LN0_ACU_PORT4			0x16B3A0
+#define _MG_DP_MODE_LN1_ACU_PORT4			0x16B7A0
+#define MG_DP_MODE(port, ln)	\
+	_ICL_MG_PHY_PORT_LN(port, ln, _MG_DP_MODE_LN0_ACU_PORT1, \
+				      _MG_DP_MODE_LN0_ACU_PORT2, \
+				      _MG_DP_MODE_LN1_ACU_PORT1)
+#define   MG_DP_MODE_CFG_DP_X2_MODE			(1 << 7)
+#define   MG_DP_MODE_CFG_DP_X1_MODE			(1 << 6)
+
 /* The spec defines this only for BXT PHY0, but lets assume that this
  * would exist for PHY1 too if it had a second channel.
  */
drivers/gpu/drm/i915/intel_ddi.c +2 -0
index 1d5bfec57c33..c3c29565b863 100644
@@ -2667,6 +2667,8 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 
 	intel_display_power_get(dev_priv, dig_port->ddi_io_power_domain);
 
+	icl_program_mg_dp_mode(intel_dp);
+
 	if (IS_ICELAKE(dev_priv))
 		icl_ddi_vswing_sequence(encoder, level, encoder->type);
 	else if (IS_CANNONLAKE(dev_priv))
drivers/gpu/drm/i915/intel_dp.c +17 -0
index a883a3264e56..1228d6185f76 100644
@@ -229,6 +229,72 @@ intel_dp_link_required(int pixel_clock, int bpp)
 	return DIV_ROUND_UP(pixel_clock * bpp, 8);
 }
 
+void icl_program_mg_dp_mode(struct intel_dp *intel_dp)
+{
+	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
+	struct drm_i915_private *dev_priv = to_i915(intel_dp_to_dev(intel_dp));
+	enum port port = intel_dig_port->base.port;
+	enum tc_port tc_port = intel_port_to_tc(dev_priv, port);
+	u32 ln0, ln1, lane_info;
+
+	if (tc_port == PORT_TC_NONE || intel_dig_port->tc_type == TC_PORT_TBT)
+		return;
+
+	ln0 = I915_READ(MG_DP_MODE(port, 0));
+	ln1 = I915_READ(MG_DP_MODE(port, 1));
+
+	switch (intel_dig_port->tc_type) {
+	case TC_PORT_TYPEC:
+		ln0 &= ~(MG_DP_MODE_CFG_DP_X1_MODE | MG_DP_MODE_CFG_DP_X2_MODE);

drivers/gpu/drm/i915/intel_dp.c intel_dp_link_required(int pixel_clock, int bpp) · line 258

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +10 -0
+		ln1 &= ~(MG_DP_MODE_CFG_DP_X1_MODE | MG_DP_MODE_CFG_DP_X2_MODE);
+
+		lane_info = (I915_READ(PORT_TX_DFLEXDPSP) &
+			     DP_LANE_ASSIGNMENT_MASK(tc_port)) >>
+			    DP_LANE_ASSIGNMENT_SHIFT(tc_port);
+
+		switch (lane_info) {
+		case 0x1:
+		case 0x4:
+			break;

Shouldn't this still be x1 mode?

~Maarten

Quoted 47 lines
drivers/gpu/drm/i915/intel_dp.c +39 -0
+		case 0x2:
+			ln0 |= MG_DP_MODE_CFG_DP_X1_MODE;
+			break;
+		case 0x3:
+			ln0 |= MG_DP_MODE_CFG_DP_X1_MODE |
+			       MG_DP_MODE_CFG_DP_X2_MODE;
+			break;
+		case 0x8:
+			ln1 |= MG_DP_MODE_CFG_DP_X1_MODE;
+			break;
+		case 0xC:
+			ln1 |= MG_DP_MODE_CFG_DP_X1_MODE |
+			       MG_DP_MODE_CFG_DP_X2_MODE;
+			break;
+		case 0xF:
+			ln0 |= MG_DP_MODE_CFG_DP_X1_MODE |
+			       MG_DP_MODE_CFG_DP_X2_MODE;
+			ln1 |= MG_DP_MODE_CFG_DP_X1_MODE |
+			       MG_DP_MODE_CFG_DP_X2_MODE;
+			break;
+		default:
+			MISSING_CASE(lane_info);
+		}
+		break;
+
+	case TC_PORT_LEGACY:
+		ln0 |= MG_DP_MODE_CFG_DP_X1_MODE | MG_DP_MODE_CFG_DP_X2_MODE;
+		ln1 |= MG_DP_MODE_CFG_DP_X1_MODE | MG_DP_MODE_CFG_DP_X2_MODE;
+		break;
+
+	default:
+		MISSING_CASE(intel_dig_port->tc_type);
+		return;
+	}
+
+	I915_WRITE(MG_DP_MODE(port, 0), ln0);
+	I915_WRITE(MG_DP_MODE(port, 1), ln1);
+}
+
 int
 intel_dp_max_data_rate(int max_link_clock, int max_lanes)
 {
drivers/gpu/drm/i915/intel_drv.h +0 -0
index 8602f2e17d86..d04be4c1f30e 100644

drivers/gpu/drm/i915/intel_drv.h void intel_edp_drrs_invalidate(struct drm_i915_private *dev_priv, · line 1708

Quoted 7 lines
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -1702,6 +1702,7 @@ void intel_edp_drrs_invalidate(struct drm_i915_private *dev_priv,
 			       unsigned int frontbuffer_bits);
 void intel_edp_drrs_flush(struct drm_i915_private *dev_priv,
 			  unsigned int frontbuffer_bits);
+void icl_program_mg_dp_mode(struct intel_dp *intel_dp);
 
 void
 intel_dp_program_link_training_pattern(struct intel_dp *intel_dp,

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by
#84 lore raw

Re: [PATCH 23/24] drm/i915/icl: program MG_DP_MODE

Op 19-06-18 om 14:59 schreef Maarten Lankhorst:

Quoted 82 lines

Op 22-05-18 om 02:25 schreef Paulo Zanoni:

Quoted 81 lines

Programming this register is part of the Enable Sequence for DisplayPort on ICL. Do as the spec says.

Cc Animesh Manna <[email protected]>
Cc Manasi Navare <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
---
 drivers/gpu/drm/i915/i915_reg.h  | 15 +++++++++
 drivers/gpu/drm/i915/intel_ddi.c |  2 ++
 drivers/gpu/drm/i915/intel_dp.c  | 66 ++++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h |  1 +
 4 files changed, 84 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +15 -0
index 2a501e7590bf..2ccae6c3e905 100644
@@ -1943,6 +1943,21 @@ enum i915_power_well_id {
 #define CRI_TXDEEMPH_OVERRIDE_5_0(x)			((x) << 16)
 #define CRI_TXDEEMPH_OVERRIDE_5_0_MASK			(0x3F << 16)
 
+#define _MG_DP_MODE_LN0_ACU_PORT1			0x1683A0
+#define _MG_DP_MODE_LN1_ACU_PORT1			0x1687A0
+#define _MG_DP_MODE_LN0_ACU_PORT2			0x1693A0
+#define _MG_DP_MODE_LN1_ACU_PORT2			0x1697A0
+#define _MG_DP_MODE_LN0_ACU_PORT3			0x16A3A0
+#define _MG_DP_MODE_LN1_ACU_PORT3			0x16A7A0
+#define _MG_DP_MODE_LN0_ACU_PORT4			0x16B3A0
+#define _MG_DP_MODE_LN1_ACU_PORT4			0x16B7A0
+#define MG_DP_MODE(port, ln)	\
+	_ICL_MG_PHY_PORT_LN(port, ln, _MG_DP_MODE_LN0_ACU_PORT1, \
+				      _MG_DP_MODE_LN0_ACU_PORT2, \
+				      _MG_DP_MODE_LN1_ACU_PORT1)
+#define   MG_DP_MODE_CFG_DP_X2_MODE			(1 << 7)
+#define   MG_DP_MODE_CFG_DP_X1_MODE			(1 << 6)
+
 /* The spec defines this only for BXT PHY0, but lets assume that this
  * would exist for PHY1 too if it had a second channel.
  */
drivers/gpu/drm/i915/intel_ddi.c +2 -0
index 1d5bfec57c33..c3c29565b863 100644
@@ -2667,6 +2667,8 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 
 	intel_display_power_get(dev_priv, dig_port->ddi_io_power_domain);
 
+	icl_program_mg_dp_mode(intel_dp);
+
 	if (IS_ICELAKE(dev_priv))
 		icl_ddi_vswing_sequence(encoder, level, encoder->type);
 	else if (IS_CANNONLAKE(dev_priv))
drivers/gpu/drm/i915/intel_dp.c +20 -0
index a883a3264e56..1228d6185f76 100644
@@ -229,6 +229,72 @@ intel_dp_link_required(int pixel_clock, int bpp)
 	return DIV_ROUND_UP(pixel_clock * bpp, 8);
 }
 
+void icl_program_mg_dp_mode(struct intel_dp *intel_dp)
+{
+	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
+	struct drm_i915_private *dev_priv = to_i915(intel_dp_to_dev(intel_dp));
+	enum port port = intel_dig_port->base.port;
+	enum tc_port tc_port = intel_port_to_tc(dev_priv, port);
+	u32 ln0, ln1, lane_info;
+
+	if (tc_port == PORT_TC_NONE || intel_dig_port->tc_type == TC_PORT_TBT)
+		return;
+
+	ln0 = I915_READ(MG_DP_MODE(port, 0));
+	ln1 = I915_READ(MG_DP_MODE(port, 1));
+
+	switch (intel_dig_port->tc_type) {
+	case TC_PORT_TYPEC:
+		ln0 &= ~(MG_DP_MODE_CFG_DP_X1_MODE | MG_DP_MODE_CFG_DP_X2_MODE);
+		ln1 &= ~(MG_DP_MODE_CFG_DP_X1_MODE | MG_DP_MODE_CFG_DP_X2_MODE);
+
+		lane_info = (I915_READ(PORT_TX_DFLEXDPSP) &
Quoted 8 lines

drivers/gpu/drm/i915/intel_dp.c intel_dp_link_required(int pixel_clock, int bpp) · line 258

Quoted 7 lines
drivers/gpu/drm/i915/intel_dp.c +7 -0
+			     DP_LANE_ASSIGNMENT_MASK(tc_port)) >>
+			    DP_LANE_ASSIGNMENT_SHIFT(tc_port);
+
+		switch (lane_info) {
+		case 0x1:
+		case 0x4:
+			break;

Shouldn't this still be x1 mode?

Ah nm, found the mapping.

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#85 lore raw

PATCH 24/24 drm/i915/icl: toggle PHY clock gating around link training

In reply to Paulo Zanoni

The Gen11 TypeC PHY DDI Buffer chapter, PHY Clock Gating Programming section says that PHY clock gating should be disabled before starting voltage swing programming, then enabled after any link training is complete.

Cc Animesh Manna <[email protected]>
Cc Manasi Navare <[email protected]>
---
 drivers/gpu/drm/i915/i915_reg.h  | 21 +++++++++++++
 drivers/gpu/drm/i915/intel_ddi.c |  3 ++
 drivers/gpu/drm/i915/intel_dp.c  | 66 ++++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h |  2 ++
 4 files changed, 92 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +21 -0
index 2ccae6c3e905..9d2c022bc3a1 100644
@@ -1957,6 +1957,27 @@ enum i915_power_well_id {
 				      _MG_DP_MODE_LN1_ACU_PORT1)
 #define   MG_DP_MODE_CFG_DP_X2_MODE			(1 << 7)
 #define   MG_DP_MODE_CFG_DP_X1_MODE			(1 << 6)
+#define   MG_DP_MODE_CFG_TR2PWR_GATING			(1 << 5)
+#define   MG_DP_MODE_CFG_TRPWR_GATING			(1 << 4)
+#define   MG_DP_MODE_CFG_CLNPWR_GATING			(1 << 3)
+#define   MG_DP_MODE_CFG_DIGPWR_GATING			(1 << 2)
+#define   MG_DP_MODE_CFG_GAONPWR_GATING			(1 << 1)
+
+#define _MG_MISC_SUS0_PORT1				0x168814
+#define _MG_MISC_SUS0_PORT2				0x169814
+#define _MG_MISC_SUS0_PORT3				0x16A814
+#define _MG_MISC_SUS0_PORT4				0x16B814
+#define MG_MISC_SUS0(tc_port) \
+	_MMIO(_PORT(tc_port, _MG_MISC_SUS0_PORT1, _MG_MISC_SUS0_PORT2))
+#define   MG_MISC_SUS0_SUSCLK_DYNCLKGATE_MODE_MASK	(3 << 14)
+#define   MG_MISC_SUS0_SUSCLK_DYNCLKGATE_MODE(x)	((x) << 14)
+#define   MG_MISC_SUS0_CFG_TR2PWR_GATING		(1 << 12)
+#define   MG_MISC_SUS0_CFG_CL2PWR_GATING		(1 << 11)
+#define   MG_MISC_SUS0_CFG_GAONPWR_GATING		(1 << 10)
+#define   MG_MISC_SUS0_CFG_TRPWR_GATING			(1 << 7)
+#define   MG_MISC_SUS0_CFG_CL1PWR_GATING		(1 << 6)
+#define   MG_MISC_SUS0_CFG_DGPWR_GATING			(1 << 5)
+
 
 /* The spec defines this only for BXT PHY0, but lets assume that this
  * would exist for PHY1 too if it had a second channel.
drivers/gpu/drm/i915/intel_ddi.c +3 -0
index c3c29565b863..6617950a28a9 100644
@@ -2668,6 +2668,7 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 	intel_display_power_get(dev_priv, dig_port->ddi_io_power_domain);
 
 	icl_program_mg_dp_mode(intel_dp);
+	icl_disable_phy_clock_gating(dig_port);
 
 	if (IS_ICELAKE(dev_priv))
 		icl_ddi_vswing_sequence(encoder, level, encoder->type);
@@ -2684,6 +2685,8 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 	intel_dp_start_link_train(intel_dp);
 	if (port != PORT_A || INTEL_GEN(dev_priv) >= 9)
 		intel_dp_stop_link_train(intel_dp);
+
+	icl_enable_phy_clock_gating(dig_port);
 }
 
 static void intel_ddi_pre_enable_hdmi(struct intel_encoder *encoder,
drivers/gpu/drm/i915/intel_dp.c +66 -0

72 lines not on this page · raw message

drivers/gpu/drm/i915/intel_drv.h +2 -0
index d04be4c1f30e..8c77e0499b44 100644
@@ -1703,6 +1703,8 @@ void intel_edp_drrs_invalidate(struct drm_i915_private *dev_priv,
 void intel_edp_drrs_flush(struct drm_i915_private *dev_priv,
 			  unsigned int frontbuffer_bits);
 void icl_program_mg_dp_mode(struct intel_dp *intel_dp);
+void icl_enable_phy_clock_gating(struct intel_digital_port *dig_port);
+void icl_disable_phy_clock_gating(struct intel_digital_port *dig_port);
 
 void
 intel_dp_program_link_training_pattern(struct intel_dp *intel_dp,
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 24/24
#86 lore raw

Re: [PATCH 24/24] drm/i915/icl: toggle PHY clock gating around link training

Op 22-05-18 om 02:25 schreef Paulo Zanoni:

Quoted 150 lines

The Gen11 TypeC PHY DDI Buffer chapter, PHY Clock Gating Programming section says that PHY clock gating should be disabled before starting voltage swing programming, then enabled after any link training is complete.

Cc Animesh Manna <[email protected]>
Cc Manasi Navare <[email protected]>
---
 drivers/gpu/drm/i915/i915_reg.h  | 21 +++++++++++++
 drivers/gpu/drm/i915/intel_ddi.c |  3 ++
 drivers/gpu/drm/i915/intel_dp.c  | 66 ++++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h |  2 ++
 4 files changed, 92 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +21 -0
index 2ccae6c3e905..9d2c022bc3a1 100644
@@ -1957,6 +1957,27 @@ enum i915_power_well_id {
 				      _MG_DP_MODE_LN1_ACU_PORT1)
 #define   MG_DP_MODE_CFG_DP_X2_MODE			(1 << 7)
 #define   MG_DP_MODE_CFG_DP_X1_MODE			(1 << 6)
+#define   MG_DP_MODE_CFG_TR2PWR_GATING			(1 << 5)
+#define   MG_DP_MODE_CFG_TRPWR_GATING			(1 << 4)
+#define   MG_DP_MODE_CFG_CLNPWR_GATING			(1 << 3)
+#define   MG_DP_MODE_CFG_DIGPWR_GATING			(1 << 2)
+#define   MG_DP_MODE_CFG_GAONPWR_GATING			(1 << 1)
+
+#define _MG_MISC_SUS0_PORT1				0x168814
+#define _MG_MISC_SUS0_PORT2				0x169814
+#define _MG_MISC_SUS0_PORT3				0x16A814
+#define _MG_MISC_SUS0_PORT4				0x16B814
+#define MG_MISC_SUS0(tc_port) \
+	_MMIO(_PORT(tc_port, _MG_MISC_SUS0_PORT1, _MG_MISC_SUS0_PORT2))
+#define   MG_MISC_SUS0_SUSCLK_DYNCLKGATE_MODE_MASK	(3 << 14)
+#define   MG_MISC_SUS0_SUSCLK_DYNCLKGATE_MODE(x)	((x) << 14)
+#define   MG_MISC_SUS0_CFG_TR2PWR_GATING		(1 << 12)
+#define   MG_MISC_SUS0_CFG_CL2PWR_GATING		(1 << 11)
+#define   MG_MISC_SUS0_CFG_GAONPWR_GATING		(1 << 10)
+#define   MG_MISC_SUS0_CFG_TRPWR_GATING			(1 << 7)
+#define   MG_MISC_SUS0_CFG_CL1PWR_GATING		(1 << 6)
+#define   MG_MISC_SUS0_CFG_DGPWR_GATING			(1 << 5)
+
 
 /* The spec defines this only for BXT PHY0, but lets assume that this
  * would exist for PHY1 too if it had a second channel.
drivers/gpu/drm/i915/intel_ddi.c +3 -0
index c3c29565b863..6617950a28a9 100644
@@ -2668,6 +2668,7 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 	intel_display_power_get(dev_priv, dig_port->ddi_io_power_domain);
 
 	icl_program_mg_dp_mode(intel_dp);
+	icl_disable_phy_clock_gating(dig_port);
 
 	if (IS_ICELAKE(dev_priv))
 		icl_ddi_vswing_sequence(encoder, level, encoder->type);
@@ -2684,6 +2685,8 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 	intel_dp_start_link_train(intel_dp);
 	if (port != PORT_A || INTEL_GEN(dev_priv) >= 9)
 		intel_dp_stop_link_train(intel_dp);
+
+	icl_enable_phy_clock_gating(dig_port);
 }
 
 static void intel_ddi_pre_enable_hdmi(struct intel_encoder *encoder,
drivers/gpu/drm/i915/intel_dp.c +66 -0
index 1228d6185f76..e898d61b5924 100644
@@ -295,6 +295,72 @@ void icl_program_mg_dp_mode(struct intel_dp *intel_dp)
 	I915_WRITE(MG_DP_MODE(port, 1), ln1);
 }
 
+void icl_enable_phy_clock_gating(struct intel_digital_port *dig_port)
+{
+	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
+	enum port port = dig_port->base.port;
+	enum tc_port tc_port = intel_port_to_tc(dev_priv, port);
+	i915_reg_t mg_regs[2] = { MG_DP_MODE(port, 0), MG_DP_MODE(port, 1) };
+	u32 val;
+	int i;
+
+	if (tc_port == PORT_TC_NONE)
+		return;
+
+	for (i = 0; i < ARRAY_SIZE(mg_regs); i++) {
+		val = I915_READ(mg_regs[i]);
+		val |= MG_DP_MODE_CFG_TR2PWR_GATING |
+		       MG_DP_MODE_CFG_TRPWR_GATING |
+		       MG_DP_MODE_CFG_CLNPWR_GATING |
+		       MG_DP_MODE_CFG_DIGPWR_GATING |
+		       MG_DP_MODE_CFG_GAONPWR_GATING;
+		I915_WRITE(mg_regs[i], val);
+	}
+
+	val = I915_READ(MG_MISC_SUS0(tc_port));
+	val |= MG_MISC_SUS0_SUSCLK_DYNCLKGATE_MODE(3) |
+	       MG_MISC_SUS0_CFG_TR2PWR_GATING |
+	       MG_MISC_SUS0_CFG_CL2PWR_GATING |
+	       MG_MISC_SUS0_CFG_GAONPWR_GATING |
+	       MG_MISC_SUS0_CFG_TRPWR_GATING |
+	       MG_MISC_SUS0_CFG_CL1PWR_GATING |
+	       MG_MISC_SUS0_CFG_DGPWR_GATING;
+	I915_WRITE(MG_MISC_SUS0(tc_port), val);
+}
+
+void icl_disable_phy_clock_gating(struct intel_digital_port *dig_port)
+{
+	struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
+	enum port port = dig_port->base.port;
+	enum tc_port tc_port = intel_port_to_tc(dev_priv, port);
+	i915_reg_t mg_regs[2] = { MG_DP_MODE(port, 0), MG_DP_MODE(port, 1) };
+	u32 val;
+	int i;
+
+	if (tc_port == PORT_TC_NONE)
+		return;
+
+	for (i = 0; i < ARRAY_SIZE(mg_regs); i++) {
+		val = I915_READ(mg_regs[i]);
+		val &= ~(MG_DP_MODE_CFG_TR2PWR_GATING |
+			 MG_DP_MODE_CFG_TRPWR_GATING |
+			 MG_DP_MODE_CFG_CLNPWR_GATING |
+			 MG_DP_MODE_CFG_DIGPWR_GATING |
+			 MG_DP_MODE_CFG_GAONPWR_GATING);
+		I915_WRITE(mg_regs[i], val);
+	}
+
+	val = I915_READ(MG_MISC_SUS0(tc_port));
+	val &= ~(MG_MISC_SUS0_SUSCLK_DYNCLKGATE_MODE_MASK |
+		 MG_MISC_SUS0_CFG_TR2PWR_GATING |
+		 MG_MISC_SUS0_CFG_CL2PWR_GATING |
+		 MG_MISC_SUS0_CFG_GAONPWR_GATING |
+		 MG_MISC_SUS0_CFG_TRPWR_GATING |
+		 MG_MISC_SUS0_CFG_CL1PWR_GATING |
+		 MG_MISC_SUS0_CFG_DGPWR_GATING);
+	I915_WRITE(MG_MISC_SUS0(tc_port), val);
+}
+
 int
 intel_dp_max_data_rate(int max_link_clock, int max_lanes)
 {
drivers/gpu/drm/i915/intel_drv.h +0 -0
index d04be4c1f30e..8c77e0499b44 100644

drivers/gpu/drm/i915/intel_drv.h void intel_edp_drrs_invalidate(struct drm_i915_private *dev_priv, · line 1710

Quoted 8 lines
drivers/gpu/drm/i915/intel_drv.h +2 -0
@@ -1703,6 +1703,8 @@ void intel_edp_drrs_invalidate(struct drm_i915_private *dev_priv,
 void intel_edp_drrs_flush(struct drm_i915_private *dev_priv,
 			  unsigned int frontbuffer_bits);
 void icl_program_mg_dp_mode(struct intel_dp *intel_dp);
+void icl_enable_phy_clock_gating(struct intel_digital_port *dig_port);
+void icl_disable_phy_clock_gating(struct intel_digital_port *dig_port);
 
 void
 intel_dp_program_link_training_pattern(struct intel_dp *intel_dp,

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#87 lore raw

✗ Fi.CI.CHECKPATCH: warning for More ICL display patches

In reply to Paulo Zanoni
== Series Details ==

== Series Details ==

Series: More ICL display patches
URL : https://patchwork.freedesktop.org/series/43546/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
2ab358790967 drm/i915/icl: Extend AUX F interrupts to ICL
7f3648f2c0e1 drm/i915/icl: GSE interrupt moves from DE_MISC to GU_MISC
4b03c3e28a4a drm/i915/icl: introduce tc_port
e145ad6bdaf7 drm/i915/icl: Support for TC North Display interrupts
4b11db5d4aee drm/i915/icp: Add Interrupt Support
25d4a67290ae drm/i915/ICL: Add register definition for DFLEXDPMLE
e3cbd1343f5a drm/i915/icl: Add DDI HDMI level selection for ICL
e2f7e7c949f8 drm/i915/icl: Map VBT DDC Pin to BSpec DDC Pin
f70b5bcd4230 drm/i915/icl: Add Icelake PCH detection
20396ea4a008 drm/i915/icl: add icelake_get_ddi_pll()
ea723cce4da2 drm/i915/icl: Get DDI clock for ICL based on PLLs.
8aeab8ca85b0 drm/i915/icl: Calculate link clock using the new registers
ce32f58b49ab drm/i915/icl: unconditionally init DDI for every port
84be8b3f963c drm/i915/icl: start adding the TBT pll
-:162: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations
#162: FILE: drivers/gpu/drm/i915/intel_dpll_mgr.h:137:
 };
+#define I915_NUM_PLLS 7

total: 0 errors, 0 warnings, 1 checks, 129 lines checked eb581c948e8c drm/i915/icl: compute the TBT PLL registers -:18: CHECK:CAMELCASE: Avoid CamelCase: <icl_tbt_pll_24MHz_values> #18: FILE: drivers/gpu/drm/i915/intel_dpll_mgr.c:2455:
+static const struct skl_wrpll_params icl_tbt_pll_24MHz_values = {

-:23: CHECK:CAMELCASE: Avoid CamelCase: <icl_tbt_pll_19_2MHz_values> #23: FILE: drivers/gpu/drm/i915/intel_dpll_mgr.c:2460:
+static const struct skl_wrpll_params icl_tbt_pll_19_2MHz_values = {

total: 0 errors, 0 warnings, 2 checks, 51 lines checked
bb11361a8af0 drm/i915/icl: Handle hotplug interrupts for DP over TBT 2eb44a94c4a2 drm/i915/icl: Add 10-bit support for hdmi
83cac5646aac drm/i915/icl: implement icl_digital_port_connected() dde729bf09c6 drm/i915/icl: store the port type for TC ports 38f287b089ee drm/i915/icl: implement the tc/legacy HPD {dis, }connect flow for DP cb0454d09ead drm/i915/icl: implement the legacy HPD {dis, }connect flow for HDMI 2732eb911ea5 drm/i915/icl: Update FIA supported lane count for hpd. 6f6990bdd31e drm/i915/icl: program MG_DP_MODE
c9e0a92395b2 drm/i915/icl: toggle PHY clock gating around link training

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#88 lore raw

✗ Fi.CI.SPARSE: warning for More ICL display patches

In reply to Paulo Zanoni
== Series Details ==

== Series Details ==

Series: More ICL display patches
URL : https://patchwork.freedesktop.org/series/43546/
State : warning

== Summary ==

$ dim sparse origin/drm-tip
Commit: drm/i915/icl: Extend AUX F interrupts to ICL
Okay!

Commit: drm/i915/icl: GSE interrupt moves from DE_MISC to GU_MISC Okay!

Commit: drm/i915/icl: introduce tc_port
Okay!

Commit: drm/i915/icl: Support for TC North Display interrupts Okay!

Commit: drm/i915/icp: Add Interrupt Support
Okay!

Commit: drm/i915/ICL: Add register definition for DFLEXDPMLE Okay!

Commit: drm/i915/icl: Add DDI HDMI level selection for ICL Okay!

Commit: drm/i915/icl: Map VBT DDC Pin to BSpec DDC Pin Okay!

Commit: drm/i915/icl: Add Icelake PCH detection
Okay!

Commit: drm/i915/icl: add icelake_get_ddi_pll()
Okay!

Commit: drm/i915/icl: Get DDI clock for ICL based on PLLs. Okay!

Commit: drm/i915/icl: Calculate link clock using the new registers Okay!

Commit: drm/i915/icl: unconditionally init DDI for every port Okay!

Commit: drm/i915/icl: start adding the TBT pll
Okay!

Commit: drm/i915/icl: compute the TBT PLL registers Okay!

Commit: drm/i915/icl: Handle hotplug interrupts for DP over TBT Okay!

Commit: drm/i915/icl: Add 10-bit support for hdmi
Okay!

Commit: drm/i915/icl: implement icl_digital_port_connected() Okay!

Commit: drm/i915/icl: store the port type for TC ports Okay!

Commit: drm/i915/icl: implement the tc/legacy HPD {dis, }connect flow for DP Okay!

Commit: drm/i915/icl: implement the legacy HPD {dis, }connect flow for HDMI Okay!

Commit: drm/i915/icl: Update FIA supported lane count for hpd. -O:drivers/gpu/drm/i915/intel_dp.c:186:16: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/intel_dp.c:186:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_dp.c:217:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_dp.c:217:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_dp.c:217:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_dp.c:217:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_dp.c:217:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_dp.c:217:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_dp.c:217:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_dp.c:217:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_dp.c:217:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_dp.c:217:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_dp.c:217:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_dp.c:217:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_dp.c:217:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_dp.c:217:16: warning: expression using sizeof(void)

Commit: drm/i915/icl: program MG_DP_MODE
Okay!

Commit: drm/i915/icl: toggle PHY clock gating around link training Okay!

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#89 lore raw

✓ Fi.CI.BAT: success for More ICL display patches

In reply to Paulo Zanoni
== Series Details ==

== Series Details ==

Series: More ICL display patches
URL : https://patchwork.freedesktop.org/series/43546/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4213 -> Patchwork_9074 =

== Summary - WARNING ==

Minor unknown changes coming with Patchwork_9074 need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_9074, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://patchwork.freedesktop.org/api/1.0/series/43546/revisions/1/mbox/

== Possible new issues ==

Here are the unknown changes that may have been introduced in Patchwork_9074:

=== IGT changes ===

    ==== Warnings ====

    igt@gem_exec_gttfill@basic:
      fi-pnv-d510:        PASS -> SKIP

== Known issues ==

Here are the changes found in Patchwork_9074 that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c:
      fi-bxt-dsi:         PASS -> INCOMPLETE (fdo#103927)

fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927

== Participating hosts (43 -> 39) ==

Missing (4): fi-ctg-p8600 fi-ilk-m540 fi-bsw-cyan fi-skl-6700hq

== Build changes ==

* Linux: CI_DRM_4213 -> Patchwork_9074

CI_DRM_4213: d7671eea834c4e06f9b86e2248581d23ad98ec73 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4489: d8d5dde407e7f7b17850be71d24a7e679533b03d @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_9074: c9e0a92395b2122df86175990fef7402892664f3 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4489: 6ab75f7eb5e1dccbb773e1739beeb2d7cbd6ad0d @ git://anongit.freedesktop.org/piglit

== Linux commits ==

c9e0a92395b2 drm/i915/icl: toggle PHY clock gating around link training 6f6990bdd31e drm/i915/icl: program MG_DP_MODE
2732eb911ea5 drm/i915/icl: Update FIA supported lane count for hpd. cb0454d09ead drm/i915/icl: implement the legacy HPD {dis, }connect flow for HDMI 38f287b089ee drm/i915/icl: implement the tc/legacy HPD {dis, }connect flow for DP dde729bf09c6 drm/i915/icl: store the port type for TC ports 83cac5646aac drm/i915/icl: implement icl_digital_port_connected() 2eb44a94c4a2 drm/i915/icl: Add 10-bit support for hdmi
bb11361a8af0 drm/i915/icl: Handle hotplug interrupts for DP over TBT eb581c948e8c drm/i915/icl: compute the TBT PLL registers 84be8b3f963c drm/i915/icl: start adding the TBT pll
ce32f58b49ab drm/i915/icl: unconditionally init DDI for every port 8aeab8ca85b0 drm/i915/icl: Calculate link clock using the new registers ea723cce4da2 drm/i915/icl: Get DDI clock for ICL based on PLLs. 20396ea4a008 drm/i915/icl: add icelake_get_ddi_pll()
f70b5bcd4230 drm/i915/icl: Add Icelake PCH detection
e2f7e7c949f8 drm/i915/icl: Map VBT DDC Pin to BSpec DDC Pin e3cbd1343f5a drm/i915/icl: Add DDI HDMI level selection for ICL 25d4a67290ae drm/i915/ICL: Add register definition for DFLEXDPMLE 4b11db5d4aee drm/i915/icp: Add Interrupt Support
e145ad6bdaf7 drm/i915/icl: Support for TC North Display interrupts 4b03c3e28a4a drm/i915/icl: introduce tc_port
7f3648f2c0e1 drm/i915/icl: GSE interrupt moves from DE_MISC to GU_MISC 2ab358790967 drm/i915/icl: Extend AUX F interrupts to ICL

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_9074/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#90 lore raw

✓ Fi.CI.IGT: success for More ICL display patches

In reply to Paulo Zanoni
== Series Details ==

== Series Details ==

Series: More ICL display patches
URL : https://patchwork.freedesktop.org/series/43546/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4213_full -> Patchwork_9074_full =

== Summary - WARNING ==

Minor unknown changes coming with Patchwork_9074_full need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_9074_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://patchwork.freedesktop.org/api/1.0/series/43546/revisions/1/mbox/

== Possible new issues ==

Here are the unknown changes that may have been introduced in Patchwork_9074_full:

=== IGT changes ===

    ==== Warnings ====

    igt@gem_exec_schedule@deep-bsd1:
      shard-kbl:          SKIP -> PASS

    igt@kms_cursor_legacy@short-flip-before-cursor-atomic-transitions:
      shard-snb:          PASS -> SKIP

    igt@pm_rc6_residency@rc6-accuracy:
      shard-kbl:          PASS -> SKIP

== Known issues ==

Here are the changes found in Patchwork_9074_full that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@gem_eio@in-flight-suspend:
      shard-kbl:          PASS -> INCOMPLETE (fdo#103665)

    igt@kms_color@pipe-a-legacy-gamma-reset:
      shard-kbl:          PASS -> DMESG-WARN (fdo#103313, fdo#103558, fdo#105602) +5

    igt@kms_cursor_crc@cursor-128x128-suspend:
      shard-kbl:          PASS -> FAIL (fdo#104724, fdo#103232, fdo#103191)

    igt@kms_flip@2x-dpms-vs-vblank-race:
      shard-hsw:          PASS -> FAIL (fdo#103060)

    igt@kms_flip@dpms-vs-vblank-race-interruptible:
      shard-glk:          PASS -> FAIL (fdo#103060)

    igt@kms_flip_tiling@flip-to-x-tiled:
      shard-glk:          PASS -> FAIL (fdo#104724)

    igt@kms_pipe_crc_basic@hang-read-crc-pipe-c:
      shard-apl:          PASS -> DMESG-WARN (fdo#103558, fdo#105602) +8

    igt@kms_pipe_crc_basic@read-crc-pipe-a:
      shard-kbl:          PASS -> DMESG-WARN (fdo#103313)

    igt@kms_rotation_crc@sprite-rotation-270:
      shard-kbl:          PASS -> DMESG-WARN (fdo#103558, fdo#105602) +14

    igt@kms_setmode@basic:
      shard-hsw:          PASS -> FAIL (fdo#99912)

    
    ==== Possible fixes ====

    igt@drv_selftest@live_hangcheck:
      shard-kbl:          DMESG-FAIL (fdo#106560) -> PASS

    igt@kms_atomic_transition@1x-modeset-transitions-nonblocking:
      shard-glk:          FAIL (fdo#105703) -> PASS

    igt@kms_flip@2x-blocking-wf_vblank:
      shard-glk:          INCOMPLETE (k.org#198133, fdo#103359) -> PASS

    igt@kms_flip@2x-flip-vs-expired-vblank:
      shard-hsw:          FAIL (fdo#102887) -> PASS

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-pri-indfb-draw-render:
      shard-snb:          FAIL (fdo#104724, fdo#103167) -> PASS

    igt@kms_setmode@basic:
      shard-apl:          FAIL (fdo#99912) -> PASS

    
    ==== Warnings ====

    igt@kms_setmode@basic:
      shard-kbl:          FAIL (fdo#99912) -> DMESG-FAIL (fdo#103558, fdo#99912, fdo#105602)

fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#103232 https://bugs.freedesktop.org/show_bug.cgi?id=103232
fdo#103313 https://bugs.freedesktop.org/show_bug.cgi?id=103313
fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
fdo#103558 https://bugs.freedesktop.org/show_bug.cgi?id=103558
fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
fdo#104724 https://bugs.freedesktop.org/show_bug.cgi?id=104724
fdo#105602 https://bugs.freedesktop.org/show_bug.cgi?id=105602
fdo#105703 https://bugs.freedesktop.org/show_bug.cgi?id=105703
fdo#106560 https://bugs.freedesktop.org/show_bug.cgi?id=106560
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
k.org#198133 https://bugzilla.kernel.org/show_bug.cgi?id=198133

== Participating hosts (9 -> 9) ==

No changes in participating hosts

== Build changes ==

* Linux: CI_DRM_4213 -> Patchwork_9074

CI_DRM_4213: d7671eea834c4e06f9b86e2248581d23ad98ec73 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4489: d8d5dde407e7f7b17850be71d24a7e679533b03d @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_9074: c9e0a92395b2122df86175990fef7402892664f3 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4489: 6ab75f7eb5e1dccbb773e1739beeb2d7cbd6ad0d @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_9074/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#91 lore raw

✗ Fi.CI.CHECKPATCH: warning for More ICL display patches (rev2)

In reply to Paulo Zanoni
== Series Details ==

== Series Details ==

Series: More ICL display patches (rev2)
URL : https://patchwork.freedesktop.org/series/43546/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
127450a17db7 drm/i915/icl: Extend AUX F interrupts to ICL
531f7327f015 drm/i915/icl: GSE interrupt moves from DE_MISC to GU_MISC
f399dccd8cc6 drm/i915/icl: introduce tc_port
3f0e2981505d drm/i915/icl: Support for TC North Display interrupts
e4ec5bf09dc4 drm/i915/icp: Add Interrupt Support
6cb5cbdd40c5 drm/i915/ICL: Add register definition for DFLEXDPMLE
d33c632e9ea9 drm/i915/icl: Add DDI HDMI level selection for ICL
d58f0e17059b drm/i915/icl: Map VBT DDC Pin to BSpec DDC Pin
f9905e6229bc drm/i915/icl: Add Icelake PCH detection
1da0c5f49ffc drm/i915/icl: add icelake_get_ddi_pll()
ba91e7a19262 drm/i915/icl: Get DDI clock for ICL based on PLLs.
4a59b2d6c399 drm/i915/icl: Calculate link clock using the new registers
41d365245a0d drm/i915/icl: unconditionally init DDI for every port
e30520c96c42 drm/i915/icl: start adding the TBT pll
-:162: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations
#162: FILE: drivers/gpu/drm/i915/intel_dpll_mgr.h:137:
 };
+#define I915_NUM_PLLS 7

total: 0 errors, 0 warnings, 1 checks, 129 lines checked 4d717c17a206 drm/i915/icl: compute the TBT PLL registers -:18: CHECK:CAMELCASE: Avoid CamelCase: <icl_tbt_pll_24MHz_values> #18: FILE: drivers/gpu/drm/i915/intel_dpll_mgr.c:2455:
+static const struct skl_wrpll_params icl_tbt_pll_24MHz_values = {

-:23: CHECK:CAMELCASE: Avoid CamelCase: <icl_tbt_pll_19_2MHz_values> #23: FILE: drivers/gpu/drm/i915/intel_dpll_mgr.c:2460:
+static const struct skl_wrpll_params icl_tbt_pll_19_2MHz_values = {

total: 0 errors, 0 warnings, 2 checks, 51 lines checked
839e6e916ef0 drm/i915/icl: Handle hotplug interrupts for DP over TBT f9457e7eaac0 drm/i915/icl: Add 10-bit support for hdmi
d39f683cc31c drm/i915/icl: implement icl_digital_port_connected() 44c232d87e62 drm/i915/icl: store the port type for TC ports e9916912b1a7 drm/i915/icl: implement the tc/legacy HPD {dis, }connect flow for DP e737bd4f64f3 drm/i915/icl: implement the legacy HPD {dis, }connect flow for HDMI cd9cf1051643 drm/i915/icl: Update FIA supported lane count for hpd. b46919848803 drm/i915/icl: program MG_DP_MODE
c7b5ae16c069 drm/i915/icl: toggle PHY clock gating around link training

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#92 lore raw

✗ Fi.CI.SPARSE: warning for More ICL display patches (rev2)

In reply to Paulo Zanoni
== Series Details ==

== Series Details ==

Series: More ICL display patches (rev2)
URL : https://patchwork.freedesktop.org/series/43546/
State : warning

== Summary ==

$ dim sparse origin/drm-tip
Commit: drm/i915/icl: Extend AUX F interrupts to ICL
Okay!

Commit: drm/i915/icl: GSE interrupt moves from DE_MISC to GU_MISC Okay!

Commit: drm/i915/icl: introduce tc_port
Okay!

Commit: drm/i915/icl: Support for TC North Display interrupts Okay!

Commit: drm/i915/icp: Add Interrupt Support
Okay!

Commit: drm/i915/ICL: Add register definition for DFLEXDPMLE Okay!

Commit: drm/i915/icl: Add DDI HDMI level selection for ICL Okay!

Commit: drm/i915/icl: Map VBT DDC Pin to BSpec DDC Pin Okay!

Commit: drm/i915/icl: Add Icelake PCH detection
Okay!

Commit: drm/i915/icl: add icelake_get_ddi_pll()
Okay!

Commit: drm/i915/icl: Get DDI clock for ICL based on PLLs. Okay!

Commit: drm/i915/icl: Calculate link clock using the new registers Okay!

Commit: drm/i915/icl: unconditionally init DDI for every port Okay!

Commit: drm/i915/icl: start adding the TBT pll
Okay!

Commit: drm/i915/icl: compute the TBT PLL registers Okay!

Commit: drm/i915/icl: Handle hotplug interrupts for DP over TBT Okay!

Commit: drm/i915/icl: Add 10-bit support for hdmi
Okay!

Commit: drm/i915/icl: implement icl_digital_port_connected() Okay!

Commit: drm/i915/icl: store the port type for TC ports Okay!

Commit: drm/i915/icl: implement the tc/legacy HPD {dis, }connect flow for DP Okay!

Commit: drm/i915/icl: implement the legacy HPD {dis, }connect flow for HDMI Okay!

Commit: drm/i915/icl: Update FIA supported lane count for hpd. -O:drivers/gpu/drm/i915/intel_dp.c:186:16: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/intel_dp.c:186:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_dp.c:217:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_dp.c:217:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_dp.c:217:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_dp.c:217:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_dp.c:217:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_dp.c:217:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_dp.c:217:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_dp.c:217:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_dp.c:217:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_dp.c:217:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_dp.c:217:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_dp.c:217:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_dp.c:217:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_dp.c:217:16: warning: expression using sizeof(void)

Commit: drm/i915/icl: program MG_DP_MODE
Okay!

Commit: drm/i915/icl: toggle PHY clock gating around link training Okay!

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#93 lore raw

✓ Fi.CI.BAT: success for More ICL display patches (rev2)

In reply to Paulo Zanoni
== Series Details ==

== Series Details ==

Series: More ICL display patches (rev2)
URL : https://patchwork.freedesktop.org/series/43546/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4227 -> Patchwork_9100 =

== Summary - WARNING ==

Minor unknown changes coming with Patchwork_9100 need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_9100, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://patchwork.freedesktop.org/api/1.0/series/43546/revisions/2/mbox/

== Possible new issues ==

Here are the unknown changes that may have been introduced in Patchwork_9100:

=== IGT changes ===

    ==== Warnings ====

    igt@gem_exec_gttfill@basic:
      fi-pnv-d510:        SKIP -> PASS

== Known issues ==

Here are the changes found in Patchwork_9100 that come from known issues:

=== IGT changes ===

    ==== Possible fixes ====

    igt@kms_flip@basic-flip-vs-wf_vblank:
      fi-hsw-4770:        FAIL (fdo#100368) -> PASS

fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368

== Participating hosts (44 -> 38) ==

Missing (6): fi-ilk-m540 fi-byt-j1900 fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-skl-6700hq

== Build changes ==

* Linux: CI_DRM_4227 -> Patchwork_9100

CI_DRM_4227: a8727d3fe03770e4d523468dfbc487dfe01597d3 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4495: 71c7a5740913d2618f44bca252669efe8a84f4c9 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_9100: c7b5ae16c06957a7a21cac7e9272c507dd85eb09 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4495: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Linux commits ==

c7b5ae16c069 drm/i915/icl: toggle PHY clock gating around link training b46919848803 drm/i915/icl: program MG_DP_MODE
cd9cf1051643 drm/i915/icl: Update FIA supported lane count for hpd. e737bd4f64f3 drm/i915/icl: implement the legacy HPD {dis, }connect flow for HDMI e9916912b1a7 drm/i915/icl: implement the tc/legacy HPD {dis, }connect flow for DP 44c232d87e62 drm/i915/icl: store the port type for TC ports d39f683cc31c drm/i915/icl: implement icl_digital_port_connected() f9457e7eaac0 drm/i915/icl: Add 10-bit support for hdmi
839e6e916ef0 drm/i915/icl: Handle hotplug interrupts for DP over TBT 4d717c17a206 drm/i915/icl: compute the TBT PLL registers e30520c96c42 drm/i915/icl: start adding the TBT pll
41d365245a0d drm/i915/icl: unconditionally init DDI for every port 4a59b2d6c399 drm/i915/icl: Calculate link clock using the new registers ba91e7a19262 drm/i915/icl: Get DDI clock for ICL based on PLLs. 1da0c5f49ffc drm/i915/icl: add icelake_get_ddi_pll()
f9905e6229bc drm/i915/icl: Add Icelake PCH detection
d58f0e17059b drm/i915/icl: Map VBT DDC Pin to BSpec DDC Pin d33c632e9ea9 drm/i915/icl: Add DDI HDMI level selection for ICL 6cb5cbdd40c5 drm/i915/ICL: Add register definition for DFLEXDPMLE e4ec5bf09dc4 drm/i915/icp: Add Interrupt Support
3f0e2981505d drm/i915/icl: Support for TC North Display interrupts f399dccd8cc6 drm/i915/icl: introduce tc_port
531f7327f015 drm/i915/icl: GSE interrupt moves from DE_MISC to GU_MISC 127450a17db7 drm/i915/icl: Extend AUX F interrupts to ICL

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_9100/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#94 lore raw

✗ Fi.CI.IGT: failure for More ICL display patches (rev2)

In reply to Paulo Zanoni
== Series Details ==

== Series Details ==

Series: More ICL display patches (rev2)
URL : https://patchwork.freedesktop.org/series/43546/
State : failure

== Summary ==

= CI Bug Log - changes from CI_DRM_4227_full -> Patchwork_9100_full =

== Summary - FAILURE ==

Serious unknown changes coming with Patchwork_9100_full absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_9100_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://patchwork.freedesktop.org/api/1.0/series/43546/revisions/2/mbox/

== Possible new issues ==

Here are the unknown changes that may have been introduced in Patchwork_9100_full:

=== IGT changes ===

    ==== Possible regressions ====

    igt@drv_selftest@live_gtt:
      shard-kbl:          PASS -> FAIL

    
    ==== Warnings ====

    igt@gem_exec_schedule@deep-bsd2:
      shard-kbl:          PASS -> SKIP

    igt@perf_pmu@rc6:
      shard-kbl:          SKIP -> PASS

== Known issues ==

Here are the changes found in Patchwork_9100_full that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@drv_selftest@live_hangcheck:
      shard-kbl:          PASS -> DMESG-FAIL (fdo#106560)

    igt@kms_cursor_legacy@2x-long-nonblocking-modeset-vs-cursor-atomic:
      shard-glk:          PASS -> FAIL (fdo#106509)

    igt@kms_flip@dpms-vs-vblank-race-interruptible:
      shard-glk:          PASS -> FAIL (fdo#103060)

    igt@kms_flip@flip-vs-expired-vblank-interruptible:
      shard-glk:          PASS -> FAIL (fdo#105707)

    igt@kms_flip_tiling@flip-to-x-tiled:
      shard-glk:          PASS -> FAIL (fdo#104724)

    
    ==== Possible fixes ====

    igt@gem_ppgtt@blt-vs-render-ctxn:
      shard-kbl:          INCOMPLETE (fdo#103665, fdo#106023) -> PASS

    igt@kms_atomic_transition@1x-modeset-transitions-nonblocking-fencing:
      shard-glk:          FAIL (fdo#105703) -> PASS

    igt@kms_flip@2x-plain-flip-fb-recreate:
      shard-hsw:          FAIL (fdo#100368) -> PASS

    igt@kms_flip@flip-vs-absolute-wf_vblank-interruptible:
      shard-hsw:          FAIL (fdo#103928) -> PASS

    igt@kms_flip@plain-flip-fb-recreate-interruptible:
      shard-glk:          FAIL (fdo#100368) -> PASS +2

fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
fdo#103928 https://bugs.freedesktop.org/show_bug.cgi?id=103928
fdo#104724 https://bugs.freedesktop.org/show_bug.cgi?id=104724
fdo#105703 https://bugs.freedesktop.org/show_bug.cgi?id=105703
fdo#105707 https://bugs.freedesktop.org/show_bug.cgi?id=105707
fdo#106023 https://bugs.freedesktop.org/show_bug.cgi?id=106023
fdo#106509 https://bugs.freedesktop.org/show_bug.cgi?id=106509
fdo#106560 https://bugs.freedesktop.org/show_bug.cgi?id=106560

== Participating hosts (5 -> 5) ==

No changes in participating hosts

== Build changes ==

* Linux: CI_DRM_4227 -> Patchwork_9100

CI_DRM_4227: a8727d3fe03770e4d523468dfbc487dfe01597d3 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4495: 71c7a5740913d2618f44bca252669efe8a84f4c9 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_9100: c7b5ae16c06957a7a21cac7e9272c507dd85eb09 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4495: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_9100/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#95 lore raw

[PATCH 25/24] drm/i915/icl: fix gmbus gpio pin mapping

In reply to Paulo Zanoni

From: Mahesh Kumar <[email protected]>

ICP has GPIO pin 1/2 mapped to combo-phy ports & GPIO pins 9/10/11/12 mapped to tc ports[1-4].
This patch defines GPIOCTL registers for GPIO pins 9-12 & uses them in GPIO pin mapping table.

Cc Anusha Srivatsa <[email protected]>
Cc Madhav Chauhan <[email protected]>
Cc Lucas De Marchi <[email protected]>
---
 drivers/gpu/drm/i915/i915_reg.h   |  4 ++++
 drivers/gpu/drm/i915/intel_hdmi.c |  2 +-
 drivers/gpu/drm/i915/intel_i2c.c  | 12 ++++++------
 3 files changed, 11 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +4 -0
index 452356a4af07..e48b717769b2 100644
@@ -3015,6 +3015,10 @@ enum i915_power_well_id {
 #define GPIOF			_MMIO(0x5024)
 #define GPIOG			_MMIO(0x5028)
 #define GPIOH			_MMIO(0x502c)
+#define GPIOJ			_MMIO(0x5034)
+#define GPIOK			_MMIO(0x5038)
+#define GPIOL			_MMIO(0x503C)
+#define GPIOM			_MMIO(0x5040)
 # define GPIO_CLOCK_DIR_MASK		(1 << 0)
 # define GPIO_CLOCK_DIR_IN		(0 << 1)
 # define GPIO_CLOCK_DIR_OUT		(1 << 1)
drivers/gpu/drm/i915/intel_hdmi.c +1 -1
index 75f02a0e7d39..3db2459c79b1 100644
@@ -2276,7 +2276,7 @@ static u8 intel_hdmi_ddc_pin(struct drm_i915_private *dev_priv,
 		ddc_pin = bxt_port_to_ddc_pin(dev_priv, port);
 	else if (HAS_PCH_CNP(dev_priv))
 		ddc_pin = cnp_port_to_ddc_pin(dev_priv, port);
-	else if (IS_ICELAKE(dev_priv))
+	else if (HAS_PCH_ICP(dev_priv))
 		ddc_pin = icl_port_to_ddc_pin(dev_priv, port);
 	else
 		ddc_pin = g4x_port_to_ddc_pin(dev_priv, port);
drivers/gpu/drm/i915/intel_i2c.c +6 -6
index e6875509bcd9..b91e418028cb 100644
@@ -77,12 +77,12 @@ static const struct gmbus_pin gmbus_pins_cnp[] = {
 };
 
 static const struct gmbus_pin gmbus_pins_icp[] = {
-	[GMBUS_PIN_1_BXT] = { "dpa", GPIOA },
-	[GMBUS_PIN_2_BXT] = { "dpb", GPIOB },
-	[GMBUS_PIN_9_TC1_ICP] = { "tc1", GPIOC },
-	[GMBUS_PIN_10_TC2_ICP] = { "tc2", GPIOD },
-	[GMBUS_PIN_11_TC3_ICP] = { "tc3", GPIOE },
-	[GMBUS_PIN_12_TC4_ICP] = { "tc4", GPIOF },
+	[GMBUS_PIN_1_BXT] = { "dpa", GPIOB },
+	[GMBUS_PIN_2_BXT] = { "dpb", GPIOC },
+	[GMBUS_PIN_9_TC1_ICP] = { "tc1", GPIOJ },
+	[GMBUS_PIN_10_TC2_ICP] = { "tc2", GPIOK },
+	[GMBUS_PIN_11_TC3_ICP] = { "tc3", GPIOL },
+	[GMBUS_PIN_12_TC4_ICP] = { "tc4", GPIOM },
 };
 
 /* pin is expected to be valid */
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#96 lore raw

[PATCH 26/24] drm/i915/icl: Add allowed DP rates for Icelake

From: Manasi Navare <[email protected]>

For ICL, on Combo PHY the allowed max rates are:
- HBR3 8.1 eDP (DDIA)
- HBR2 5.4 DisplayPort (DDIB)
and for MG PHY/TC DDI Ports allowed DP rates are:
- HBR3 8.1 DisplayPort (DP alternate mode, DP over TBT,
- DP on legacy connector - DDIC/D/E/F)

Cc Rodrigo Vivi <[email protected]>
Cc Jani Nikula <[email protected]>
Cc James Ausmus <[email protected]>
---
 drivers/gpu/drm/i915/intel_dp.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +19 -2
index 5109023abe28..3ee8e74cf2b8 100644
@@ -419,6 +419,20 @@ static int cnl_max_source_rate(struct intel_dp *intel_dp)
 	return 810000;
 }
 
+static int icl_max_source_rate(struct intel_dp *intel_dp)
+{
+	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
+	enum port port = dig_port->base.port;
+
+	/* On Combo PHY port A max speed is HBR3 for all Vccio voltages
+	 * and on Combo PHY Port B the maximum supported is HBR2.
+	 */
+	if (port == PORT_B)
+		return 540000;
+
+	return 810000;
+}
+
 static void
 intel_dp_set_source_rates(struct intel_dp *intel_dp)
 {
@@ -448,10 +462,13 @@ intel_dp_set_source_rates(struct intel_dp *intel_dp)
 	/* This should only be done once */
 	WARN_ON(intel_dp->source_rates || intel_dp->num_source_rates);
 
-	if (IS_CANNONLAKE(dev_priv)) {
+	if (INTEL_GEN(dev_priv) >= 10) {
 		source_rates = cnl_rates;
 		size = ARRAY_SIZE(cnl_rates);
-		max_rate = cnl_max_source_rate(intel_dp);
+		if (IS_ICELAKE(dev_priv))
+			max_rate = icl_max_source_rate(intel_dp);
+		else
+			max_rate = cnl_max_source_rate(intel_dp);
 	} else if (IS_GEN9_LP(dev_priv)) {
 		source_rates = bxt_rates;
 		size = ARRAY_SIZE(bxt_rates);
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by
#97 lore raw

Re: [PATCH 26/24] drm/i915/icl: Add allowed DP rates for Icelake

Quoted 9 lines · Paulo Zanoni

From: Manasi Navare <[email protected]>

For ICL, on Combo PHY the allowed max rates are:
- HBR3 8.1 eDP (DDIA)
- HBR2 5.4 DisplayPort (DDIB)
and for MG PHY/TC DDI Ports allowed DP rates are:
- HBR3 8.1 DisplayPort (DP alternate mode, DP over TBT,
- DP on legacy connector - DDIC/D/E/F)

Quoted 5 lines
Cc Rodrigo Vivi <[email protected]>
Cc Jani Nikula <[email protected]>
Cc James Ausmus <[email protected]>
Quoted 48 lines
---
 drivers/gpu/drm/i915/intel_dp.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +19 -2
index 5109023abe28..3ee8e74cf2b8 100644
@@ -419,6 +419,20 @@ static int cnl_max_source_rate(struct intel_dp *intel_dp)
 	return 810000;
 }
 
+static int icl_max_source_rate(struct intel_dp *intel_dp)
+{
+	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
+	enum port port = dig_port->base.port;
+
+	/* On Combo PHY port A max speed is HBR3 for all Vccio voltages
+	 * and on Combo PHY Port B the maximum supported is HBR2.
+	 */
+	if (port == PORT_B)
+		return 540000;
+
+	return 810000;
+}
+
 static void
 intel_dp_set_source_rates(struct intel_dp *intel_dp)
 {
@@ -448,10 +462,13 @@ intel_dp_set_source_rates(struct intel_dp *intel_dp)
 	/* This should only be done once */
 	WARN_ON(intel_dp->source_rates || intel_dp->num_source_rates);
 
-	if (IS_CANNONLAKE(dev_priv)) {
+	if (INTEL_GEN(dev_priv) >= 10) {
 		source_rates = cnl_rates;
 		size = ARRAY_SIZE(cnl_rates);
-		max_rate = cnl_max_source_rate(intel_dp);
+		if (IS_ICELAKE(dev_priv))
+			max_rate = icl_max_source_rate(intel_dp);
+		else
+			max_rate = cnl_max_source_rate(intel_dp);
 	} else if (IS_GEN9_LP(dev_priv)) {
 		source_rates = bxt_rates;
 		size = ARRAY_SIZE(bxt_rates);
Signature · 1 line
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#98 lore raw

Re: [PATCH 26/24] drm/i915/icl: Add allowed DP rates for Icelake

Em Sex, 2018-05-25 às 11:32 -0700, James Ausmus escreveu:

Quoted 57 lines · Paulo Zanoni
Quoted 9 lines

From: Manasi Navare <[email protected]>

For ICL, on Combo PHY the allowed max rates are:
- HBR3 8.1 eDP (DDIA)
- HBR2 5.4 DisplayPort (DDIB)
and for MG PHY/TC DDI Ports allowed DP rates are:
- HBR3 8.1 DisplayPort (DP alternate mode, DP over TBT,
- DP on legacy connector - DDIC/D/E/F)

Quoted 5 lines
Cc Rodrigo Vivi <[email protected]>
Cc Jani Nikula <[email protected]>
Cc James Ausmus <[email protected]>
Quoted 39 lines
---
 drivers/gpu/drm/i915/intel_dp.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +6 -0
index 5109023abe28..3ee8e74cf2b8 100644
@@ -419,6 +419,20 @@ static int cnl_max_source_rate(struct intel_dp
 *intel_dp)
 	return 810000;
 }
 
+static int icl_max_source_rate(struct intel_dp *intel_dp)
+{
+	struct intel_digital_port *dig_port =
 dp_to_dig_port(intel_dp);
+	enum port port = dig_port->base.port;
+
+	/* On Combo PHY port A max speed is HBR3 for all Vccio

voltages

drivers/gpu/drm/i915/intel_dp.c +8 -0
+	 * and on Combo PHY Port B the maximum supported is HBR2.
+	 */
+	if (port == PORT_B)
+		return 540000;
+
+	return 810000;
+}
+
 static void
 intel_dp_set_source_rates(struct intel_dp *intel_dp)
 {
@@ -448,10 +462,13 @@ intel_dp_set_source_rates(struct intel_dp
 *intel_dp)
 	/* This should only be done once */
 	WARN_ON(intel_dp->source_rates || intel_dp-
 >num_source_rates);
 
Quoted 9 lines

drivers/gpu/drm/i915/intel_dp.c intel_dp_set_source_rates(struct intel_dp *intel_dp) · line 471

Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +5 -2
-	if (IS_CANNONLAKE(dev_priv)) {
+	if (INTEL_GEN(dev_priv) >= 10) {
 		source_rates = cnl_rates;
 		size = ARRAY_SIZE(cnl_rates);
-		max_rate = cnl_max_source_rate(intel_dp);
+		if (IS_ICELAKE(dev_priv))
+			max_rate = icl_max_source_rate(intel_dp);
+		else
+			max_rate = cnl_max_source_rate(intel_dp);

Bikeshed: changing this to "if (IS_CANNONLAKE())" would help ensuring any possible future platform would be using the ICL table instead of the CNL one.

Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/i915/intel_dp.c +0 -0
 	} else if (IS_GEN9_LP(dev_priv)) {
drivers/gpu/drm/i915/intel_dp.c +0 -0
 		source_rates = bxt_rates;
 		size = ARRAY_SIZE(bxt_rates);
Signature · 1 line
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

maintainer
#99 lore raw

Re: [PATCH 26/24] drm/i915/icl: Add allowed DP rates for Icelake

Quoted 58 lines · Paulo Zanoni

Em Sex, 2018-05-25 às 11:32 -0700, James Ausmus escreveu:

Quoted 57 lines · Paulo Zanoni
Quoted 9 lines

From: Manasi Navare <[email protected]>

For ICL, on Combo PHY the allowed max rates are:
- HBR3 8.1 eDP (DDIA)
- HBR2 5.4 DisplayPort (DDIB)
and for MG PHY/TC DDI Ports allowed DP rates are:
- HBR3 8.1 DisplayPort (DP alternate mode, DP over TBT,
- DP on legacy connector - DDIC/D/E/F)

Quoted 5 lines
Cc Rodrigo Vivi <[email protected]>
Cc Jani Nikula <[email protected]>
Cc James Ausmus <[email protected]>
Quoted 39 lines
---
 drivers/gpu/drm/i915/intel_dp.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +6 -0
index 5109023abe28..3ee8e74cf2b8 100644
@@ -419,6 +419,20 @@ static int cnl_max_source_rate(struct intel_dp
 *intel_dp)
 	return 810000;
 }
 
+static int icl_max_source_rate(struct intel_dp *intel_dp)
+{
+	struct intel_digital_port *dig_port =
 dp_to_dig_port(intel_dp);
+	enum port port = dig_port->base.port;
+
+	/* On Combo PHY port A max speed is HBR3 for all Vccio

voltages

drivers/gpu/drm/i915/intel_dp.c +8 -0
+	 * and on Combo PHY Port B the maximum supported is HBR2.
+	 */
+	if (port == PORT_B)
+		return 540000;
+
+	return 810000;
+}
+
 static void
 intel_dp_set_source_rates(struct intel_dp *intel_dp)
 {
@@ -448,10 +462,13 @@ intel_dp_set_source_rates(struct intel_dp
 *intel_dp)
 	/* This should only be done once */
 	WARN_ON(intel_dp->source_rates || intel_dp-
 >num_source_rates);
 
Quoted 13 lines
Quoted 9 lines

drivers/gpu/drm/i915/intel_dp.c intel_dp_set_source_rates(struct intel_dp *intel_dp) · line 471

Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +5 -2
-	if (IS_CANNONLAKE(dev_priv)) {
+	if (INTEL_GEN(dev_priv) >= 10) {
 		source_rates = cnl_rates;
 		size = ARRAY_SIZE(cnl_rates);
-		max_rate = cnl_max_source_rate(intel_dp);
+		if (IS_ICELAKE(dev_priv))
+			max_rate = icl_max_source_rate(intel_dp);
+		else
+			max_rate = cnl_max_source_rate(intel_dp);

Bikeshed: changing this to "if (IS_CANNONLAKE())" would help ensuring any possible future platform would be using the ICL table instead of the CNL one.

I agree... but I'd prefer s/IS_ICELAKE/gen >= 11

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +0 -0
 	} else if (IS_GEN9_LP(dev_priv)) {
drivers/gpu/drm/i915/intel_dp.c +0 -0
 		source_rates = bxt_rates;
 		size = ARRAY_SIZE(bxt_rates);
Signature · 1 line
2.14.3
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#100 lore raw

Re: [PATCH 26/24] drm/i915/icl: Add allowed DP rates for Icelake

Quoted 73 lines · Rodrigo Vivi
Quoted 58 lines · Paulo Zanoni

Em Sex, 2018-05-25 às 11:32 -0700, James Ausmus escreveu:

Quoted 57 lines · Paulo Zanoni
Quoted 9 lines

From: Manasi Navare <[email protected]>

For ICL, on Combo PHY the allowed max rates are:
- HBR3 8.1 eDP (DDIA)
- HBR2 5.4 DisplayPort (DDIB)
and for MG PHY/TC DDI Ports allowed DP rates are:
- HBR3 8.1 DisplayPort (DP alternate mode, DP over TBT,
- DP on legacy connector - DDIC/D/E/F)

Quoted 5 lines
Cc Rodrigo Vivi <[email protected]>
Cc Jani Nikula <[email protected]>
Cc James Ausmus <[email protected]>
Quoted 39 lines
---
 drivers/gpu/drm/i915/intel_dp.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +6 -0
index 5109023abe28..3ee8e74cf2b8 100644
@@ -419,6 +419,20 @@ static int cnl_max_source_rate(struct intel_dp
 *intel_dp)
 	return 810000;
 }
 
+static int icl_max_source_rate(struct intel_dp *intel_dp)
+{
+	struct intel_digital_port *dig_port =
 dp_to_dig_port(intel_dp);
+	enum port port = dig_port->base.port;
+
+	/* On Combo PHY port A max speed is HBR3 for all Vccio

voltages

drivers/gpu/drm/i915/intel_dp.c +8 -0
+	 * and on Combo PHY Port B the maximum supported is HBR2.
+	 */
+	if (port == PORT_B)
+		return 540000;
+
+	return 810000;
+}
+
 static void
 intel_dp_set_source_rates(struct intel_dp *intel_dp)
 {
@@ -448,10 +462,13 @@ intel_dp_set_source_rates(struct intel_dp
 *intel_dp)
 	/* This should only be done once */
 	WARN_ON(intel_dp->source_rates || intel_dp-
 >num_source_rates);
 
Quoted 13 lines
Quoted 9 lines

drivers/gpu/drm/i915/intel_dp.c intel_dp_set_source_rates(struct intel_dp *intel_dp) · line 471

Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +5 -2
-	if (IS_CANNONLAKE(dev_priv)) {
+	if (INTEL_GEN(dev_priv) >= 10) {
 		source_rates = cnl_rates;
 		size = ARRAY_SIZE(cnl_rates);
-		max_rate = cnl_max_source_rate(intel_dp);
+		if (IS_ICELAKE(dev_priv))
+			max_rate = icl_max_source_rate(intel_dp);
+		else
+			max_rate = cnl_max_source_rate(intel_dp);

Bikeshed: changing this to "if (IS_CANNONLAKE())" would help ensuring any possible future platform would be using the ICL table instead of the CNL one.

Quoted 1 line

I agree... but I'd prefer s/IS_ICELAKE/gen >= 11

Ok, so remove IS_CANNONLAKE and only have the code for Gen >=11 right? So remove the cnl_max_source_rate also?

Regards
Manasi

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +0 -0
 	} else if (IS_GEN9_LP(dev_priv)) {
drivers/gpu/drm/i915/intel_dp.c +0 -0
 		source_rates = bxt_rates;
 		size = ARRAY_SIZE(bxt_rates);
Signature · 1 line
2.14.3
Quoted 8 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

maintainer
#101 lore raw

Re: [PATCH 26/24] drm/i915/icl: Add allowed DP rates for Icelake

Quoted 74 lines · Manasi Navare
Quoted 73 lines · Rodrigo Vivi
Quoted 71 lines · Paulo Zanoni

Em Sex, 2018-05-25 às 11:32 -0700, James Ausmus escreveu:

Quoted 57 lines · Paulo Zanoni
Quoted 9 lines

From: Manasi Navare <[email protected]>

For ICL, on Combo PHY the allowed max rates are:
- HBR3 8.1 eDP (DDIA)
- HBR2 5.4 DisplayPort (DDIB)
and for MG PHY/TC DDI Ports allowed DP rates are:
- HBR3 8.1 DisplayPort (DP alternate mode, DP over TBT,
- DP on legacy connector - DDIC/D/E/F)

Quoted 5 lines
Cc Rodrigo Vivi <[email protected]>
Cc Jani Nikula <[email protected]>
Cc James Ausmus <[email protected]>
Quoted 39 lines
---
 drivers/gpu/drm/i915/intel_dp.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +6 -0
index 5109023abe28..3ee8e74cf2b8 100644
@@ -419,6 +419,20 @@ static int cnl_max_source_rate(struct intel_dp
 *intel_dp)
 	return 810000;
 }
 
+static int icl_max_source_rate(struct intel_dp *intel_dp)
+{
+	struct intel_digital_port *dig_port =
 dp_to_dig_port(intel_dp);
+	enum port port = dig_port->base.port;
+
+	/* On Combo PHY port A max speed is HBR3 for all Vccio

voltages

drivers/gpu/drm/i915/intel_dp.c +8 -0
+	 * and on Combo PHY Port B the maximum supported is HBR2.
+	 */
+	if (port == PORT_B)
+		return 540000;
+
+	return 810000;
+}
+
 static void
 intel_dp_set_source_rates(struct intel_dp *intel_dp)
 {
@@ -448,10 +462,13 @@ intel_dp_set_source_rates(struct intel_dp
 *intel_dp)
 	/* This should only be done once */
 	WARN_ON(intel_dp->source_rates || intel_dp-
 >num_source_rates);
 
Quoted 9 lines

drivers/gpu/drm/i915/intel_dp.c intel_dp_set_source_rates(struct intel_dp *intel_dp) · line 471

Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +5 -2
-	if (IS_CANNONLAKE(dev_priv)) {
+	if (INTEL_GEN(dev_priv) >= 10) {
 		source_rates = cnl_rates;
 		size = ARRAY_SIZE(cnl_rates);
-		max_rate = cnl_max_source_rate(intel_dp);
+		if (IS_ICELAKE(dev_priv))
+			max_rate = icl_max_source_rate(intel_dp);
+		else
+			max_rate = cnl_max_source_rate(intel_dp);

Bikeshed: changing this to "if (IS_CANNONLAKE())" would help ensuring any possible future platform would be using the ICL table instead of the CNL one.

Quoted 4 lines
Quoted 1 line

I agree... but I'd prefer s/IS_ICELAKE/gen >= 11

Ok, so remove IS_CANNONLAKE and only have the code for Gen >=11 right? So remove the cnl_max_source_rate also?

No no, the rest of the patch is okay and should stay... only instead of IS_ICELAKE you use gen >= 11

Quoted 17 lines

Regards
Manasi

Quoted 13 lines
Quoted 13 lines
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +0 -0
 	} else if (IS_GEN9_LP(dev_priv)) {
drivers/gpu/drm/i915/intel_dp.c +0 -0
 		source_rates = bxt_rates;
 		size = ARRAY_SIZE(bxt_rates);
Signature · 1 line
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Quoted 8 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

maintainer Reviewed-by
#102 lore raw

Re: [PATCH 26/24] drm/i915/icl: Add allowed DP rates for Icelake

In reply to Paulo Zanoni
Quoted 25 lines · Paulo Zanoni

From: Manasi Navare <[email protected]>

For ICL, on Combo PHY the allowed max rates are:
- HBR3 8.1 eDP (DDIA)
- HBR2 5.4 DisplayPort (DDIB)
and for MG PHY/TC DDI Ports allowed DP rates are:
- HBR3 8.1 DisplayPort (DP alternate mode, DP over TBT,
- DP on legacy connector - DDIC/D/E/F)

Cc Rodrigo Vivi <[email protected]>
Cc Jani Nikula <[email protected]>
Cc James Ausmus <[email protected]>
---
 drivers/gpu/drm/i915/intel_dp.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +0 -0
index 5109023abe28..3ee8e74cf2b8 100644
@@ -419,6 +419,20 @@ static int cnl_max_source_rate(struct intel_dp *intel_dp)
 	return 810000;
 }

drivers/gpu/drm/i915/intel_dp.c static int cnl_max_source_rate(struct intel_dp *intel_dp) · line 430

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +9 -0
 
+static int icl_max_source_rate(struct intel_dp *intel_dp)
+{
+	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
+	enum port port = dig_port->base.port;
+
+	/* On Combo PHY port A max speed is HBR3 for all Vccio voltages
+	 * and on Combo PHY Port B the maximum supported is HBR2.
+	 */
+	if (port == PORT_B)

A more generic way here would be COMBO and !eDP

Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +5 -0
+		return 540000;
+
+	return 810000;
+}
+
 static void
 intel_dp_set_source_rates(struct intel_dp *intel_dp)
 {

drivers/gpu/drm/i915/intel_dp.c intel_dp_set_source_rates(struct intel_dp *intel_dp) · line 468

Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +2 -2
@@ -448,10 +462,13 @@ intel_dp_set_source_rates(struct intel_dp *intel_dp)
 	/* This should only be done once */
 	WARN_ON(intel_dp->source_rates || intel_dp->num_source_rates);
 
-	if (IS_CANNONLAKE(dev_priv)) {
+	if (INTEL_GEN(dev_priv) >= 10) {
 		source_rates = cnl_rates;
 		size = ARRAY_SIZE(cnl_rates);
-		max_rate = cnl_max_source_rate(intel_dp);
+		if (IS_ICELAKE(dev_priv))

and gen >= 11

but changes can be in follow-up work, so

Quoted 13 lines
drivers/gpu/drm/i915/intel_dp.c +3 -0
+			max_rate = icl_max_source_rate(intel_dp);
+		else
+			max_rate = cnl_max_source_rate(intel_dp);
 	} else if (IS_GEN9_LP(dev_priv)) {
 		source_rates = bxt_rates;
 		size = ARRAY_SIZE(bxt_rates);
Signature · 6 lines
2.14.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#103 lore raw

Re: [PATCH 26/24] drm/i915/icl: Add allowed DP rates for Icelake

Quoted 27 lines · Rodrigo Vivi
Quoted 26 lines · Paulo Zanoni

From: Manasi Navare <[email protected]>

For ICL, on Combo PHY the allowed max rates are:
- HBR3 8.1 eDP (DDIA)
- HBR2 5.4 DisplayPort (DDIB)
and for MG PHY/TC DDI Ports allowed DP rates are:
- HBR3 8.1 DisplayPort (DP alternate mode, DP over TBT,
- DP on legacy connector - DDIC/D/E/F)

Cc Rodrigo Vivi <[email protected]>
Cc Jani Nikula <[email protected]>
Cc James Ausmus <[email protected]>
---
 drivers/gpu/drm/i915/intel_dp.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +0 -0
index 5109023abe28..3ee8e74cf2b8 100644
@@ -419,6 +419,20 @@ static int cnl_max_source_rate(struct intel_dp *intel_dp)
 	return 810000;
 }
 
Quoted 11 lines

drivers/gpu/drm/i915/intel_dp.c static int cnl_max_source_rate(struct intel_dp *intel_dp) · line 430

Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +9 -0
+static int icl_max_source_rate(struct intel_dp *intel_dp)
+{
+	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
+	enum port port = dig_port->base.port;
+
+	/* On Combo PHY port A max speed is HBR3 for all Vccio voltages
+	 * and on Combo PHY Port B the maximum supported is HBR2.
+	 */
+	if (port == PORT_B)

A more generic way here would be COMBO and !eDP

Yes I can use the function intel_is_port_combophy() but I dont see that merged yet Will have to wait to spin this patch in that case.

Quoted 22 lines
Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +5 -0
+		return 540000;
+
+	return 810000;
+}
+
 static void
 intel_dp_set_source_rates(struct intel_dp *intel_dp)
 {

drivers/gpu/drm/i915/intel_dp.c intel_dp_set_source_rates(struct intel_dp *intel_dp) · line 468

Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +2 -2
@@ -448,10 +462,13 @@ intel_dp_set_source_rates(struct intel_dp *intel_dp)
 	/* This should only be done once */
 	WARN_ON(intel_dp->source_rates || intel_dp->num_source_rates);
 
-	if (IS_CANNONLAKE(dev_priv)) {
+	if (INTEL_GEN(dev_priv) >= 10) {
 		source_rates = cnl_rates;
 		size = ARRAY_SIZE(cnl_rates);
-		max_rate = cnl_max_source_rate(intel_dp);
+		if (IS_ICELAKE(dev_priv))

and gen >= 11

Quoted 1 line

but changes can be in follow-up work, so

Yes will change that to use >= 11

Manasi

Quoted 12 lines
Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c +3 -0
+			max_rate = icl_max_source_rate(intel_dp);
+		else
+			max_rate = cnl_max_source_rate(intel_dp);
 	} else if (IS_GEN9_LP(dev_priv)) {
 		source_rates = bxt_rates;
 		size = ARRAY_SIZE(bxt_rates);
Signature · 1 line
2.14.3
Quoted 8 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx