[Intel-gfx] [PATCH 1/3] drm/i915: Introduce an IS_SDV() macro

Damien Lespiau damien.lespiau at gmail.com
Sat Dec 8 19:08:09 CET 2012


From: Damien Lespiau <damien.lespiau at intel.com>

Not to have raw checks on the PCI ID in the code. Make
lpt_init_pch_refclk() use it.

Signed-off-by: Damien Lespiau <damien.lespiau at intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h      |    2 ++
 drivers/gpu/drm/i915/intel_display.c |   16 ++++++----------
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index a1885c3..70df0c4 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1166,6 +1166,8 @@ struct drm_i915_file_private {
 #define IS_VALLEYVIEW(dev)	(INTEL_INFO(dev)->is_valleyview)
 #define IS_HASWELL(dev)	(INTEL_INFO(dev)->is_haswell)
 #define IS_MOBILE(dev)		(INTEL_INFO(dev)->is_mobile)
+#define IS_SDV(dev)		(IS_HASWELL(dev) && \
+				 ((dev)->pci_device & 0xFF00) == 0x0C00)
 #define IS_ULT(dev)		(IS_HASWELL(dev) && \
 				 ((dev)->pci_device & 0xFF00) == 0x0A00)
 
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 6e6a143..9f5c1dc 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4985,7 +4985,6 @@ static void lpt_init_pch_refclk(struct drm_device *dev)
 	struct drm_mode_config *mode_config = &dev->mode_config;
 	struct intel_encoder *encoder;
 	bool has_vga = false;
-	bool is_sdv = false;
 	u32 tmp;
 
 	list_for_each_entry(encoder, &mode_config->encoder_list, base.head) {
@@ -4999,9 +4998,6 @@ static void lpt_init_pch_refclk(struct drm_device *dev)
 	if (!has_vga)
 		return;
 
-	if (IS_HASWELL(dev) && (dev->pci_device & 0xFF00) == 0x0C00)
-		is_sdv = true;
-
 	tmp = intel_sbi_read(dev_priv, SBI_SSCCTL, SBI_ICLK);
 	tmp &= ~SBI_SSCCTL_DISABLE;
 	tmp |= SBI_SSCCTL_PATHALT;
@@ -5013,7 +5009,7 @@ static void lpt_init_pch_refclk(struct drm_device *dev)
 	tmp &= ~SBI_SSCCTL_PATHALT;
 	intel_sbi_write(dev_priv, SBI_SSCCTL, tmp, SBI_ICLK);
 
-	if (!is_sdv) {
+	if (!IS_SDV(dev)) {
 		tmp = I915_READ(SOUTH_CHICKEN2);
 		tmp |= FDI_MPHY_IOSFSB_RESET_CTL;
 		I915_WRITE(SOUTH_CHICKEN2, tmp);
@@ -5037,14 +5033,14 @@ static void lpt_init_pch_refclk(struct drm_device *dev)
 	tmp |= (0x12 << 24);
 	intel_sbi_write(dev_priv, 0x8008, tmp, SBI_MPHY);
 
-	if (!is_sdv) {
+	if (!IS_SDV(dev)) {
 		tmp = intel_sbi_read(dev_priv, 0x808C, SBI_MPHY);
 		tmp &= ~(0x3 << 6);
 		tmp |= (1 << 6) | (1 << 0);
 		intel_sbi_write(dev_priv, 0x808C, tmp, SBI_MPHY);
 	}
 
-	if (is_sdv) {
+	if (IS_SDV(dev)) {
 		tmp = intel_sbi_read(dev_priv, 0x800C, SBI_MPHY);
 		tmp |= 0x7FFF;
 		intel_sbi_write(dev_priv, 0x800C, tmp, SBI_MPHY);
@@ -5058,7 +5054,7 @@ static void lpt_init_pch_refclk(struct drm_device *dev)
 	tmp |= (1 << 11);
 	intel_sbi_write(dev_priv, 0x2108, tmp, SBI_MPHY);
 
-	if (is_sdv) {
+	if (IS_SDV(dev)) {
 		tmp = intel_sbi_read(dev_priv, 0x2038, SBI_MPHY);
 		tmp |= (0x3F << 24) | (0xF << 20) | (0xF << 16);
 		intel_sbi_write(dev_priv, 0x2038, tmp, SBI_MPHY);
@@ -5084,7 +5080,7 @@ static void lpt_init_pch_refclk(struct drm_device *dev)
 	tmp |= (1 << 24) | (1 << 21) | (1 << 18);
 	intel_sbi_write(dev_priv, 0x216C, tmp, SBI_MPHY);
 
-	if (!is_sdv) {
+	if (!IS_SDV(dev)) {
 		tmp = intel_sbi_read(dev_priv, 0x2080, SBI_MPHY);
 		tmp &= ~(7 << 13);
 		tmp |= (5 << 13);
@@ -5116,7 +5112,7 @@ static void lpt_init_pch_refclk(struct drm_device *dev)
 	tmp |= (0x1C << 16);
 	intel_sbi_write(dev_priv, 0x2198, tmp, SBI_MPHY);
 
-	if (!is_sdv) {
+	if (!IS_SDV(dev)) {
 		tmp = intel_sbi_read(dev_priv, 0x20C4, SBI_MPHY);
 		tmp |= (1 << 27);
 		intel_sbi_write(dev_priv, 0x20C4, tmp, SBI_MPHY);
-- 
1.7.7.5




More information about the Intel-gfx mailing list