From patchwork Sun Apr 17 06:43:33 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 713301 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3H6iO7W004636 for ; Sun, 17 Apr 2011 06:44:44 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B8C359E836 for ; Sat, 16 Apr 2011 23:44:24 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [143.182.124.21]) by gabe.freedesktop.org (Postfix) with ESMTP id D50219E732 for ; Sat, 16 Apr 2011 23:43:38 -0700 (PDT) Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 16 Apr 2011 23:43:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.64,226,1301900400"; d="scan'208";a="420630564" Received: from unknown (HELO cantiga.alporthouse.com) ([10.255.12.206]) by azsmga001.ch.intel.com with ESMTP; 16 Apr 2011 23:43:37 -0700 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Sun, 17 Apr 2011 07:43:33 +0100 Message-Id: <1303022613-18414-2-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1303022613-18414-1-git-send-email-chris@chris-wilson.co.uk> References: <1303022613-18414-1-git-send-email-chris@chris-wilson.co.uk> Cc: Dave Airlied Subject: [Intel-gfx] [PATCH 2/2] drm/i915/lvds: Use i915.lvds_fixed_mode= as a last resort X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sun, 17 Apr 2011 06:44:44 +0000 (UTC) If we can find no other reliable source of panel configuration data, turn to the user and see if they have a passed a mode line (ala video=) through the i915.lvds_fixed_mode= string. Signed-off-by: Chris Wilson Cc: Oliver Seitz Cc: Mike Isely Cc: Dave Airlied --- drivers/gpu/drm/i915/i915_drv.c | 4 +++ drivers/gpu/drm/i915/i915_drv.h | 3 +- drivers/gpu/drm/i915/intel_lvds.c | 46 ++++++++++++++++++++++++++++--------- 3 files changed, 41 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 16a2532..4a618f6 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -67,6 +67,10 @@ module_param_named(vbt_sdvo_panel_type, i915_vbt_sdvo_panel_type, int, 0600); static bool i915_try_reset = true; module_param_named(reset, i915_try_reset, bool, 0600); +char *i915_lvds_fixed_mode; +module_param_named(lvds_fixed_mode, i915_lvds_fixed_mode, charp, 0600); +MODULE_PARM_DESC(lvds_fixed_mode, "specify the mode line for the LVDS panel to be used in the absence of any configuration data, using the video= format"); + unsigned int i915_lvds_24bit = 0; module_param_named(lvds_24bit, i915_lvds_24bit, int, 0600); MODULE_PARM_DESC(lvds_24bit, "LVDS 24 bit pixel format: 0=leave untouched (default), 1=24 bit '2.0' format, 2=24 bit '2.1' format, 3=force older 18 bit format"); diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 2112af3..c6cc4e2 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -977,12 +977,13 @@ extern unsigned int i915_fbpercrtc; extern int i915_panel_ignore_lid; extern unsigned int i915_powersave; extern unsigned int i915_semaphores; +extern char *i915_lvds_fixed_mode; extern unsigned int i915_lvds_channels; +extern unsigned int i915_lvds_24bit; extern unsigned int i915_lvds_downclock; extern unsigned int i915_panel_use_ssc; extern int i915_vbt_sdvo_panel_type; extern unsigned int i915_enable_rc6; -extern unsigned int i915_lvds_24bit; extern int i915_suspend(struct drm_device *dev, pm_message_t state); extern int i915_resume(struct drm_device *dev); diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index a562bd2..32b86ea 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c @@ -924,6 +924,11 @@ bool intel_lvds_init(struct drm_device *dev) * if none of the above, no panel * 4) make sure lid is open * if closed, act like it's not there for now + * + * Finally, we allow the user to specify his own mode. We do this + * last because we want to prevent the user from damaging their + * hardware with a dangerous modeline. Though we may eventually + * be forced to add an override for truly broken machines. */ /* @@ -982,19 +987,38 @@ bool intel_lvds_init(struct drm_device *dev) */ /* Ironlake: FIXME if still fail, not try pipe mode now */ - if (HAS_PCH_SPLIT(dev)) - goto failed; + if (!HAS_PCH_SPLIT(dev)) { + lvds = I915_READ(LVDS); + pipe = (lvds & LVDS_PIPEB_SELECT) ? 1 : 0; + crtc = intel_get_crtc_for_pipe(dev, pipe); + + if (crtc && (lvds & LVDS_PORT_EN)) { + intel_lvds->fixed_mode = intel_crtc_mode_get(dev, crtc); + if (intel_lvds->fixed_mode) { + intel_lvds->fixed_mode->type |= + DRM_MODE_TYPE_PREFERRED; + goto out; + } + } + } - lvds = I915_READ(LVDS); - pipe = (lvds & LVDS_PIPEB_SELECT) ? 1 : 0; - crtc = intel_get_crtc_for_pipe(dev, pipe); + /* No panel cnnfiguration data, and nothing already driving the panel + * at its preferred mode. Check to see if the user provided this vital + * bit of information... + */ + if (i915_lvds_fixed_mode) { + struct drm_cmdline_mode mode; - if (crtc && (lvds & LVDS_PORT_EN)) { - intel_lvds->fixed_mode = intel_crtc_mode_get(dev, crtc); - if (intel_lvds->fixed_mode) { - intel_lvds->fixed_mode->type |= - DRM_MODE_TYPE_PREFERRED; - goto out; + if (drm_mode_parse_command_line_for_connector(i915_lvds_fixed_mode, + connector, + &mode)) { + intel_lvds->fixed_mode = + drm_mode_create_from_cmdline_mode(dev, &mode); + if (intel_lvds->fixed_mode) { + intel_lvds->fixed_mode->type |= + DRM_MODE_TYPE_PREFERRED; + goto out; + } } }