All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@gmail.com>
To: intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Subject: [PATCH 03/11] drm/i915: split aux_clock_divider logic in a separated function for reuse.
Date: Wed, 26 Jun 2013 18:55:14 -0300	[thread overview]
Message-ID: <1372283722-12988-3-git-send-email-rodrigo.vivi@gmail.com> (raw)
In-Reply-To: <1372283722-12988-1-git-send-email-rodrigo.vivi@gmail.com>

Prep patch for reuse aux_clock_divider with EDP_PSR_AUX_CTL setup.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 58 +++++++++++++++++++++++------------------
 1 file changed, 33 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 709e9d9..5cd276b 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -271,29 +271,12 @@ intel_dp_aux_wait_done(struct intel_dp *intel_dp, bool has_aux_irq)
 	return status;
 }
 
-static int
-intel_dp_aux_ch(struct intel_dp *intel_dp,
-		uint8_t *send, int send_bytes,
-		uint8_t *recv, int recv_size)
+static uint32_t get_aux_clock_divider(struct intel_dp *intel_dp)
 {
 	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
 	struct drm_device *dev = intel_dig_port->base.base.dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	uint32_t ch_ctl = intel_dp->aux_ch_ctl_reg;
-	uint32_t ch_data = ch_ctl + 4;
-	int i, ret, recv_bytes;
-	uint32_t status;
-	uint32_t aux_clock_divider;
-	int try, precharge;
-	bool has_aux_irq = INTEL_INFO(dev)->gen >= 5 && !IS_VALLEYVIEW(dev);
 
-	/* dp aux is extremely sensitive to irq latency, hence request the
-	 * lowest possible wakeup latency and so prevent the cpu from going into
-	 * deep sleep states.
-	 */
-	pm_qos_update_request(&dev_priv->pm_qos, 0);
-
-	intel_dp_check_edp(intel_dp);
 	/* The clock divider is based off the hrawclk,
 	 * and would like to run at 2MHz. So, take the
 	 * hrawclk value and divide by 2 and use that
@@ -302,23 +285,48 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
 	 * clock divider.
 	 */
 	if (IS_VALLEYVIEW(dev)) {
-		aux_clock_divider = 100;
+		return 100;
 	} else if (intel_dig_port->port == PORT_A) {
 		if (HAS_DDI(dev))
-			aux_clock_divider = DIV_ROUND_CLOSEST(
+			return DIV_ROUND_CLOSEST(
 				intel_ddi_get_cdclk_freq(dev_priv), 2000);
 		else if (IS_GEN6(dev) || IS_GEN7(dev))
-			aux_clock_divider = 200; /* SNB & IVB eDP input clock at 400Mhz */
+			return 200; /* SNB & IVB eDP input clock at 400Mhz */
 		else
-			aux_clock_divider = 225; /* eDP input clock at 450Mhz */
+			return 225; /* eDP input clock at 450Mhz */
 	} else if (dev_priv->pch_id == INTEL_PCH_LPT_DEVICE_ID_TYPE) {
 		/* Workaround for non-ULT HSW */
-		aux_clock_divider = 74;
+		return 74;
 	} else if (HAS_PCH_SPLIT(dev)) {
-		aux_clock_divider = DIV_ROUND_UP(intel_pch_rawclk(dev), 2);
+		return DIV_ROUND_UP(intel_pch_rawclk(dev), 2);
 	} else {
-		aux_clock_divider = intel_hrawclk(dev) / 2;
+		return intel_hrawclk(dev) / 2;
 	}
+}
+
+static int
+intel_dp_aux_ch(struct intel_dp *intel_dp,
+		uint8_t *send, int send_bytes,
+		uint8_t *recv, int recv_size)
+{
+	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
+	struct drm_device *dev = intel_dig_port->base.base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	uint32_t ch_ctl = intel_dp->aux_ch_ctl_reg;
+	uint32_t ch_data = ch_ctl + 4;
+	int i, ret, recv_bytes;
+	uint32_t status;
+	uint32_t aux_clock_divider = get_aux_clock_divider(intel_dp);
+	int try, precharge;
+	bool has_aux_irq = INTEL_INFO(dev)->gen >= 5 && !IS_VALLEYVIEW(dev);
+
+	/* dp aux is extremely sensitive to irq latency, hence request the
+	 * lowest possible wakeup latency and so prevent the cpu from going into
+	 * deep sleep states.
+	 */
+	pm_qos_update_request(&dev_priv->pm_qos, 0);
+
+	intel_dp_check_edp(intel_dp);
 
 	if (IS_GEN6(dev))
 		precharge = 3;
-- 
1.8.1.4

  parent reply	other threads:[~2013-06-26 21:55 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-26 21:55 [PATCH 01/11] drm: Added SDP and VSC structures for handling PSR for eDP Rodrigo Vivi
2013-06-26 21:55 ` [PATCH 02/11] drm/i915: Read the EDP DPCD and PSR Capability Rodrigo Vivi
2013-06-28 16:57   ` [PATCH] " Rodrigo Vivi
2013-06-26 21:55 ` Rodrigo Vivi [this message]
2013-06-26 21:55 ` [PATCH 04/11] drm/i915: Enable/Disable PSR Rodrigo Vivi
2013-06-28 17:16   ` [PATCH] " Rodrigo Vivi
2013-06-28 19:31     ` Paulo Zanoni
2013-07-01 20:40       ` Rodrigo Vivi
2013-07-05 21:58         ` Paulo Zanoni
2013-07-05 22:14           ` Daniel Vetter
2013-07-08 22:09           ` Rodrigo Vivi
2013-07-02  0:29       ` Rodrigo Vivi
2013-07-05 22:20         ` Paulo Zanoni
2013-06-26 21:55 ` [PATCH 05/11] drm/i915: Added debugfs support for PSR Status Rodrigo Vivi
2013-06-28 17:29   ` [PATCH] " Rodrigo Vivi
2013-06-28 20:08     ` Paulo Zanoni
2013-06-28 20:14       ` Paulo Zanoni
2013-07-02  0:46         ` Rodrigo Vivi
2013-06-26 21:55 ` [PATCH 06/11] drm/i915: Match all PSR mode entry conditions before enabling it Rodrigo Vivi
2013-06-28 17:36   ` [PATCH] " Rodrigo Vivi
2013-06-28 20:46     ` Paulo Zanoni
2013-07-01 20:47       ` Rodrigo Vivi
2013-07-05 20:32         ` Daniel Vetter
2013-07-08 22:25           ` Rodrigo Vivi
2013-07-11 18:09             ` Rodrigo Vivi
2013-07-02  0:50       ` Rodrigo Vivi
2013-06-26 21:55 ` [PATCH 07/11] drm/i915: add update function to disable/enable-back PSR Rodrigo Vivi
2013-06-28 17:44   ` [PATCH] " Rodrigo Vivi
2013-07-05 22:48     ` Paulo Zanoni
2013-07-08 21:52       ` Rodrigo Vivi
2013-06-26 21:55 ` [PATCH 08/11] drm/intel: add enable_psr module option Rodrigo Vivi
2013-06-28 17:47   ` [PATCH] " Rodrigo Vivi
2013-07-08 12:45     ` Paulo Zanoni
2013-06-26 21:55 ` [PATCH 09/11] drm/i915: Adding global I915_PARAM for PSR ACTIVE Rodrigo Vivi
2013-06-26 22:18   ` Chris Wilson
2013-06-26 23:23     ` [PATCH] drm/i915: Adding global I915_PARAM for PSR ENABLED Rodrigo Vivi
2013-06-27 12:51       ` Rodrigo Vivi
2013-06-26 21:55 ` [PATCH 10/11] drm/i915: Add functions to force psr exit Rodrigo Vivi
2013-06-27 13:03   ` [PATCH] " Rodrigo Vivi
2013-06-28 17:52     ` Rodrigo Vivi
2013-06-28 17:57       ` Chris Wilson
2013-06-28 18:05         ` Rodrigo Vivi
2013-07-08 13:03       ` Paulo Zanoni
2013-07-08 21:48         ` Rodrigo Vivi
2013-06-26 21:55 ` [PATCH 11/11] drm/i915: Hook PSR functionality Rodrigo Vivi
2013-06-28 21:00   ` Paulo Zanoni
2013-07-02  0:52     ` [PATCH] " Rodrigo Vivi
2013-07-08 13:13       ` Paulo Zanoni
2013-07-08 19:46         ` Daniel Vetter
2013-07-08 21:40           ` Rodrigo Vivi
2013-07-11 21:44 [PATCH 00/11] Enable PSR on Haswell Rodrigo Vivi
2013-07-11 21:44 ` [PATCH 03/11] drm/i915: split aux_clock_divider logic in a separated function for reuse Rodrigo Vivi

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=1372283722-12988-3-git-send-email-rodrigo.vivi@gmail.com \
    --to=rodrigo.vivi@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --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.