Skip to contentSkip to conversation

Haswell

RFC PATCH In review Eugeni Dodonov 6 participants 95 messages Mar 22, 2012 – Mar 28, 2012

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

cover Haswell

Hi folks,

To contribute to everyones curiosity and further enrich Phoronix articles :), this is the initial Haswell enablement patchset for basic modesetting support over VGA.

This is actually the first time I am doing such enablement, and the combination of HSW/LPT changes proved to be quite tricky, yet also very cool to do. But certainly, while I tried to split the patches in the best way to 'tell a story', I suspect lots and lots of things could be improved. So bikeshedding is much welcomed! And of course, there are still a bunch of things missing, but those can be done in parallel now.

As for those patches, I organized them in the following way:
- The first part adds new hardware information and new registers which we'll need to make it work (a.k.a, 'The Pledge'). This goes from patch 01 until patch 21.
- The second part does small changes to existent functions to make them work on Haswell ('The Turn'). This goes from patch 22 to patch 28. Haswell is not quite Gen7, but is shares lots of stuff with what we already have, so there was no point in reinventing the wheel just now.
- The third part makes things work by enabling power wells, DDI and FDI connections, PCH-specific stuff and so on ('The Prestige'). This is from patch 29 to patch 35. Those are the scariest ones, but I couldn't split them better and still maintain logical consistency among them. Initially, those were 24 small patches, but it was very hard to keep track of them, so I combined them into just 6 for this patchset.
- And finally, there are 2 last patches ('The Prestige Debug' :)) which won't be present in the final series, but are helpful at least for me to trace where things go wrong. So if you run into issues and want to send me a dmesg, those traces will make my life so much easier.

I didn't wanted to go much deeper with HSW for now because I would end up doing a massive code reordering to maintain my mental sanity, and as we already discussed by email earlier today Jesse is running into same problems as well. So perhaps we should just settle on doing some cleanup in our intel_display module before adding more platform-specific stuff?

And finally, I'd like to thank once again Jesse with his help on some of the trickiest issues, and Ben for taking a look at those patches and point me at things I've been doing wrong :).

Cheers,
Eugeni

Eugeni Dodonov (37):
drm/i915: add Haswell devices and their PCI IDs drm/i915: add support for LynxPoint PCH drm/i915: add HAS_PLL_SPLIT macro
drm/i915: add haswell into the PCH SPLIT company drm/i915: add support for power wells
drm/i915: add DDI registers
drm/i915: add DP_TP_CTL registers
drm/i915: add DP_TP_STATUS registers
drm/i915: add definitions for DDI_BUF_CTL registers drm/i915: add definition of LPT FDI port width registers drm/i915: add definition of DDI buffer translations regs drm/i915: add SBI registers
drm/i915: add support for SBI ops
drm/i915: add PIXCLK_GATE register
drm/i915: add S PLL control
drm/i915: add port clock selection support for HSW drm/i915: add SSC offsets for SBI access drm/i915: add GTC registers
drm/i915: add LCPLL control registers
drm/i915: add WM_LINETIME registers
drm/i915: calculate watermarks on Gen7 archs in one place drm/i915: program WM_LINETIME on Haswell drm/i915: do not set 6BPP dithering on haswell drm/i915: share forcewaking code between IVB and HSW drm/i915: haswell has 3 pipes as well
drm/i915: reuse Ivybridge interrupts code for Haswell drm/i915: share pipe count handling with Ivybridge drm/i915: share IVB cursor routine with Haswell drm/i915: enable power wells on haswell init drm/i915: disable rc6 on haswell for now drm/i915: enable PCH earlier
drm/i915: perform Haswell DDI link training in FDI mode drm/i915: double-write DDI translation table drm/i915: do not use fdi_normal_train on haswell drm/i915: program iCLKIP on Lynx Point
drm/i915: add warning when using old bits on Haswell/LPT drm/i915: dump registers read/write ops

 drivers/char/agp/intel-agp.c         |    4 +
 drivers/char/agp/intel-agp.h         |   11 +
 drivers/char/agp/intel-gtt.c         |   14 +
 drivers/gpu/drm/i915/i915_dma.c      |    2 +-
 drivers/gpu/drm/i915/i915_drv.c      |   29 ++
 drivers/gpu/drm/i915/i915_drv.h      |    7 +-
 drivers/gpu/drm/i915/i915_irq.c      |    6 +-
 drivers/gpu/drm/i915/i915_reg.h      |  181 ++++++++++
 drivers/gpu/drm/i915/intel_display.c |  656 ++++++++++++++++++++++++++++++++--
 9 files changed, 883 insertions(+), 27 deletions(-)
Signature · 1 line
1.7.9.2
#1 lore raw

PATCH 1/37 drm/i915: add Haswell devices and their PCI IDs

This adds product definitions for desktop, mobile and server boards.

---
 drivers/char/agp/intel-agp.c    |    4 ++++
 drivers/char/agp/intel-agp.h    |   11 +++++++++++
 drivers/char/agp/intel-gtt.c    |   14 ++++++++++++++
 drivers/gpu/drm/i915/i915_drv.c |   23 +++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_drv.h |    2 ++
 5 files changed, 54 insertions(+)
drivers/char/agp/intel-agp.c +4 -0
index 962e75d..0ad4933 100644
@@ -907,6 +907,10 @@ static struct pci_device_id agp_intel_pci_table[] = {
 	ID(PCI_DEVICE_ID_INTEL_IVYBRIDGE_HB),
 	ID(PCI_DEVICE_ID_INTEL_IVYBRIDGE_M_HB),
 	ID(PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_HB),
+	ID(PCI_DEVICE_ID_INTEL_HASWELL_HB),
+	ID(PCI_DEVICE_ID_INTEL_HASWELL_M_HB),
+	ID(PCI_DEVICE_ID_INTEL_HASWELL_S_HB),
+	ID(PCI_DEVICE_ID_INTEL_HASWELL_E_HB),
 	{ }
 };
 
drivers/char/agp/intel-agp.h +11 -0
index 5da67f1..46394c11 100644
@@ -234,6 +234,17 @@
 #define PCI_DEVICE_ID_INTEL_IVYBRIDGE_M_GT2_IG		0x0166
 #define PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_HB		0x0158  /* Server */
 #define PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_GT1_IG		0x015A
+#define PCI_DEVICE_ID_INTEL_HASWELL_HB				0x0400 /* Desktop */
+#define PCI_DEVICE_ID_INTEL_HASWELL_D_GT1_IG		0x0402
+#define PCI_DEVICE_ID_INTEL_HASWELL_D_GT2_IG		0x0412
+#define PCI_DEVICE_ID_INTEL_HASWELL_M_HB			0x0404 /* Mobile */
+#define PCI_DEVICE_ID_INTEL_HASWELL_M_GT1_IG		0x0406
+#define PCI_DEVICE_ID_INTEL_HASWELL_M_GT2_IG		0x0416
+#define PCI_DEVICE_ID_INTEL_HASWELL_S_HB			0x0408 /* Server */
+#define PCI_DEVICE_ID_INTEL_HASWELL_S_GT1_IG		0x040a
+#define PCI_DEVICE_ID_INTEL_HASWELL_S_GT2_IG		0x041a
+#define PCI_DEVICE_ID_INTEL_HASWELL_SDV		0x0c16 /* SDV */
+#define PCI_DEVICE_ID_INTEL_HASWELL_E_HB			0x0c04
 
 int intel_gmch_probe(struct pci_dev *pdev,
 			       struct agp_bridge_data *bridge);
drivers/char/agp/intel-gtt.c +14 -0
index 5cf47ac..f494556 100644
@@ -1459,6 +1459,20 @@ static const struct intel_gtt_driver_description {
 	    "Ivybridge", &sandybridge_gtt_driver },
 	{ PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_GT1_IG,
 	    "Ivybridge", &sandybridge_gtt_driver },
+	{ PCI_DEVICE_ID_INTEL_HASWELL_D_GT1_IG,
+	    "Haswell", &sandybridge_gtt_driver },
+	{ PCI_DEVICE_ID_INTEL_HASWELL_D_GT2_IG,
+	    "Haswell", &sandybridge_gtt_driver },
+	{ PCI_DEVICE_ID_INTEL_HASWELL_M_GT1_IG,
+	    "Haswell", &sandybridge_gtt_driver },
+	{ PCI_DEVICE_ID_INTEL_HASWELL_M_GT2_IG,
+	    "Haswell", &sandybridge_gtt_driver },
+	{ PCI_DEVICE_ID_INTEL_HASWELL_S_GT1_IG,
+	    "Haswell", &sandybridge_gtt_driver },
+	{ PCI_DEVICE_ID_INTEL_HASWELL_S_GT2_IG,
+	    "Haswell", &sandybridge_gtt_driver },
+	{ PCI_DEVICE_ID_INTEL_HASWELL_SDV,
+	    "Haswell", &sandybridge_gtt_driver },
 	{ 0, NULL, NULL }
 };
 
drivers/gpu/drm/i915/i915_drv.c +23 -0
index 0694e17..d4f542b 100644
@@ -248,6 +248,22 @@ static const struct intel_device_info intel_ivybridge_m_info = {
 	.has_llc = 1,
 };
 
+static const struct intel_device_info intel_haswell_d_info = {
+	.is_haswell = 1, .gen = 7,
+	.need_gfx_hws = 1, .has_hotplug = 1,
+	.has_bsd_ring = 1,
+	.has_blt_ring = 1,
+	.has_llc = 1,
+};
+
+static const struct intel_device_info intel_haswell_m_info = {
+	.is_haswell = 1, .gen = 7, .is_mobile = 1,
+	.need_gfx_hws = 1, .has_hotplug = 1,
+	.has_bsd_ring = 1,
+	.has_blt_ring = 1,
+	.has_llc = 1,
+};
+
 static const struct pci_device_id pciidlist[] = {		/* aka */
 	INTEL_VGA_DEVICE(0x3577, &intel_i830_info),		/* I830_M */
 	INTEL_VGA_DEVICE(0x2562, &intel_845g_info),		/* 845_G */
@@ -292,6 +308,13 @@ static const struct pci_device_id pciidlist[] = {		/* aka */
 	INTEL_VGA_DEVICE(0x0152, &intel_ivybridge_d_info), /* GT1 desktop */
 	INTEL_VGA_DEVICE(0x0162, &intel_ivybridge_d_info), /* GT2 desktop */
 	INTEL_VGA_DEVICE(0x015a, &intel_ivybridge_d_info), /* GT1 server */
+	INTEL_VGA_DEVICE(0x0402, &intel_haswell_d_info), /* GT1 desktop */
+	INTEL_VGA_DEVICE(0x0412, &intel_haswell_d_info), /* GT2 desktop */
+	INTEL_VGA_DEVICE(0x040a, &intel_haswell_d_info), /* GT1 server */
+	INTEL_VGA_DEVICE(0x041a, &intel_haswell_d_info), /* GT2 server */
+	INTEL_VGA_DEVICE(0x0406, &intel_haswell_m_info), /* GT1 mobile */
+	INTEL_VGA_DEVICE(0x0416, &intel_haswell_m_info), /* GT2 mobile */
+	INTEL_VGA_DEVICE(0x0c16, &intel_haswell_d_info), /* SDV */
 	{0, 0, 0}
 };
 
drivers/gpu/drm/i915/i915_drv.h +2 -0
index c0f19f5..9a99ef1 100644
@@ -255,6 +255,7 @@ struct intel_device_info {
 	u8 is_broadwater:1;
 	u8 is_crestline:1;
 	u8 is_ivybridge:1;
+	u8 is_haswell:1;
 	u8 has_fbc:1;
 	u8 has_pipe_cxsr:1;
 	u8 has_hotplug:1;
@@ -1001,6 +1002,7 @@ struct drm_i915_file_private {
 #define IS_IRONLAKE_D(dev)	((dev)->pci_device == 0x0042)
 #define IS_IRONLAKE_M(dev)	((dev)->pci_device == 0x0046)
 #define IS_IVYBRIDGE(dev)	(INTEL_INFO(dev)->is_ivybridge)
+#define IS_HASWELL(dev)	(INTEL_INFO(dev)->is_haswell)
 #define IS_MOBILE(dev)		(INTEL_INFO(dev)->is_mobile)
 
 /*
Signature · 1 line
1.7.9.2
#2 lore raw

Re: [PATCH 01/37] drm/i915: add Haswell devices and their PCI IDs

Quoted 3 lines · Eugeni Dodonov

This adds product definitions for desktop, mobile and server boards.

Like in the vlv series we need to split this into a second patch, which just adds the pci ids to the tables, and which will get merged last when everything works (well, works well enough).
-Daniel

Quoted 138 lines
---
 drivers/char/agp/intel-agp.c    |    4 ++++
 drivers/char/agp/intel-agp.h    |   11 +++++++++++
 drivers/char/agp/intel-gtt.c    |   14 ++++++++++++++
 drivers/gpu/drm/i915/i915_drv.c |   23 +++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_drv.h |    2 ++
 5 files changed, 54 insertions(+)
drivers/char/agp/intel-agp.c +4 -0
index 962e75d..0ad4933 100644
@@ -907,6 +907,10 @@ static struct pci_device_id agp_intel_pci_table[] = {
 	ID(PCI_DEVICE_ID_INTEL_IVYBRIDGE_HB),
 	ID(PCI_DEVICE_ID_INTEL_IVYBRIDGE_M_HB),
 	ID(PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_HB),
+	ID(PCI_DEVICE_ID_INTEL_HASWELL_HB),
+	ID(PCI_DEVICE_ID_INTEL_HASWELL_M_HB),
+	ID(PCI_DEVICE_ID_INTEL_HASWELL_S_HB),
+	ID(PCI_DEVICE_ID_INTEL_HASWELL_E_HB),
 	{ }
 };
 
drivers/char/agp/intel-agp.h +11 -0
index 5da67f1..46394c11 100644
@@ -234,6 +234,17 @@
 #define PCI_DEVICE_ID_INTEL_IVYBRIDGE_M_GT2_IG		0x0166
 #define PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_HB		0x0158  /* Server */
 #define PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_GT1_IG		0x015A
+#define PCI_DEVICE_ID_INTEL_HASWELL_HB				0x0400 /* Desktop */
+#define PCI_DEVICE_ID_INTEL_HASWELL_D_GT1_IG		0x0402
+#define PCI_DEVICE_ID_INTEL_HASWELL_D_GT2_IG		0x0412
+#define PCI_DEVICE_ID_INTEL_HASWELL_M_HB			0x0404 /* Mobile */
+#define PCI_DEVICE_ID_INTEL_HASWELL_M_GT1_IG		0x0406
+#define PCI_DEVICE_ID_INTEL_HASWELL_M_GT2_IG		0x0416
+#define PCI_DEVICE_ID_INTEL_HASWELL_S_HB			0x0408 /* Server */
+#define PCI_DEVICE_ID_INTEL_HASWELL_S_GT1_IG		0x040a
+#define PCI_DEVICE_ID_INTEL_HASWELL_S_GT2_IG		0x041a
+#define PCI_DEVICE_ID_INTEL_HASWELL_SDV		0x0c16 /* SDV */
+#define PCI_DEVICE_ID_INTEL_HASWELL_E_HB			0x0c04
 
 int intel_gmch_probe(struct pci_dev *pdev,
 			       struct agp_bridge_data *bridge);
drivers/char/agp/intel-gtt.c +14 -0
index 5cf47ac..f494556 100644
@@ -1459,6 +1459,20 @@ static const struct intel_gtt_driver_description {
 	    "Ivybridge", &sandybridge_gtt_driver },
 	{ PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_GT1_IG,
 	    "Ivybridge", &sandybridge_gtt_driver },
+	{ PCI_DEVICE_ID_INTEL_HASWELL_D_GT1_IG,
+	    "Haswell", &sandybridge_gtt_driver },
+	{ PCI_DEVICE_ID_INTEL_HASWELL_D_GT2_IG,
+	    "Haswell", &sandybridge_gtt_driver },
+	{ PCI_DEVICE_ID_INTEL_HASWELL_M_GT1_IG,
+	    "Haswell", &sandybridge_gtt_driver },
+	{ PCI_DEVICE_ID_INTEL_HASWELL_M_GT2_IG,
+	    "Haswell", &sandybridge_gtt_driver },
+	{ PCI_DEVICE_ID_INTEL_HASWELL_S_GT1_IG,
+	    "Haswell", &sandybridge_gtt_driver },
+	{ PCI_DEVICE_ID_INTEL_HASWELL_S_GT2_IG,
+	    "Haswell", &sandybridge_gtt_driver },
+	{ PCI_DEVICE_ID_INTEL_HASWELL_SDV,
+	    "Haswell", &sandybridge_gtt_driver },
 	{ 0, NULL, NULL }
 };
 
drivers/gpu/drm/i915/i915_drv.c +23 -0
index 0694e17..d4f542b 100644
@@ -248,6 +248,22 @@ static const struct intel_device_info intel_ivybridge_m_info = {
 	.has_llc = 1,
 };
 
+static const struct intel_device_info intel_haswell_d_info = {
+	.is_haswell = 1, .gen = 7,
+	.need_gfx_hws = 1, .has_hotplug = 1,
+	.has_bsd_ring = 1,
+	.has_blt_ring = 1,
+	.has_llc = 1,
+};
+
+static const struct intel_device_info intel_haswell_m_info = {
+	.is_haswell = 1, .gen = 7, .is_mobile = 1,
+	.need_gfx_hws = 1, .has_hotplug = 1,
+	.has_bsd_ring = 1,
+	.has_blt_ring = 1,
+	.has_llc = 1,
+};
+
 static const struct pci_device_id pciidlist[] = {		/* aka */
 	INTEL_VGA_DEVICE(0x3577, &intel_i830_info),		/* I830_M */
 	INTEL_VGA_DEVICE(0x2562, &intel_845g_info),		/* 845_G */
@@ -292,6 +308,13 @@ static const struct pci_device_id pciidlist[] = {		/* aka */
 	INTEL_VGA_DEVICE(0x0152, &intel_ivybridge_d_info), /* GT1 desktop */
 	INTEL_VGA_DEVICE(0x0162, &intel_ivybridge_d_info), /* GT2 desktop */
 	INTEL_VGA_DEVICE(0x015a, &intel_ivybridge_d_info), /* GT1 server */
+	INTEL_VGA_DEVICE(0x0402, &intel_haswell_d_info), /* GT1 desktop */
+	INTEL_VGA_DEVICE(0x0412, &intel_haswell_d_info), /* GT2 desktop */
+	INTEL_VGA_DEVICE(0x040a, &intel_haswell_d_info), /* GT1 server */
+	INTEL_VGA_DEVICE(0x041a, &intel_haswell_d_info), /* GT2 server */
+	INTEL_VGA_DEVICE(0x0406, &intel_haswell_m_info), /* GT1 mobile */
+	INTEL_VGA_DEVICE(0x0416, &intel_haswell_m_info), /* GT2 mobile */
+	INTEL_VGA_DEVICE(0x0c16, &intel_haswell_d_info), /* SDV */
 	{0, 0, 0}
 };
 
drivers/gpu/drm/i915/i915_drv.h +2 -0
index c0f19f5..9a99ef1 100644
@@ -255,6 +255,7 @@ struct intel_device_info {
 	u8 is_broadwater:1;
 	u8 is_crestline:1;
 	u8 is_ivybridge:1;
+	u8 is_haswell:1;
 	u8 has_fbc:1;
 	u8 has_pipe_cxsr:1;
 	u8 has_hotplug:1;
@@ -1001,6 +1002,7 @@ struct drm_i915_file_private {
 #define IS_IRONLAKE_D(dev)	((dev)->pci_device == 0x0042)
 #define IS_IRONLAKE_M(dev)	((dev)->pci_device == 0x0046)
 #define IS_IVYBRIDGE(dev)	(INTEL_INFO(dev)->is_ivybridge)
+#define IS_HASWELL(dev)	(INTEL_INFO(dev)->is_haswell)
 #define IS_MOBILE(dev)		(INTEL_INFO(dev)->is_mobile)
 
 /*
Signature · 6 lines
1.7.9.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
#3 lore raw

PATCH 2/37 drm/i915: add support for LynxPoint PCH

In reply to Eugeni Dodonov
---
 drivers/gpu/drm/i915/i915_drv.c |    4 ++++
 drivers/gpu/drm/i915/i915_drv.h |    2 ++
 2 files changed, 6 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +4 -0
index d4f542b..5fe9d62 100644
@@ -326,6 +326,7 @@ MODULE_DEVICE_TABLE(pci, pciidlist);
 #define INTEL_PCH_IBX_DEVICE_ID_TYPE	0x3b00
 #define INTEL_PCH_CPT_DEVICE_ID_TYPE	0x1c00
 #define INTEL_PCH_PPT_DEVICE_ID_TYPE	0x1e00
+#define INTEL_PCH_LPT_DEVICE_ID_TYPE	0x8c00
 
 void intel_detect_pch(struct drm_device *dev)
 {
@@ -354,6 +355,9 @@ void intel_detect_pch(struct drm_device *dev)
 				/* PantherPoint is CPT compatible */
 				dev_priv->pch_type = PCH_CPT;
 				DRM_DEBUG_KMS("Found PatherPoint PCH\n");
+			} else if (id == INTEL_PCH_LPT_DEVICE_ID_TYPE) {
+				dev_priv->pch_type = PCH_LPT;
+				DRM_DEBUG_KMS("Found LynxPoint PCH\n");
 			}
 		}
 		pci_dev_put(pch);
drivers/gpu/drm/i915/i915_drv.h +2 -0
index 9a99ef1..49488e1 100644
@@ -292,6 +292,7 @@ enum no_fbc_reason {
 enum intel_pch {
 	PCH_IBX,	/* Ibexpeak PCH */
 	PCH_CPT,	/* Cougarpoint PCH */
+	PCH_LPT,	/* Lynxpoint PCH */
 };
 
 #define QUIRK_PIPEA_FORCE (1<<0)
@@ -1050,6 +1051,7 @@ struct drm_i915_file_private {
 #define HAS_PIPE_CONTROL(dev) (INTEL_INFO(dev)->gen >= 5)
 
 #define INTEL_PCH_TYPE(dev) (((struct drm_i915_private *)(dev)->dev_private)->pch_type)
+#define HAS_PCH_LPT(dev) (INTEL_PCH_TYPE(dev) == PCH_LPT)
 #define HAS_PCH_CPT(dev) (INTEL_PCH_TYPE(dev) == PCH_CPT)
 #define HAS_PCH_IBX(dev) (INTEL_PCH_TYPE(dev) == PCH_IBX)
 
Signature · 1 line
1.7.9.2
Reviewed-by on v1 2/37
#4 lore raw

Re: [PATCH 02/37] drm/i915: add support for LynxPoint PCH

Quoted 55 lines · Eugeni Dodonov

---
 drivers/gpu/drm/i915/i915_drv.c |    4 ++++
 drivers/gpu/drm/i915/i915_drv.h |    2 ++

 2 files changed, 6 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +4 -0
index d4f542b..5fe9d62 100644
@@ -326,6 +326,7 @@ MODULE_DEVICE_TABLE(pci, pciidlist);
  #define INTEL_PCH_IBX_DEVICE_ID_TYPE   0x3b00
  #define INTEL_PCH_CPT_DEVICE_ID_TYPE   0x1c00
  #define INTEL_PCH_PPT_DEVICE_ID_TYPE   0x1e00
+#define INTEL_PCH_LPT_DEVICE_ID_TYPE   0x8c00
 
  void intel_detect_pch(struct drm_device *dev)
  {
@@ -354,6 +355,9 @@ void intel_detect_pch(struct drm_device *dev)
                                /* PantherPoint is CPT compatible */
                                dev_priv->pch_type = PCH_CPT;
                                DRM_DEBUG_KMS("Found PatherPoint PCH\n");
+                       } else if (id == INTEL_PCH_LPT_DEVICE_ID_TYPE) {
+                               dev_priv->pch_type = PCH_LPT;
+                               DRM_DEBUG_KMS("Found LynxPoint PCH\n");
                        }
                }
                pci_dev_put(pch);
drivers/gpu/drm/i915/i915_drv.h +0 -0
index 9a99ef1..49488e1 100644
@@ -292,6 +292,7 @@ enum no_fbc_reason {
  enum intel_pch {

       PCH_IBX,        /* Ibexpeak PCH */
       PCH_CPT,        /* Cougarpoint PCH */
+       PCH_LPT,        /* Lynxpoint PCH */
 };

 #define QUIRK_PIPEA_FORCE (1<<0)

drivers/gpu/drm/i915/i915_drv.h +1 -1
@@ -1050,6 +1051,7 @@ struct drm_i915_file_private {
  #define HAS_PIPE_CONTROL(dev) (INTEL_INFO(dev)->gen >= 5)
 
  #define INTEL_PCH_TYPE(dev) (((struct drm_i915_private *)(dev)->dev_private)->pch_type)
+#define HAS_PCH_LPT(dev) (INTEL_PCH_TYPE(dev) == PCH_LPT)
  #define HAS_PCH_CPT(dev) (INTEL_PCH_TYPE(dev) == PCH_CPT)
  #define HAS_PCH_IBX(dev) (INTEL_PCH_TYPE(dev) == PCH_IBX)
 
--

1.7.9.2

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

Signature · 3 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
#5 lore raw

PATCH 3/37 drm/i915: add HAS_PLL_SPLIT macro

In reply to Eugeni Dodonov

Ivy Bridge is the only GPU which has split 3-display support over 2 PLLs.

---
 drivers/gpu/drm/i915/i915_drv.h |    1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/i915_drv.h +1 -0
index 49488e1..fb50c42 100644
@@ -1048,6 +1048,7 @@ struct drm_i915_file_private {
 #define I915_HAS_FBC(dev) (INTEL_INFO(dev)->has_fbc)
 
 #define HAS_PCH_SPLIT(dev) (IS_GEN5(dev) || IS_GEN6(dev) || IS_IVYBRIDGE(dev))
+#define HAS_PLL_SPLIT(dev) (IS_IVYBRIDGE(dev))
 #define HAS_PIPE_CONTROL(dev) (INTEL_INFO(dev)->gen >= 5)
 
 #define INTEL_PCH_TYPE(dev) (((struct drm_i915_private *)(dev)->dev_private)->pch_type)
Signature · 1 line
1.7.9.2
#6 lore raw

Re: [PATCH 03/37] drm/i915: add HAS_PLL_SPLIT macro

Quoted 3 lines · Eugeni Dodonov

Ivy Bridge is the only GPU which has split 3-display support over 2 PLLs.

This is imo a strange name for '3 pipes but just 2 plls' hw. And I couldn't find any usage of this in your series, so I don't know how you intend to use it. But usually for such narrow, single-chip special cases I prefer a fe IS_IVB checks in the code instead of this indirection. -Daniel

Quoted 23 lines
---
 drivers/gpu/drm/i915/i915_drv.h |    1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/i915_drv.h +1 -0
index 49488e1..fb50c42 100644
@@ -1048,6 +1048,7 @@ struct drm_i915_file_private {
 #define I915_HAS_FBC(dev) (INTEL_INFO(dev)->has_fbc)
 
 #define HAS_PCH_SPLIT(dev) (IS_GEN5(dev) || IS_GEN6(dev) || IS_IVYBRIDGE(dev))
+#define HAS_PLL_SPLIT(dev) (IS_IVYBRIDGE(dev))
 #define HAS_PIPE_CONTROL(dev) (INTEL_INFO(dev)->gen >= 5)
 
 #define INTEL_PCH_TYPE(dev) (((struct drm_i915_private *)(dev)->dev_private)->pch_type)
Signature · 6 lines
1.7.9.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
#7 lore raw

PATCH 4/37 drm/i915: add haswell into the PCH SPLIT company

In reply to Eugeni Dodonov

Haswell is similar to Ivy Bridge in this sense.

---
 drivers/gpu/drm/i915/i915_drv.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +1 -1
index fb50c42..51e04ec 100644
@@ -1047,7 +1047,7 @@ struct drm_i915_file_private {
 #define HAS_PIPE_CXSR(dev) (INTEL_INFO(dev)->has_pipe_cxsr)
 #define I915_HAS_FBC(dev) (INTEL_INFO(dev)->has_fbc)
 
-#define HAS_PCH_SPLIT(dev) (IS_GEN5(dev) || IS_GEN6(dev) || IS_IVYBRIDGE(dev))
+#define HAS_PCH_SPLIT(dev) (IS_GEN5(dev) || IS_GEN6(dev) || IS_IVYBRIDGE(dev) || IS_HASWELL(dev))
 #define HAS_PLL_SPLIT(dev) (IS_IVYBRIDGE(dev))
 #define HAS_PIPE_CONTROL(dev) (INTEL_INFO(dev)->gen >= 5)
 
Signature · 1 line
1.7.9.2
#8 lore raw

Re: [PATCH 04/37] drm/i915: add haswell into the PCH SPLIT company

Quoted 3 lines · Eugeni Dodonov

Haswell is similar to Ivy Bridge in this sense.

Given that vlv is gen7, too, but not pch_split, I think it's time to promote this into a feature flag. We use this at tons of places, so the added indirection imo isn't too bad.
-Daniel

Quoted 24 lines
---
 drivers/gpu/drm/i915/i915_drv.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +1 -1
index fb50c42..51e04ec 100644
@@ -1047,7 +1047,7 @@ struct drm_i915_file_private {
 #define HAS_PIPE_CXSR(dev) (INTEL_INFO(dev)->has_pipe_cxsr)
 #define I915_HAS_FBC(dev) (INTEL_INFO(dev)->has_fbc)
 
-#define HAS_PCH_SPLIT(dev) (IS_GEN5(dev) || IS_GEN6(dev) || IS_IVYBRIDGE(dev))
+#define HAS_PCH_SPLIT(dev) (IS_GEN5(dev) || IS_GEN6(dev) || IS_IVYBRIDGE(dev) || IS_HASWELL(dev))
 #define HAS_PLL_SPLIT(dev) (IS_IVYBRIDGE(dev))
 #define HAS_PIPE_CONTROL(dev) (INTEL_INFO(dev)->gen >= 5)
 
Signature · 6 lines
1.7.9.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
#9 lore raw

PATCH 5/37 drm/i915: add support for power wells

In reply to Eugeni Dodonov

This defines the registers used by different power wells.

---
 drivers/gpu/drm/i915/i915_reg.h |   13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +13 -0
index 52a06be..ddc9c87 100644
@@ -3850,4 +3850,17 @@
 #define   AUD_CONFIG_PIXEL_CLOCK_HDMI		(0xf << 16)
 #define   AUD_CONFIG_DISABLE_NCTS		(1 << 3)
 
+/* HSW Power Wells */
+#define HSW_PWR_WELL_CTL1		0x45400		/* BIOS */
+#define HSW_PWR_WELL_CTL2		0x45404		/* Driver */
+#define HSW_PWR_WELL_CTL3		0x45408		/* KVMR */
+#define HSW_PWR_WELL_CTL4		0x4540C		/* Debug */
+#define   HSW_PWR_WELL_ENABLE	(1<<31)
+#define   HSW_PWR_WELL_STATE	(1<<30)
+#define HSW_PWR_WELL_CTL5		0x45410
+#define   HSW_PWR_WELL_ENABLE_SINGLE_STEP	(1<<31)
+#define   HSW_PWR_WELL_PWR_GATE_OVERRIDE	(1<<20)
+#define   HSW_PWR_WELL_FORCE_ON	(1<<19)
+#define HSW_PWR_WELL_CTL6		0x45414
+
 #endif /* _I915_REG_H_ */
Signature · 1 line
1.7.9.2
Reviewed-by on v1 5/37
#10 lore raw

Re: [PATCH 05/37] drm/i915: add support for power wells

Like in this patch, the defines indentation in some patches in this series sounds strange, wrong, or at least different from the one already in use.

So, since I don't know if we should care about indentation now, for those patches I'll just mark like this:

* indentation

Quoted 36 lines · Eugeni Dodonov

This defines the registers used by different power wells.

---
 drivers/gpu/drm/i915/i915_reg.h |   13 +++++++++++++

 1 file changed, 13 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +13 -1
index 52a06be..ddc9c87 100644
@@ -3850,4 +3850,17 @@
  #define   AUD_CONFIG_PIXEL_CLOCK_HDMI          (0xf << 16)
  #define   AUD_CONFIG_DISABLE_NCTS              (1 << 3)
 
+/* HSW Power Wells */
+#define HSW_PWR_WELL_CTL1              0x45400         /* BIOS */
+#define HSW_PWR_WELL_CTL2              0x45404         /* Driver */
+#define HSW_PWR_WELL_CTL3              0x45408         /* KVMR */
+#define HSW_PWR_WELL_CTL4              0x4540C         /* Debug */
+#define   HSW_PWR_WELL_ENABLE  (1<<31)
+#define   HSW_PWR_WELL_STATE   (1<<30)
+#define HSW_PWR_WELL_CTL5              0x45410
+#define   HSW_PWR_WELL_ENABLE_SINGLE_STEP      (1<<31)
+#define   HSW_PWR_WELL_PWR_GATE_OVERRIDE       (1<<20)
+#define   HSW_PWR_WELL_FORCE_ON        (1<<19)
+#define HSW_PWR_WELL_CTL6              0x45414
+
  #endif /* _I915_REG_H_ */
--

1.7.9.2

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

Signature · 3 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
#11 lore raw

Re: [PATCH 05/37] drm/i915: add support for power wells

Quoted 10 lines · Rodrigo Vivi

Like in this patch, the defines indentation in some patches in this series sounds strange, wrong, or at least different from the one already in use.

So, since I don't know if we should care about indentation now, for those patches I'll just mark like this:

* indentation

The identation is different between registers themselves (e.g., 0xSOMETHING) and the bits we use in those registers (e.g., (1<<31)). So this is on purpose.

Signature · 2 lines
Eugeni Dodonov
<http://eugeni.dodonov.net/>

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

#12 lore raw

PATCH 6/37 drm/i915: add DDI registers

In reply to Eugeni Dodonov

There is one set of such registers for each pipe (A/B/C/EDP).

---
 drivers/gpu/drm/i915/i915_reg.h |   27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +27 -0
index ddc9c87..09b2267 100644
@@ -3863,4 +3863,31 @@
 #define   HSW_PWR_WELL_FORCE_ON	(1<<19)
 #define HSW_PWR_WELL_CTL6		0x45414
 
+/* Per-pipe DDI Function Control */
+#define PIPE_DDI_FUNC_CTL_A			0x60400
+#define PIPE_DDI_FUNC_CTL_B			0x61400
+#define PIPE_DDI_FUNC_CTL_C			0x62400
+#define PIPE_DDI_FUNC_CTL_EDP		0x6F400
+#define DDI_FUNC_CTL(pipe) _PIPE(pipe, \
+					PIPE_DDI_FUNC_CTL_A, \
+					PIPE_DDI_FUNC_CTL_B)
+#define  PIPE_DDI_FUNC_ENABLE		(1<<31)
+/* Those bits are ignored by pipe EDP since it can only connect to DDI A */
+#define  PIPE_DDI_SELECT_DDI_B	(0x1<<28)
+#define  PIPE_DDI_SELECT_DDI_C	(0x2<<28)
+#define  PIPE_DDI_SELECT_DDI_D	(0x3<<28)
+#define  PIPE_DDI_SELECT_DDI_E	(0x4<<28)
+#define  PIPE_DDI_MODE_SELECT_HDMI	(0<<24)
+#define  PIPE_DDI_MODE_SELECT_DVI	(1<<24)
+#define  PIPE_DDI_MODE_SELECT_DP_SST	(2<<24)
+#define  PIPE_DDI_MODE_SELECT_FDI	(4<<24)
+#define  PIPE_DDI_BPC_8				(0<<20)
+#define  PIPE_DDI_BPC_10			(1<<20)
+#define  PIPE_DDI_BPC_6				(2<<20)
+#define  PIPE_DDI_BPC_12			(3<<20)
+#define  PIPE_DDI_BFI_ENABLE		(1<<4)
+#define  PIPE_DDI_PORT_WIDTH_X1			(0<<1)
+#define  PIPE_DDI_PORT_WIDTH_X2			(1<<1)
+#define  PIPE_DDI_PORT_WIDTH_X4			(3<<1)
+
 #endif /* _I915_REG_H_ */
Signature · 1 line
1.7.9.2
Reviewed-by on v1 6/37
#13 lore raw

Re: [PATCH 06/37] drm/i915: add DDI registers

*indentation
and it is missing
#define PIPE_DDI_MODE_SELECT_DP_MST (3<<24)

Otherwise:

Quoted 50 lines · Eugeni Dodonov

There is one set of such registers for each pipe (A/B/C/EDP).

---
 drivers/gpu/drm/i915/i915_reg.h |   27 +++++++++++++++++++++++++++

 1 file changed, 27 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +27 -1
index ddc9c87..09b2267 100644
@@ -3863,4 +3863,31 @@
  #define   HSW_PWR_WELL_FORCE_ON        (1<<19)
  #define HSW_PWR_WELL_CTL6              0x45414
 
+/* Per-pipe DDI Function Control */
+#define PIPE_DDI_FUNC_CTL_A                    0x60400
+#define PIPE_DDI_FUNC_CTL_B                    0x61400
+#define PIPE_DDI_FUNC_CTL_C                    0x62400
+#define PIPE_DDI_FUNC_CTL_EDP          0x6F400
+#define DDI_FUNC_CTL(pipe) _PIPE(pipe, \
+                                       PIPE_DDI_FUNC_CTL_A, \
+                                       PIPE_DDI_FUNC_CTL_B)
+#define  PIPE_DDI_FUNC_ENABLE          (1<<31)
+/* Those bits are ignored by pipe EDP since it can only connect to DDI A */
+#define  PIPE_DDI_SELECT_DDI_B (0x1<<28)
+#define  PIPE_DDI_SELECT_DDI_C (0x2<<28)
+#define  PIPE_DDI_SELECT_DDI_D (0x3<<28)
+#define  PIPE_DDI_SELECT_DDI_E (0x4<<28)
+#define  PIPE_DDI_MODE_SELECT_HDMI     (0<<24)
+#define  PIPE_DDI_MODE_SELECT_DVI      (1<<24)
+#define  PIPE_DDI_MODE_SELECT_DP_SST   (2<<24)
+#define  PIPE_DDI_MODE_SELECT_FDI      (4<<24)
+#define  PIPE_DDI_BPC_8                                (0<<20)
+#define  PIPE_DDI_BPC_10                       (1<<20)
+#define  PIPE_DDI_BPC_6                                (2<<20)
+#define  PIPE_DDI_BPC_12                       (3<<20)
+#define  PIPE_DDI_BFI_ENABLE           (1<<4)
+#define  PIPE_DDI_PORT_WIDTH_X1                        (0<<1)
+#define  PIPE_DDI_PORT_WIDTH_X2                        (1<<1)
+#define  PIPE_DDI_PORT_WIDTH_X4                        (3<<1)
+
  #endif /* _I915_REG_H_ */
--

1.7.9.2

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

Signature · 3 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
#14 lore raw

Re: [PATCH 06/37] drm/i915: add DDI registers

Quoted 7 lines · Rodrigo Vivi

*indentation
and it is missing
#define PIPE_DDI_MODE_SELECT_DP_MST (3<<24)

Otherwise:

We are not using this bit, this is why I am not exposing it...

Signature · 2 lines
Eugeni Dodonov
<http://eugeni.dodonov.net/>

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

#15 lore raw

Re: [PATCH 06/37] drm/i915: add DDI registers

ah ok, no problem than... I just imagine that this would be useful because in other places you mentioned the DP MST mode...

Quoted 15 lines · Eugeni Dodonov
Quoted 7 lines · Rodrigo Vivi

*indentation
and it is missing
#define  PIPE_DDI_MODE_SELECT_DP_MST  (3<<24)

Otherwise:

We are not using this bit, this is why I am not exposing it...

--
Eugeni Dodonov

Signature · 3 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
#16 lore raw

PATCH 7/37 drm/i915: add DP_TP_CTL registers

In reply to Eugeni Dodonov

This is one set of those registers for each pipe.

---
 drivers/gpu/drm/i915/i915_reg.h |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +16 -0
index 09b2267..7a9232e 100644
@@ -3890,4 +3890,20 @@
 #define  PIPE_DDI_PORT_WIDTH_X2			(1<<1)
 #define  PIPE_DDI_PORT_WIDTH_X4			(3<<1)
 
+/* DisplayPort Transport Control */
+#define DP_TP_CTL_A			0x64040
+#define DP_TP_CTL_B			0x64140
+#define DP_TP_CTL_C			0x64240
+#define DP_TP_CTL_D			0x64340
+#define DP_TP_CTL_E			0x64440
+#define  DP_TP_CTL_ENABLE		(1<<31)
+#define  DP_TP_CTL_MODE_SST	(0<<27)
+#define  DP_TP_CTL_MODE_MST	(1<<27)
+#define  DP_TP_CTL_ENHANCED_FRAME_ENABLE	(1<<18)
+#define  DP_TP_CTL_FDI_AUTOTRAIN	(1<<15)
+#define  DP_TP_CTL_LINK_TRAIN_MASK		(7<<8)
+#define  DP_TP_CTL_LINK_TRAIN_PAT1		(0<<8)
+#define  DP_TP_CTL_LINK_TRAIN_PAT2		(1<<8)
+#define  DP_TP_CTL_LINK_TRAIN_NORMAL	(3<<8)
+
 #endif /* _I915_REG_H_ */
Signature · 1 line
1.7.9.2
#17 lore raw

Re: [PATCH 07/37] drm/i915: add DP_TP_CTL registers

Quoted 20 lines · Eugeni Dodonov

This is one set of those registers for each pipe.

---
 drivers/gpu/drm/i915/i915_reg.h |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +5 -0
index 09b2267..7a9232e 100644
@@ -3890,4 +3890,20 @@
 #define  PIPE_DDI_PORT_WIDTH_X2			(1<<1)
 #define  PIPE_DDI_PORT_WIDTH_X4			(3<<1)
 
+/* DisplayPort Transport Control */
+#define DP_TP_CTL_A			0x64040
+#define DP_TP_CTL_B			0x64140
+#define DP_TP_CTL_C			0x64240
+#define DP_TP_CTL_D			0x64340

drivers/gpu/drm/i915/i915_reg.h line 3907

Quoted 10 lines
drivers/gpu/drm/i915/i915_reg.h +10 -0
+#define DP_TP_CTL_E			0x64440
+#define  DP_TP_CTL_ENABLE		(1<<31)
+#define  DP_TP_CTL_MODE_SST	(0<<27)
+#define  DP_TP_CTL_MODE_MST	(1<<27)
+#define  DP_TP_CTL_ENHANCED_FRAME_ENABLE	(1<<18)
+#define  DP_TP_CTL_FDI_AUTOTRAIN	(1<<15)
+#define  DP_TP_CTL_LINK_TRAIN_MASK		(7<<8)
+#define  DP_TP_CTL_LINK_TRAIN_PAT1		(0<<8)
+#define  DP_TP_CTL_LINK_TRAIN_PAT2		(1<<8)
+#define  DP_TP_CTL_LINK_TRAIN_NORMAL	(3<<8)

Would these not benefit from a #define DP_TP_CTL(pipe)? -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#18 lore raw

Re: [PATCH 07/37] drm/i915: add DP_TP_CTL registers

Quoted 4 lines · Chris Wilson
Quoted 1 line · Eugeni Dodonov

This is one set of those registers for each pipe.

Would these not benefit from a #define DP_TP_CTL(pipe)?

Quoted 1 line

Sorry, my typo went in - there is one set of those registers for each *port*. I defined DP_TP_CTL(pipe) for this (and all other DP_TP_* ones), but in the end I figured out that pipes need to be programmed independently from ports.

Signature · 2 lines
Eugeni Dodonov
<http://eugeni.dodonov.net/>

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

#19 lore raw

Re: [PATCH 07/37] drm/i915: add DP_TP_CTL registers

Quoted 6 lines · Eugeni Dodonov
Quoted 4 lines · Chris Wilson
Quoted 1 line · Eugeni Dodonov

This is one set of those registers for each pipe.

Quoted 7 lines

Would these not benefit from a #define DP_TP_CTL(pipe)?

Quoted 1 line

Sorry, my typo went in - there is one set of those registers for each *port*. I defined DP_TP_CTL(pipe) for this (and all other DP_TP_* ones), but in the end I figured out that pipes need to be programmed independently from ports.

Hm, so maybe it's time to add an enum ports as Chris suggested? Or is that stuff to different on the different platforms to make sense? -Daniel

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
#20 lore raw

PATCH 8/37 drm/i915: add DP_TP_STATUS registers

In reply to Eugeni Dodonov

There is one set of those registers for each port.

---
 drivers/gpu/drm/i915/i915_reg.h |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +8 -0
index 7a9232e..3831fe7 100644
@@ -3906,4 +3906,12 @@
 #define  DP_TP_CTL_LINK_TRAIN_PAT2		(1<<8)
 #define  DP_TP_CTL_LINK_TRAIN_NORMAL	(3<<8)
 
+/* DisplayPort Transport Status */
+#define DP_TP_STATUS_A			0x64044
+#define DP_TP_STATUS_B			0x64144
+#define DP_TP_STATUS_C			0x64244
+#define DP_TP_STATUS_D			0x64344
+#define DP_TP_STATUS_E			0x64444
+#define  DP_TP_STATUS_AUTOTRAIN_DONE	(1<<12)
+
 #endif /* _I915_REG_H_ */
Signature · 1 line
1.7.9.2
#21 lore raw

Re: [PATCH 08/37] drm/i915: add DP_TP_STATUS registers

Quoted 1 line · Eugeni Dodonov

There is one set of those registers for each port.

Looks like we need an enum port in addition to enum plane and enum pipe. And a _PORT() switcher. The idea behind having separate PIPE, PLANE, PORT macros was that eventually we would put a BUILD_BUG_ON(typeof(&x)!=typeof(enum pipe *)) and so catch misuse of pipe versus plane (a common bug in the bad old days). However, that requires the code base being cleansed of all the int plane, port; -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#22 lore raw

PATCH 9/37 drm/i915: add definitions for DDI_BUF_CTL registers

In reply to Eugeni Dodonov

There is one instance of those registers for each DDI port.

---
 drivers/gpu/drm/i915/i915_reg.h |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +23 -0
index 3831fe7..2927460 100644
@@ -3914,4 +3914,27 @@
 #define DP_TP_STATUS_E			0x64444
 #define  DP_TP_STATUS_AUTOTRAIN_DONE	(1<<12)
 
+/* DDI Buffer Control */
+#define DDI_BUF_CTL_A				0x64000
+#define DDI_BUF_CTL_B				0x64100
+#define DDI_BUF_CTL_C				0x64200
+#define DDI_BUF_CTL_D				0x64300
+#define DDI_BUF_CTL_E				0x64400
+#define  DDI_BUF_CTL_ENABLE			(1<<31)
+#define  DDI_BUF_EMP_400MV_0DB_HSW		(0<<24)   /* Sel0 */
+#define  DDI_BUF_EMP_400MV_3_5DB_HSW	(1<<24)   /* Sel1 */
+#define  DDI_BUF_EMP_400MV_6DB_HSW		(2<<24)   /* Sel2 */
+#define  DDI_BUF_EMP_400MV_9_5DB_HSW	(3<<24)   /* Sel3 */
+#define  DDI_BUF_EMP_600MV_0DB_HSW		(4<<24)   /* Sel4 */
+#define  DDI_BUF_EMP_600MV_3_5DB_HSW	(5<<24)   /* Sel5 */
+#define  DDI_BUF_EMP_600MV_6DB_HSW		(6<<24)   /* Sel6 */
+#define  DDI_BUF_EMP_800MV_0DB_HSW		(7<<24)   /* Sel7 */
+#define  DDI_BUF_EMP_800MV_3_5DB_HSW	(8<<24)   /* Sel8 */
+#define  DDI_BUF_EMP_MASK				(0xf<<24)
+#define  DDI_BUF_IS_IDLE				(1<<7)
+#define  DDI_PORT_WIDTH_X1				(0<<1)
+#define  DDI_PORT_WIDTH_X2				(1<<1)
+#define  DDI_PORT_WIDTH_X4				(3<<1)
+#define  DDI_INIT_DISPLAY_DETECTED		(1<<0)
+
 #endif /* _I915_REG_H_ */
Signature · 1 line
1.7.9.2
Reviewed-by on v1 9/37
#23 lore raw

Re: [PATCH 09/37] drm/i915: add definitions for DDI_BUF_CTL registers

* indentation

Quoted 46 lines · Eugeni Dodonov

There is one instance of those registers for each DDI port.

---
 drivers/gpu/drm/i915/i915_reg.h |   23 +++++++++++++++++++++++

 1 file changed, 23 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +23 -1
index 3831fe7..2927460 100644
@@ -3914,4 +3914,27 @@
  #define DP_TP_STATUS_E                 0x64444
  #define  DP_TP_STATUS_AUTOTRAIN_DONE   (1<<12)
 
+/* DDI Buffer Control */
+#define DDI_BUF_CTL_A                          0x64000
+#define DDI_BUF_CTL_B                          0x64100
+#define DDI_BUF_CTL_C                          0x64200
+#define DDI_BUF_CTL_D                          0x64300
+#define DDI_BUF_CTL_E                          0x64400
+#define  DDI_BUF_CTL_ENABLE                    (1<<31)
+#define  DDI_BUF_EMP_400MV_0DB_HSW             (0<<24)   /* Sel0 */
+#define  DDI_BUF_EMP_400MV_3_5DB_HSW   (1<<24)   /* Sel1 */
+#define  DDI_BUF_EMP_400MV_6DB_HSW             (2<<24)   /* Sel2 */
+#define  DDI_BUF_EMP_400MV_9_5DB_HSW   (3<<24)   /* Sel3 */
+#define  DDI_BUF_EMP_600MV_0DB_HSW             (4<<24)   /* Sel4 */
+#define  DDI_BUF_EMP_600MV_3_5DB_HSW   (5<<24)   /* Sel5 */
+#define  DDI_BUF_EMP_600MV_6DB_HSW             (6<<24)   /* Sel6 */
+#define  DDI_BUF_EMP_800MV_0DB_HSW             (7<<24)   /* Sel7 */
+#define  DDI_BUF_EMP_800MV_3_5DB_HSW   (8<<24)   /* Sel8 */
+#define  DDI_BUF_EMP_MASK                              (0xf<<24)
+#define  DDI_BUF_IS_IDLE                               (1<<7)
+#define  DDI_PORT_WIDTH_X1                             (0<<1)
+#define  DDI_PORT_WIDTH_X2                             (1<<1)
+#define  DDI_PORT_WIDTH_X4                             (3<<1)
+#define  DDI_INIT_DISPLAY_DETECTED             (1<<0)
+
  #endif /* _I915_REG_H_ */
--

1.7.9.2

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

Signature · 3 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
#24 lore raw

PATCH 10/37 drm/i915: add definition of LPT FDI port width registers

In reply to Eugeni Dodonov
---
 drivers/gpu/drm/i915/i915_reg.h |    3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +3 -0
index 2927460..b732aa1 100644
@@ -3473,6 +3473,9 @@
 #define  FDI_LINK_TRAIN_PATTERN_IDLE_CPT	(2<<8)
 #define  FDI_LINK_TRAIN_NORMAL_CPT		(3<<8)
 #define  FDI_LINK_TRAIN_PATTERN_MASK_CPT	(3<<8)
+/* LPT */
+#define  LPT_FDI_PORT_WIDTH_1X          (0<<19)
+#define  LPT_FDI_PORT_WIDTH_2X          (1<<19)
 
 #define _FDI_RXA_MISC            0xf0010
 #define _FDI_RXB_MISC            0xf1010
Signature · 1 line
1.7.9.2
Reviewed-by on v1 10/37
#25 lore raw

Re: [PATCH 10/37] drm/i915: add definition of LPT FDI port width registers

Quoted 26 lines · Eugeni Dodonov

---
 drivers/gpu/drm/i915/i915_reg.h |    3 +++

 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +3 -1
index 2927460..b732aa1 100644
@@ -3473,6 +3473,9 @@
  #define  FDI_LINK_TRAIN_PATTERN_IDLE_CPT       (2<<8)
  #define  FDI_LINK_TRAIN_NORMAL_CPT             (3<<8)
  #define  FDI_LINK_TRAIN_PATTERN_MASK_CPT       (3<<8)
+/* LPT */
+#define  LPT_FDI_PORT_WIDTH_1X          (0<<19)
+#define  LPT_FDI_PORT_WIDTH_2X          (1<<19)
 
  #define _FDI_RXA_MISC            0xf0010
  #define _FDI_RXB_MISC            0xf1010
--

1.7.9.2

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

Signature · 3 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
#26 lore raw

PATCH 11/37 drm/i915: add definition of DDI buffer translations regs

In reply to Eugeni Dodonov

Those registers are used to train DDI buffer translations for each link type.

---
 drivers/gpu/drm/i915/i915_reg.h |    7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +7 -0
index b732aa1..0af47b4 100644
@@ -3940,4 +3940,11 @@
 #define  DDI_PORT_WIDTH_X4				(3<<1)
 #define  DDI_INIT_DISPLAY_DETECTED		(1<<0)
 
+/* DDI Buffer Translations */
+#define DDI_BUF_TRANS_A				0x64E00
+#define DDI_BUF_TRANS_B				0x64E60
+#define DDI_BUF_TRANS_C				0x64EC0
+#define DDI_BUF_TRANS_D				0x64F20
+#define DDI_BUF_TRANS_E				0x64F80
+
 #endif /* _I915_REG_H_ */
Signature · 1 line
1.7.9.2
Reviewed-by on v1 11/37
#27 lore raw

Re: [PATCH 11/37] drm/i915: add definition of DDI buffer translations regs

Quoted 31 lines · Eugeni Dodonov

Those registers are used to train DDI buffer translations for each link type.

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

 1 file changed, 7 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +7 -1
index b732aa1..0af47b4 100644
@@ -3940,4 +3940,11 @@
  #define  DDI_PORT_WIDTH_X4                             (3<<1)
  #define  DDI_INIT_DISPLAY_DETECTED             (1<<0)
 
+/* DDI Buffer Translations */
+#define DDI_BUF_TRANS_A                                0x64E00
+#define DDI_BUF_TRANS_B                                0x64E60
+#define DDI_BUF_TRANS_C                                0x64EC0
+#define DDI_BUF_TRANS_D                                0x64F20
+#define DDI_BUF_TRANS_E                                0x64F80
+
  #endif /* _I915_REG_H_ */
--

1.7.9.2

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

Signature · 3 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
#28 lore raw

Re: [PATCH 11/37] drm/i915: add definition of DDI buffer translations regs

In reply to Eugeni Dodonov
Quoted 4 lines · Eugeni Dodonov

Those registers are used to train DDI buffer translations for each link type.

some quick private discussion releaved that the A-E in these defines are also per-port. So I think we also need to rebase these on top of a port enum with a DDI_BUF_TRANS(port) macros instead.
-Daniel

Quoted 27 lines
---
 drivers/gpu/drm/i915/i915_reg.h |    7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +7 -0
index b732aa1..0af47b4 100644
@@ -3940,4 +3940,11 @@
 #define  DDI_PORT_WIDTH_X4				(3<<1)
 #define  DDI_INIT_DISPLAY_DETECTED		(1<<0)
 
+/* DDI Buffer Translations */
+#define DDI_BUF_TRANS_A				0x64E00
+#define DDI_BUF_TRANS_B				0x64E60
+#define DDI_BUF_TRANS_C				0x64EC0
+#define DDI_BUF_TRANS_D				0x64F20
+#define DDI_BUF_TRANS_E				0x64F80
+
 #endif /* _I915_REG_H_ */
Signature · 6 lines
1.7.9.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
#29 lore raw

PATCH 12/37 drm/i915: add SBI registers

In reply to Eugeni Dodonov

Those are responsible for the Sideband Interface programming.

---
 drivers/gpu/drm/i915/i915_reg.h |   10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +10 -0
index 0af47b4..4ee8965 100644
@@ -3947,4 +3947,14 @@
 #define DDI_BUF_TRANS_D				0x64F20
 #define DDI_BUF_TRANS_E				0x64F80
 
+/* Sideband Interface (SBI) is programmed indirectly, via
+ * SBI_ADDR, which contains the register offset; and SBI_DATA,
+ * which contains the payload */
+#define SBI_ADDR				0xC6000
+#define SBI_DATA				0xC6004
+#define SBI_CTL_STAT			0xC6008
+#define  SBI_CTL_OP_CRRD		(0x6<<8)
+#define  SBI_CTL_OP_CRWR		(0x7<<8)
+#define  SBI_RESPONSE			(0x1<<1)
+#define  SBI_READY				(0x1<<0)
 #endif /* _I915_REG_H_ */
Signature · 1 line
1.7.9.2
Reviewed-by on v1 12/37
#30 lore raw

Re: [PATCH 12/37] drm/i915: add SBI registers

* indentation

Quoted 33 lines · Eugeni Dodonov

Those are responsible for the Sideband Interface programming.

---
 drivers/gpu/drm/i915/i915_reg.h |   10 ++++++++++

 1 file changed, 10 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +10 -1
index 0af47b4..4ee8965 100644
@@ -3947,4 +3947,14 @@
  #define DDI_BUF_TRANS_D                                0x64F20
  #define DDI_BUF_TRANS_E                                0x64F80
 
+/* Sideband Interface (SBI) is programmed indirectly, via
+ * SBI_ADDR, which contains the register offset; and SBI_DATA,
+ * which contains the payload */
+#define SBI_ADDR                               0xC6000
+#define SBI_DATA                               0xC6004
+#define SBI_CTL_STAT                   0xC6008
+#define  SBI_CTL_OP_CRRD               (0x6<<8)
+#define  SBI_CTL_OP_CRWR               (0x7<<8)
+#define  SBI_RESPONSE                  (0x1<<1)
+#define  SBI_READY                             (0x1<<0)
  #endif /* _I915_REG_H_ */
--

1.7.9.2

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

Signature · 3 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
Reviewed-by
#31 lore raw

Re: [PATCH 12/37] drm/i915: add SBI registers

Ops, actually I'm in doubt about this one, for me:

SBI_RESPONSE should be (0x0<<1)
SBI_READY should be (0x0<<0)

let's double check this togheter, otherwise:

Quoted 45 lines · Rodrigo Vivi

* indentation

Quoted 29 lines · Eugeni Dodonov

Those are responsible for the Sideband Interface programming.

---
 drivers/gpu/drm/i915/i915_reg.h |   10 ++++++++++

 1 file changed, 10 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +10 -1
index 0af47b4..4ee8965 100644
@@ -3947,4 +3947,14 @@
  #define DDI_BUF_TRANS_D                                0x64F20
  #define DDI_BUF_TRANS_E                                0x64F80
 
+/* Sideband Interface (SBI) is programmed indirectly, via
+ * SBI_ADDR, which contains the register offset; and SBI_DATA,
+ * which contains the payload */
+#define SBI_ADDR                               0xC6000
+#define SBI_DATA                               0xC6004
+#define SBI_CTL_STAT                   0xC6008
+#define  SBI_CTL_OP_CRRD               (0x6<<8)
+#define  SBI_CTL_OP_CRWR               (0x7<<8)
+#define  SBI_RESPONSE                  (0x1<<1)
+#define  SBI_READY                             (0x1<<0)
  #endif /* _I915_REG_H_ */
--

1.7.9.2

Quoted 4 lines

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

--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net

Signature · 3 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
#32 lore raw

Re: [PATCH 12/37] drm/i915: add SBI registers

and here can be

SBI_BUSY 0x1<<0
and SBI_RESPONSE_UNSUCCESSFUL 0x1<<1

Quoted 62 lines · Rodrigo Vivi

Ops, actually I'm in doubt about this one, for me:

SBI_RESPONSE  should be  (0x0<<1)
SBI_READY  should be    (0x0<<0)

let's double check this togheter, otherwise:

Quoted 34 lines · Rodrigo Vivi

* indentation

Quoted 29 lines · Eugeni Dodonov

Those are responsible for the Sideband Interface programming.

---
 drivers/gpu/drm/i915/i915_reg.h |   10 ++++++++++

 1 file changed, 10 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +10 -1
index 0af47b4..4ee8965 100644
@@ -3947,4 +3947,14 @@
  #define DDI_BUF_TRANS_D                                0x64F20
  #define DDI_BUF_TRANS_E                                0x64F80
 
+/* Sideband Interface (SBI) is programmed indirectly, via
+ * SBI_ADDR, which contains the register offset; and SBI_DATA,
+ * which contains the payload */
+#define SBI_ADDR                               0xC6000
+#define SBI_DATA                               0xC6004
+#define SBI_CTL_STAT                   0xC6008
+#define  SBI_CTL_OP_CRRD               (0x6<<8)
+#define  SBI_CTL_OP_CRWR               (0x7<<8)
+#define  SBI_RESPONSE                  (0x1<<1)
+#define  SBI_READY                             (0x1<<0)
  #endif /* _I915_REG_H_ */
--

1.7.9.2

Quoted 11 lines
Quoted 4 lines

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

--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net

--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net

Signature · 3 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
#33 lore raw

PATCH 13/37 drm/i915: add support for SBI ops

In reply to Eugeni Dodonov

With Lynx Point, we need to use SBI to communicate with the display clock control. This commit adds helper functions to access the registers via SBI.

---
 drivers/gpu/drm/i915/intel_display.c |   44 ++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
drivers/gpu/drm/i915/intel_display.c +44 -0
index de1ba19..c225de4 100644
@@ -1198,6 +1198,50 @@ static void intel_disable_pll(struct drm_i915_private *dev_priv, enum pipe pipe)
 	POSTING_READ(reg);
 }
 
+/* SBI access */
+static inline void
+SBI_WRITE(struct drm_i915_private *dev_priv, u16 reg, u32 value)
+{
+	if (wait_for((I915_READ(SBI_CTL_STAT) & SBI_READY) == 0,
+				10))
+		DRM_ERROR("timeout waiting for SBI to become ready\n");
+
+	I915_WRITE(SBI_ADDR,
+			(reg << 16));
+	I915_WRITE(SBI_DATA,
+			value);
+	I915_WRITE(SBI_CTL_STAT,
+			SBI_READY |
+			SBI_CTL_OP_CRWR);
+
+	if (wait_for((I915_READ(SBI_CTL_STAT) & (SBI_READY | SBI_RESPONSE)) == 0,
+				10))
+		DRM_ERROR("timeout waiting for SBI to complete write transaction\n");
+}
+
+static inline u32
+SBI_READ(struct drm_i915_private *dev_priv, u16 reg)
+{
+	u32 value;
+	if (wait_for((I915_READ(SBI_CTL_STAT) & SBI_READY) == 0,
+				10))
+		DRM_ERROR("timeout waiting for SBI to become ready\n");
+
+	I915_WRITE(SBI_ADDR,
+			(reg << 16));
+	I915_WRITE(SBI_CTL_STAT,
+			SBI_READY |
+			SBI_CTL_OP_CRRD);
+
+	if (wait_for((I915_READ(SBI_CTL_STAT) & (SBI_READY | SBI_RESPONSE)) == 0,
+				10))
+		DRM_ERROR("timeout waiting for SBI to complete read transaction\n");
+
+	value = I915_READ(SBI_DATA);
+
+	return value;
+}
+
 /**
  * intel_enable_pch_pll - enable PCH PLL
  * @dev_priv: i915 private structure
Signature · 1 line
1.7.9.2
#34 lore raw

Re: [PATCH 13/37] drm/i915: add support for SBI ops

Quoted 5 lines · Eugeni Dodonov

With Lynx Point, we need to use SBI to communicate with the display clock control. This commit adds helper functions to access the registers via SBI.

Does this sbi stuff on hsw have anything to do with dpio from vlv? Or do hw engineers simply like to reinvent the wheel?
-Daniel

Quoted 66 lines
---
 drivers/gpu/drm/i915/intel_display.c |   44 ++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
drivers/gpu/drm/i915/intel_display.c +44 -0
index de1ba19..c225de4 100644
@@ -1198,6 +1198,50 @@ static void intel_disable_pll(struct drm_i915_private *dev_priv, enum pipe pipe)
 	POSTING_READ(reg);
 }
 
+/* SBI access */
+static inline void
+SBI_WRITE(struct drm_i915_private *dev_priv, u16 reg, u32 value)
+{
+	if (wait_for((I915_READ(SBI_CTL_STAT) & SBI_READY) == 0,
+				10))
+		DRM_ERROR("timeout waiting for SBI to become ready\n");
+
+	I915_WRITE(SBI_ADDR,
+			(reg << 16));
+	I915_WRITE(SBI_DATA,
+			value);
+	I915_WRITE(SBI_CTL_STAT,
+			SBI_READY |
+			SBI_CTL_OP_CRWR);
+
+	if (wait_for((I915_READ(SBI_CTL_STAT) & (SBI_READY | SBI_RESPONSE)) == 0,
+				10))
+		DRM_ERROR("timeout waiting for SBI to complete write transaction\n");
+}
+
+static inline u32
+SBI_READ(struct drm_i915_private *dev_priv, u16 reg)
+{
+	u32 value;
+	if (wait_for((I915_READ(SBI_CTL_STAT) & SBI_READY) == 0,
+				10))
+		DRM_ERROR("timeout waiting for SBI to become ready\n");
+
+	I915_WRITE(SBI_ADDR,
+			(reg << 16));
+	I915_WRITE(SBI_CTL_STAT,
+			SBI_READY |
+			SBI_CTL_OP_CRRD);
+
+	if (wait_for((I915_READ(SBI_CTL_STAT) & (SBI_READY | SBI_RESPONSE)) == 0,
+				10))
+		DRM_ERROR("timeout waiting for SBI to complete read transaction\n");
+
+	value = I915_READ(SBI_DATA);
+
+	return value;
+}
+
 /**
  * intel_enable_pch_pll - enable PCH PLL
  * @dev_priv: i915 private structure
Signature · 6 lines
1.7.9.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
#35 lore raw

Re: [PATCH 13/37] drm/i915: add support for SBI ops

In reply to Eugeni Dodonov
Quoted 14 lines · Eugeni Dodonov

With Lynx Point, we need to use SBI to communicate with the display clock control. This commit adds helper functions to access the registers via SBI.

---
 drivers/gpu/drm/i915/intel_display.c |   44 ++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
drivers/gpu/drm/i915/intel_display.c +0 -0
index de1ba19..c225de4 100644

drivers/gpu/drm/i915/intel_display.c static void intel_disable_pll(struct drm_i915_private *dev_priv, enum pipe pipe) · line 1203

Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +3 -0
@@ -1198,6 +1198,50 @@ static void intel_disable_pll(struct drm_i915_private *dev_priv, enum pipe pipe)
 	POSTING_READ(reg);
 }
 
+/* SBI access */
+static inline void
+SBI_WRITE(struct drm_i915_private *dev_priv, u16 reg, u32 value)

These are too big and too frequent to be inlined. At least that means we won't have to shout!
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#36 lore raw

PATCH 14/37 drm/i915: add PIXCLK_GATE register

In reply to Eugeni Dodonov

Pixel clock gating control for Lynx point.

---
 drivers/gpu/drm/i915/i915_reg.h |    6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +6 -0
index 4ee8965..9ff9856 100644
@@ -3957,4 +3957,10 @@
 #define  SBI_CTL_OP_CRWR		(0x7<<8)
 #define  SBI_RESPONSE			(0x1<<1)
 #define  SBI_READY				(0x1<<0)
+
+/* LPT PIXCLK_GATE */
+#define PIXCLK_GATE				0xC6020
+#define  PIXCLK_GATE_UNGATE		1<<0
+#define  PIXCLK_GATE_GATE		0<<0
+
 #endif /* _I915_REG_H_ */
Signature · 1 line
1.7.9.2
Reviewed-by on v1 14/37
#37 lore raw

Re: [PATCH 14/37] drm/i915: add PIXCLK_GATE register

* indentation

Quoted 29 lines · Eugeni Dodonov

Pixel clock gating control for Lynx point.

---
 drivers/gpu/drm/i915/i915_reg.h |    6 ++++++

 1 file changed, 6 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +6 -1
index 4ee8965..9ff9856 100644
@@ -3957,4 +3957,10 @@
  #define  SBI_CTL_OP_CRWR               (0x7<<8)
  #define  SBI_RESPONSE                  (0x1<<1)
  #define  SBI_READY                             (0x1<<0)
+
+/* LPT PIXCLK_GATE */
+#define PIXCLK_GATE                            0xC6020
+#define  PIXCLK_GATE_UNGATE            1<<0
+#define  PIXCLK_GATE_GATE              0<<0
+
  #endif /* _I915_REG_H_ */
--

1.7.9.2

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

Signature · 3 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
#38 lore raw

PATCH 15/37 drm/i915: add S PLL control

In reply to Eugeni Dodonov

This PLL control can drive DDI ports at desired frequencies for DisplayPort and FDI connections.

---
 drivers/gpu/drm/i915/i915_reg.h |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +8 -0
index 9ff9856..e38dafc 100644
@@ -3963,4 +3963,12 @@
 #define  PIXCLK_GATE_UNGATE		1<<0
 #define  PIXCLK_GATE_GATE		0<<0
 
+/* SPLL */
+#define SPLL_CTL				0x46020
+#define  SPLL_PLL_ENABLE		(1<<31)
+#define  SPLL_PLL_SCC			(1<<28)
+#define  SPLL_PLL_NON_SCC		(2<<28)
+#define  SPLL_PLL_FREQ_810MHz	(0<<26)
+#define  SPLL_PLL_FREQ_1350MHz	(1<<26)
+
 #endif /* _I915_REG_H_ */
Signature · 1 line
1.7.9.2
Reviewed-by on v1 15/37
#39 lore raw

Re: [PATCH 15/37] drm/i915: add S PLL control

* indentation

Quoted 32 lines · Eugeni Dodonov

This PLL control can drive DDI ports at desired frequencies for DisplayPort and FDI connections.

---
 drivers/gpu/drm/i915/i915_reg.h |    8 ++++++++

 1 file changed, 8 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +8 -1
index 9ff9856..e38dafc 100644
@@ -3963,4 +3963,12 @@
  #define  PIXCLK_GATE_UNGATE            1<<0
  #define  PIXCLK_GATE_GATE              0<<0
 
+/* SPLL */
+#define SPLL_CTL                               0x46020
+#define  SPLL_PLL_ENABLE               (1<<31)
+#define  SPLL_PLL_SCC                  (1<<28)
+#define  SPLL_PLL_NON_SCC              (2<<28)
+#define  SPLL_PLL_FREQ_810MHz  (0<<26)
+#define  SPLL_PLL_FREQ_1350MHz (1<<26)
+
  #endif /* _I915_REG_H_ */
--

1.7.9.2

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

Signature · 3 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
#40 lore raw

PATCH 16/37 drm/i915: add port clock selection support for HSW

In reply to Eugeni Dodonov

Multiple clocks can drive different outputs.

---
 drivers/gpu/drm/i915/i915_reg.h |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +23 -0
index e38dafc..eebe9d3 100644
@@ -3971,4 +3971,27 @@
 #define  SPLL_PLL_FREQ_810MHz	(0<<26)
 #define  SPLL_PLL_FREQ_1350MHz	(1<<26)
 
+/* Port clock selection */
+#define PORT_CLK_SEL_A			0x46100
+#define PORT_CLK_SEL_B			0x46104
+#define PORT_CLK_SEL_C			0x46108
+#define PORT_CLK_SEL_D			0x4610C
+#define PORT_CLK_SEL_E			0x46110
+#define  PORT_CLK_SEL_LCPLL_2700	(0<<29)
+#define  PORT_CLK_SEL_LCPLL_1350	(1<<29)
+#define  PORT_CLK_SEL_LCPLL_810		(2<<29)
+#define  PORT_CLK_SEL_SPLL			(3<<29)
+#define  PORT_CLK_SEL_WRPLL1		(4<<29)
+#define  PORT_CLK_SEL_WRPLL2		(5<<29)
+
+/* Pipe clock selection */
+#define PIPE_CLK_SEL_A			0x46140
+#define PIPE_CLK_SEL_B			0x46144
+#define PIPE_CLK_SEL(pipe) _PIPE(pipe, \
+					PIPE_CLK_SEL_A, \
+					PIPE_CLK_SEL_B)
+#define  PIPE_CLK_SEL_DDIB		(2<<29)
+#define  PIPE_CLK_SEL_DDIC		(3<<29)
+#define  PIPE_CLK_SEL_DDID		(4<<29)
+#define  PIPE_CLK_SEL_DDIE		(5<<29)
 #endif /* _I915_REG_H_ */
Signature · 1 line
1.7.9.2
Reviewed-by on v1 16/37
#41 lore raw

Re: [PATCH 16/37] drm/i915: add port clock selection support for HSW

Quoted 46 lines · Eugeni Dodonov

Multiple clocks can drive different outputs.

---
 drivers/gpu/drm/i915/i915_reg.h |   23 +++++++++++++++++++++++

 1 file changed, 23 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +23 -1
index e38dafc..eebe9d3 100644
@@ -3971,4 +3971,27 @@
  #define  SPLL_PLL_FREQ_810MHz  (0<<26)
  #define  SPLL_PLL_FREQ_1350MHz (1<<26)
 
+/* Port clock selection */
+#define PORT_CLK_SEL_A                 0x46100
+#define PORT_CLK_SEL_B                 0x46104
+#define PORT_CLK_SEL_C                 0x46108
+#define PORT_CLK_SEL_D                 0x4610C
+#define PORT_CLK_SEL_E                 0x46110
+#define  PORT_CLK_SEL_LCPLL_2700       (0<<29)
+#define  PORT_CLK_SEL_LCPLL_1350       (1<<29)
+#define  PORT_CLK_SEL_LCPLL_810                (2<<29)
+#define  PORT_CLK_SEL_SPLL                     (3<<29)
+#define  PORT_CLK_SEL_WRPLL1           (4<<29)
+#define  PORT_CLK_SEL_WRPLL2           (5<<29)
+
+/* Pipe clock selection */
+#define PIPE_CLK_SEL_A                 0x46140
+#define PIPE_CLK_SEL_B                 0x46144
+#define PIPE_CLK_SEL(pipe) _PIPE(pipe, \
+                                       PIPE_CLK_SEL_A, \
+                                       PIPE_CLK_SEL_B)
+#define  PIPE_CLK_SEL_DDIB             (2<<29)
+#define  PIPE_CLK_SEL_DDIC             (3<<29)
+#define  PIPE_CLK_SEL_DDID             (4<<29)
+#define  PIPE_CLK_SEL_DDIE             (5<<29)
  #endif /* _I915_REG_H_ */
--

1.7.9.2

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

Signature · 3 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
#42 lore raw

PATCH 17/37 drm/i915: add SSC offsets for SBI access

In reply to Eugeni Dodonov

Different registers are identified by their target id and offset. To simplify their programming, they are called as <RegisterName><TargetId>. For example, SSCCTL register accessed through SBI at target id 6 and offset 0c is called SBI_SSCCTL6.

---
 drivers/gpu/drm/i915/i915_reg.h |   15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +15 -0
index eebe9d3..193fb11 100644
@@ -3958,6 +3958,21 @@
 #define  SBI_RESPONSE			(0x1<<1)
 #define  SBI_READY				(0x1<<0)
 
+/* SBI offsets */
+#define  SBI_SSCDIVINTPHASE6		0x0600
+#define   SBI_SSCDIVINTPHASE_DIVSEL_MASK	((0x7f)<<1)
+#define   SBI_SSCDIVINTPHASE_DIVSEL(x)		((x)<<1)
+#define   SBI_SSCDIVINTPHASE_INCVAL_MASK	((0x7f)<<8)
+#define   SBI_SSCDIVINTPHASE_INCVAL(x)		((x)<<8)
+#define   SBI_SSCDIVINTPHASE_DIR(x)			((x)<<15)
+#define   SBI_SSCDIVINTPHASE_PROPAGATE		(1<<0)
+#define  SBI_SSCCTL					0x020c
+#define  SBI_SSCCTL6				0x060C
+#define   SBI_SSCCTL_DISABLE		(1<<0)
+#define  SBI_SSCAUXDIV6				0x0610
+#define   SBI_SSCAUXDIV_FINALDIV2SEL(x)		((x)<<4)
+#define  SBI_DBUFF0					0x2a00
+
 /* LPT PIXCLK_GATE */
 #define PIXCLK_GATE				0xC6020
 #define  PIXCLK_GATE_UNGATE		1<<0
Signature · 1 line
1.7.9.2
Reviewed-by on v1 17/37
#43 lore raw

Re: [PATCH 17/37] drm/i915: add SSC offsets for SBI access

* indentation

Quoted 43 lines · Eugeni Dodonov

Different registers are identified by their target id and offset. To simplify their programming, they are called as <RegisterName><TargetId>. For example, SSCCTL register accessed through SBI at target id 6 and offset 0c is called SBI_SSCCTL6.

---
 drivers/gpu/drm/i915/i915_reg.h |   15 +++++++++++++++

 1 file changed, 15 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +15 -1
index eebe9d3..193fb11 100644
@@ -3958,6 +3958,21 @@
  #define  SBI_RESPONSE                  (0x1<<1)
  #define  SBI_READY                             (0x1<<0)
 
+/* SBI offsets */
+#define  SBI_SSCDIVINTPHASE6           0x0600
+#define   SBI_SSCDIVINTPHASE_DIVSEL_MASK       ((0x7f)<<1)
+#define   SBI_SSCDIVINTPHASE_DIVSEL(x)         ((x)<<1)
+#define   SBI_SSCDIVINTPHASE_INCVAL_MASK       ((0x7f)<<8)
+#define   SBI_SSCDIVINTPHASE_INCVAL(x)         ((x)<<8)
+#define   SBI_SSCDIVINTPHASE_DIR(x)                    ((x)<<15)
+#define   SBI_SSCDIVINTPHASE_PROPAGATE         (1<<0)
+#define  SBI_SSCCTL                                    0x020c
+#define  SBI_SSCCTL6                           0x060C
+#define   SBI_SSCCTL_DISABLE           (1<<0)
+#define  SBI_SSCAUXDIV6                                0x0610
+#define   SBI_SSCAUXDIV_FINALDIV2SEL(x)                ((x)<<4)
+#define  SBI_DBUFF0                                    0x2a00
+
  /* LPT PIXCLK_GATE */
  #define PIXCLK_GATE                            0xC6020
  #define  PIXCLK_GATE_UNGATE            1<<0
--

1.7.9.2

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

Signature · 3 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
#44 lore raw

PATCH 18/37 drm/i915: add GTC registers

In reply to Eugeni Dodonov

Add Global Time Clock registers

---
 drivers/gpu/drm/i915/i915_reg.h |    5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +5 -0
index 193fb11..03fb10d 100644
@@ -4009,4 +4009,9 @@
 #define  PIPE_CLK_SEL_DDIC		(3<<29)
 #define  PIPE_CLK_SEL_DDID		(4<<29)
 #define  PIPE_CLK_SEL_DDIE		(5<<29)
+
+/* Global time clock */
+#define GTCCLK_EN				0xC6030
+#define  GTCCLK_EN_ENABLE		(1<<0)
+
 #endif /* _I915_REG_H_ */
Signature · 1 line
1.7.9.2
#45 lore raw

Re: [PATCH 18/37] drm/i915: add GTC registers

Quoted 1 line · Eugeni Dodonov

Add Global Time Clock registers

Interesting; driven by what? Is it coupled to the EU? Will it fail along with the GPU or is an external source?
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Reviewed-by on v1 18/37
#46 lore raw

Re: [PATCH 18/37] drm/i915: add GTC registers

In reply to Eugeni Dodonov

* indentation

Quoted 28 lines · Eugeni Dodonov

Add Global Time Clock registers

---
 drivers/gpu/drm/i915/i915_reg.h |    5 +++++

 1 file changed, 5 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +5 -1
index 193fb11..03fb10d 100644
@@ -4009,4 +4009,9 @@
  #define  PIPE_CLK_SEL_DDIC             (3<<29)
  #define  PIPE_CLK_SEL_DDID             (4<<29)
  #define  PIPE_CLK_SEL_DDIE             (5<<29)
+
+/* Global time clock */
+#define GTCCLK_EN                              0xC6030
+#define  GTCCLK_EN_ENABLE              (1<<0)
+
  #endif /* _I915_REG_H_ */
--

1.7.9.2

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

Signature · 3 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
#47 lore raw

PATCH 19/37 drm/i915: add LCPLL control registers

In reply to Eugeni Dodonov

Those are used to control the display core clock.

---
 drivers/gpu/drm/i915/i915_reg.h |    7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +7 -0
index 03fb10d..fa9e3a8 100644
@@ -4014,4 +4014,11 @@
 #define GTCCLK_EN				0xC6030
 #define  GTCCLK_EN_ENABLE		(1<<0)
 
+/* LCPLL Control */
+#define LCPLL_CTL				0x130040
+#define  LCPLL_PLL_ENABLE		(1<<31)
+#define  LCPLL_PLL_LOCK			(1<<30)
+#define  LCPLL_CD_CLOCK_DISABLE	(1<<25)
+#define  LCPLL_CD2X_CLOCK_DISABLE	(1<<23)
+
 #endif /* _I915_REG_H_ */
Signature · 1 line
1.7.9.2
Reviewed-by on v1 19/37
#48 lore raw

Re: [PATCH 19/37] drm/i915: add LCPLL control registers

LCPLL_PLL_ENABLE should be (0<<31)\

Otherwise

Quoted 30 lines · Eugeni Dodonov

Those are used to control the display core clock.

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

 1 file changed, 7 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +7 -1
index 03fb10d..fa9e3a8 100644
@@ -4014,4 +4014,11 @@
  #define GTCCLK_EN                              0xC6030
  #define  GTCCLK_EN_ENABLE              (1<<0)
 
+/* LCPLL Control */
+#define LCPLL_CTL                              0x130040
+#define  LCPLL_PLL_ENABLE              (1<<31)
+#define  LCPLL_PLL_LOCK                        (1<<30)
+#define  LCPLL_CD_CLOCK_DISABLE        (1<<25)
+#define  LCPLL_CD2X_CLOCK_DISABLE      (1<<23)
+
  #endif /* _I915_REG_H_ */
--

1.7.9.2

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

Signature · 3 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
#49 lore raw

Re: [PATCH 19/37] drm/i915: add LCPLL control registers

Quoted 1 line · Rodrigo Vivi

LCPLL_PLL_ENABLE should be (0<<31)\

I that case I think we should name it LCPLL_PLL_DISABLE (and use (1<<31) obviously).
-Daniel

Quoted 48 lines

Otherwise

Quoted 30 lines · Eugeni Dodonov

Those are used to control the display core clock.

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

 1 file changed, 7 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +7 -1
index 03fb10d..fa9e3a8 100644
@@ -4014,4 +4014,11 @@
  #define GTCCLK_EN                              0xC6030
  #define  GTCCLK_EN_ENABLE              (1<<0)
 
+/* LCPLL Control */
+#define LCPLL_CTL                              0x130040
+#define  LCPLL_PLL_ENABLE              (1<<31)
+#define  LCPLL_PLL_LOCK                        (1<<30)
+#define  LCPLL_CD_CLOCK_DISABLE        (1<<25)
+#define  LCPLL_CD2X_CLOCK_DISABLE      (1<<23)
+
  #endif /* _I915_REG_H_ */
--

1.7.9.2

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

Signature · 7 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
#50 lore raw

Re: [PATCH 19/37] drm/i915: add LCPLL control registers

that's true!

Quoted 60 lines · Daniel Vetter
Quoted 1 line · Rodrigo Vivi

 LCPLL_PLL_ENABLE should be  (0<<31)\

I that case I think we should name it LCPLL_PLL_DISABLE (and use (1<<31) obviously).
-Daniel

Quoted 33 lines

Otherwise

Quoted 26 lines · Eugeni Dodonov

Those are used to control the display core clock.

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

 1 file changed, 7 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +7 -1
index 03fb10d..fa9e3a8 100644
@@ -4014,4 +4014,11 @@
  #define GTCCLK_EN                              0xC6030
  #define  GTCCLK_EN_ENABLE              (1<<0)
 
+/* LCPLL Control */
+#define LCPLL_CTL                              0x130040
+#define  LCPLL_PLL_ENABLE              (1<<31)
+#define  LCPLL_PLL_LOCK                        (1<<30)
+#define  LCPLL_CD_CLOCK_DISABLE        (1<<25)
+#define  LCPLL_CD2X_CLOCK_DISABLE      (1<<23)
+
  #endif /* _I915_REG_H_ */
--

1.7.9.2

Quoted 15 lines
Quoted 4 lines

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

--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48

Signature · 3 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
#51 lore raw

PATCH 20/37 drm/i915: add WM_LINETIME registers

In reply to Eugeni Dodonov

Watermark line time registers for display low power watermark.

---
 drivers/gpu/drm/i915/i915_reg.h |   10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +10 -0
index fa9e3a8..76f7acb 100644
@@ -4021,4 +4021,14 @@
 #define  LCPLL_CD_CLOCK_DISABLE	(1<<25)
 #define  LCPLL_CD2X_CLOCK_DISABLE	(1<<23)
 
+/* Pipe WM_LINETIME - watermark line time */
+#define PIPE_WM_LINETIME_A		0x45270
+#define PIPE_WM_LINETIME_B		0x45274
+#define PIPE_WM_LINETIME(pipe) _PIPE(pipe, \
+					PIPE_WM_LINETIME_A, \
+					PIPE_WM_LINETIME_A)
+#define   PIPE_WM_LINETIME_LINETIME_MASK		(0x1ff)
+#define   PIPE_WM_LINETIME_LINETIME(x)			((x))
+#define   PIPE_WM_LINETIME_IPS_LINETIME_MASK	(0x1ff<<16)
+#define   PIPE_WM_LINETIME_IPS_LINETIME(x)		((x)<<16)
 #endif /* _I915_REG_H_ */
Signature · 1 line
1.7.9.2
Reviewed-by on v1 20/37
#52 lore raw

Re: [PATCH 20/37] drm/i915: add WM_LINETIME registers

* indentation

Quoted 33 lines · Eugeni Dodonov

Watermark line time registers for display low power watermark.

---
 drivers/gpu/drm/i915/i915_reg.h |   10 ++++++++++

 1 file changed, 10 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +10 -1
index fa9e3a8..76f7acb 100644
@@ -4021,4 +4021,14 @@
  #define  LCPLL_CD_CLOCK_DISABLE        (1<<25)
  #define  LCPLL_CD2X_CLOCK_DISABLE      (1<<23)
 
+/* Pipe WM_LINETIME - watermark line time */
+#define PIPE_WM_LINETIME_A             0x45270
+#define PIPE_WM_LINETIME_B             0x45274
+#define PIPE_WM_LINETIME(pipe) _PIPE(pipe, \
+                                       PIPE_WM_LINETIME_A, \
+                                       PIPE_WM_LINETIME_A)
+#define   PIPE_WM_LINETIME_LINETIME_MASK               (0x1ff)
+#define   PIPE_WM_LINETIME_LINETIME(x)                 ((x))
+#define   PIPE_WM_LINETIME_IPS_LINETIME_MASK   (0x1ff<<16)
+#define   PIPE_WM_LINETIME_IPS_LINETIME(x)             ((x)<<16)
  #endif /* _I915_REG_H_ */
--

1.7.9.2

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

Signature · 3 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
#53 lore raw

PATCH 21/37 drm/i915: calculate watermarks on Gen7 archs in one place

In reply to Eugeni Dodonov
---
 drivers/gpu/drm/i915/intel_display.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
index c225de4..46633fe 100644
@@ -4649,7 +4649,7 @@ void sandybridge_update_wm(struct drm_device *dev)
 	}
 
 	/* IVB has 3 pipes */
-	if (IS_IVYBRIDGE(dev) &&
+	if (IS_GEN7(dev) &&
 	    g4x_compute_wm0(dev, 2,
 			    &sandybridge_display_wm_info, latency,
 			    &sandybridge_cursor_wm_info, latency,
Signature · 1 line
1.7.9.2
#54 lore raw

Re: [PATCH 21/37] drm/i915: calculate watermarks on Gen7 archs in one place

Quoted 10 lines · Eugeni Dodonov
---
 drivers/gpu/drm/i915/intel_display.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index c225de4..46633fe 100644

drivers/gpu/drm/i915/intel_display.c void sandybridge_update_wm(struct drm_device *dev) · line 4652

Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -4649,7 +4649,7 @@ void sandybridge_update_wm(struct drm_device *dev)
 	}
 
 	/* IVB has 3 pipes */
-	if (IS_IVYBRIDGE(dev) &&
+	if (IS_GEN7(dev) &&

I can sense a Jesse rant about needing proper names to distinguish gen7 render engines versus gen7 displays. But maybe another time. ;-) -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#55 lore raw

Re: [PATCH 21/37] drm/i915: calculate watermarks on Gen7 archs in one place

Quoted 13 lines · Chris Wilson
Quoted 12 lines · Eugeni Dodonov
---
 drivers/gpu/drm/i915/intel_display.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index c225de4..46633fe 100644
@@ -4649,7 +4649,7 @@ void sandybridge_update_wm(struct drm_device *dev)
 	}
 
Quoted 6 lines

drivers/gpu/drm/i915/intel_display.c void sandybridge_update_wm(struct drm_device *dev) · line 4652

Quoted 3 lines
drivers/gpu/drm/i915/intel_display.c +1 -1
 	/* IVB has 3 pipes */
-	if (IS_IVYBRIDGE(dev) &&
+	if (IS_GEN7(dev) &&

I can sense a Jesse rant about needing proper names to distinguish gen7 render engines versus gen7 displays. But maybe another time. ;-)

You already have a Daniel rant somewhere later complaining that some of the s/IS_IVB/IS_GEN7/ will surely blow up on vlv ;-)
-Daniel

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
#56 lore raw

PATCH 22/37 drm/i915: program WM_LINETIME on Haswell

In reply to Eugeni Dodonov

The line time can be programmed according to the number of horizontal pixels vs effective pixel rate ratio.

---
 drivers/gpu/drm/i915/intel_display.c |   11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/gpu/drm/i915/intel_display.c +11 -0
index 46633fe..e056c32 100644
@@ -6073,6 +6073,17 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
 		   (adjusted_mode->crtc_vsync_start - 1) |
 		   ((adjusted_mode->crtc_vsync_end - 1) << 16));
 
+	if (IS_HASWELL(dev)) {
+		temp = I915_READ(PIPE_WM_LINETIME(pipe));
+		temp &= ~PIPE_WM_LINETIME_LINETIME_MASK;
+
+		/* Pipe horizontal total number of pixels / pixel rate in MHz. */
+		temp |= PIPE_WM_LINETIME_LINETIME(
+				adjusted_mode->crtc_hdisplay /
+				(adjusted_mode->clock / 1000));
+		I915_WRITE(PIPE_WM_LINETIME(pipe), temp);
+	}
+
 	/* pipesrc controls the size that is scaled from, which should
 	 * always be the user's requested size.
 	 */
Signature · 1 line
1.7.9.2
#57 lore raw

Re: [PATCH 22/37] drm/i915: program WM_LINETIME on Haswell

Quoted 13 lines · Eugeni Dodonov

The line time can be programmed according to the number of horizontal pixels vs effective pixel rate ratio.

---
 drivers/gpu/drm/i915/intel_display.c |   11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 46633fe..e056c32 100644

drivers/gpu/drm/i915/intel_display.c static int ironlake_crtc_mode_set(struct drm_crtc *crtc, · line 6080

Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +5 -0
@@ -6073,6 +6073,17 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
 		   (adjusted_mode->crtc_vsync_start - 1) |
 		   ((adjusted_mode->crtc_vsync_end - 1) << 16));
 
+	if (IS_HASWELL(dev)) {
+		temp = I915_READ(PIPE_WM_LINETIME(pipe));
+		temp &= ~PIPE_WM_LINETIME_LINETIME_MASK;
+
+		/* Pipe horizontal total number of pixels / pixel rate in MHz. */

That comment really doesn't tell me anything more than the following
line. Ok, perhaps a CLOCK_TO_MHz(x) ((x)/1000), but not a lot else.
/* The WM are automatically computed based on how long it takes to fill a row at the given clock rate */ is slightly better as to start to see the meaning and the why.

Any chance of finding another name for LINETIME, perhaps duration:
PIPE_WM_LINETIME_MASK
PIPE_WM_LINETIME_TIME(x)
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#58 lore raw

PATCH 23/37 drm/i915: do not set 6BPP dithering on haswell

In reply to Eugeni Dodonov

We don't have those bits on Haswell anymore, so do not set them.

---
 drivers/gpu/drm/i915/intel_display.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +3 -2
index e056c32..24a0a6c 100644
@@ -5335,9 +5335,10 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc,
 	pipeconf &= ~(PIPECONF_BPP_MASK | PIPECONF_DITHER_EN);
 	if (is_dp) {
 		if (mode->private_flags & INTEL_MODE_DP_FORCE_6BPC) {
-			pipeconf |= PIPECONF_BPP_6 |
-				    PIPECONF_DITHER_EN |
+			pipeconf |= PIPECONF_DITHER_EN |
 				    PIPECONF_DITHER_TYPE_SP;
+			if (!IS_HASWELL(dev))
+				pipeconf |= PIPECONF_BPP_6;
 		}
 	}
 
Signature · 1 line
1.7.9.2
#59 lore raw

Re: [PATCH 23/37] drm/i915: do not set 6BPP dithering on haswell

Quoted 3 lines · Eugeni Dodonov

We don't have those bits on Haswell anymore, so do not set them.

Hm, how is 6bpp dithering supposed to work now, when e.g. a lame dp link can't handle more due to bandwidth issues?
-Daniel

Quoted 28 lines
---
 drivers/gpu/drm/i915/intel_display.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +3 -2
index e056c32..24a0a6c 100644
@@ -5335,9 +5335,10 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc,
 	pipeconf &= ~(PIPECONF_BPP_MASK | PIPECONF_DITHER_EN);
 	if (is_dp) {
 		if (mode->private_flags & INTEL_MODE_DP_FORCE_6BPC) {
-			pipeconf |= PIPECONF_BPP_6 |
-				    PIPECONF_DITHER_EN |
+			pipeconf |= PIPECONF_DITHER_EN |
 				    PIPECONF_DITHER_TYPE_SP;
+			if (!IS_HASWELL(dev))
+				pipeconf |= PIPECONF_BPP_6;
 		}
 	}
 
Signature · 6 lines
1.7.9.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
#60 lore raw

Re: [PATCH 23/37] drm/i915: do not set 6BPP dithering on haswell

Quoted 8 lines · Daniel Vetter
Quoted 3 lines · Eugeni Dodonov

We don't have those bits on Haswell anymore, so do not set them.

Hm, how is 6bpp dithering supposed to work now, when e.g. a lame dp link can't handle more due to bandwidth issues?

It is handled when configuring DDI link instead now. So same functionality, but in different place.

I also noticed that this my patch ended up in a wrong place - in i9xx_crtc_mode_set instead of ironlake_crtc_mode_set; I'll have to rework it anyway. Duh...

Signature · 2 lines
Eugeni Dodonov
<http://eugeni.dodonov.net/>

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

#61 lore raw

PATCH 24/37 drm/i915: share forcewaking code between IVB and HSW

In reply to Eugeni Dodonov
---
 drivers/gpu/drm/i915/intel_display.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
index 24a0a6c..27ab70d 100644
@@ -8906,7 +8906,7 @@ static void intel_init_display(struct drm_device *dev)
 		dev_priv->display.force_wake_put = __gen6_gt_force_wake_put;
 
 		/* IVB configs may use multi-threaded forcewake */
-		if (IS_IVYBRIDGE(dev)) {
+		if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev)) {
 			u32	ecobus;
 
 			/* A small trick here - if the bios hasn't configured MT forcewake,
Signature · 1 line
1.7.9.2
Reviewed-by on v1 24/37
#62 lore raw

Re: [PATCH 24/37] drm/i915: share forcewaking code between IVB and HSW

Quoted 25 lines · Eugeni Dodonov

---
 drivers/gpu/drm/i915/intel_display.c |    2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +1 -2
index 24a0a6c..27ab70d 100644
@@ -8906,7 +8906,7 @@ static void intel_init_display(struct drm_device *dev)
                dev_priv->display.force_wake_put = __gen6_gt_force_wake_put;
 
                /* IVB configs may use multi-threaded forcewake */
-               if (IS_IVYBRIDGE(dev)) {
+               if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev)) {
                        u32     ecobus;
 
                        /* A small trick here - if the bios hasn't configured MT forcewake,
--

1.7.9.2

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

Signature · 3 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
#63 lore raw

PATCH 25/37 drm/i915: haswell has 3 pipes as well

In reply to Eugeni Dodonov

They work differently, but the count is the same.

---
 drivers/gpu/drm/i915/i915_dma.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_dma.c +1 -1
index 9341eb8..a2c0e75 100644
@@ -2073,7 +2073,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 	spin_lock_init(&dev_priv->error_lock);
 	spin_lock_init(&dev_priv->rps_lock);
 
-	if (IS_IVYBRIDGE(dev))
+	if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev))
 		dev_priv->num_pipe = 3;
 	else if (IS_MOBILE(dev) || !IS_GEN2(dev))
 		dev_priv->num_pipe = 2;
Signature · 1 line
1.7.9.2
Reviewed-by on v1 25/37
#64 lore raw

Re: [PATCH 25/37] drm/i915: haswell has 3 pipes as well

Quoted 27 lines · Eugeni Dodonov

They work differently, but the count is the same.

---
 drivers/gpu/drm/i915/i915_dma.c |    2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_dma.c +1 -2
index 9341eb8..a2c0e75 100644
@@ -2073,7 +2073,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
        spin_lock_init(&dev_priv->error_lock);
        spin_lock_init(&dev_priv->rps_lock);
 
-       if (IS_IVYBRIDGE(dev))
+       if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev))
                dev_priv->num_pipe = 3;
        else if (IS_MOBILE(dev) || !IS_GEN2(dev))
                dev_priv->num_pipe = 2;
--

1.7.9.2

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

Signature · 3 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
#65 lore raw

PATCH 26/37 drm/i915: reuse Ivybridge interrupts code for Haswell

In reply to Eugeni Dodonov
---
 drivers/gpu/drm/i915/i915_irq.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +3 -3
index afd4e03..ede51f0 100644
@@ -1810,7 +1810,7 @@ static void ironlake_irq_preinstall(struct drm_device *dev)
 
 	INIT_WORK(&dev_priv->hotplug_work, i915_hotplug_work_func);
 	INIT_WORK(&dev_priv->error_work, i915_error_work_func);
-	if (IS_GEN6(dev) || IS_IVYBRIDGE(dev))
+	if (IS_GEN6(dev) || IS_GEN7(dev))
 		INIT_WORK(&dev_priv->rps_work, gen6_pm_rps_work);
 
 	I915_WRITE(HWSTAM, 0xeffe);
@@ -2136,7 +2136,7 @@ void intel_irq_init(struct drm_device *dev)
 {
 	dev->driver->get_vblank_counter = i915_get_vblank_counter;
 	dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */
-	if (IS_G4X(dev) || IS_GEN5(dev) || IS_GEN6(dev) || IS_IVYBRIDGE(dev)) {
+	if (IS_G4X(dev) || IS_GEN5(dev) || IS_GEN6(dev) || IS_GEN7(dev)) {
 		dev->max_vblank_count = 0xffffffff; /* full 32 bit counter */
 		dev->driver->get_vblank_counter = gm45_get_vblank_counter;
 	}
@@ -2147,7 +2147,7 @@ void intel_irq_init(struct drm_device *dev)
 		dev->driver->get_vblank_timestamp = NULL;
 	dev->driver->get_scanout_position = i915_get_crtc_scanoutpos;
 
-	if (IS_IVYBRIDGE(dev)) {
+	if (IS_GEN7(dev)) {
 		/* Share pre & uninstall handlers with ILK/SNB */
 		dev->driver->irq_handler = ivybridge_irq_handler;
 		dev->driver->irq_preinstall = ironlake_irq_preinstall;
Signature · 1 line
1.7.9.2
#66 lore raw

Re: [PATCH 26/37] drm/i915: reuse Ivybridge interrupts code for Haswell

Quoted 1 line · Eugeni Dodonov

Hm, I have a feeling that some of these s/IS_IVB/IS_GEN7/ checks will collide with the vlv code. I guess neither Jesse nor you have tried to merge in each another's branch yet. This will be fun to sort out ;-) -Daniel

Quoted 42 lines
---
 drivers/gpu/drm/i915/i915_irq.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +3 -3
index afd4e03..ede51f0 100644
@@ -1810,7 +1810,7 @@ static void ironlake_irq_preinstall(struct drm_device *dev)
 
 	INIT_WORK(&dev_priv->hotplug_work, i915_hotplug_work_func);
 	INIT_WORK(&dev_priv->error_work, i915_error_work_func);
-	if (IS_GEN6(dev) || IS_IVYBRIDGE(dev))
+	if (IS_GEN6(dev) || IS_GEN7(dev))
 		INIT_WORK(&dev_priv->rps_work, gen6_pm_rps_work);
 
 	I915_WRITE(HWSTAM, 0xeffe);
@@ -2136,7 +2136,7 @@ void intel_irq_init(struct drm_device *dev)
 {
 	dev->driver->get_vblank_counter = i915_get_vblank_counter;
 	dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */
-	if (IS_G4X(dev) || IS_GEN5(dev) || IS_GEN6(dev) || IS_IVYBRIDGE(dev)) {
+	if (IS_G4X(dev) || IS_GEN5(dev) || IS_GEN6(dev) || IS_GEN7(dev)) {
 		dev->max_vblank_count = 0xffffffff; /* full 32 bit counter */
 		dev->driver->get_vblank_counter = gm45_get_vblank_counter;
 	}
@@ -2147,7 +2147,7 @@ void intel_irq_init(struct drm_device *dev)
 		dev->driver->get_vblank_timestamp = NULL;
 	dev->driver->get_scanout_position = i915_get_crtc_scanoutpos;
 
-	if (IS_IVYBRIDGE(dev)) {
+	if (IS_GEN7(dev)) {
 		/* Share pre & uninstall handlers with ILK/SNB */
 		dev->driver->irq_handler = ivybridge_irq_handler;
 		dev->driver->irq_preinstall = ironlake_irq_preinstall;
Signature · 6 lines
1.7.9.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
#67 lore raw

Re: [PATCH 26/37] drm/i915: reuse Ivybridge interrupts code for Haswell

Quoted 7 lines · Daniel Vetter
Quoted 1 line · Eugeni Dodonov

Hm, I have a feeling that some of these s/IS_IVB/IS_GEN7/ checks will collide with the vlv code. I guess neither Jesse nor you have tried to merge in each another's branch yet. This will be fun to sort out ;-)

Yep, we haven't tried yet :).

HSW interrupts handling seems to be very similar to IVB up to the point I investigated, but anyway, I think most of this code will have to be adapted between those branches. Both are Gen7, but some subtle differences make them way to different in some places.

Signature · 2 lines
Eugeni Dodonov
<http://eugeni.dodonov.net/>

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

#68 lore raw

PATCH 27/37 drm/i915: share pipe count handling with Ivybridge

In reply to Eugeni Dodonov
---
 drivers/gpu/drm/i915/intel_display.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
index 27ab70d..2978597 100644
@@ -2308,7 +2308,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
 	case 1:
 		break;
 	case 2:
-		if (IS_IVYBRIDGE(dev))
+		if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev))
 			break;
 		/* fall through otherwise */
 	default:
Signature · 1 line
1.7.9.2
Reviewed-by on v1 27/37
#69 lore raw

Re: [PATCH 27/37] drm/i915: share pipe count handling with Ivybridge

Quoted 25 lines · Eugeni Dodonov

---
 drivers/gpu/drm/i915/intel_display.c |    2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 27ab70d..2978597 100644
@@ -2308,7 +2308,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,

       case 1:
               break;
       case 2:
-               if (IS_IVYBRIDGE(dev))
+               if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev)) break;
               /* fall through otherwise */ default:
--
1.7.9.2

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

Signature · 3 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
#70 lore raw

PATCH 28/37 drm/i915: share IVB cursor routine with Haswell

In reply to Eugeni Dodonov
---
 drivers/gpu/drm/i915/intel_display.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
index 2978597..3b3dc15 100644
@@ -6467,7 +6467,7 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
 	if (!visible && !intel_crtc->cursor_visible)
 		return;
 
-	if (IS_IVYBRIDGE(dev)) {
+	if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev)) {
 		I915_WRITE(CURPOS_IVB(pipe), pos);
 		ivb_update_cursor(crtc, base);
 	} else {
Signature · 1 line
1.7.9.2
Reviewed-by on v1 28/37
#71 lore raw

Re: [PATCH 28/37] drm/i915: share IVB cursor routine with Haswell

Quoted 25 lines · Eugeni Dodonov

---
 drivers/gpu/drm/i915/intel_display.c |    2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +1 -2
index 2978597..3b3dc15 100644
@@ -6467,7 +6467,7 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
        if (!visible && !intel_crtc->cursor_visible)
                return;
 
-       if (IS_IVYBRIDGE(dev)) {
+       if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev)) {
                I915_WRITE(CURPOS_IVB(pipe), pos);
                ivb_update_cursor(crtc, base);
        } else {
--

1.7.9.2

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

Signature · 3 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
#72 lore raw

PATCH 29/37 drm/i915: enable power wells on haswell init

In reply to Eugeni Dodonov

This attempts to enable all the available power wells during the initialization.

---
 drivers/gpu/drm/i915/intel_display.c |   31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
drivers/gpu/drm/i915/intel_display.c +31 -0
index 3b3dc15..2c5b953 100644
@@ -9142,6 +9142,34 @@ static void i915_disable_vga(struct drm_device *dev)
 	POSTING_READ(vga_reg);
 }
 
+/* Starting with Haswell, we have different power wells for
+ * different parts of the GPU. This attempts to enable them all.
+ */
+static void intel_init_power_wells(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	unsigned long power_wells[] = {
+		HSW_PWR_WELL_CTL1,
+		HSW_PWR_WELL_CTL2,
+		HSW_PWR_WELL_CTL4
+	};
+	int i;
+
+	mutex_lock(&dev->struct_mutex);
+
+	for (i = 0; i < ARRAY_SIZE(power_wells); i++) {
+		int well = I915_READ(power_wells[i]);
+
+		if ((well & HSW_PWR_WELL_STATE) == 0) {
+			I915_WRITE(power_wells[i], well & HSW_PWR_WELL_ENABLE);
+			if (wait_for(I915_READ(power_wells[i] & HSW_PWR_WELL_STATE), 20))
+				DRM_ERROR("Error enabling power well %lx\n", power_wells[i]);
+		}
+	}
+
+	mutex_unlock(&dev->struct_mutex);
+}
+
 void intel_modeset_init(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -9159,6 +9187,9 @@ void intel_modeset_init(struct drm_device *dev)
 
 	intel_init_quirks(dev);
 
+	if (IS_HASWELL(dev))
+		intel_init_power_wells(dev);
+
 	intel_init_display(dev);
 
 	if (IS_GEN2(dev)) {
Signature · 1 line
1.7.9.2
#73 lore raw

Re: [PATCH 29/37] drm/i915: enable power wells on haswell init

Quoted 30 lines · Eugeni Dodonov

This attempts to enable all the available power wells during the initialization.

---
 drivers/gpu/drm/i915/intel_display.c |   31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
drivers/gpu/drm/i915/intel_display.c +14 -0
index 3b3dc15..2c5b953 100644
@@ -9142,6 +9142,34 @@ static void i915_disable_vga(struct drm_device *dev)
 	POSTING_READ(vga_reg);
 }
 
+/* Starting with Haswell, we have different power wells for
+ * different parts of the GPU. This attempts to enable them all.
+ */
+static void intel_init_power_wells(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	unsigned long power_wells[] = {
+		HSW_PWR_WELL_CTL1,
+		HSW_PWR_WELL_CTL2,
+		HSW_PWR_WELL_CTL4
+	};
+	int i;
+
+	mutex_lock(&dev->struct_mutex);

drivers/gpu/drm/i915/intel_display.c static void i915_disable_vga(struct drm_device *dev) · line 9168

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10 -0
+
+	for (i = 0; i < ARRAY_SIZE(power_wells); i++) {
+		int well = I915_READ(power_wells[i]);
+
+		if ((well & HSW_PWR_WELL_STATE) == 0) {
+			I915_WRITE(power_wells[i], well & HSW_PWR_WELL_ENABLE);
+			if (wait_for(I915_READ(power_wells[i] & HSW_PWR_WELL_STATE), 20))
+				DRM_ERROR("Error enabling power well %lx\n", power_wells[i]);
+		}
+	}

Out of curiosity, can we enable the powerwells in parallel or must it be done sequentially?
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#74 lore raw

PATCH 30/37 drm/i915: disable rc6 on haswell for now

In reply to Eugeni Dodonov

This needs proper enablement to avoid machine hangs, so let's just avoid it for now.

---
 drivers/gpu/drm/i915/intel_display.c |    4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/i915/intel_display.c +4 -0
index 2c5b953..f7dbcab 100644
@@ -8275,6 +8275,10 @@ static bool intel_enable_rc6(struct drm_device *dev)
 	if (INTEL_INFO(dev)->gen == 5)
 		return 0;
 
+	/* Sorry Haswell, no RC6 for you for now. */
+	if (IS_HASWELL(dev))
+		return 0;
+
 	/*
 	 * Disable rc6 on Sandybridge
 	 */
Signature · 1 line
1.7.9.2
Reviewed-by on v1 30/37
#75 lore raw

Re: [PATCH 30/37] drm/i915: disable rc6 on haswell for now

Quoted 30 lines · Eugeni Dodonov

This needs proper enablement to avoid machine hangs, so let's just avoid it for now.

---
 drivers/gpu/drm/i915/intel_display.c |    4 ++++

 1 file changed, 4 insertions(+)
drivers/gpu/drm/i915/intel_display.c +4 -1
index 2c5b953..f7dbcab 100644
@@ -8275,6 +8275,10 @@ static bool intel_enable_rc6(struct drm_device *dev)
        if (INTEL_INFO(dev)->gen == 5)
                return 0;
 
+       /* Sorry Haswell, no RC6 for you for now. */
+       if (IS_HASWELL(dev))
+               return 0;
+
        /*
         * Disable rc6 on Sandybridge
         */
--

1.7.9.2

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

Signature · 3 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
#76 lore raw

PATCH 31/37 drm/i915: enable PCH earlier

In reply to Eugeni Dodonov

The modesetting sequence for PCH-related connections mentions that the order of plane/pipe enablement could happen either before of after PCH enablement.

With LPT, however, we need to enable some things earlier to be able to talk to PCH. So let's do it a bit in advance.

---
 drivers/gpu/drm/i915/intel_display.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +3 -3
index f7dbcab..b1ad10a 100644
@@ -3140,12 +3140,12 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)
 	 */
 	intel_crtc_load_lut(crtc);
 
-	intel_enable_pipe(dev_priv, pipe, is_pch_port);
-	intel_enable_plane(dev_priv, plane, pipe);
-
 	if (is_pch_port)
 		ironlake_pch_enable(crtc);
 
+	intel_enable_pipe(dev_priv, pipe, is_pch_port);
+	intel_enable_plane(dev_priv, plane, pipe);
+
 	mutex_lock(&dev->struct_mutex);
 	intel_update_fbc(dev);
 	mutex_unlock(&dev->struct_mutex);
Signature · 1 line
1.7.9.2
#77 lore raw

Re: [PATCH 31/37] drm/i915: enable PCH earlier

Quoted 6 lines · Eugeni Dodonov

The modesetting sequence for PCH-related connections mentions that the order of plane/pipe enablement could happen either before of after PCH enablement.

With LPT, however, we need to enable some things earlier to be able to talk to PCH. So let's do it a bit in advance.

Touching modesetting sequence is a nerve racking experience. Can we arrange to have this patch tested by itself, right now? -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#78 lore raw

Re: [PATCH 31/37] drm/i915: enable PCH earlier

Quoted 10 lines · On Thu, 22 Mar 2012 11:05:22 +0000 Chris Wilson <[email protected]>…
Quoted 6 lines · Eugeni Dodonov

The modesetting sequence for PCH-related connections mentions that the order of plane/pipe enablement could happen either before of after PCH enablement.

With LPT, however, we need to enable some things earlier to be able to talk to PCH. So let's do it a bit in advance.

Touching modesetting sequence is a nerve racking experience. Can we arrange to have this patch tested by itself, right now?

Double plus agree. Core changes like this need to be run against as many configs and previous gens as possible...

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center

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

#79 lore raw

Re: [PATCH 31/37] drm/i915: enable PCH earlier

Quoted 9 lines · Jesse Barnes
Quoted 1 line · On Thu, 22 Mar 2012 11:05:22 +0000 Chris Wilson <[email protected]>…

On Wed, 21 Mar 2012 22:10:06 -0300, Eugeni Dodonov <

Quoted 4 lines · [email protected]> wrote:
Quoted 4 lines

The modesetting sequence for PCH-related connections mentions that the order of plane/pipe enablement could happen either before of after PCH enablement.

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

With LPT, however, we need to enable some things earlier to be able to talk to PCH. So let's do it a bit in advance.

Touching modesetting sequence is a nerve racking experience. Can we arrange to have this patch tested by itself, right now?

Double plus agree. Core changes like this need to be run against as many configs and previous gens as possible...

With the latest iteration of the patches, I managed to work-around this properly. So I'll drop this patch from the next patch-bomb.

Signature · 2 lines
Eugeni Dodonov
<http://eugeni.dodonov.net/>

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

#80 lore raw

PATCH 32/37 drm/i915: perform Haswell DDI link training in FDI mode

In reply to Eugeni Dodonov

This patch attempts at following the modeset sequence closely, retrying with different voltages if the DP_TP_STATUS reports a failed training.

For training, we add a table of recommended settings for FDI, HDMI and DP connections. For FDI and DP modes, we also add the HDMI buffer translation as the last item. Those are ignored in such modes, so there is no harm in having them set.

Initially, we use DDI E for FDI connectivity. This is the suggested configuration, and this seems to be what should work the best with FDI.

---
 drivers/gpu/drm/i915/intel_display.c |  170 ++++++++++++++++++++++++++++++++++
 1 file changed, 170 insertions(+)
drivers/gpu/drm/i915/intel_display.c +170 -0
index b1ad10a..04625d5 100644
@@ -1409,6 +1409,16 @@ static void intel_enable_pipe(struct drm_i915_private *dev_priv, enum pipe pipe,
 		/* FIXME: assert CPU port conditions for SNB+ */
 	}
 
+	/* On HSW, enable PIPE_DDI_FUNC_CTL for the pipe */
+	if (IS_HASWELL(dev_priv->dev)) {
+		I915_WRITE(DDI_FUNC_CTL(pipe),
+				I915_READ(DDI_FUNC_CTL(pipe)) |
+					PIPE_DDI_SELECT_DDI_E |
+					PIPE_DDI_PORT_WIDTH_X2 |
+					PIPE_DDI_MODE_SELECT_FDI |
+					PIPE_DDI_FUNC_ENABLE);
+	}
+
 	reg = PIPECONF(pipe);
 	val = I915_READ(reg);
 	if (val & PIPECONF_ENABLE)
@@ -2698,6 +2708,151 @@ static void gen6_fdi_link_train(struct drm_crtc *crtc)
 	DRM_DEBUG_KMS("FDI train done.\n");
 }
 
+static const long hsw_ddi_translations_dp[] = {
+	0x00FFFFFF, 0x0006000E,
+	0x00D75FFF, 0x0005000A,
+	0x00C30FFF, 0x00040006,
+	0x80AAAFFF, 0x000B0000,
+	0x00FFFFFF, 0x0005000A,
+	0x00D75FFF, 0x000C0004,
+	0x80C30FFF, 0x000B0000,
+	0x00FFFFFF, 0x00040006,
+	0x80D75FFF, 0x000B0000,
+	0x00FFFFFF, 0x00040006
+};
+
+static const long hsw_ddi_translations_fdi[] = {
+	0x00FFFFFF, 0x0007000E,
+	0x00D75FFF, 0x000F000A,
+	0x00C30FFF, 0x00060006,
+	0x00AAAFFF, 0x001E0000,
+	0x00FFFFFF, 0x000F000A,
+	0x00D75FFF, 0x00160004,
+	0x00C30FFF, 0x001E0000,
+	0x00FFFFFF, 0x00060006,
+	0x00D75FFF, 0x001E0000,
+	0x00FFFFFF, 0x00040006
+};
+
+/* For HDMI, we are only interested in the last entry */
+static const long hsw_ddi_translations_hdmi[] = {
+	0x0, 0x0,
+	0x0, 0x0,
+	0x0, 0x0,
+	0x0, 0x0,
+	0x0, 0x0,
+	0x0, 0x0,
+	0x0, 0x0,
+	0x0, 0x0,
+	0x0, 0x0,
+	0x00FFFFFF, 0x00040006
+};
+
+
+static const long hsw_ddi_buf_ctl_values[] = {
+	DDI_BUF_EMP_400MV_0DB_HSW,
+	DDI_BUF_EMP_400MV_3_5DB_HSW,
+	DDI_BUF_EMP_400MV_6DB_HSW,
+	DDI_BUF_EMP_400MV_9_5DB_HSW,
+	DDI_BUF_EMP_600MV_0DB_HSW,
+	DDI_BUF_EMP_600MV_3_5DB_HSW,
+	DDI_BUF_EMP_600MV_6DB_HSW,
+	DDI_BUF_EMP_800MV_0DB_HSW,
+	DDI_BUF_EMP_800MV_3_5DB_HSW
+};
+
+
+/* Link training for HSW parts */
+static void hsw_fdi_link_train(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+	int pipe = intel_crtc->pipe;
+	u32 reg, temp, i;
+
+	/* Prior to enabling DDI, configure buffer translation with FDI values */
+	for (i=0, reg=DDI_BUF_TRANS_E; i < ARRAY_SIZE(hsw_ddi_translations_fdi); i++) {
+		I915_WRITE(reg, hsw_ddi_translations_fdi[i]);
+		reg += 4;
+	}
+
+	/* Configure CPU PLL, wait for warmup */
+	I915_WRITE(SPLL_CTL,
+			SPLL_PLL_ENABLE |
+			SPLL_PLL_FREQ_1350MHz |
+			SPLL_PLL_SCC);
+
+	/* Use SPLL to drive the output when in FDI mode */
+	I915_WRITE(PORT_CLK_SEL_E,
+			PORT_CLK_SEL_SPLL);
+	I915_WRITE(PIPE_CLK_SEL(pipe),
+			PIPE_CLK_SEL_DDIE);
+
+	udelay(20);
+
+	/* Start the training iterating through available voltages and emphasis */
+	for (i=0; i < ARRAY_SIZE(hsw_ddi_buf_ctl_values); i++) {
+		/* Configure DP_TP_CTL with auto-training */
+		I915_WRITE(DP_TP_CTL_E,
+					DP_TP_CTL_FDI_AUTOTRAIN |
+					DP_TP_CTL_ENHANCED_FRAME_ENABLE |
+					DP_TP_CTL_LINK_TRAIN_PAT1 |
+					DP_TP_CTL_ENABLE);
+
+		/* Configure and enable DDI_BUF_CTL for DDI E with next voltage */
+		temp = I915_READ(DDI_BUF_CTL_E);
+		temp = (temp & ~DDI_BUF_EMP_MASK);
+		I915_WRITE(DDI_BUF_CTL_E,
+				temp |
+				DDI_BUF_CTL_ENABLE |
+				DDI_PORT_WIDTH_X2 |
+				hsw_ddi_buf_ctl_values[i]);
+
+		udelay(600);
+
+		/* Enable CPU FDI Receiver with auto-training */
+		I915_WRITE(FDI_RX_CTL(pipe),
+				I915_READ(FDI_RX_CTL(pipe)) |
+					FDI_LINK_TRAIN_AUTO |
+					FDI_RX_ENABLE |
+					FDI_LINK_TRAIN_PATTERN_1_CPT |
+					FDI_RX_ENHANCE_FRAME_ENABLE |
+					LPT_FDI_PORT_WIDTH_2X |
+					FDI_RX_PLL_ENABLE);
+		POSTING_READ(reg);
+		udelay(100);
+
+		temp = I915_READ(DP_TP_STATUS_E);
+		if (temp & DP_TP_STATUS_AUTOTRAIN_DONE) {
+			DRM_INFO("BUF_CTL training done on %d step\n", i);
+
+			/* Enable normal pixel sending for FDI */
+			I915_WRITE(DP_TP_CTL_E,
+						DP_TP_CTL_FDI_AUTOTRAIN |
+						DP_TP_CTL_LINK_TRAIN_NORMAL |
+						DP_TP_CTL_ENHANCED_FRAME_ENABLE |
+						DP_TP_CTL_ENABLE);
+
+			break;
+		} else {
+			DRM_ERROR("Error training BUF_CTL %d\n", i);
+
+			/* Disable DP_TP_CTL and FDI_RX_CTL) and retry */
+			I915_WRITE(DP_TP_CTL_E,
+					I915_READ(DP_TP_CTL_E) &
+						~DP_TP_CTL_ENABLE);
+			I915_WRITE(FDI_RX_CTL(pipe),
+					I915_READ(FDI_RX_CTL(pipe)) &
+						~FDI_RX_PLL_ENABLE);
+			continue;
+		}
+	}
+
+
+	DRM_DEBUG_KMS("FDI train done.\n");
+}
+
 /* Manual link training for Ivy Bridge A0 parts */
 static void ivb_manual_fdi_link_train(struct drm_crtc *crtc)
 {
@@ -3019,6 +3174,10 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)
 			temp |= (TRANSC_DPLL_ENABLE | transc_sel);
 		}
 		I915_WRITE(PCH_DPLL_SEL, temp);
+	} else if (HAS_PCH_LPT(dev)) {
+		/* DDIE clock is recommented for FDI connections */
+		I915_WRITE(PIPE_CLK_SEL(pipe),
+				PIPE_CLK_SEL_DDIE);
 	}
 
 	/* set transcoder timing, panel must allow it */
@@ -8975,6 +9134,17 @@ static void intel_init_display(struct drm_device *dev)
 			}
 			dev_priv->display.init_clock_gating = ivybridge_init_clock_gating;
 			dev_priv->display.write_eld = ironlake_write_eld;
+		} else if (IS_HASWELL(dev)) {
+			dev_priv->display.fdi_link_train = hsw_fdi_link_train;
+			if (SNB_READ_WM0_LATENCY()) {
+				dev_priv->display.update_wm = sandybridge_update_wm;
+			} else {
+				DRM_DEBUG_KMS("Failed to read display plane latency. "
+					      "Disable CxSR\n");
+				dev_priv->display.update_wm = NULL;
+			}
+			dev_priv->display.init_clock_gating = ivybridge_init_clock_gating;
+			dev_priv->display.write_eld = ironlake_write_eld;
 		} else
 			dev_priv->display.update_wm = NULL;
 	} else if (IS_PINEVIEW(dev)) {
Signature · 1 line
1.7.9.2
Reviewed-by on v1 32/37
#81 lore raw

Re: [PATCH 32/37] drm/i915: perform Haswell DDI link training in FDI mode

Quoted 225 lines · Eugeni Dodonov

This patch attempts at following the modeset sequence closely, retrying with different voltages if the DP_TP_STATUS reports a failed training.

For training, we add a table of recommended settings for FDI, HDMI and DP connections. For FDI and DP modes, we also add the HDMI buffer translation as the last item. Those are ignored in such modes, so there is no harm in having them set.

Initially, we use DDI E for FDI connectivity.  This is the suggested configuration, and this seems to be what should work the best with FDI.

---
 drivers/gpu/drm/i915/intel_display.c |  170 ++++++++++++++++++++++++++++++++++

 1 file changed, 170 insertions(+)
drivers/gpu/drm/i915/intel_display.c +170 -1
index b1ad10a..04625d5 100644
@@ -1409,6 +1409,16 @@ static void intel_enable_pipe(struct drm_i915_private *dev_priv, enum pipe pipe,
                /* FIXME: assert CPU port conditions for SNB+ */
        }
 
+       /* On HSW, enable PIPE_DDI_FUNC_CTL for the pipe */
+       if (IS_HASWELL(dev_priv->dev)) {
+               I915_WRITE(DDI_FUNC_CTL(pipe),
+                               I915_READ(DDI_FUNC_CTL(pipe)) |
+                                       PIPE_DDI_SELECT_DDI_E |
+                                       PIPE_DDI_PORT_WIDTH_X2 |
+                                       PIPE_DDI_MODE_SELECT_FDI |
+                                       PIPE_DDI_FUNC_ENABLE);
+       }
+
        reg = PIPECONF(pipe);
        val = I915_READ(reg);
        if (val & PIPECONF_ENABLE)
@@ -2698,6 +2708,151 @@ static void gen6_fdi_link_train(struct drm_crtc *crtc)
        DRM_DEBUG_KMS("FDI train done.\n");
  }
 
+static const long hsw_ddi_translations_dp[] = {
+       0x00FFFFFF, 0x0006000E,
+       0x00D75FFF, 0x0005000A,
+       0x00C30FFF, 0x00040006,
+       0x80AAAFFF, 0x000B0000,
+       0x00FFFFFF, 0x0005000A,
+       0x00D75FFF, 0x000C0004,
+       0x80C30FFF, 0x000B0000,
+       0x00FFFFFF, 0x00040006,
+       0x80D75FFF, 0x000B0000,
+       0x00FFFFFF, 0x00040006
+};
+
+static const long hsw_ddi_translations_fdi[] = {
+       0x00FFFFFF, 0x0007000E,
+       0x00D75FFF, 0x000F000A,
+       0x00C30FFF, 0x00060006,
+       0x00AAAFFF, 0x001E0000,
+       0x00FFFFFF, 0x000F000A,
+       0x00D75FFF, 0x00160004,
+       0x00C30FFF, 0x001E0000,
+       0x00FFFFFF, 0x00060006,
+       0x00D75FFF, 0x001E0000,
+       0x00FFFFFF, 0x00040006
+};
+
+/* For HDMI, we are only interested in the last entry */
+static const long hsw_ddi_translations_hdmi[] = {
+       0x0, 0x0,
+       0x0, 0x0,
+       0x0, 0x0,
+       0x0, 0x0,
+       0x0, 0x0,
+       0x0, 0x0,
+       0x0, 0x0,
+       0x0, 0x0,
+       0x0, 0x0,
+       0x00FFFFFF, 0x00040006
+};
+
+
+static const long hsw_ddi_buf_ctl_values[] = {
+       DDI_BUF_EMP_400MV_0DB_HSW,
+       DDI_BUF_EMP_400MV_3_5DB_HSW,
+       DDI_BUF_EMP_400MV_6DB_HSW,
+       DDI_BUF_EMP_400MV_9_5DB_HSW,
+       DDI_BUF_EMP_600MV_0DB_HSW,
+       DDI_BUF_EMP_600MV_3_5DB_HSW,
+       DDI_BUF_EMP_600MV_6DB_HSW,
+       DDI_BUF_EMP_800MV_0DB_HSW,
+       DDI_BUF_EMP_800MV_3_5DB_HSW
+};
+
+
+/* Link training for HSW parts */
+static void hsw_fdi_link_train(struct drm_crtc *crtc)
+{
+       struct drm_device *dev = crtc->dev;
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+       int pipe = intel_crtc->pipe;
+       u32 reg, temp, i;
+
+       /* Prior to enabling DDI, configure buffer translation with FDI values */
+       for (i=0, reg=DDI_BUF_TRANS_E; i < ARRAY_SIZE(hsw_ddi_translations_fdi); i++) {
+               I915_WRITE(reg, hsw_ddi_translations_fdi[i]);
+               reg += 4;
+       }
+
+       /* Configure CPU PLL, wait for warmup */
+       I915_WRITE(SPLL_CTL,
+                       SPLL_PLL_ENABLE |
+                       SPLL_PLL_FREQ_1350MHz |
+                       SPLL_PLL_SCC);
+
+       /* Use SPLL to drive the output when in FDI mode */
+       I915_WRITE(PORT_CLK_SEL_E,
+                       PORT_CLK_SEL_SPLL);
+       I915_WRITE(PIPE_CLK_SEL(pipe),
+                       PIPE_CLK_SEL_DDIE);
+
+       udelay(20);
+
+       /* Start the training iterating through available voltages and emphasis */
+       for (i=0; i < ARRAY_SIZE(hsw_ddi_buf_ctl_values); i++) {
+               /* Configure DP_TP_CTL with auto-training */
+               I915_WRITE(DP_TP_CTL_E,
+                                       DP_TP_CTL_FDI_AUTOTRAIN |
+                                       DP_TP_CTL_ENHANCED_FRAME_ENABLE |
+                                       DP_TP_CTL_LINK_TRAIN_PAT1 |
+                                       DP_TP_CTL_ENABLE);
+
+               /* Configure and enable DDI_BUF_CTL for DDI E with next voltage */
+               temp = I915_READ(DDI_BUF_CTL_E);
+               temp = (temp & ~DDI_BUF_EMP_MASK);
+               I915_WRITE(DDI_BUF_CTL_E,
+                               temp |
+                               DDI_BUF_CTL_ENABLE |
+                               DDI_PORT_WIDTH_X2 |
+                               hsw_ddi_buf_ctl_values[i]);
+
+               udelay(600);
+
+               /* Enable CPU FDI Receiver with auto-training */
+               I915_WRITE(FDI_RX_CTL(pipe),
+                               I915_READ(FDI_RX_CTL(pipe)) |
+                                       FDI_LINK_TRAIN_AUTO |
+                                       FDI_RX_ENABLE |
+                                       FDI_LINK_TRAIN_PATTERN_1_CPT |
+                                       FDI_RX_ENHANCE_FRAME_ENABLE |
+                                       LPT_FDI_PORT_WIDTH_2X |
+                                       FDI_RX_PLL_ENABLE);
+               POSTING_READ(reg);
+               udelay(100);
+
+               temp = I915_READ(DP_TP_STATUS_E);
+               if (temp & DP_TP_STATUS_AUTOTRAIN_DONE) {
+                       DRM_INFO("BUF_CTL training done on %d step\n", i);
+
+                       /* Enable normal pixel sending for FDI */
+                       I915_WRITE(DP_TP_CTL_E,
+                                               DP_TP_CTL_FDI_AUTOTRAIN |
+                                               DP_TP_CTL_LINK_TRAIN_NORMAL |
+                                               DP_TP_CTL_ENHANCED_FRAME_ENABLE |
+                                               DP_TP_CTL_ENABLE);
+
+                       break;
+               } else {
+                       DRM_ERROR("Error training BUF_CTL %d\n", i);
+
+                       /* Disable DP_TP_CTL and FDI_RX_CTL) and retry */
+                       I915_WRITE(DP_TP_CTL_E,
+                                       I915_READ(DP_TP_CTL_E) &
+                                               ~DP_TP_CTL_ENABLE);
+                       I915_WRITE(FDI_RX_CTL(pipe),
+                                       I915_READ(FDI_RX_CTL(pipe)) &
+                                               ~FDI_RX_PLL_ENABLE);
+                       continue;
+               }
+       }
+
+
+       DRM_DEBUG_KMS("FDI train done.\n");
+}
+
  /* Manual link training for Ivy Bridge A0 parts */
  static void ivb_manual_fdi_link_train(struct drm_crtc *crtc)
  {
@@ -3019,6 +3174,10 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)
                        temp |= (TRANSC_DPLL_ENABLE | transc_sel);
                }
                I915_WRITE(PCH_DPLL_SEL, temp);
+       } else if (HAS_PCH_LPT(dev)) {
+               /* DDIE clock is recommented for FDI connections */
+               I915_WRITE(PIPE_CLK_SEL(pipe),
+                               PIPE_CLK_SEL_DDIE);
        }
 
        /* set transcoder timing, panel must allow it */
@@ -8975,6 +9134,17 @@ static void intel_init_display(struct drm_device *dev)
                        }
                        dev_priv->display.init_clock_gating = ivybridge_init_clock_gating;
                        dev_priv->display.write_eld = ironlake_write_eld;
+               } else if (IS_HASWELL(dev)) {
+                       dev_priv->display.fdi_link_train = hsw_fdi_link_train;
+                       if (SNB_READ_WM0_LATENCY()) {
+                               dev_priv->display.update_wm = sandybridge_update_wm;
+                       } else {
+                               DRM_DEBUG_KMS("Failed to read display plane latency. "
+                                             "Disable CxSR\n");
+                               dev_priv->display.update_wm = NULL;
+                       }
+                       dev_priv->display.init_clock_gating = ivybridge_init_clock_gating;
+                       dev_priv->display.write_eld = ironlake_write_eld;
                } else
                        dev_priv->display.update_wm = NULL;
        } else if (IS_PINEVIEW(dev)) {
--

1.7.9.2

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

Signature · 3 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
#82 lore raw

PATCH 33/37 drm/i915: double-write DDI translation table

In reply to Eugeni Dodonov

Some double-buffered registers need to be written twice.

Note that it is being sent as a separate patch because sometimes these registers do work when written only once. But double-writing on my machine ensured that they work more often.

---
 drivers/gpu/drm/i915/intel_display.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_display.c +8 -4
index 04625d5..8a839be 100644
@@ -2769,12 +2769,16 @@ static void hsw_fdi_link_train(struct drm_crtc *crtc)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	int pipe = intel_crtc->pipe;
-	u32 reg, temp, i;
+	u32 reg, temp, i, j;
 
 	/* Prior to enabling DDI, configure buffer translation with FDI values */
-	for (i=0, reg=DDI_BUF_TRANS_E; i < ARRAY_SIZE(hsw_ddi_translations_fdi); i++) {
-		I915_WRITE(reg, hsw_ddi_translations_fdi[i]);
-		reg += 4;
+	/* Those registers seem to be double-buffered - at least, the hw team writes them twice. */
+	for (j=0; j < 2; j++) {
+		for (i=0, reg=DDI_BUF_TRANS_E; i < ARRAY_SIZE(hsw_ddi_translations_fdi); i++) {
+			I915_WRITE(reg, hsw_ddi_translations_fdi[i]);
+			reg += 4;
+		}
+		udelay(20);
 	}
 
 	/* Configure CPU PLL, wait for warmup */
Signature · 1 line
1.7.9.2
Reviewed-by on v1 33/37
#83 lore raw

Re: [PATCH 33/37] drm/i915: double-write DDI translation table

Quoted 43 lines · Eugeni Dodonov

Some double-buffered registers need to be written twice.

Note that it is being sent as a separate patch because sometimes these registers do work when written only once. But double-writing on my machine ensured that they work more often.

---
 drivers/gpu/drm/i915/intel_display.c |   12 ++++++++----

 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_display.c +8 -5
index 04625d5..8a839be 100644
@@ -2769,12 +2769,16 @@ static void hsw_fdi_link_train(struct drm_crtc *crtc)
        struct drm_i915_private *dev_priv = dev->dev_private;
        struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
        int pipe = intel_crtc->pipe;
-       u32 reg, temp, i;
+       u32 reg, temp, i, j;
 
        /* Prior to enabling DDI, configure buffer translation with FDI values */
-       for (i=0, reg=DDI_BUF_TRANS_E; i < ARRAY_SIZE(hsw_ddi_translations_fdi); i++) {
-               I915_WRITE(reg, hsw_ddi_translations_fdi[i]);
-               reg += 4;
+       /* Those registers seem to be double-buffered - at least, the hw team writes them twice. */
+       for (j=0; j < 2; j++) {
+               for (i=0, reg=DDI_BUF_TRANS_E; i < ARRAY_SIZE(hsw_ddi_translations_fdi); i++) {
+                       I915_WRITE(reg, hsw_ddi_translations_fdi[i]);
+                       reg += 4;
+               }
+               udelay(20);
        }
 
        /* Configure CPU PLL, wait for warmup */
--

1.7.9.2

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

Signature · 3 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
#84 lore raw

PATCH 34/37 drm/i915: do not use fdi_normal_train on haswell

In reply to Eugeni Dodonov

This should be already configured when FDI auto-negotiation is done.

---
 drivers/gpu/drm/i915/intel_display.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +2 -1
index 8a839be..5f6cb35 100644
@@ -3195,7 +3195,8 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)
 	I915_WRITE(TRANS_VSYNC(pipe),  I915_READ(VSYNC(pipe)));
 	I915_WRITE(TRANS_VSYNCSHIFT(pipe),  I915_READ(VSYNCSHIFT(pipe)));
 
-	intel_fdi_normal_train(crtc);
+	if (!IS_HASWELL(dev))
+		intel_fdi_normal_train(crtc);
 
 	/* For PCH DP, enable TRANS_DP_CTL */
 	if (HAS_PCH_CPT(dev) &&
Signature · 1 line
1.7.9.2
Reviewed-by on v1 34/37
#85 lore raw

Re: [PATCH 34/37] drm/i915: do not use fdi_normal_train on haswell

Quoted 28 lines · Eugeni Dodonov

This should be already configured when FDI auto-negotiation is done.

---
 drivers/gpu/drm/i915/intel_display.c |    3 ++-

 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +2 -1
index 8a839be..5f6cb35 100644
@@ -3195,7 +3195,8 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)
        I915_WRITE(TRANS_VSYNC(pipe),  I915_READ(VSYNC(pipe)));
        I915_WRITE(TRANS_VSYNCSHIFT(pipe),  I915_READ(VSYNCSHIFT(pipe)));
 
-       intel_fdi_normal_train(crtc);
+       if (!IS_HASWELL(dev))
+               intel_fdi_normal_train(crtc);
 
        /* For PCH DP, enable TRANS_DP_CTL */

       if (HAS_PCH_CPT(dev) &&
--
1.7.9.2

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

Signature · 3 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
#86 lore raw

PATCH 35/37 drm/i915: program iCLKIP on Lynx Point

In reply to Eugeni Dodonov

The iCLKIP clock is used to drive the VGA pixel clock on the PCH. In order to do so, it must be programmed to properly do the clock ticks according to the divisor, phase direction, phase increments and a special auxiliary divisor for 20MHz clock.

Those values can be programmed individually, by doing some math; or we could use a pre-defined table of values for each modeset. For speed and simplification, the idea was to just adopt the table of valid pixel clocks and select the matching iCLKIP values from there.

As a possible idea for the future, it would be possible to add a fallback and calculate those values manually in case no match is found. But I don't think we'll encounter a mode not covered by those table, and VGA is pretty much going away in the future anyway.

---
 drivers/gpu/drm/i915/intel_display.c |  309 ++++++++++++++++++++++++++++++++++
 1 file changed, 309 insertions(+)
drivers/gpu/drm/i915/intel_display.c +309 -0
index 5f6cb35..a37e0b7 100644
@@ -2761,6 +2761,312 @@ static const long hsw_ddi_buf_ctl_values[] = {
 	DDI_BUF_EMP_800MV_3_5DB_HSW
 };
 
+/* Available pixel clock values */
+struct iclk_vga_clock {
+	u32 clock;
+	u16 auxdiv;
+	u16 divsel;
+	u16 phasedir;
+	u16 phaseinc;
+};
+
+static const struct iclk_vga_clock iclk_vga_clock_table[] = {
+	{20000,	1,	0x41,	0,	0x20},	/* 20000 ppm=0 */
+	{21000,	0,	0x7E,	0,	0x25},	/* 20999 ppm=-53 */
+	{21912,	0,	0x79,	0,	0x0E},	/* 21912 ppm=12 */
+	{22000,	0,	0x78,	0,	0x2F},	/* 21999 ppm=-58 */
+	{23000,	0,	0x73,	0,	0x19},	/* 23000 ppm=6 */
+	{24000,	0,	0x6E,	0,	0x20},	/* 24000 ppm=0 */
+	{25000,	0,	0x6A,	0,	0x00},	/* 25000 ppm=0 */
+	{25175,	0,	0x69,	0,	0x10},	/* 25175 ppm=-7 */
+	{25200,	0,	0x69,	0,	0x09},	/* 25201 ppm=21 */
+	{26000,	0,	0x66,	1,	0x0A},	/* 26001 ppm=24 */
+	{27000,	0,	0x62,	0,	0x00},	/* 27000 ppm=0 */
+	{27027,	0,	0x62,	1,	0x06},	/* 27025 ppm=-62 */
+	{27500,	0,	0x60,	0,	0x0C},	/* 27498 ppm=-58 */
+	{28000,	0,	0x5E,	0,	0x1B},	/* 28002 ppm=70 */
+	{28320,	0,	0x5D,	0,	0x16},	/* 28319 ppm=-50 */
+	{28322,	0,	0x5D,	0,	0x15},	/* 28323 ppm=44 */
+	{29000,	0,	0x5B,	0,	0x07},	/* 28998 ppm=-64 */
+	{30000,	0,	0x58,	0,	0x00},	/* 30000 ppm=0 */
+	{31000,	0,	0x55,	0,	0x06},	/* 31001 ppm=35 */
+	{31500,	0,	0x54,	1,	0x12},	/* 31498 ppm=-53 */
+	{32000,	0,	0x52,	0,	0x18},	/* 32000 ppm=0 */
+	{32500,	0,	0x51,	0,	0x05},	/* 32500 ppm=-15 */
+	{33000,	0,	0x50,	1,	0x0C},	/* 33002 ppm=70 */
+	{34000,	0,	0x4D,	0,	0x1A},	/* 34002 ppm=70 */
+	{35000,	0,	0x4B,	0,	0x09},	/* 35001 ppm=29 */
+	{35500,	0,	0x4A,	0,	0x04},	/* 35497 ppm=-82 */
+	{36000,	0,	0x49,	0,	0x00},	/* 36000 ppm=0 */
+	{37000,	0,	0x47,	1,	0x02},	/* 37002 ppm=58 */
+	{38000,	0,	0x45,	0,	0x03},	/* 38003 ppm=82 */
+	{39000,	0,	0x43,	0,	0x0F},	/* 38998 ppm=-53 */
+	{40000,	0,	0x41,	0,	0x20},	/* 40000 ppm=0 */
+	{40500,	0,	0x41,	1,	0x15},	/* 40497 ppm=-79 */
+	{40541,	0,	0x41,	1,	0x1A},	/* 40544 ppm=95 */
+	{41000,	0,	0x40,	1,	0x09},	/* 40996 ppm=-87 */
+	{41540,	0,	0x3F,	0,	0x00},	/* 41538 ppm=-38 */
+	{42000,	0,	0x3E,	0,	0x12},	/* 42003 ppm=70 */
+	{43000,	0,	0x3D,	1,	0x0D},	/* 42996 ppm=-99 */
+	{43163,	0,	0x3D,	1,	0x1D},	/* 43168 ppm=108 */
+	{44000,	0,	0x3B,	0,	0x17},	/* 44003 ppm=70 */
+	{44900,	0,	0x3A,	0,	0x09},	/* 44895 ppm=-117 */
+	{45000,	0,	0x3A,	0,	0x00},	/* 45000 ppm=0 */
+	{46000,	0,	0x39,	1,	0x13},	/* 45994 ppm=-128 */
+	{47000,	0,	0x37,	0,	0x1D},	/* 46995 ppm=-110 */
+	{48000,	0,	0x36,	0,	0x10},	/* 48000 ppm=0 */
+	{49000,	0,	0x35,	0,	0x07},	/* 48993 ppm=-134 */
+	{49500,	0,	0x35,	1,	0x1D},	/* 49499 ppm=-27 */
+	{50000,	0,	0x34,	0,	0x00},	/* 50000 ppm=0 */
+	{51000,	0,	0x33,	1,	0x04},	/* 51004 ppm=70 */
+	{52000,	0,	0x32,	1,	0x05},	/* 52001 ppm=24 */
+	{52406,	0,	0x32,	1,	0x1F},	/* 52411 ppm=101 */
+	{53000,	0,	0x31,	1,	0x04},	/* 53006 ppm=116 */
+	{54000,	0,	0x30,	0,	0x00},	/* 54000 ppm=0 */
+	{54054,	0,	0x30,	1,	0x03},	/* 54051 ppm=-62 */
+	{55000,	0,	0x2F,	0,	0x06},	/* 54997 ppm=-58 */
+	{56000,	0,	0x2E,	0,	0x0E},	/* 55995 ppm=-93 */
+	{56250,	0,	0x2E,	0,	0x00},	/* 56250 ppm=0 */
+	{57000,	0,	0x2D,	0,	0x18},	/* 56992 ppm=-139 */
+	{58000,	0,	0x2D,	1,	0x1D},	/* 58006 ppm=105 */
+	{59000,	0,	0x2C,	1,	0x0F},	/* 58996 ppm=-64 */
+	{60000,	0,	0x2B,	0,	0x00},	/* 60000 ppm=0 */
+	{61000,	0,	0x2A,	0,	0x11},	/* 60995 ppm=-76 */
+	{62000,	0,	0x2A,	1,	0x1D},	/* 62002 ppm=35 */
+	{63000,	0,	0x29,	1,	0x09},	/* 62997 ppm=-53 */
+	{64000,	0,	0x28,	0,	0x0C},	/* 64000 ppm=0 */
+	{65000,	0,	0x28,	1,	0x1E},	/* 65011 ppm=174 */
+	{66000,	0,	0x27,	1,	0x06},	/* 66005 ppm=70 */
+	{66667,	0,	0x26,	0,	0x20},	/* 66667 ppm=-5 */
+	{67000,	0,	0x26,	0,	0x13},	/* 67003 ppm=41 */
+	{68000,	0,	0x26,	1,	0x13},	/* 68005 ppm=70 */
+	{68179,	0,	0x26,	1,	0x19},	/* 68166 ppm=-196 */
+	{69000,	0,	0x25,	0,	0x08},	/* 69010 ppm=139 */
+	{70000,	0,	0x25,	1,	0x1B},	/* 69988 ppm=-174 */
+	{71000,	0,	0x24,	0,	0x02},	/* 70994 ppm=-82 */
+	{72000,	0,	0x23,	0,	0x20},	/* 72000 ppm=0 */
+	{73000,	0,	0x23,	1,	0x01},	/* 73004 ppm=53 */
+	{74000,	0,	0x22,	0,	0x1F},	/* 74004 ppm=58 */
+	{74175,	0,	0x22,	0,	0x1A},	/* 74163 ppm=-161 */
+	{74250,	0,	0x22,	0,	0x17},	/* 74259 ppm=118 */
+	{74481,	0,	0x22,	0,	0x10},	/* 74483 ppm=24 */
+	{75000,	0,	0x22,	0,	0x00},	/* 75000 ppm=0 */
+	{76000,	0,	0x22,	1,	0x1E},	/* 75989 ppm=-139 */
+	{77000,	0,	0x21,	0,	0x04},	/* 77005 ppm=70 */
+	{78000,	0,	0x21,	1,	0x19},	/* 78014 ppm=174 */
+	{78750,	0,	0x20,	0,	0x12},	/* 78760 ppm=131 */
+	{79000,	0,	0x20,	0,	0x0B},	/* 79012 ppm=157 */
+	{80000,	0,	0x20,	1,	0x10},	/* 80000 ppm=0 */
+	{81000,	0,	0x1F,	0,	0x15},	/* 81013 ppm=157 */
+	{81081,	0,	0x1F,	0,	0x13},	/* 81089 ppm=95 */
+	{81624,	0,	0x1F,	0,	0x05},	/* 81625 ppm=12 */
+	{82000,	0,	0x1F,	1,	0x05},	/* 82012 ppm=151 */
+	{83000,	0,	0x1F,	1,	0x1E},	/* 82997 ppm=-35 */
+	{83950,	0,	0x1E,	0,	0x0A},	/* 83965 ppm=179 */
+	{84000,	0,	0x1E,	0,	0x09},	/* 84006 ppm=70 */
+	{85000,	0,	0x1E,	1,	0x0F},	/* 84998 ppm=-29 */
+	{86000,	0,	0x1D,	0,	0x19},	/* 86013 ppm=151 */
+	{87000,	0,	0x1D,	0,	0x02},	/* 87009 ppm=105 */
+	{88000,	0,	0x1D,	1,	0x14},	/* 87984 ppm=-186 */
+	{89000,	0,	0x1C,	0,	0x16},	/* 88980 ppm=-220 */
+	{90000,	0,	0x1C,	0,	0x00},	/* 90000 ppm=0 */
+	{91000,	0,	0x1C,	1,	0x15},	/* 90995 ppm=-53 */
+	{92000,	0,	0x1B,	0,	0x16},	/* 92013 ppm=139 */
+	{93000,	0,	0x1B,	0,	0x02},	/* 93003 ppm=35 */
+	{94000,	0,	0x1B,	1,	0x12},	/* 94015 ppm=163 */
+	{94500,	0,	0x1B,	1,	0x1B},	/* 94478 ppm=-235 */
+	{95000,	0,	0x1A,	0,	0x1B},	/* 94997 ppm=-29 */
+	{95654,	0,	0x1A,	0,	0x0F},	/* 95628 ppm=-271 */
+	{96000,	0,	0x1A,	0,	0x08},	/* 96000 ppm=0 */
+	{97000,	0,	0x1A,	1,	0x0B},	/* 97024 ppm=249 */
+	{98000,	0,	0x1A,	1,	0x1D},	/* 98015 ppm=151 */
+	{99000,	0,	0x19,	0,	0x11},	/* 99026 ppm=261 */
+	{100000,	0,	0x19,	0,	0x00},	/* 100000 ppm=0 */
+	{101000,	0,	0x19,	1,	0x11},	/* 100994 ppm=-64 */
+	{102000,	0,	0x18,	0,	0x1E},	/* 102007 ppm=70 */
+	{103000,	0,	0x18,	0,	0x0E},	/* 102980 ppm=-197 */
+	{104000,	0,	0x18,	1,	0x02},	/* 103971 ppm=-278 */
+	{105000,	0,	0x18,	1,	0x12},	/* 104982 ppm=-174 */
+	{106000,	0,	0x17,	0,	0x1E},	/* 106012 ppm=116 */
+	{107000,	0,	0x17,	0,	0x0F},	/* 106997 ppm=-29 */
+	{107214,	0,	0x17,	0,	0x0C},	/* 107196 ppm=-168 */
+	{108000,	0,	0x17,	0,	0x00},	/* 108000 ppm=0 */
+	{109000,	0,	0x17,	1,	0x0F},	/* 109022 ppm=203 */
+	{110000,	0,	0x17,	1,	0x1D},	/* 109994 ppm=-58 */
+	{110013,	0,	0x17,	1,	0x1D},	/* 109994 ppm=-177 */
+	{111000,	0,	0x16,	0,	0x15},	/* 110983 ppm=-157 */
+	{111263,	0,	0x16,	0,	0x11},	/* 111269 ppm=55 */
+	{111375,	0,	0x16,	0,	0x10},	/* 111340 ppm=-313 */
+	{112000,	0,	0x16,	0,	0x07},	/* 111990 ppm=-93 */
+	{113000,	0,	0x16,	1,	0x07},	/* 113015 ppm=134 */
+	{113309,	0,	0x16,	1,	0x0B},	/* 113311 ppm=22 */
+	{113100,	0,	0x16,	1,	0x08},	/* 113089 ppm=-98 */
+	{114000,	0,	0x16,	1,	0x14},	/* 113984 ppm=-139 */
+	{115000,	0,	0x15,	0,	0x1F},	/* 114970 ppm=-261 */
+	{116000,	0,	0x15,	0,	0x12},	/* 115973 ppm=-232 */
+	{117000,	0,	0x15,	0,	0x05},	/* 116994 ppm=-53 */
+	{118000,	0,	0x15,	1,	0x08},	/* 118033 ppm=278 */
+	{119000,	0,	0x15,	1,	0x14},	/* 119008 ppm=70 */
+	{119651,	0,	0x15,	1,	0x1C},	/* 119668 ppm=139 */
+	{120000,	0,	0x14,	0,	0x20},	/* 120000 ppm=0 */
+	{121000,	0,	0x14,	0,	0x14},	/* 121008 ppm=70 */
+	{122000,	0,	0x14,	0,	0x08},	/* 122034 ppm=278 */
+	{122614,	0,	0x14,	0,	0x01},	/* 122640 ppm=214 */
+	{123000,	0,	0x14,	1,	0x03},	/* 122989 ppm=-87 */
+	{123379,	0,	0x14,	1,	0x07},	/* 123340 ppm=-313 */
+	{124000,	0,	0x14,	1,	0x0E},	/* 123960 ppm=-324 */
+	{125000,	0,	0x14,	1,	0x1A},	/* 125036 ppm=290 */
+	{126000,	0,	0x13,	0,	0x1B},	/* 126039 ppm=313 */
+	{127000,	0,	0x13,	0,	0x11},	/* 126965 ppm=-272 */
+	{128000,	0,	0x13,	0,	0x06},	/* 128000 ppm=0 */
+	{129000,	0,	0x13,	1,	0x04},	/* 128955 ppm=-348 */
+	{129859,	0,	0x13,	1,	0x0D},	/* 129827 ppm=-245 */
+	{130000,	0,	0x13,	1,	0x0F},	/* 130023 ppm=174 */
+	{131000,	0,	0x13,	1,	0x19},	/* 131008 ppm=64 */
+	{131850,	0,	0x12,	0,	0x1F},	/* 131808 ppm=-321 */
+	{132000,	0,	0x12,	0,	0x1D},	/* 132009 ppm=70 */
+	{133000,	0,	0x12,	0,	0x13},	/* 133025 ppm=192 */
+	{133330,	0,	0x12,	0,	0x10},	/* 133333 ppm=26 */
+	{134000,	0,	0x12,	0,	0x0A},	/* 133953 ppm=-348 */
+	{135000,	0,	0x12,	0,	0x00},	/* 135000 ppm=0 */
+	{136000,	0,	0x12,	1,	0x09},	/* 135956 ppm=-324 */
+	{137000,	0,	0x12,	1,	0x13},	/* 137034 ppm=249 */
+	{138000,	0,	0x12,	1,	0x1C},	/* 138019 ppm=139 */
+	{139000,	0,	0x11,	0,	0x1B},	/* 139019 ppm=134 */
+	{139050,	0,	0x11,	0,	0x1B},	/* 139019 ppm=-227 */
+	{139054,	0,	0x11,	0,	0x1B},	/* 139019 ppm=-256 */
+	{140000,	0,	0x11,	0,	0x12},	/* 140032 ppm=232 */
+	{141000,	0,	0x11,	0,	0x0A},	/* 140946 ppm=-382 */
+	{142000,	0,	0x11,	0,	0x01},	/* 141988 ppm=-82 */
+	{143000,	0,	0x11,	1,	0x08},	/* 143046 ppm=325 */
+	{143472,	0,	0x11,	1,	0x0C},	/* 143522 ppm=346 */
+	{144000,	0,	0x11,	1,	0x10},	/* 144000 ppm=0 */
+	{145000,	0,	0x11,	1,	0x18},	/* 144966 ppm=-232 */
+	{146000,	0,	0x10,	0,	0x20},	/* 145946 ppm=-371 */
+	{147000,	0,	0x10,	0,	0x18},	/* 146939 ppm=-417 */
+	{147891,	0,	0x10,	0,	0x10},	/* 147945 ppm=367 */
+	{148000,	0,	0x10,	0,	0x10},	/* 147945 ppm=-371 */
+	{148350,	0,	0x10,	0,	0x0D},	/* 148326 ppm=-161 */
+	{148500,	0,	0x10,	0,	0x0C},	/* 148454 ppm=-313 */
+	{149000,	0,	0x10,	0,	0x08},	/* 148966 ppm=-232 */
+	{150000,	0,	0x10,	0,	0x00},	/* 150000 ppm=0 */
+	{151000,	0,	0x10,	1,	0x08},	/* 151049 ppm=325 */
+	{152000,	0,	0x10,	1,	0x0F},	/* 151979 ppm=-139 */
+	{152280,	0,	0x10,	1,	0x11},	/* 152247 ppm=-219 */
+	{153000,	0,	0x10,	1,	0x17},	/* 153056 ppm=365 */
+	{154000,	0,	0x10,	1,	0x1E},	/* 154011 ppm=70 */
+	{155000,	0,	0x0F,	0,	0x1B},	/* 154978 ppm=-145 */
+	{156000,	0,	0x0F,	0,	0x14},	/* 155957 ppm=-278 */
+	{157000,	0,	0x0F,	0,	0x0D},	/* 156948 ppm=-330 */
+	{157500,	0,	0x0F,	0,	0x09},	/* 157521 ppm=131 */
+	{158000,	0,	0x0F,	0,	0x06},	/* 157952 ppm=-301 */
+	{159000,	0,	0x0F,	1,	0x01},	/* 158970 ppm=-191 */
+	{160000,	0,	0x0F,	1,	0x08},	/* 160000 ppm=0 */
+	{161000,	0,	0x0F,	1,	0x0F},	/* 161044 ppm=273 */
+	{162000,	0,	0x0F,	1,	0x15},	/* 161949 ppm=-313 */
+	{163000,	0,	0x0F,	1,	0x1C},	/* 163019 ppm=116 */
+	{164000,	0,	0x0E,	0,	0x1E},	/* 163947 ppm=-324 */
+	{165000,	0,	0x0E,	0,	0x17},	/* 165043 ppm=261 */
+	{166000,	0,	0x0E,	0,	0x11},	/* 165994 ppm=-35 */
+	{167000,	0,	0x0E,	0,	0x0B},	/* 166957 ppm=-261 */
+	{168000,	0,	0x0E,	0,	0x05},	/* 167930 ppm=-417 */
+	{169000,	0,	0x0E,	1,	0x02},	/* 169080 ppm=475 */
+	{169128,	0,	0x0E,	1,	0x02},	/* 169080 ppm=-283 */
+	{170000,	0,	0x0E,	1,	0x08},	/* 170079 ppm=464 */
+	{171000,	0,	0x0E,	1,	0x0D},	/* 170920 ppm=-469 */
+	{172000,	0,	0x0E,	1,	0x13},	/* 171940 ppm=-348 */
+	{172800,	0,	0x0E,	1,	0x18},	/* 172800 ppm=0 */
+	{173000,	0,	0x0E,	1,	0x19},	/* 172973 ppm=-157 */
+	{174000,	0,	0x0E,	1,	0x1F},	/* 174018 ppm=105 */
+	{174787,	0,	0x0D,	0,	0x1D},	/* 174722 ppm=-373 */
+	{175000,	0,	0x0D,	0,	0x1B},	/* 175076 ppm=435 */
+	{175500,	0,	0x0D,	0,	0x19},	/* 175431 ppm=-391 */
+	{176000,	0,	0x0D,	0,	0x16},	/* 175967 ppm=-186 */
+	{177000,	0,	0x0D,	0,	0x10},	/* 177049 ppm=278 */
+	{178000,	0,	0x0D,	0,	0x0B},	/* 177961 ppm=-220 */
+	{179000,	0,	0x0D,	0,	0x05},	/* 179067 ppm=377 */
+	{180000,	0,	0x0D,	0,	0x00},	/* 180000 ppm=0 */
+};
+
+/* Program iCLKIP clock to the desired frequency */
+static void lpt_program_iclkip(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	u32 auxdiv=0, divsel=0, phasedir=0, phaseinc=0, valid=0;
+	u32 temp, i;
+
+	/* Ungate pixel clock */
+	I915_WRITE(PIXCLK_GATE, PIXCLK_GATE_GATE);
+
+	/* Disable SSCCTL */
+	SBI_WRITE(dev_priv, SBI_SSCCTL6,
+				SBI_READ(dev_priv, SBI_SSCCTL6) |
+					SBI_SSCCTL_DISABLE);
+
+	/* Calculating clock values for iCLKIP */
+	for (i=0; i < ARRAY_SIZE(iclk_vga_clock_table); i++) {
+		if (crtc->mode.clock == iclk_vga_clock_table[i].clock) {
+			DRM_INFO("Found clock settings for %dKHz refresh rate\n",
+					crtc->mode.clock);
+
+			auxdiv = iclk_vga_clock_table[i].auxdiv;
+			divsel = iclk_vga_clock_table[i].divsel;
+			phasedir = iclk_vga_clock_table[i].phasedir;
+			phaseinc = iclk_vga_clock_table[i].phaseinc;
+
+			valid = 1;
+
+			break;
+		}
+	}
+
+	if (!valid) {
+		DRM_ERROR("Unable to find iCLKIP clock settings for %dKHz refresh rate\n",
+				crtc->mode.clock);
+		return;
+	}
+
+	/* Program SSCDIVINTPHASE6 with values which HW team uses */
+	DRM_DEBUG("Programming SSCDIVINTPHASE for %dKHz: auxdiv=%x, divsel=%x, phasedir=%x, phaseinc=%x\n",
+			crtc->mode.clock,
+			auxdiv,
+			divsel,
+			phasedir,
+			phaseinc);
+
+	/* Program SSCDIVINTPHASE6 */
+	temp = SBI_READ(dev_priv, SBI_SSCDIVINTPHASE6);
+	temp &= ~SBI_SSCDIVINTPHASE_DIVSEL_MASK;
+	temp |= SBI_SSCDIVINTPHASE_DIVSEL(divsel);
+	temp &= ~SBI_SSCDIVINTPHASE_INCVAL_MASK;
+	temp |= SBI_SSCDIVINTPHASE_INCVAL(phaseinc);
+	temp |= SBI_SSCDIVINTPHASE_DIR(phasedir);
+	temp |= SBI_SSCDIVINTPHASE_PROPAGATE;
+
+	SBI_WRITE(dev_priv,
+			SBI_SSCDIVINTPHASE6,
+			temp);
+
+	/* Program SSCAUXDIV */
+	SBI_WRITE(dev_priv,
+			SBI_SSCAUXDIV6,
+				SBI_READ(dev_priv, SBI_SSCAUXDIV6) |
+					SBI_SSCAUXDIV_FINALDIV2SEL(auxdiv));
+
+
+	/* Enable modulator and associated divider */
+	SBI_WRITE(dev_priv, SBI_SSCCTL6,
+				SBI_READ(dev_priv, SBI_SSCCTL6) &
+					~SBI_SSCCTL_DISABLE);
+
+	/* Wait for initialization time */
+	udelay(50);
+
+	/* Gate pixel clock */
+	I915_WRITE(PIXCLK_GATE, PIXCLK_GATE_UNGATE);
+}
+
 
 /* Link training for HSW parts */
 static void hsw_fdi_link_train(struct drm_crtc *crtc)
@@ -3182,6 +3488,9 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)
 		/* DDIE clock is recommented for FDI connections */
 		I915_WRITE(PIPE_CLK_SEL(pipe),
 				PIPE_CLK_SEL_DDIE);
+
+		/* Program iCLKIP */
+		lpt_program_iclkip(crtc);
 	}
 
 	/* set transcoder timing, panel must allow it */
Signature · 1 line
1.7.9.2
#87 lore raw

Re: [PATCH 35/37] drm/i915: program iCLKIP on Lynx Point

Quoted 10 lines · Eugeni Dodonov

The iCLKIP clock is used to drive the VGA pixel clock on the PCH. In order to do so, it must be programmed to properly do the clock ticks according to the divisor, phase direction, phase increments and a special auxiliary divisor for 20MHz clock.

Those values can be programmed individually, by doing some math; or we could use a pre-defined table of values for each modeset. For speed and simplification, the idea was to just adopt the table of valid pixel clocks and select the matching iCLKIP values from there.

Quoted 6 lines

As a possible idea for the future, it would be possible to add a fallback and calculate those values manually in case no match is found. But I don't think we'll encounter a mode not covered by those table, and VGA is pretty much going away in the future anyway.

With stuff like this, intel_display.c has definitely grown into the unmanageable territory. Along Jesse's suggestion I think it would make sense to split out the pch and gmch modeset stuff into separate files (and leave all the other things like initialization, clock gating watermark functions, pageflip, cursors, power crap and what not else in intel_display.c). We could call these new files intel_pch_modeset.c and intel_gmch_modeset.c, they'd contain the respective crtc_mode_set function plus all associated support code.

I'll leave this to you and Jesse to decide whether it makes sense as proposed and when you want to move the code. But I think we need to slaugther this dragon and cut it into more manageable pieces now.

Jesse?

Yours, Daniel

Quoted 338 lines
---
 drivers/gpu/drm/i915/intel_display.c |  309 ++++++++++++++++++++++++++++++++++
 1 file changed, 309 insertions(+)
drivers/gpu/drm/i915/intel_display.c +309 -0
index 5f6cb35..a37e0b7 100644
@@ -2761,6 +2761,312 @@ static const long hsw_ddi_buf_ctl_values[] = {
 	DDI_BUF_EMP_800MV_3_5DB_HSW
 };
 
+/* Available pixel clock values */
+struct iclk_vga_clock {
+	u32 clock;
+	u16 auxdiv;
+	u16 divsel;
+	u16 phasedir;
+	u16 phaseinc;
+};
+
+static const struct iclk_vga_clock iclk_vga_clock_table[] = {
+	{20000,	1,	0x41,	0,	0x20},	/* 20000 ppm=0 */
+	{21000,	0,	0x7E,	0,	0x25},	/* 20999 ppm=-53 */
+	{21912,	0,	0x79,	0,	0x0E},	/* 21912 ppm=12 */
+	{22000,	0,	0x78,	0,	0x2F},	/* 21999 ppm=-58 */
+	{23000,	0,	0x73,	0,	0x19},	/* 23000 ppm=6 */
+	{24000,	0,	0x6E,	0,	0x20},	/* 24000 ppm=0 */
+	{25000,	0,	0x6A,	0,	0x00},	/* 25000 ppm=0 */
+	{25175,	0,	0x69,	0,	0x10},	/* 25175 ppm=-7 */
+	{25200,	0,	0x69,	0,	0x09},	/* 25201 ppm=21 */
+	{26000,	0,	0x66,	1,	0x0A},	/* 26001 ppm=24 */
+	{27000,	0,	0x62,	0,	0x00},	/* 27000 ppm=0 */
+	{27027,	0,	0x62,	1,	0x06},	/* 27025 ppm=-62 */
+	{27500,	0,	0x60,	0,	0x0C},	/* 27498 ppm=-58 */
+	{28000,	0,	0x5E,	0,	0x1B},	/* 28002 ppm=70 */
+	{28320,	0,	0x5D,	0,	0x16},	/* 28319 ppm=-50 */
+	{28322,	0,	0x5D,	0,	0x15},	/* 28323 ppm=44 */
+	{29000,	0,	0x5B,	0,	0x07},	/* 28998 ppm=-64 */
+	{30000,	0,	0x58,	0,	0x00},	/* 30000 ppm=0 */
+	{31000,	0,	0x55,	0,	0x06},	/* 31001 ppm=35 */
+	{31500,	0,	0x54,	1,	0x12},	/* 31498 ppm=-53 */
+	{32000,	0,	0x52,	0,	0x18},	/* 32000 ppm=0 */
+	{32500,	0,	0x51,	0,	0x05},	/* 32500 ppm=-15 */
+	{33000,	0,	0x50,	1,	0x0C},	/* 33002 ppm=70 */
+	{34000,	0,	0x4D,	0,	0x1A},	/* 34002 ppm=70 */
+	{35000,	0,	0x4B,	0,	0x09},	/* 35001 ppm=29 */
+	{35500,	0,	0x4A,	0,	0x04},	/* 35497 ppm=-82 */
+	{36000,	0,	0x49,	0,	0x00},	/* 36000 ppm=0 */
+	{37000,	0,	0x47,	1,	0x02},	/* 37002 ppm=58 */
+	{38000,	0,	0x45,	0,	0x03},	/* 38003 ppm=82 */
+	{39000,	0,	0x43,	0,	0x0F},	/* 38998 ppm=-53 */
+	{40000,	0,	0x41,	0,	0x20},	/* 40000 ppm=0 */
+	{40500,	0,	0x41,	1,	0x15},	/* 40497 ppm=-79 */
+	{40541,	0,	0x41,	1,	0x1A},	/* 40544 ppm=95 */
+	{41000,	0,	0x40,	1,	0x09},	/* 40996 ppm=-87 */
+	{41540,	0,	0x3F,	0,	0x00},	/* 41538 ppm=-38 */
+	{42000,	0,	0x3E,	0,	0x12},	/* 42003 ppm=70 */
+	{43000,	0,	0x3D,	1,	0x0D},	/* 42996 ppm=-99 */
+	{43163,	0,	0x3D,	1,	0x1D},	/* 43168 ppm=108 */
+	{44000,	0,	0x3B,	0,	0x17},	/* 44003 ppm=70 */
+	{44900,	0,	0x3A,	0,	0x09},	/* 44895 ppm=-117 */
+	{45000,	0,	0x3A,	0,	0x00},	/* 45000 ppm=0 */
+	{46000,	0,	0x39,	1,	0x13},	/* 45994 ppm=-128 */
+	{47000,	0,	0x37,	0,	0x1D},	/* 46995 ppm=-110 */
+	{48000,	0,	0x36,	0,	0x10},	/* 48000 ppm=0 */
+	{49000,	0,	0x35,	0,	0x07},	/* 48993 ppm=-134 */
+	{49500,	0,	0x35,	1,	0x1D},	/* 49499 ppm=-27 */
+	{50000,	0,	0x34,	0,	0x00},	/* 50000 ppm=0 */
+	{51000,	0,	0x33,	1,	0x04},	/* 51004 ppm=70 */
+	{52000,	0,	0x32,	1,	0x05},	/* 52001 ppm=24 */
+	{52406,	0,	0x32,	1,	0x1F},	/* 52411 ppm=101 */
+	{53000,	0,	0x31,	1,	0x04},	/* 53006 ppm=116 */
+	{54000,	0,	0x30,	0,	0x00},	/* 54000 ppm=0 */
+	{54054,	0,	0x30,	1,	0x03},	/* 54051 ppm=-62 */
+	{55000,	0,	0x2F,	0,	0x06},	/* 54997 ppm=-58 */
+	{56000,	0,	0x2E,	0,	0x0E},	/* 55995 ppm=-93 */
+	{56250,	0,	0x2E,	0,	0x00},	/* 56250 ppm=0 */
+	{57000,	0,	0x2D,	0,	0x18},	/* 56992 ppm=-139 */
+	{58000,	0,	0x2D,	1,	0x1D},	/* 58006 ppm=105 */
+	{59000,	0,	0x2C,	1,	0x0F},	/* 58996 ppm=-64 */
+	{60000,	0,	0x2B,	0,	0x00},	/* 60000 ppm=0 */
+	{61000,	0,	0x2A,	0,	0x11},	/* 60995 ppm=-76 */
+	{62000,	0,	0x2A,	1,	0x1D},	/* 62002 ppm=35 */
+	{63000,	0,	0x29,	1,	0x09},	/* 62997 ppm=-53 */
+	{64000,	0,	0x28,	0,	0x0C},	/* 64000 ppm=0 */
+	{65000,	0,	0x28,	1,	0x1E},	/* 65011 ppm=174 */
+	{66000,	0,	0x27,	1,	0x06},	/* 66005 ppm=70 */
+	{66667,	0,	0x26,	0,	0x20},	/* 66667 ppm=-5 */
+	{67000,	0,	0x26,	0,	0x13},	/* 67003 ppm=41 */
+	{68000,	0,	0x26,	1,	0x13},	/* 68005 ppm=70 */
+	{68179,	0,	0x26,	1,	0x19},	/* 68166 ppm=-196 */
+	{69000,	0,	0x25,	0,	0x08},	/* 69010 ppm=139 */
+	{70000,	0,	0x25,	1,	0x1B},	/* 69988 ppm=-174 */
+	{71000,	0,	0x24,	0,	0x02},	/* 70994 ppm=-82 */
+	{72000,	0,	0x23,	0,	0x20},	/* 72000 ppm=0 */
+	{73000,	0,	0x23,	1,	0x01},	/* 73004 ppm=53 */
+	{74000,	0,	0x22,	0,	0x1F},	/* 74004 ppm=58 */
+	{74175,	0,	0x22,	0,	0x1A},	/* 74163 ppm=-161 */
+	{74250,	0,	0x22,	0,	0x17},	/* 74259 ppm=118 */
+	{74481,	0,	0x22,	0,	0x10},	/* 74483 ppm=24 */
+	{75000,	0,	0x22,	0,	0x00},	/* 75000 ppm=0 */
+	{76000,	0,	0x22,	1,	0x1E},	/* 75989 ppm=-139 */
+	{77000,	0,	0x21,	0,	0x04},	/* 77005 ppm=70 */
+	{78000,	0,	0x21,	1,	0x19},	/* 78014 ppm=174 */
+	{78750,	0,	0x20,	0,	0x12},	/* 78760 ppm=131 */
+	{79000,	0,	0x20,	0,	0x0B},	/* 79012 ppm=157 */
+	{80000,	0,	0x20,	1,	0x10},	/* 80000 ppm=0 */
+	{81000,	0,	0x1F,	0,	0x15},	/* 81013 ppm=157 */
+	{81081,	0,	0x1F,	0,	0x13},	/* 81089 ppm=95 */
+	{81624,	0,	0x1F,	0,	0x05},	/* 81625 ppm=12 */
+	{82000,	0,	0x1F,	1,	0x05},	/* 82012 ppm=151 */
+	{83000,	0,	0x1F,	1,	0x1E},	/* 82997 ppm=-35 */
+	{83950,	0,	0x1E,	0,	0x0A},	/* 83965 ppm=179 */
+	{84000,	0,	0x1E,	0,	0x09},	/* 84006 ppm=70 */
+	{85000,	0,	0x1E,	1,	0x0F},	/* 84998 ppm=-29 */
+	{86000,	0,	0x1D,	0,	0x19},	/* 86013 ppm=151 */
+	{87000,	0,	0x1D,	0,	0x02},	/* 87009 ppm=105 */
+	{88000,	0,	0x1D,	1,	0x14},	/* 87984 ppm=-186 */
+	{89000,	0,	0x1C,	0,	0x16},	/* 88980 ppm=-220 */
+	{90000,	0,	0x1C,	0,	0x00},	/* 90000 ppm=0 */
+	{91000,	0,	0x1C,	1,	0x15},	/* 90995 ppm=-53 */
+	{92000,	0,	0x1B,	0,	0x16},	/* 92013 ppm=139 */
+	{93000,	0,	0x1B,	0,	0x02},	/* 93003 ppm=35 */
+	{94000,	0,	0x1B,	1,	0x12},	/* 94015 ppm=163 */
+	{94500,	0,	0x1B,	1,	0x1B},	/* 94478 ppm=-235 */
+	{95000,	0,	0x1A,	0,	0x1B},	/* 94997 ppm=-29 */
+	{95654,	0,	0x1A,	0,	0x0F},	/* 95628 ppm=-271 */
+	{96000,	0,	0x1A,	0,	0x08},	/* 96000 ppm=0 */
+	{97000,	0,	0x1A,	1,	0x0B},	/* 97024 ppm=249 */
+	{98000,	0,	0x1A,	1,	0x1D},	/* 98015 ppm=151 */
+	{99000,	0,	0x19,	0,	0x11},	/* 99026 ppm=261 */
+	{100000,	0,	0x19,	0,	0x00},	/* 100000 ppm=0 */
+	{101000,	0,	0x19,	1,	0x11},	/* 100994 ppm=-64 */
+	{102000,	0,	0x18,	0,	0x1E},	/* 102007 ppm=70 */
+	{103000,	0,	0x18,	0,	0x0E},	/* 102980 ppm=-197 */
+	{104000,	0,	0x18,	1,	0x02},	/* 103971 ppm=-278 */
+	{105000,	0,	0x18,	1,	0x12},	/* 104982 ppm=-174 */
+	{106000,	0,	0x17,	0,	0x1E},	/* 106012 ppm=116 */
+	{107000,	0,	0x17,	0,	0x0F},	/* 106997 ppm=-29 */
+	{107214,	0,	0x17,	0,	0x0C},	/* 107196 ppm=-168 */
+	{108000,	0,	0x17,	0,	0x00},	/* 108000 ppm=0 */
+	{109000,	0,	0x17,	1,	0x0F},	/* 109022 ppm=203 */
+	{110000,	0,	0x17,	1,	0x1D},	/* 109994 ppm=-58 */
+	{110013,	0,	0x17,	1,	0x1D},	/* 109994 ppm=-177 */
+	{111000,	0,	0x16,	0,	0x15},	/* 110983 ppm=-157 */
+	{111263,	0,	0x16,	0,	0x11},	/* 111269 ppm=55 */
+	{111375,	0,	0x16,	0,	0x10},	/* 111340 ppm=-313 */
+	{112000,	0,	0x16,	0,	0x07},	/* 111990 ppm=-93 */
+	{113000,	0,	0x16,	1,	0x07},	/* 113015 ppm=134 */
+	{113309,	0,	0x16,	1,	0x0B},	/* 113311 ppm=22 */
+	{113100,	0,	0x16,	1,	0x08},	/* 113089 ppm=-98 */
+	{114000,	0,	0x16,	1,	0x14},	/* 113984 ppm=-139 */
+	{115000,	0,	0x15,	0,	0x1F},	/* 114970 ppm=-261 */
+	{116000,	0,	0x15,	0,	0x12},	/* 115973 ppm=-232 */
+	{117000,	0,	0x15,	0,	0x05},	/* 116994 ppm=-53 */
+	{118000,	0,	0x15,	1,	0x08},	/* 118033 ppm=278 */
+	{119000,	0,	0x15,	1,	0x14},	/* 119008 ppm=70 */
+	{119651,	0,	0x15,	1,	0x1C},	/* 119668 ppm=139 */
+	{120000,	0,	0x14,	0,	0x20},	/* 120000 ppm=0 */
+	{121000,	0,	0x14,	0,	0x14},	/* 121008 ppm=70 */
+	{122000,	0,	0x14,	0,	0x08},	/* 122034 ppm=278 */
+	{122614,	0,	0x14,	0,	0x01},	/* 122640 ppm=214 */
+	{123000,	0,	0x14,	1,	0x03},	/* 122989 ppm=-87 */
+	{123379,	0,	0x14,	1,	0x07},	/* 123340 ppm=-313 */
+	{124000,	0,	0x14,	1,	0x0E},	/* 123960 ppm=-324 */
+	{125000,	0,	0x14,	1,	0x1A},	/* 125036 ppm=290 */
+	{126000,	0,	0x13,	0,	0x1B},	/* 126039 ppm=313 */
+	{127000,	0,	0x13,	0,	0x11},	/* 126965 ppm=-272 */
+	{128000,	0,	0x13,	0,	0x06},	/* 128000 ppm=0 */
+	{129000,	0,	0x13,	1,	0x04},	/* 128955 ppm=-348 */
+	{129859,	0,	0x13,	1,	0x0D},	/* 129827 ppm=-245 */
+	{130000,	0,	0x13,	1,	0x0F},	/* 130023 ppm=174 */
+	{131000,	0,	0x13,	1,	0x19},	/* 131008 ppm=64 */
+	{131850,	0,	0x12,	0,	0x1F},	/* 131808 ppm=-321 */
+	{132000,	0,	0x12,	0,	0x1D},	/* 132009 ppm=70 */
+	{133000,	0,	0x12,	0,	0x13},	/* 133025 ppm=192 */
+	{133330,	0,	0x12,	0,	0x10},	/* 133333 ppm=26 */
+	{134000,	0,	0x12,	0,	0x0A},	/* 133953 ppm=-348 */
+	{135000,	0,	0x12,	0,	0x00},	/* 135000 ppm=0 */
+	{136000,	0,	0x12,	1,	0x09},	/* 135956 ppm=-324 */
+	{137000,	0,	0x12,	1,	0x13},	/* 137034 ppm=249 */
+	{138000,	0,	0x12,	1,	0x1C},	/* 138019 ppm=139 */
+	{139000,	0,	0x11,	0,	0x1B},	/* 139019 ppm=134 */
+	{139050,	0,	0x11,	0,	0x1B},	/* 139019 ppm=-227 */
+	{139054,	0,	0x11,	0,	0x1B},	/* 139019 ppm=-256 */
+	{140000,	0,	0x11,	0,	0x12},	/* 140032 ppm=232 */
+	{141000,	0,	0x11,	0,	0x0A},	/* 140946 ppm=-382 */
+	{142000,	0,	0x11,	0,	0x01},	/* 141988 ppm=-82 */
+	{143000,	0,	0x11,	1,	0x08},	/* 143046 ppm=325 */
+	{143472,	0,	0x11,	1,	0x0C},	/* 143522 ppm=346 */
+	{144000,	0,	0x11,	1,	0x10},	/* 144000 ppm=0 */
+	{145000,	0,	0x11,	1,	0x18},	/* 144966 ppm=-232 */
+	{146000,	0,	0x10,	0,	0x20},	/* 145946 ppm=-371 */
+	{147000,	0,	0x10,	0,	0x18},	/* 146939 ppm=-417 */
+	{147891,	0,	0x10,	0,	0x10},	/* 147945 ppm=367 */
+	{148000,	0,	0x10,	0,	0x10},	/* 147945 ppm=-371 */
+	{148350,	0,	0x10,	0,	0x0D},	/* 148326 ppm=-161 */
+	{148500,	0,	0x10,	0,	0x0C},	/* 148454 ppm=-313 */
+	{149000,	0,	0x10,	0,	0x08},	/* 148966 ppm=-232 */
+	{150000,	0,	0x10,	0,	0x00},	/* 150000 ppm=0 */
+	{151000,	0,	0x10,	1,	0x08},	/* 151049 ppm=325 */
+	{152000,	0,	0x10,	1,	0x0F},	/* 151979 ppm=-139 */
+	{152280,	0,	0x10,	1,	0x11},	/* 152247 ppm=-219 */
+	{153000,	0,	0x10,	1,	0x17},	/* 153056 ppm=365 */
+	{154000,	0,	0x10,	1,	0x1E},	/* 154011 ppm=70 */
+	{155000,	0,	0x0F,	0,	0x1B},	/* 154978 ppm=-145 */
+	{156000,	0,	0x0F,	0,	0x14},	/* 155957 ppm=-278 */
+	{157000,	0,	0x0F,	0,	0x0D},	/* 156948 ppm=-330 */
+	{157500,	0,	0x0F,	0,	0x09},	/* 157521 ppm=131 */
+	{158000,	0,	0x0F,	0,	0x06},	/* 157952 ppm=-301 */
+	{159000,	0,	0x0F,	1,	0x01},	/* 158970 ppm=-191 */
+	{160000,	0,	0x0F,	1,	0x08},	/* 160000 ppm=0 */
+	{161000,	0,	0x0F,	1,	0x0F},	/* 161044 ppm=273 */
+	{162000,	0,	0x0F,	1,	0x15},	/* 161949 ppm=-313 */
+	{163000,	0,	0x0F,	1,	0x1C},	/* 163019 ppm=116 */
+	{164000,	0,	0x0E,	0,	0x1E},	/* 163947 ppm=-324 */
+	{165000,	0,	0x0E,	0,	0x17},	/* 165043 ppm=261 */
+	{166000,	0,	0x0E,	0,	0x11},	/* 165994 ppm=-35 */
+	{167000,	0,	0x0E,	0,	0x0B},	/* 166957 ppm=-261 */
+	{168000,	0,	0x0E,	0,	0x05},	/* 167930 ppm=-417 */
+	{169000,	0,	0x0E,	1,	0x02},	/* 169080 ppm=475 */
+	{169128,	0,	0x0E,	1,	0x02},	/* 169080 ppm=-283 */
+	{170000,	0,	0x0E,	1,	0x08},	/* 170079 ppm=464 */
+	{171000,	0,	0x0E,	1,	0x0D},	/* 170920 ppm=-469 */
+	{172000,	0,	0x0E,	1,	0x13},	/* 171940 ppm=-348 */
+	{172800,	0,	0x0E,	1,	0x18},	/* 172800 ppm=0 */
+	{173000,	0,	0x0E,	1,	0x19},	/* 172973 ppm=-157 */
+	{174000,	0,	0x0E,	1,	0x1F},	/* 174018 ppm=105 */
+	{174787,	0,	0x0D,	0,	0x1D},	/* 174722 ppm=-373 */
+	{175000,	0,	0x0D,	0,	0x1B},	/* 175076 ppm=435 */
+	{175500,	0,	0x0D,	0,	0x19},	/* 175431 ppm=-391 */
+	{176000,	0,	0x0D,	0,	0x16},	/* 175967 ppm=-186 */
+	{177000,	0,	0x0D,	0,	0x10},	/* 177049 ppm=278 */
+	{178000,	0,	0x0D,	0,	0x0B},	/* 177961 ppm=-220 */
+	{179000,	0,	0x0D,	0,	0x05},	/* 179067 ppm=377 */
+	{180000,	0,	0x0D,	0,	0x00},	/* 180000 ppm=0 */
+};
+
+/* Program iCLKIP clock to the desired frequency */
+static void lpt_program_iclkip(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	u32 auxdiv=0, divsel=0, phasedir=0, phaseinc=0, valid=0;
+	u32 temp, i;
+
+	/* Ungate pixel clock */
+	I915_WRITE(PIXCLK_GATE, PIXCLK_GATE_GATE);
+
+	/* Disable SSCCTL */
+	SBI_WRITE(dev_priv, SBI_SSCCTL6,
+				SBI_READ(dev_priv, SBI_SSCCTL6) |
+					SBI_SSCCTL_DISABLE);
+
+	/* Calculating clock values for iCLKIP */
+	for (i=0; i < ARRAY_SIZE(iclk_vga_clock_table); i++) {
+		if (crtc->mode.clock == iclk_vga_clock_table[i].clock) {
+			DRM_INFO("Found clock settings for %dKHz refresh rate\n",
+					crtc->mode.clock);
+
+			auxdiv = iclk_vga_clock_table[i].auxdiv;
+			divsel = iclk_vga_clock_table[i].divsel;
+			phasedir = iclk_vga_clock_table[i].phasedir;
+			phaseinc = iclk_vga_clock_table[i].phaseinc;
+
+			valid = 1;
+
+			break;
+		}
+	}
+
+	if (!valid) {
+		DRM_ERROR("Unable to find iCLKIP clock settings for %dKHz refresh rate\n",
+				crtc->mode.clock);
+		return;
+	}
+
+	/* Program SSCDIVINTPHASE6 with values which HW team uses */
+	DRM_DEBUG("Programming SSCDIVINTPHASE for %dKHz: auxdiv=%x, divsel=%x, phasedir=%x, phaseinc=%x\n",
+			crtc->mode.clock,
+			auxdiv,
+			divsel,
+			phasedir,
+			phaseinc);
+
+	/* Program SSCDIVINTPHASE6 */
+	temp = SBI_READ(dev_priv, SBI_SSCDIVINTPHASE6);
+	temp &= ~SBI_SSCDIVINTPHASE_DIVSEL_MASK;
+	temp |= SBI_SSCDIVINTPHASE_DIVSEL(divsel);
+	temp &= ~SBI_SSCDIVINTPHASE_INCVAL_MASK;
+	temp |= SBI_SSCDIVINTPHASE_INCVAL(phaseinc);
+	temp |= SBI_SSCDIVINTPHASE_DIR(phasedir);
+	temp |= SBI_SSCDIVINTPHASE_PROPAGATE;
+
+	SBI_WRITE(dev_priv,
+			SBI_SSCDIVINTPHASE6,
+			temp);
+
+	/* Program SSCAUXDIV */
+	SBI_WRITE(dev_priv,
+			SBI_SSCAUXDIV6,
+				SBI_READ(dev_priv, SBI_SSCAUXDIV6) |
+					SBI_SSCAUXDIV_FINALDIV2SEL(auxdiv));
+
+
+	/* Enable modulator and associated divider */
+	SBI_WRITE(dev_priv, SBI_SSCCTL6,
+				SBI_READ(dev_priv, SBI_SSCCTL6) &
+					~SBI_SSCCTL_DISABLE);
+
+	/* Wait for initialization time */
+	udelay(50);
+
+	/* Gate pixel clock */
+	I915_WRITE(PIXCLK_GATE, PIXCLK_GATE_UNGATE);
+}
+
 
 /* Link training for HSW parts */
 static void hsw_fdi_link_train(struct drm_crtc *crtc)
@@ -3182,6 +3488,9 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)
 		/* DDIE clock is recommented for FDI connections */
 		I915_WRITE(PIPE_CLK_SEL(pipe),
 				PIPE_CLK_SEL_DDIE);
+
+		/* Program iCLKIP */
+		lpt_program_iclkip(crtc);
 	}
 
 	/* set transcoder timing, panel must allow it */
Signature · 6 lines
1.7.9.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
#88 lore raw

Re: [PATCH 35/37] drm/i915: program iCLKIP on Lynx Point

Yeah, intel_display is becoming so huge.

Paulo, Jesse and I talked a bit about this in osts and I think a reorg here would be good. What do you think about splitting it in something similar to omap displays (drivers/video/omap)?

Quoted 382 lines · Daniel Vetter
Quoted 10 lines · Eugeni Dodonov

The iCLKIP clock is used to drive the VGA pixel clock on the PCH. In order to do so, it must be programmed to properly do the clock ticks according to the divisor, phase direction, phase increments and a special auxiliary divisor for 20MHz clock.

Those values can be programmed individually, by doing some math; or we could use a pre-defined table of values for each modeset. For speed and simplification, the idea was to just adopt the table of valid pixel clocks and select the matching iCLKIP values from there.

Quoted 6 lines

As a possible idea for the future, it would be possible to add a fallback and calculate those values manually in case no match is found. But I don't think we'll encounter a mode not covered by those table, and VGA is pretty much going away in the future anyway.

With stuff like this, intel_display.c has definitely grown into the unmanageable territory. Along Jesse's suggestion I think it would make sense to split out the pch and gmch modeset stuff into separate files (and leave all the other things like initialization, clock gating watermark functions, pageflip, cursors, power crap and what not else in intel_display.c). We could call these new files intel_pch_modeset.c and intel_gmch_modeset.c, they'd contain the respective crtc_mode_set function plus all associated support code.

I'll leave this to you and Jesse to decide whether it makes sense as proposed and when you want to move the code. But I think we need to slaugther this dragon and cut it into more manageable pieces now.

Jesse?

Yours, Daniel

Quoted 334 lines

---
 drivers/gpu/drm/i915/intel_display.c |  309 ++++++++++++++++++++++++++++++++++

 1 file changed, 309 insertions(+)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 5f6cb35..a37e0b7 100644
@@ -2761,6 +2761,312 @@ static const long hsw_ddi_buf_ctl_values[] = {

      DDI_BUF_EMP_800MV_3_5DB_HSW
 };

drivers/gpu/drm/i915/intel_display.c +306 -0
+/* Available pixel clock values */
+struct iclk_vga_clock {
+     u32 clock;
+     u16 auxdiv;
+     u16 divsel;
+     u16 phasedir;
+     u16 phaseinc;
+};
+
+static const struct iclk_vga_clock iclk_vga_clock_table[] = {
+     {20000, 1,      0x41,   0,      0x20},  /* 20000 ppm=0 */
+     {21000, 0,      0x7E,   0,      0x25},  /* 20999 ppm=-53 */
+     {21912, 0,      0x79,   0,      0x0E},  /* 21912 ppm=12 */
+     {22000, 0,      0x78,   0,      0x2F},  /* 21999 ppm=-58 */
+     {23000, 0,      0x73,   0,      0x19},  /* 23000 ppm=6 */
+     {24000, 0,      0x6E,   0,      0x20},  /* 24000 ppm=0 */
+     {25000, 0,      0x6A,   0,      0x00},  /* 25000 ppm=0 */
+     {25175, 0,      0x69,   0,      0x10},  /* 25175 ppm=-7 */
+     {25200, 0,      0x69,   0,      0x09},  /* 25201 ppm=21 */
+     {26000, 0,      0x66,   1,      0x0A},  /* 26001 ppm=24 */
+     {27000, 0,      0x62,   0,      0x00},  /* 27000 ppm=0 */
+     {27027, 0,      0x62,   1,      0x06},  /* 27025 ppm=-62 */
+     {27500, 0,      0x60,   0,      0x0C},  /* 27498 ppm=-58 */
+     {28000, 0,      0x5E,   0,      0x1B},  /* 28002 ppm=70 */
+     {28320, 0,      0x5D,   0,      0x16},  /* 28319 ppm=-50 */
+     {28322, 0,      0x5D,   0,      0x15},  /* 28323 ppm=44 */
+     {29000, 0,      0x5B,   0,      0x07},  /* 28998 ppm=-64 */
+     {30000, 0,      0x58,   0,      0x00},  /* 30000 ppm=0 */
+     {31000, 0,      0x55,   0,      0x06},  /* 31001 ppm=35 */
+     {31500, 0,      0x54,   1,      0x12},  /* 31498 ppm=-53 */
+     {32000, 0,      0x52,   0,      0x18},  /* 32000 ppm=0 */
+     {32500, 0,      0x51,   0,      0x05},  /* 32500 ppm=-15 */
+     {33000, 0,      0x50,   1,      0x0C},  /* 33002 ppm=70 */
+     {34000, 0,      0x4D,   0,      0x1A},  /* 34002 ppm=70 */
+     {35000, 0,      0x4B,   0,      0x09},  /* 35001 ppm=29 */
+     {35500, 0,      0x4A,   0,      0x04},  /* 35497 ppm=-82 */
+     {36000, 0,      0x49,   0,      0x00},  /* 36000 ppm=0 */
+     {37000, 0,      0x47,   1,      0x02},  /* 37002 ppm=58 */
+     {38000, 0,      0x45,   0,      0x03},  /* 38003 ppm=82 */
+     {39000, 0,      0x43,   0,      0x0F},  /* 38998 ppm=-53 */
+     {40000, 0,      0x41,   0,      0x20},  /* 40000 ppm=0 */
+     {40500, 0,      0x41,   1,      0x15},  /* 40497 ppm=-79 */
+     {40541, 0,      0x41,   1,      0x1A},  /* 40544 ppm=95 */
+     {41000, 0,      0x40,   1,      0x09},  /* 40996 ppm=-87 */
+     {41540, 0,      0x3F,   0,      0x00},  /* 41538 ppm=-38 */
+     {42000, 0,      0x3E,   0,      0x12},  /* 42003 ppm=70 */
+     {43000, 0,      0x3D,   1,      0x0D},  /* 42996 ppm=-99 */
+     {43163, 0,      0x3D,   1,      0x1D},  /* 43168 ppm=108 */
+     {44000, 0,      0x3B,   0,      0x17},  /* 44003 ppm=70 */
+     {44900, 0,      0x3A,   0,      0x09},  /* 44895 ppm=-117 */
+     {45000, 0,      0x3A,   0,      0x00},  /* 45000 ppm=0 */
+     {46000, 0,      0x39,   1,      0x13},  /* 45994 ppm=-128 */
+     {47000, 0,      0x37,   0,      0x1D},  /* 46995 ppm=-110 */
+     {48000, 0,      0x36,   0,      0x10},  /* 48000 ppm=0 */
+     {49000, 0,      0x35,   0,      0x07},  /* 48993 ppm=-134 */
+     {49500, 0,      0x35,   1,      0x1D},  /* 49499 ppm=-27 */
+     {50000, 0,      0x34,   0,      0x00},  /* 50000 ppm=0 */
+     {51000, 0,      0x33,   1,      0x04},  /* 51004 ppm=70 */
+     {52000, 0,      0x32,   1,      0x05},  /* 52001 ppm=24 */
+     {52406, 0,      0x32,   1,      0x1F},  /* 52411 ppm=101 */
+     {53000, 0,      0x31,   1,      0x04},  /* 53006 ppm=116 */
+     {54000, 0,      0x30,   0,      0x00},  /* 54000 ppm=0 */
+     {54054, 0,      0x30,   1,      0x03},  /* 54051 ppm=-62 */
+     {55000, 0,      0x2F,   0,      0x06},  /* 54997 ppm=-58 */
+     {56000, 0,      0x2E,   0,      0x0E},  /* 55995 ppm=-93 */
+     {56250, 0,      0x2E,   0,      0x00},  /* 56250 ppm=0 */
+     {57000, 0,      0x2D,   0,      0x18},  /* 56992 ppm=-139 */
+     {58000, 0,      0x2D,   1,      0x1D},  /* 58006 ppm=105 */
+     {59000, 0,      0x2C,   1,      0x0F},  /* 58996 ppm=-64 */
+     {60000, 0,      0x2B,   0,      0x00},  /* 60000 ppm=0 */
+     {61000, 0,      0x2A,   0,      0x11},  /* 60995 ppm=-76 */
+     {62000, 0,      0x2A,   1,      0x1D},  /* 62002 ppm=35 */
+     {63000, 0,      0x29,   1,      0x09},  /* 62997 ppm=-53 */
+     {64000, 0,      0x28,   0,      0x0C},  /* 64000 ppm=0 */
+     {65000, 0,      0x28,   1,      0x1E},  /* 65011 ppm=174 */
+     {66000, 0,      0x27,   1,      0x06},  /* 66005 ppm=70 */
+     {66667, 0,      0x26,   0,      0x20},  /* 66667 ppm=-5 */
+     {67000, 0,      0x26,   0,      0x13},  /* 67003 ppm=41 */
+     {68000, 0,      0x26,   1,      0x13},  /* 68005 ppm=70 */
+     {68179, 0,      0x26,   1,      0x19},  /* 68166 ppm=-196 */
+     {69000, 0,      0x25,   0,      0x08},  /* 69010 ppm=139 */
+     {70000, 0,      0x25,   1,      0x1B},  /* 69988 ppm=-174 */
+     {71000, 0,      0x24,   0,      0x02},  /* 70994 ppm=-82 */
+     {72000, 0,      0x23,   0,      0x20},  /* 72000 ppm=0 */
+     {73000, 0,      0x23,   1,      0x01},  /* 73004 ppm=53 */
+     {74000, 0,      0x22,   0,      0x1F},  /* 74004 ppm=58 */
+     {74175, 0,      0x22,   0,      0x1A},  /* 74163 ppm=-161 */
+     {74250, 0,      0x22,   0,      0x17},  /* 74259 ppm=118 */
+     {74481, 0,      0x22,   0,      0x10},  /* 74483 ppm=24 */
+     {75000, 0,      0x22,   0,      0x00},  /* 75000 ppm=0 */
+     {76000, 0,      0x22,   1,      0x1E},  /* 75989 ppm=-139 */
+     {77000, 0,      0x21,   0,      0x04},  /* 77005 ppm=70 */
+     {78000, 0,      0x21,   1,      0x19},  /* 78014 ppm=174 */
+     {78750, 0,      0x20,   0,      0x12},  /* 78760 ppm=131 */
+     {79000, 0,      0x20,   0,      0x0B},  /* 79012 ppm=157 */
+     {80000, 0,      0x20,   1,      0x10},  /* 80000 ppm=0 */
+     {81000, 0,      0x1F,   0,      0x15},  /* 81013 ppm=157 */
+     {81081, 0,      0x1F,   0,      0x13},  /* 81089 ppm=95 */
+     {81624, 0,      0x1F,   0,      0x05},  /* 81625 ppm=12 */
+     {82000, 0,      0x1F,   1,      0x05},  /* 82012 ppm=151 */
+     {83000, 0,      0x1F,   1,      0x1E},  /* 82997 ppm=-35 */
+     {83950, 0,      0x1E,   0,      0x0A},  /* 83965 ppm=179 */
+     {84000, 0,      0x1E,   0,      0x09},  /* 84006 ppm=70 */
+     {85000, 0,      0x1E,   1,      0x0F},  /* 84998 ppm=-29 */
+     {86000, 0,      0x1D,   0,      0x19},  /* 86013 ppm=151 */
+     {87000, 0,      0x1D,   0,      0x02},  /* 87009 ppm=105 */
+     {88000, 0,      0x1D,   1,      0x14},  /* 87984 ppm=-186 */
+     {89000, 0,      0x1C,   0,      0x16},  /* 88980 ppm=-220 */
+     {90000, 0,      0x1C,   0,      0x00},  /* 90000 ppm=0 */
+     {91000, 0,      0x1C,   1,      0x15},  /* 90995 ppm=-53 */
+     {92000, 0,      0x1B,   0,      0x16},  /* 92013 ppm=139 */
+     {93000, 0,      0x1B,   0,      0x02},  /* 93003 ppm=35 */
+     {94000, 0,      0x1B,   1,      0x12},  /* 94015 ppm=163 */
+     {94500, 0,      0x1B,   1,      0x1B},  /* 94478 ppm=-235 */
+     {95000, 0,      0x1A,   0,      0x1B},  /* 94997 ppm=-29 */
+     {95654, 0,      0x1A,   0,      0x0F},  /* 95628 ppm=-271 */
+     {96000, 0,      0x1A,   0,      0x08},  /* 96000 ppm=0 */
+     {97000, 0,      0x1A,   1,      0x0B},  /* 97024 ppm=249 */
+     {98000, 0,      0x1A,   1,      0x1D},  /* 98015 ppm=151 */
+     {99000, 0,      0x19,   0,      0x11},  /* 99026 ppm=261 */
+     {100000,        0,      0x19,   0,      0x00},  /* 100000 ppm=0 */
+     {101000,        0,      0x19,   1,      0x11},  /* 100994 ppm=-64 */
+     {102000,        0,      0x18,   0,      0x1E},  /* 102007 ppm=70 */
+     {103000,        0,      0x18,   0,      0x0E},  /* 102980 ppm=-197 */
+     {104000,        0,      0x18,   1,      0x02},  /* 103971 ppm=-278 */
+     {105000,        0,      0x18,   1,      0x12},  /* 104982 ppm=-174 */
+     {106000,        0,      0x17,   0,      0x1E},  /* 106012 ppm=116 */
+     {107000,        0,      0x17,   0,      0x0F},  /* 106997 ppm=-29 */
+     {107214,        0,      0x17,   0,      0x0C},  /* 107196 ppm=-168 */
+     {108000,        0,      0x17,   0,      0x00},  /* 108000 ppm=0 */
+     {109000,        0,      0x17,   1,      0x0F},  /* 109022 ppm=203 */
+     {110000,        0,      0x17,   1,      0x1D},  /* 109994 ppm=-58 */
+     {110013,        0,      0x17,   1,      0x1D},  /* 109994 ppm=-177 */
+     {111000,        0,      0x16,   0,      0x15},  /* 110983 ppm=-157 */
+     {111263,        0,      0x16,   0,      0x11},  /* 111269 ppm=55 */
+     {111375,        0,      0x16,   0,      0x10},  /* 111340 ppm=-313 */
+     {112000,        0,      0x16,   0,      0x07},  /* 111990 ppm=-93 */
+     {113000,        0,      0x16,   1,      0x07},  /* 113015 ppm=134 */
+     {113309,        0,      0x16,   1,      0x0B},  /* 113311 ppm=22 */
+     {113100,        0,      0x16,   1,      0x08},  /* 113089 ppm=-98 */
+     {114000,        0,      0x16,   1,      0x14},  /* 113984 ppm=-139 */
+     {115000,        0,      0x15,   0,      0x1F},  /* 114970 ppm=-261 */
+     {116000,        0,      0x15,   0,      0x12},  /* 115973 ppm=-232 */
+     {117000,        0,      0x15,   0,      0x05},  /* 116994 ppm=-53 */
+     {118000,        0,      0x15,   1,      0x08},  /* 118033 ppm=278 */
+     {119000,        0,      0x15,   1,      0x14},  /* 119008 ppm=70 */
+     {119651,        0,      0x15,   1,      0x1C},  /* 119668 ppm=139 */
+     {120000,        0,      0x14,   0,      0x20},  /* 120000 ppm=0 */
+     {121000,        0,      0x14,   0,      0x14},  /* 121008 ppm=70 */
+     {122000,        0,      0x14,   0,      0x08},  /* 122034 ppm=278 */
+     {122614,        0,      0x14,   0,      0x01},  /* 122640 ppm=214 */
+     {123000,        0,      0x14,   1,      0x03},  /* 122989 ppm=-87 */
+     {123379,        0,      0x14,   1,      0x07},  /* 123340 ppm=-313 */
+     {124000,        0,      0x14,   1,      0x0E},  /* 123960 ppm=-324 */
+     {125000,        0,      0x14,   1,      0x1A},  /* 125036 ppm=290 */
+     {126000,        0,      0x13,   0,      0x1B},  /* 126039 ppm=313 */
+     {127000,        0,      0x13,   0,      0x11},  /* 126965 ppm=-272 */
+     {128000,        0,      0x13,   0,      0x06},  /* 128000 ppm=0 */
+     {129000,        0,      0x13,   1,      0x04},  /* 128955 ppm=-348 */
+     {129859,        0,      0x13,   1,      0x0D},  /* 129827 ppm=-245 */
+     {130000,        0,      0x13,   1,      0x0F},  /* 130023 ppm=174 */
+     {131000,        0,      0x13,   1,      0x19},  /* 131008 ppm=64 */
+     {131850,        0,      0x12,   0,      0x1F},  /* 131808 ppm=-321 */
+     {132000,        0,      0x12,   0,      0x1D},  /* 132009 ppm=70 */
+     {133000,        0,      0x12,   0,      0x13},  /* 133025 ppm=192 */
+     {133330,        0,      0x12,   0,      0x10},  /* 133333 ppm=26 */
+     {134000,        0,      0x12,   0,      0x0A},  /* 133953 ppm=-348 */
+     {135000,        0,      0x12,   0,      0x00},  /* 135000 ppm=0 */
+     {136000,        0,      0x12,   1,      0x09},  /* 135956 ppm=-324 */
+     {137000,        0,      0x12,   1,      0x13},  /* 137034 ppm=249 */
+     {138000,        0,      0x12,   1,      0x1C},  /* 138019 ppm=139 */
+     {139000,        0,      0x11,   0,      0x1B},  /* 139019 ppm=134 */
+     {139050,        0,      0x11,   0,      0x1B},  /* 139019 ppm=-227 */
+     {139054,        0,      0x11,   0,      0x1B},  /* 139019 ppm=-256 */
+     {140000,        0,      0x11,   0,      0x12},  /* 140032 ppm=232 */
+     {141000,        0,      0x11,   0,      0x0A},  /* 140946 ppm=-382 */
+     {142000,        0,      0x11,   0,      0x01},  /* 141988 ppm=-82 */
+     {143000,        0,      0x11,   1,      0x08},  /* 143046 ppm=325 */
+     {143472,        0,      0x11,   1,      0x0C},  /* 143522 ppm=346 */
+     {144000,        0,      0x11,   1,      0x10},  /* 144000 ppm=0 */
+     {145000,        0,      0x11,   1,      0x18},  /* 144966 ppm=-232 */
+     {146000,        0,      0x10,   0,      0x20},  /* 145946 ppm=-371 */
+     {147000,        0,      0x10,   0,      0x18},  /* 146939 ppm=-417 */
+     {147891,        0,      0x10,   0,      0x10},  /* 147945 ppm=367 */
+     {148000,        0,      0x10,   0,      0x10},  /* 147945 ppm=-371 */
+     {148350,        0,      0x10,   0,      0x0D},  /* 148326 ppm=-161 */
+     {148500,        0,      0x10,   0,      0x0C},  /* 148454 ppm=-313 */
+     {149000,        0,      0x10,   0,      0x08},  /* 148966 ppm=-232 */
+     {150000,        0,      0x10,   0,      0x00},  /* 150000 ppm=0 */
+     {151000,        0,      0x10,   1,      0x08},  /* 151049 ppm=325 */
+     {152000,        0,      0x10,   1,      0x0F},  /* 151979 ppm=-139 */
+     {152280,        0,      0x10,   1,      0x11},  /* 152247 ppm=-219 */
+     {153000,        0,      0x10,   1,      0x17},  /* 153056 ppm=365 */
+     {154000,        0,      0x10,   1,      0x1E},  /* 154011 ppm=70 */
+     {155000,        0,      0x0F,   0,      0x1B},  /* 154978 ppm=-145 */
+     {156000,        0,      0x0F,   0,      0x14},  /* 155957 ppm=-278 */
+     {157000,        0,      0x0F,   0,      0x0D},  /* 156948 ppm=-330 */
+     {157500,        0,      0x0F,   0,      0x09},  /* 157521 ppm=131 */
+     {158000,        0,      0x0F,   0,      0x06},  /* 157952 ppm=-301 */
+     {159000,        0,      0x0F,   1,      0x01},  /* 158970 ppm=-191 */
+     {160000,        0,      0x0F,   1,      0x08},  /* 160000 ppm=0 */
+     {161000,        0,      0x0F,   1,      0x0F},  /* 161044 ppm=273 */
+     {162000,        0,      0x0F,   1,      0x15},  /* 161949 ppm=-313 */
+     {163000,        0,      0x0F,   1,      0x1C},  /* 163019 ppm=116 */
+     {164000,        0,      0x0E,   0,      0x1E},  /* 163947 ppm=-324 */
+     {165000,        0,      0x0E,   0,      0x17},  /* 165043 ppm=261 */
+     {166000,        0,      0x0E,   0,      0x11},  /* 165994 ppm=-35 */
+     {167000,        0,      0x0E,   0,      0x0B},  /* 166957 ppm=-261 */
+     {168000,        0,      0x0E,   0,      0x05},  /* 167930 ppm=-417 */
+     {169000,        0,      0x0E,   1,      0x02},  /* 169080 ppm=475 */
+     {169128,        0,      0x0E,   1,      0x02},  /* 169080 ppm=-283 */
+     {170000,        0,      0x0E,   1,      0x08},  /* 170079 ppm=464 */
+     {171000,        0,      0x0E,   1,      0x0D},  /* 170920 ppm=-469 */
+     {172000,        0,      0x0E,   1,      0x13},  /* 171940 ppm=-348 */
+     {172800,        0,      0x0E,   1,      0x18},  /* 172800 ppm=0 */
+     {173000,        0,      0x0E,   1,      0x19},  /* 172973 ppm=-157 */
+     {174000,        0,      0x0E,   1,      0x1F},  /* 174018 ppm=105 */
+     {174787,        0,      0x0D,   0,      0x1D},  /* 174722 ppm=-373 */
+     {175000,        0,      0x0D,   0,      0x1B},  /* 175076 ppm=435 */
+     {175500,        0,      0x0D,   0,      0x19},  /* 175431 ppm=-391 */
+     {176000,        0,      0x0D,   0,      0x16},  /* 175967 ppm=-186 */
+     {177000,        0,      0x0D,   0,      0x10},  /* 177049 ppm=278 */
+     {178000,        0,      0x0D,   0,      0x0B},  /* 177961 ppm=-220 */
+     {179000,        0,      0x0D,   0,      0x05},  /* 179067 ppm=377 */
+     {180000,        0,      0x0D,   0,      0x00},  /* 180000 ppm=0 */
+};
+
+/* Program iCLKIP clock to the desired frequency */
+static void lpt_program_iclkip(struct drm_crtc *crtc)
+{
+     struct drm_device *dev = crtc->dev;
+     struct drm_i915_private *dev_priv = dev->dev_private;
+     u32 auxdiv=0, divsel=0, phasedir=0, phaseinc=0, valid=0;
+     u32 temp, i;
+
+     /* Ungate pixel clock */
+     I915_WRITE(PIXCLK_GATE, PIXCLK_GATE_GATE);
+
+     /* Disable SSCCTL */
+     SBI_WRITE(dev_priv, SBI_SSCCTL6,
+                             SBI_READ(dev_priv, SBI_SSCCTL6) |
+                                     SBI_SSCCTL_DISABLE);
+
+     /* Calculating clock values for iCLKIP */
+     for (i=0; i < ARRAY_SIZE(iclk_vga_clock_table); i++) {
+             if (crtc->mode.clock == iclk_vga_clock_table[i].clock) {
+                     DRM_INFO("Found clock settings for %dKHz refresh rate\n",
+                                     crtc->mode.clock);
+
+                     auxdiv = iclk_vga_clock_table[i].auxdiv;
+                     divsel = iclk_vga_clock_table[i].divsel;
+                     phasedir = iclk_vga_clock_table[i].phasedir;
+                     phaseinc = iclk_vga_clock_table[i].phaseinc;
+
+                     valid = 1;
+
+                     break;
+             }
+     }
+
+     if (!valid) {
+             DRM_ERROR("Unable to find iCLKIP clock settings for %dKHz refresh rate\n",
+                             crtc->mode.clock);
+             return;
+     }
+
+     /* Program SSCDIVINTPHASE6 with values which HW team uses */
+     DRM_DEBUG("Programming SSCDIVINTPHASE for %dKHz: auxdiv=%x, divsel=%x, phasedir=%x, phaseinc=%x\n",
+                     crtc->mode.clock,
+                     auxdiv,
+                     divsel,
+                     phasedir,
+                     phaseinc);
+
+     /* Program SSCDIVINTPHASE6 */
+     temp = SBI_READ(dev_priv, SBI_SSCDIVINTPHASE6);
+     temp &= ~SBI_SSCDIVINTPHASE_DIVSEL_MASK;
+     temp |= SBI_SSCDIVINTPHASE_DIVSEL(divsel);
+     temp &= ~SBI_SSCDIVINTPHASE_INCVAL_MASK;
+     temp |= SBI_SSCDIVINTPHASE_INCVAL(phaseinc);
+     temp |= SBI_SSCDIVINTPHASE_DIR(phasedir);
+     temp |= SBI_SSCDIVINTPHASE_PROPAGATE;
+
+     SBI_WRITE(dev_priv,
+                     SBI_SSCDIVINTPHASE6,
+                     temp);
+
+     /* Program SSCAUXDIV */
+     SBI_WRITE(dev_priv,
+                     SBI_SSCAUXDIV6,
+                             SBI_READ(dev_priv, SBI_SSCAUXDIV6) |
+                                     SBI_SSCAUXDIV_FINALDIV2SEL(auxdiv));
+
+
+     /* Enable modulator and associated divider */
+     SBI_WRITE(dev_priv, SBI_SSCCTL6,
+                             SBI_READ(dev_priv, SBI_SSCCTL6) &
+                                     ~SBI_SSCCTL_DISABLE);
+
+     /* Wait for initialization time */
+     udelay(50);
+
+     /* Gate pixel clock */
+     I915_WRITE(PIXCLK_GATE, PIXCLK_GATE_UNGATE);
+}
+

 /* Link training for HSW parts */
 static void hsw_fdi_link_train(struct drm_crtc *crtc)

drivers/gpu/drm/i915/intel_display.c +3 -1
@@ -3182,6 +3488,9 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)
               /* DDIE clock is recommented for FDI connections */
               I915_WRITE(PIPE_CLK_SEL(pipe),
                               PIPE_CLK_SEL_DDIE);
+
+             /* Program iCLKIP */
+             lpt_program_iclkip(crtc);
       }
 
       /* set transcoder timing, panel must allow it */
--

1.7.9.2

Quoted 4 lines

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

--
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 3 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
#89 lore raw

Re: [PATCH 35/37] drm/i915: program iCLKIP on Lynx Point

Quoted 5 lines · On Mon, 26 Mar 2012 15:00:14 -0300 Rodrigo Vivi <[email protected]> wrote:

Yeah, intel_display is becoming so huge.

Paulo, Jesse and I talked a bit about this in osts and I think a reorg here would be good. What do you think about splitting it in something similar to omap displays (drivers/video/omap)?

Yeah more splitting is definitely desired. We already have per-output stuff like OMAP appears to have, but I think at the very least intel_display.c should be split between PCH and non-PCH parts to start with.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center

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

#90 lore raw

PATCH 36/37 drm/i915: add warning when using old bits on Haswell/LPT

In reply to Eugeni Dodonov

Those have different functionality on Haswell architecture, so let's trigger a warning message when we are going through a path we should not go into on Haswell.

This patch is here for make debugging and log tracing easier, it should go away in the future, we we'll stop hitting those code paths.

---
 drivers/gpu/drm/i915/intel_display.c |   59 +++++++++++++++++++++++++++-------
 1 file changed, 47 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/intel_display.c +47 -12
index a37e0b7..10b92e8 100644
@@ -847,9 +847,16 @@ static void assert_fdi_tx(struct drm_i915_private *dev_priv,
 	u32 val;
 	bool cur_state;
 
-	reg = FDI_TX_CTL(pipe);
-	val = I915_READ(reg);
-	cur_state = !!(val & FDI_TX_ENABLE);
+	if (IS_HASWELL(dev_priv->dev)) {
+		DRM_ERROR("Attempting to check FDI_TX_CTL on Haswell, using DDI instead\n");
+		reg = DDI_FUNC_CTL(pipe);
+		val = I915_READ(reg);
+		cur_state = !!(val & PIPE_DDI_FUNC_ENABLE);
+	} else {
+		reg = FDI_TX_CTL(pipe);
+		val = I915_READ(reg);
+		cur_state = !!(val & FDI_TX_ENABLE);
+	}
 	WARN(cur_state != state,
 	     "FDI TX state assertion failure (expected %s, current %s)\n",
 	     state_string(state), state_string(cur_state));
@@ -864,9 +871,14 @@ static void assert_fdi_rx(struct drm_i915_private *dev_priv,
 	u32 val;
 	bool cur_state;
 
-	reg = FDI_RX_CTL(pipe);
-	val = I915_READ(reg);
-	cur_state = !!(val & FDI_RX_ENABLE);
+	if (IS_HASWELL(dev_priv->dev) && pipe > 0) {
+			DRM_ERROR("Attempting to enable FDI_RX on Haswell pipe > 0\n");
+			return;
+	} else {
+		reg = FDI_RX_CTL(pipe);
+		val = I915_READ(reg);
+		cur_state = !!(val & FDI_RX_ENABLE);
+	}
 	WARN(cur_state != state,
 	     "FDI RX state assertion failure (expected %s, current %s)\n",
 	     state_string(state), state_string(cur_state));
@@ -884,6 +896,11 @@ static void assert_fdi_tx_pll_enabled(struct drm_i915_private *dev_priv,
 	if (dev_priv->info->gen == 5)
 		return;
 
+	if (IS_HASWELL(dev_priv->dev)) {
+		DRM_ERROR("Attempting to check FDI_TX_PLL on Haswell, aborting\n");
+		return;
+	}
+
 	reg = FDI_TX_CTL(pipe);
 	val = I915_READ(reg);
 	WARN(!(val & FDI_TX_PLL_ENABLE), "FDI TX PLL assertion failure, should be active but is disabled\n");
@@ -895,6 +912,10 @@ static void assert_fdi_rx_pll_enabled(struct drm_i915_private *dev_priv,
 	int reg;
 	u32 val;
 
+	if (IS_HASWELL(dev_priv->dev) && pipe > 0) {
+		DRM_ERROR("Attempting to enable FDI on Haswell with pipe > 0\n");
+		return;
+	}
 	reg = FDI_RX_CTL(pipe);
 	val = I915_READ(reg);
 	WARN(!(val & FDI_RX_PLL_ENABLE), "FDI RX PLL assertion failure, should be active but is disabled\n");
@@ -1000,6 +1021,11 @@ static void assert_pch_refclk_enabled(struct drm_i915_private *dev_priv)
 	u32 val;
 	bool enabled;
 
+	if (HAS_PCH_LPT(dev_priv->dev)) {
+		DRM_ERROR("LPT does not has PCH refclk, skipping check\n");
+		return;
+	}
+
 	val = I915_READ(PCH_DREF_CONTROL);
 	enabled = !!(val & (DREF_SSC_SOURCE_MASK | DREF_NONSPREAD_SOURCE_MASK |
 			    DREF_SUPERSPREAD_SOURCE_MASK));
@@ -1323,6 +1349,10 @@ static void intel_enable_transcoder(struct drm_i915_private *dev_priv,
 	assert_fdi_tx_enabled(dev_priv, pipe);
 	assert_fdi_rx_enabled(dev_priv, pipe);
 
+	if (IS_HASWELL(dev_priv->dev) && pipe > 0) {
+		DRM_ERROR("Attempting to enable FDI on Haswell with pipe > 0\n");
+		return;
+	}
 	reg = TRANSCONF(pipe);
 	val = I915_READ(reg);
 	pipeconf_val = I915_READ(PIPECONF(pipe));
@@ -3308,13 +3338,18 @@ static void ironlake_fdi_pll_enable(struct drm_crtc *crtc)
 	udelay(200);
 
 	/* Enable CPU FDI TX PLL, always on for Ironlake */
-	reg = FDI_TX_CTL(pipe);
-	temp = I915_READ(reg);
-	if ((temp & FDI_TX_PLL_ENABLE) == 0) {
-		I915_WRITE(reg, temp | FDI_TX_PLL_ENABLE);
+	if (IS_HASWELL(dev)) {
+		DRM_ERROR("Skipping enablement of FDI_TX_PLL on Haswell\n");
+		return;
+	} else {
+		reg = FDI_TX_CTL(pipe);
+		temp = I915_READ(reg);
+		if ((temp & FDI_TX_PLL_ENABLE) == 0) {
+			I915_WRITE(reg, temp | FDI_TX_PLL_ENABLE);
 
-		POSTING_READ(reg);
-		udelay(100);
+			POSTING_READ(reg);
+			udelay(100);
+		}
 	}
 }
 
Signature · 1 line
1.7.9.2
Reviewed-by on v1 36/37
#91 lore raw

Re: [PATCH 36/37] drm/i915: add warning when using old bits on Haswell/LPT

Quoted 132 lines · Eugeni Dodonov

Those have different functionality on Haswell architecture, so let's trigger a warning message when we are going through a path we should not go into on Haswell.

This patch is here for make debugging and log tracing easier, it should go away in the future, we we'll stop hitting those code paths.

---
 drivers/gpu/drm/i915/intel_display.c |   59 +++++++++++++++++++++++++++-------

 1 file changed, 47 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/intel_display.c +32 -6
index a37e0b7..10b92e8 100644
@@ -847,9 +847,16 @@ static void assert_fdi_tx(struct drm_i915_private *dev_priv,
        u32 val;
        bool cur_state;
 
-       reg = FDI_TX_CTL(pipe);
-       val = I915_READ(reg);
-       cur_state = !!(val & FDI_TX_ENABLE);
+       if (IS_HASWELL(dev_priv->dev)) {
+               DRM_ERROR("Attempting to check FDI_TX_CTL on Haswell, using DDI instead\n");
+               reg = DDI_FUNC_CTL(pipe);
+               val = I915_READ(reg);
+               cur_state = !!(val & PIPE_DDI_FUNC_ENABLE);
+       } else {
+               reg = FDI_TX_CTL(pipe);
+               val = I915_READ(reg);
+               cur_state = !!(val & FDI_TX_ENABLE);
+       }
        WARN(cur_state != state,
             "FDI TX state assertion failure (expected %s, current %s)\n",
             state_string(state), state_string(cur_state));
@@ -864,9 +871,14 @@ static void assert_fdi_rx(struct drm_i915_private *dev_priv,
        u32 val;
        bool cur_state;
 
-       reg = FDI_RX_CTL(pipe);
-       val = I915_READ(reg);
-       cur_state = !!(val & FDI_RX_ENABLE);
+       if (IS_HASWELL(dev_priv->dev) && pipe > 0) {
+                       DRM_ERROR("Attempting to enable FDI_RX on Haswell pipe > 0\n");
+                       return;
+       } else {
+               reg = FDI_RX_CTL(pipe);
+               val = I915_READ(reg);
+               cur_state = !!(val & FDI_RX_ENABLE);
+       }
        WARN(cur_state != state,
             "FDI RX state assertion failure (expected %s, current %s)\n",
             state_string(state), state_string(cur_state));
@@ -884,6 +896,11 @@ static void assert_fdi_tx_pll_enabled(struct drm_i915_private *dev_priv,
        if (dev_priv->info->gen == 5)
                return;
 
+       if (IS_HASWELL(dev_priv->dev)) {
+               DRM_ERROR("Attempting to check FDI_TX_PLL on Haswell, aborting\n");
+               return;
+       }
+
        reg = FDI_TX_CTL(pipe);
        val = I915_READ(reg);
        WARN(!(val & FDI_TX_PLL_ENABLE), "FDI TX PLL assertion failure, should be active but is disabled\n");
@@ -895,6 +912,10 @@ static void assert_fdi_rx_pll_enabled(struct drm_i915_private *dev_priv,
        int reg;
        u32 val;
 
+       if (IS_HASWELL(dev_priv->dev) && pipe > 0) {
+               DRM_ERROR("Attempting to enable FDI on Haswell with pipe > 0\n");
+               return;
+       }
        reg = FDI_RX_CTL(pipe);
        val = I915_READ(reg);
        WARN(!(val & FDI_RX_PLL_ENABLE), "FDI RX PLL assertion failure, should be active but is disabled\n");
@@ -1000,6 +1021,11 @@ static void assert_pch_refclk_enabled(struct drm_i915_private *dev_priv)
        u32 val;
        bool enabled;
 
+       if (HAS_PCH_LPT(dev_priv->dev)) {
+               DRM_ERROR("LPT does not has PCH refclk, skipping check\n");
+               return;
+       }
+
        val = I915_READ(PCH_DREF_CONTROL);

       enabled = !!(val & (DREF_SSC_SOURCE_MASK | DREF_NONSPREAD_SOURCE_MASK | DREF_SUPERSPREAD_SOURCE_MASK));

drivers/gpu/drm/i915/intel_display.c +15 -7
@@ -1323,6 +1349,10 @@ static void intel_enable_transcoder(struct drm_i915_private *dev_priv,
        assert_fdi_tx_enabled(dev_priv, pipe);
        assert_fdi_rx_enabled(dev_priv, pipe);
 
+       if (IS_HASWELL(dev_priv->dev) && pipe > 0) {
+               DRM_ERROR("Attempting to enable FDI on Haswell with pipe > 0\n");
+               return;
+       }
        reg = TRANSCONF(pipe);
        val = I915_READ(reg);
        pipeconf_val = I915_READ(PIPECONF(pipe));
@@ -3308,13 +3338,18 @@ static void ironlake_fdi_pll_enable(struct drm_crtc *crtc)
        udelay(200);
 
        /* Enable CPU FDI TX PLL, always on for Ironlake */
-       reg = FDI_TX_CTL(pipe);
-       temp = I915_READ(reg);
-       if ((temp & FDI_TX_PLL_ENABLE) == 0) {
-               I915_WRITE(reg, temp | FDI_TX_PLL_ENABLE);
+       if (IS_HASWELL(dev)) {
+               DRM_ERROR("Skipping enablement of FDI_TX_PLL on Haswell\n");
+               return;
+       } else {
+               reg = FDI_TX_CTL(pipe);
+               temp = I915_READ(reg);
+               if ((temp & FDI_TX_PLL_ENABLE) == 0) {
+                       I915_WRITE(reg, temp | FDI_TX_PLL_ENABLE);
 
-               POSTING_READ(reg);
-               udelay(100);
+                       POSTING_READ(reg);
+                       udelay(100);
+               }
        }
  }
 
--

1.7.9.2

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

Signature · 3 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net
#92 lore raw

PATCH 37/37 drm/i915: dump registers read/write ops

In reply to Eugeni Dodonov

This logs all the registers and SBI accesses as they happen.

Note that it is not supposed to go into the final patch series. But there are too many subtle changes in both HSW and LPT that are much easier to spot with this extra debugging when attaching a dmesg output in case of problems.

In other words, this is ugly, but if you run into an issue and send me dmesg with those included, my chances of investigating the problems will increase exponentially.

---
 drivers/gpu/drm/i915/i915_drv.c      |    2 ++
 drivers/gpu/drm/i915/intel_display.c |    2 ++
 2 files changed, 4 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +2 -0
index 5fe9d62..f75d16f 100644
@@ -1022,6 +1022,7 @@ u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg) { \
 		val = read##y(dev_priv->regs + reg); \
 	} \
 	trace_i915_reg_rw(false, reg, val, sizeof(val)); \
+	DRM_DEBUG("I915_READ: 0x%x = 0x%x\n", reg, val); \
 	return val; \
 }
 
@@ -1034,6 +1035,7 @@ __i915_read(64, q)
 #define __i915_write(x, y) \
 void i915_write##x(struct drm_i915_private *dev_priv, u32 reg, u##x val) { \
 	u32 __fifo_ret = 0; \
+	DRM_DEBUG("I915_WRITE: 0x%x = 0x%x\n", reg, val); \
 	trace_i915_reg_rw(true, reg, val, sizeof(val)); \
 	if (NEEDS_FORCE_WAKE((dev_priv), (reg))) { \
 		__fifo_ret = __gen6_gt_wait_for_fifo(dev_priv); \
drivers/gpu/drm/i915/intel_display.c +2 -0
index 10b92e8..fa016f8 100644
@@ -1240,6 +1240,7 @@ SBI_WRITE(struct drm_i915_private *dev_priv, u16 reg, u32 value)
 			SBI_READY |
 			SBI_CTL_OP_CRWR);
 
+	DRM_DEBUG("SBI_WRITE: 0x%x = 0x%x\n", reg, value);
 	if (wait_for((I915_READ(SBI_CTL_STAT) & (SBI_READY | SBI_RESPONSE)) == 0,
 				10))
 		DRM_ERROR("timeout waiting for SBI to complete write transaction\n");
@@ -1265,6 +1266,7 @@ SBI_READ(struct drm_i915_private *dev_priv, u16 reg)
 
 	value = I915_READ(SBI_DATA);
 
+	DRM_DEBUG("SBI_READ: 0x%x = 0x%x\n", reg, value); \
 	return value;
 }
 
Signature · 1 line
1.7.9.2
#93 lore raw

Re: [PATCH 37/37] drm/i915: dump registers read/write ops

Quoted 10 lines · Eugeni Dodonov

This logs all the registers and SBI accesses as they happen.

Note that it is not supposed to go into the final patch series. But there are too many subtle changes in both HSW and LPT that are much easier to spot with this extra debugging when attaching a dmesg output in case of problems.

In other words, this is ugly, but if you run into an issue and send me dmesg with those included, my chances of investigating the problems will increase exponentially.

This should already by covered by the tracepoints. I guess you just lacked the magic patch to enable ftrace on module load.

[email protected]

I was hoping that since Steven Rostedt agreed and seemed to convince Rusty as well, he would pick it up... So it could do with some love. -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#94 lore raw
In reply to Eugeni Dodonov
Quoted 32 lines · Eugeni Dodonov

Hi folks,

To contribute to everyones curiosity and further enrich Phoronix articles :), this is the initial Haswell enablement patchset for basic modesetting support over VGA.

This is actually the first time I am doing such enablement, and the combination of HSW/LPT changes proved to be quite tricky, yet also very cool to do. But certainly, while I tried to split the patches in the best way to 'tell a story', I suspect lots and lots of things could be improved. So bikeshedding is much welcomed! And of course, there are still a bunch of things missing, but those can be done in parallel now.

As for those patches, I organized them in the following way:
- The first part adds new hardware information and new registers which we'll need to make it work (a.k.a, 'The Pledge'). This goes from patch 01 until patch 21.
- The second part does small changes to existent functions to make them work on Haswell ('The Turn'). This goes from patch 22 to patch 28. Haswell is not quite Gen7, but is shares lots of stuff with what we already have, so there was no point in reinventing the wheel just now.
- The third part makes things work by enabling power wells, DDI and FDI connections, PCH-specific stuff and so on ('The Prestige'). This is from patch 29 to patch 35. Those are the scariest ones, but I couldn't split them better and still maintain logical consistency among them. Initially, those were 24 small patches, but it was very hard to keep track of them, so I combined them into just 6 for this patchset.
- And finally, there are 2 last patches ('The Prestige Debug' :)) which won't be present in the final series, but are helpful at least for me to trace where things go wrong. So if you run into issues and want to send me a dmesg, those traces will make my life so much easier.

Quoted 5 lines

I didn't wanted to go much deeper with HSW for now because I would end up doing a massive code reordering to maintain my mental sanity, and as we already discussed by email earlier today Jesse is running into same problems as well. So perhaps we should just settle on doing some cleanup in our intel_display module before adding more platform-specific stuff?

Awesome work and nice patch series. To satisfy you're expectation, I've dropped a few bikesheds on it. Now my gut says that this needs some more work before we can merge hsw support, but there are quite a few things that I'd like to pick up earlier (just so you don't have to carry so many patches):

- the separate register definition patches are rather nice, so as soon as someone with enough coffee has cross-checked them with Bspec I could merge them, maybe already next week.

- some of the infrastucture work (like adding the has_pch_split feature work) could go in early, too. Luckily hsw seems to be less a frankenstein monster than vlv, which nicely reflects in much fewer pain points when integrating it in our code.

- for merging real hsw support (and especially the pci ids) I think we should wait until digital outputs also work somewhat.

Yours, Daniel

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48