All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Lespiau <damien.lespiau@gmail.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 1/3] drm/i915: Introduce an IS_SDV() macro
Date: Sat,  8 Dec 2012 18:08:09 +0000	[thread overview]
Message-ID: <1354990091-9629-2-git-send-email-damien.lespiau@gmail.com> (raw)
In-Reply-To: <1354990091-9629-1-git-send-email-damien.lespiau@gmail.com>

From: Damien Lespiau <damien.lespiau@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@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

  reply	other threads:[~2012-12-08 18:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-08 18:08 add lpt_init_pch_refclk bike-sheds Damien Lespiau
2012-12-08 18:08 ` Damien Lespiau [this message]
2012-12-08 18:08 ` [PATCH 2/3] drm/i915: Fix a typo in a lpt_init_pch_refclk() error message Damien Lespiau
2012-12-10  9:40   ` Daniel Vetter
2012-12-08 18:08 ` [PATCH 3/3] drm/i915: Correctly enable CLKOUT_DP for ULT platoforms Damien Lespiau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1354990091-9629-2-git-send-email-damien.lespiau@gmail.com \
    --to=damien.lespiau@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.