From: Daniel Vetter <daniel@ffwll.ch>
To: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 10/26] drm/i915: split LVDS update code out of i9xx_crtc_mode_set
Date: Sat, 24 Mar 2012 00:04:58 +0100 [thread overview]
Message-ID: <20120323230458.GD29390@phenom.ffwll.local> (raw)
In-Reply-To: <1332452348-8814-11-git-send-email-jbarnes@virtuousgeek.org>
On Thu, Mar 22, 2012 at 02:38:52PM -0700, Jesse Barnes wrote:
> Just to make things clearer and reduce the size of this monstrosity.
>
> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
In-depth review ftw. This time the code looks good, but the call the the
new funtion looks a bit misplaced. See below.
-Daniel
> ---
> drivers/gpu/drm/i915/intel_display.c | 117 ++++++++++++++++++----------------
> 1 files changed, 63 insertions(+), 54 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 84480da..adfa19b 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -5230,6 +5230,62 @@ static void i9xx_update_pll_dividers(struct drm_crtc *crtc,
> }
> }
>
> +static void intel_update_lvds(struct drm_crtc *crtc, intel_clock_t *clock,
> + struct drm_display_mode *adjusted_mode)
> +{
> + 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 temp, lvds_sync = 0;
> +
> + temp = I915_READ(LVDS);
> + temp |= LVDS_PORT_EN | LVDS_A0A2_CLKA_POWER_UP;
> + if (pipe == 1) {
> + temp |= LVDS_PIPEB_SELECT;
> + } else {
> + temp &= ~LVDS_PIPEB_SELECT;
> + }
> + /* set the corresponsding LVDS_BORDER bit */
> + temp |= dev_priv->lvds_border_bits;
> + /* Set the B0-B3 data pairs corresponding to whether we're going to
> + * set the DPLLs for dual-channel mode or not.
> + */
> + if (clock->p2 == 7)
> + temp |= LVDS_B0B3_POWER_UP | LVDS_CLKB_POWER_UP;
> + else
> + temp &= ~(LVDS_B0B3_POWER_UP | LVDS_CLKB_POWER_UP);
> +
> + /* It would be nice to set 24 vs 18-bit mode (LVDS_A3_POWER_UP)
> + * appropriately here, but we need to look more thoroughly into how
> + * panels behave in the two modes.
> + */
> + /* set the dithering flag on LVDS as needed */
> + if (INTEL_INFO(dev)->gen >= 4) {
> + if (dev_priv->lvds_dither)
> + temp |= LVDS_ENABLE_DITHER;
> + else
> + temp &= ~LVDS_ENABLE_DITHER;
> + }
> + if (adjusted_mode->flags & DRM_MODE_FLAG_NHSYNC)
> + lvds_sync |= LVDS_HSYNC_POLARITY;
> + if (adjusted_mode->flags & DRM_MODE_FLAG_NVSYNC)
> + lvds_sync |= LVDS_VSYNC_POLARITY;
> + if ((temp & (LVDS_HSYNC_POLARITY | LVDS_VSYNC_POLARITY))
> + != lvds_sync) {
> + char flags[2] = "-+";
> + DRM_INFO("Changing LVDS panel from "
> + "(%chsync, %cvsync) to (%chsync, %cvsync)\n",
> + flags[!(temp & LVDS_HSYNC_POLARITY)],
> + flags[!(temp & LVDS_VSYNC_POLARITY)],
> + flags[!(lvds_sync & LVDS_HSYNC_POLARITY)],
> + flags[!(lvds_sync & LVDS_VSYNC_POLARITY)]);
> + temp &= ~(LVDS_HSYNC_POLARITY | LVDS_VSYNC_POLARITY);
> + temp |= lvds_sync;
> + }
> + I915_WRITE(LVDS, temp);
> +}
> +
> static void i9xx_update_pll(struct drm_crtc *crtc,
> struct drm_display_mode *mode,
> struct drm_display_mode *adjusted_mode,
> @@ -5305,6 +5361,13 @@ static void i9xx_update_pll(struct drm_crtc *crtc,
> POSTING_READ(DPLL(pipe));
> udelay(150);
>
> + /* The LVDS pin pair needs to be on before the DPLLs are enabled.
> + * This is an exception to the general rule that mode_set doesn't turn
> + * things on.
> + */
> + if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS))
> + intel_update_lvds(crtc, clock, adjusted_mode);
> +
Why is this code now at a different place? Especially since it looks like
this will break my dear old i855gm :(
> if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT))
> intel_dp_set_m_n(crtc, mode, adjusted_mode);
>
> @@ -5414,8 +5477,6 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc,
> struct intel_encoder *encoder;
> const intel_limit_t *limit;
> int ret;
> - u32 temp;
> - u32 lvds_sync = 0;
>
> list_for_each_entry(encoder, &mode_config->encoder_list, base.head) {
> if (encoder->base.crtc != crtc)
> @@ -5515,58 +5576,6 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc,
> DRM_DEBUG_KMS("Mode for pipe %c:\n", pipe == 0 ? 'A' : 'B');
> drm_mode_debug_printmodeline(mode);
>
> - /* The LVDS pin pair needs to be on before the DPLLs are enabled.
> - * This is an exception to the general rule that mode_set doesn't turn
> - * things on.
> - */
> - if (is_lvds) {
> - temp = I915_READ(LVDS);
> - temp |= LVDS_PORT_EN | LVDS_A0A2_CLKA_POWER_UP;
> - if (pipe == 1) {
> - temp |= LVDS_PIPEB_SELECT;
> - } else {
> - temp &= ~LVDS_PIPEB_SELECT;
> - }
> - /* set the corresponsding LVDS_BORDER bit */
> - temp |= dev_priv->lvds_border_bits;
> - /* Set the B0-B3 data pairs corresponding to whether we're going to
> - * set the DPLLs for dual-channel mode or not.
> - */
> - if (clock.p2 == 7)
> - temp |= LVDS_B0B3_POWER_UP | LVDS_CLKB_POWER_UP;
> - else
> - temp &= ~(LVDS_B0B3_POWER_UP | LVDS_CLKB_POWER_UP);
> -
> - /* It would be nice to set 24 vs 18-bit mode (LVDS_A3_POWER_UP)
> - * appropriately here, but we need to look more thoroughly into how
> - * panels behave in the two modes.
> - */
> - /* set the dithering flag on LVDS as needed */
> - if (INTEL_INFO(dev)->gen >= 4) {
> - if (dev_priv->lvds_dither)
> - temp |= LVDS_ENABLE_DITHER;
> - else
> - temp &= ~LVDS_ENABLE_DITHER;
> - }
> - if (adjusted_mode->flags & DRM_MODE_FLAG_NHSYNC)
> - lvds_sync |= LVDS_HSYNC_POLARITY;
> - if (adjusted_mode->flags & DRM_MODE_FLAG_NVSYNC)
> - lvds_sync |= LVDS_VSYNC_POLARITY;
> - if ((temp & (LVDS_HSYNC_POLARITY | LVDS_VSYNC_POLARITY))
> - != lvds_sync) {
> - char flags[2] = "-+";
> - DRM_INFO("Changing LVDS panel from "
> - "(%chsync, %cvsync) to (%chsync, %cvsync)\n",
> - flags[!(temp & LVDS_HSYNC_POLARITY)],
> - flags[!(temp & LVDS_VSYNC_POLARITY)],
> - flags[!(lvds_sync & LVDS_HSYNC_POLARITY)],
> - flags[!(lvds_sync & LVDS_VSYNC_POLARITY)]);
> - temp &= ~(LVDS_HSYNC_POLARITY | LVDS_VSYNC_POLARITY);
> - temp |= lvds_sync;
> - }
> - I915_WRITE(LVDS, temp);
> - }
> -
> if (HAS_PIPE_CXSR(dev)) {
> if (intel_crtc->lowfreq_avail) {
> DRM_DEBUG_KMS("enabling CxSR downclocking\n");
> --
> 1.7.5.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Mail: daniel@ffwll.ch
Mobile: +41 (0)79 365 57 48
next prev parent reply other threads:[~2012-03-23 23:04 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-22 21:38 [RFCv2] ValleyView support Jesse Barnes
2012-03-22 21:38 ` [PATCH 01/26] drm/i915: move NEEDS_FORCE_WAKE to i915_drv.c Jesse Barnes
2012-03-22 22:20 ` Ben Widawsky
2012-03-23 22:46 ` Daniel Vetter
2012-03-22 21:38 ` [PATCH 02/26] drm/i915: re-order GT IIR bit definitions Jesse Barnes
2012-03-22 22:25 ` Ben Widawsky
2012-03-23 22:46 ` Daniel Vetter
2012-03-22 21:38 ` [PATCH 03/26] drm/i915: add ValleyView driver structs and IS_VALLEYVIEW macro Jesse Barnes
2012-03-22 22:31 ` Ben Widawsky
2012-03-22 21:38 ` [PATCH 04/26] drm/i915: ValleyView watermark support Jesse Barnes
2012-03-23 3:29 ` Ben Widawsky
2012-03-23 9:51 ` Daniel Vetter
2012-03-24 2:46 ` Ben Widawsky
2012-03-22 21:38 ` [PATCH 05/26] drm/i915: PLL defines for VLV Jesse Barnes
2012-03-23 3:35 ` Ben Widawsky
2012-03-22 21:38 ` [PATCH 06/26] drm/i915: interrupt bit definitions " Jesse Barnes
2012-03-22 21:38 ` [PATCH 07/26] drm/i915: add ValleyView clock gating init Jesse Barnes
2012-03-22 23:25 ` Ben Widawsky
2012-03-22 21:38 ` [PATCH 08/26] drm/i915: add DPIO read/write functions for ValleyView Jesse Barnes
2012-03-23 4:03 ` Ben Widawsky
2012-03-23 17:29 ` Eugeni Dodonov
2012-03-22 21:38 ` [PATCH 09/26] drm/i915: split PLL update code out of i9xx_crtc_mode_set Jesse Barnes
2012-03-23 4:16 ` Ben Widawsky
2012-03-23 23:00 ` Daniel Vetter
2012-03-22 21:38 ` [PATCH 10/26] drm/i915: split LVDS " Jesse Barnes
2012-03-23 23:04 ` Daniel Vetter [this message]
2012-03-22 21:38 ` [PATCH 11/26] drm/i915: ValleyView mode setting limits and PLL functions Jesse Barnes
2012-03-22 21:38 ` [PATCH 12/26] drm/i915: program drain latency regs on ValleyView Jesse Barnes
2012-03-26 1:50 ` Ben Widawsky
2012-03-22 21:38 ` [PATCH 13/26] drm/i915: Enable DP panel power sequencing for ValleyView Jesse Barnes
2012-03-22 21:38 ` [PATCH 14/26] drm/i915: Enable HDMI on ValleyView Jesse Barnes
2012-03-22 21:38 ` [PATCH 15/26] agp/intel: map more registers for use by the GTT code Jesse Barnes
2012-03-26 2:05 ` Ben Widawsky
2012-03-26 7:06 ` Daniel Vetter
2012-03-22 21:38 ` [PATCH 16/26] agp/intel: add ValleyView AGP driver Jesse Barnes
2012-03-26 2:16 ` Ben Widawsky
2012-03-26 7:08 ` Daniel Vetter
2012-03-26 18:17 ` Ben Widawsky
2012-03-22 21:38 ` [PATCH 17/26] agp/intel: bind " Jesse Barnes
2012-03-22 21:39 ` [PATCH 18/26] drm/i915: add ValleyView specific CRT detect function Jesse Barnes
2012-03-23 17:11 ` Eugeni Dodonov
2012-03-22 21:39 ` [PATCH 19/26] drm/i915: add ValleyView specific force wake get/put functions Jesse Barnes
2012-03-23 17:20 ` Eugeni Dodonov
2012-03-26 18:20 ` Ben Widawsky
2012-03-22 21:39 ` [PATCH 20/26] drm/i915: ValleyView has limited cacheability Jesse Barnes
2012-03-22 23:31 ` Jesse Barnes
2012-03-26 18:34 ` Ben Widawsky
2012-03-26 18:49 ` Daniel Vetter
2012-03-28 17:43 ` Jesse Barnes
2012-03-22 21:39 ` [PATCH 21/26] drm/i915: ValleyView IRQ support Jesse Barnes
2012-03-22 21:39 ` [PATCH 22/26] drm/i915: display regs are at 0x180000 on ValleyView Jesse Barnes
2012-03-22 21:39 ` [PATCH 23/26] drm/i915: check for disabled interrupts " Jesse Barnes
2012-03-22 21:39 ` [PATCH 24/26] drm/i915: add HDMI and DP port enumeration " Jesse Barnes
2012-03-22 21:39 ` [PATCH 25/26] drm/i915: disable turbo on ValleyView for now Jesse Barnes
2012-03-23 17:04 ` Eugeni Dodonov
2012-03-22 21:39 ` [PATCH 26/26] drm/i915: bind driver to ValleyView chipsets Jesse Barnes
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=20120323230458.GD29390@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jbarnes@virtuousgeek.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