From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: [PATCH 5/8] drm/i915: add intel_lvds->reg
Date: Mon, 5 Nov 2012 13:28:24 +0100 [thread overview]
Message-ID: <1352118507-6933-6-git-send-email-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <1352118507-6933-1-git-send-email-daniel.vetter@ffwll.ch>
To ditch at least some of the PCH_SPLIT ? PCH_LVDS : LVDS code ...
v2: Rebase on top of Jani Nikula's panel rework.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/gpu/drm/i915/intel_lvds.c | 48 ++++++++++++++++-----------------------
1 file changed, 20 insertions(+), 28 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index e4ae3a6..972ef12 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -53,6 +53,7 @@ struct intel_lvds_encoder {
u32 pfit_pgm_ratios;
bool pfit_dirty;
bool is_dual_link;
+ u32 reg;
struct intel_lvds_connector *attached_connector;
};
@@ -72,15 +73,10 @@ static bool intel_lvds_get_hw_state(struct intel_encoder *encoder,
{
struct drm_device *dev = encoder->base.dev;
struct drm_i915_private *dev_priv = dev->dev_private;
- u32 lvds_reg, tmp;
-
- if (HAS_PCH_SPLIT(dev)) {
- lvds_reg = PCH_LVDS;
- } else {
- lvds_reg = LVDS;
- }
+ struct intel_lvds_encoder *lvds_encoder = to_lvds_encoder(&encoder->base);
+ u32 tmp;
- tmp = I915_READ(lvds_reg);
+ tmp = I915_READ(lvds_encoder->reg);
if (!(tmp & LVDS_PORT_EN))
return false;
@@ -102,19 +98,17 @@ static void intel_enable_lvds(struct intel_encoder *encoder)
struct intel_lvds_encoder *lvds_encoder = to_lvds_encoder(&encoder->base);
struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
struct drm_i915_private *dev_priv = dev->dev_private;
- u32 ctl_reg, lvds_reg, stat_reg;
+ u32 ctl_reg, stat_reg;
if (HAS_PCH_SPLIT(dev)) {
ctl_reg = PCH_PP_CONTROL;
- lvds_reg = PCH_LVDS;
stat_reg = PCH_PP_STATUS;
} else {
ctl_reg = PP_CONTROL;
- lvds_reg = LVDS;
stat_reg = PP_STATUS;
}
- I915_WRITE(lvds_reg, I915_READ(lvds_reg) | LVDS_PORT_EN);
+ I915_WRITE(lvds_encoder->reg, I915_READ(lvds_encoder->reg) | LVDS_PORT_EN);
if (lvds_encoder->pfit_dirty) {
/*
@@ -133,7 +127,7 @@ static void intel_enable_lvds(struct intel_encoder *encoder)
}
I915_WRITE(ctl_reg, I915_READ(ctl_reg) | POWER_TARGET_ON);
- POSTING_READ(lvds_reg);
+ POSTING_READ(lvds_encoder->reg);
if (wait_for((I915_READ(stat_reg) & PP_ON) != 0, 1000))
DRM_ERROR("timed out waiting for panel to power on\n");
@@ -145,15 +139,13 @@ static void intel_disable_lvds(struct intel_encoder *encoder)
struct drm_device *dev = encoder->base.dev;
struct intel_lvds_encoder *lvds_encoder = to_lvds_encoder(&encoder->base);
struct drm_i915_private *dev_priv = dev->dev_private;
- u32 ctl_reg, lvds_reg, stat_reg;
+ u32 ctl_reg, stat_reg;
if (HAS_PCH_SPLIT(dev)) {
ctl_reg = PCH_PP_CONTROL;
- lvds_reg = PCH_LVDS;
stat_reg = PCH_PP_STATUS;
} else {
ctl_reg = PP_CONTROL;
- lvds_reg = LVDS;
stat_reg = PP_STATUS;
}
@@ -168,8 +160,8 @@ static void intel_disable_lvds(struct intel_encoder *encoder)
lvds_encoder->pfit_dirty = true;
}
- I915_WRITE(lvds_reg, I915_READ(lvds_reg) & ~LVDS_PORT_EN);
- POSTING_READ(lvds_reg);
+ I915_WRITE(lvds_encoder->reg, I915_READ(lvds_encoder->reg) & ~LVDS_PORT_EN);
+ POSTING_READ(lvds_encoder->reg);
}
static int intel_lvds_mode_valid(struct drm_connector *connector,
@@ -936,17 +928,11 @@ bool is_dual_link_lvds(struct drm_device *dev)
return false;
}
-static bool __is_dual_link_lvds(struct drm_device *dev)
+static bool __is_dual_link_lvds(struct intel_lvds_encoder *lvds_encoder)
{
+ struct drm_device *dev = lvds_encoder->base.base.dev;
unsigned int val;
struct drm_i915_private *dev_priv = dev->dev_private;
- u32 lvds_reg;
-
- if (HAS_PCH_SPLIT(dev)) {
- lvds_reg = PCH_LVDS;
- } else {
- lvds_reg = LVDS;
- }
/* use the module option value if specified */
if (i915_lvds_channel_mode > 0)
@@ -960,7 +946,7 @@ static bool __is_dual_link_lvds(struct drm_device *dev)
* we need to check "the value to be set" in VBT when LVDS
* register is uninitialized.
*/
- val = I915_READ(lvds_reg);
+ val = I915_READ(lvds_encoder->reg);
if (!(val & ~(LVDS_PIPE_MASK | LVDS_DETECTED)))
val = dev_priv->bios_lvds_val;
@@ -1073,6 +1059,12 @@ bool intel_lvds_init(struct drm_device *dev)
connector->interlace_allowed = false;
connector->doublescan_allowed = false;
+ if (HAS_PCH_SPLIT(dev)) {
+ lvds_encoder->reg = PCH_LVDS;
+ } else {
+ lvds_encoder->reg = LVDS;
+ }
+
/* create the scaling mode property */
drm_mode_create_scaling_mode_property(dev);
drm_connector_attach_property(&intel_connector->base,
@@ -1162,7 +1154,7 @@ bool intel_lvds_init(struct drm_device *dev)
goto failed;
out:
- lvds_encoder->is_dual_link = __is_dual_link_lvds(dev);
+ lvds_encoder->is_dual_link = __is_dual_link_lvds(lvds_encoder);
/*
* Unlock registers and just
--
1.7.11.7
next prev parent reply other threads:[~2012-11-05 12:37 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-05 12:28 [PATCH 0/8] lvds cleanup Daniel Vetter
2012-11-05 12:28 ` [PATCH 1/8] drm/i915: add encoder->pre_pll_enable callback Daniel Vetter
2012-11-16 16:05 ` Paulo Zanoni
2012-11-16 16:21 ` Daniel Vetter
2012-11-16 16:59 ` Paulo Zanoni
2012-11-05 12:28 ` [PATCH 2/8] drm/i915: replace ad-hoc dual-link lvds checks Daniel Vetter
2012-11-16 16:37 ` Paulo Zanoni
2012-11-16 16:56 ` Daniel Vetter
2012-11-16 17:07 ` Paulo Zanoni
2012-11-16 17:17 ` Daniel Vetter
2012-11-05 12:28 ` [PATCH 3/8] drm/i915: move is_dual_link_lvds to intel_lvds.c Daniel Vetter
2012-11-16 17:18 ` Paulo Zanoni
2012-11-05 12:28 ` [PATCH 4/8] drm/i915: track is_dual_link in intel_lvds Daniel Vetter
2012-11-16 17:41 ` Paulo Zanoni
2012-11-05 12:28 ` Daniel Vetter [this message]
2012-11-16 17:46 ` [PATCH 5/8] drm/i915: add intel_lvds->reg Paulo Zanoni
2012-11-05 12:28 ` [PATCH 6/8] drm/i915: move intel_update_lvds to intel_lvds->pre_pll_enable Daniel Vetter
2012-11-16 18:07 ` Paulo Zanoni
2012-11-05 12:28 ` [PATCH 7/8] drm/i915: enable intel_lvds->pre_pll_enable for ilk+, too Daniel Vetter
2012-11-16 18:17 ` Paulo Zanoni
2012-11-05 12:28 ` [PATCH 8/8] drm/i915: rip out pre-DDI stuff from haswell_crtc_mode_set Daniel Vetter
2012-11-16 18:28 ` Paulo Zanoni
2012-11-16 18:33 ` Daniel Vetter
2012-11-16 16:09 ` [PATCH 0/8] lvds cleanup Paulo Zanoni
2012-11-20 13:38 ` Daniel Vetter
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=1352118507-6933-6-git-send-email-daniel.vetter@ffwll.ch \
--to=daniel.vetter@ffwll.ch \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox