From: Chris Wilson Subject: Re: [PATCH] i915: Modify for pineview lvds sync polarity Date: Wed, 15 Dec 2010 15:07:33 +0000 Message-ID: <5b55a1$iv308b@fmsmga002.fm.intel.com> References: <1292355514-17467-1-git-send-email-bfreed@chromium.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTP id D60639E76F for ; Wed, 15 Dec 2010 07:07:36 -0800 (PST) In-Reply-To: <1292355514-17467-1-git-send-email-bfreed@chromium.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: bfreed@chromium.org, jbarnes@virtuousgeek.org, intel-gfx@lists.freedesktop.org Cc: Mark Hayter List-Id: intel-gfx@lists.freedesktop.org I was going to apply this and fix it up, but got stuck at git-am ;-) On Tue, 14 Dec 2010 11:38:34 -0800, bfreed@chromium.org wrote: > + /* Only tested on pineview, should work on IS_9XX */ Yes, according to the docs I've checked so far, this is true for all chipsets (and sharing the same bits). > + if (IS_PINEVIEW(dev)) { > + /* Set sync polarity for case when vbios did not */ > + char curhs, curvs, newhs, newvs; > + curhs = (lvds & LVDS_HSYNC_POLARITY) ? '-' : '+'; > + curvs = (lvds & LVDS_VSYNC_POLARITY) ? '-' : '+'; > + newhs = (adjusted_mode->flags & DRM_MODE_FLAG_NHSYNC) ? > + '-' : '+'; > + newvs = (adjusted_mode->flags & DRM_MODE_FLAG_NVSYNC) ? > + '-' : '+'; This unusual block of code sticks out like a sore thumb. (Admittedly, the whole of intel_display.c is ugly, but we want to try and improve it over time ;-) int lvds_sync = 0; 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 (lvds & (LVDS_HSYNC_POLARITY | LVDS_VSYNC_POLARITY) != lvds_sync) { char flags[2] = "-+"; DRM_INFO("Changing LVDS panel from (%chsync, %cvsync) to " "(%chsync, %cvsync)\n", flags[!(lvds & LVDS_HSYNC_POLARITY)], flags[!(lvds & LVDS_VSYNC_POLARITY)], flags[!(lvds_sync & LVDS_HSYNC_POLARITY)], flags[!(lvds_sync & LVDS_VSYNC_POLARITY)]); lvds &= ~(LVDS_HSYNC_POLARITY | LVDS_VSYNC_POLARITY); lvds |= lvds_sync; } -Chris -- Chris Wilson, Intel Open Source Technology Centre