From patchwork Fri Nov 16 19:34:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 1757091 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id EB94A3FCDE for ; Fri, 16 Nov 2012 19:33:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DF538E5CC9 for ; Fri, 16 Nov 2012 11:33:25 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-ea0-f177.google.com (mail-ea0-f177.google.com [209.85.215.177]) by gabe.freedesktop.org (Postfix) with ESMTP id C0D70E5C3C for ; Fri, 16 Nov 2012 11:33:14 -0800 (PST) Received: by mail-ea0-f177.google.com with SMTP id n13so1210443eaa.36 for ; Fri, 16 Nov 2012 11:33:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:x-mailer; bh=YUXppehF4zJtMCl8FI97yZe3zBimX6Drd/C9YSoXmOc=; b=JKGB4OFSAyOiVDnYecwSmzv0y8OXDISN9THv/k/kSzgcc1Kl/JbzhZVpa+palh2DMM DYlP6x0439K3I2YE+VP8jPN4K3NnC1yvLXG6TXGknmTiOb2YfjobUJVPm1EudQOHCDBs cB7oVdGoNPy5h4LxdnK/9oWNd5FVAdGg6xlhk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=YUXppehF4zJtMCl8FI97yZe3zBimX6Drd/C9YSoXmOc=; b=QhMQCJ+V/RkXqKHGu8QUyLlYf46Hd3z88CmvLylhOT6LyEUbkRFBRhj3pnOBvjGP+e viNTUEzX0jK7npN0ivghFqwrVZFGsspuXyoEwTlQWC/pLMk/M5Kjx296717DtyI+PW7p kYQH+zRGQG0wFzqwhlQPVYExCDJoa4FR5AVdRR4pzKwSZ9UcvVsXflPuvESxSsrsTU3S yhaqmaJtB51mF6cAM8OdVLw1AfIsqiJTIFIOxrnX0t7YfMyzRruWP8IKNJ47eT4Fzfdd ZxIcL4ezoOymKZnfRiY8vzApLIQ7YXgVXAShBoEGaHsQvus1gD1IEgjq/VyUc9xLUNqR +Izw== Received: by 10.14.174.194 with SMTP id x42mr135385eel.22.1353094393789; Fri, 16 Nov 2012 11:33:13 -0800 (PST) Received: from phenom.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPS id 2sm5334902eef.17.2012.11.16.11.33.12 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 16 Nov 2012 11:33:13 -0800 (PST) From: Daniel Vetter To: Intel Graphics Development Date: Fri, 16 Nov 2012 20:34:29 +0100 Message-Id: <1353094469-13163-1-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.10.4 X-Gm-Message-State: ALoCoQmYZ84D5FG0UghcrDliDjk7ujOlJiM8/ZYi/Z2TJmSE7m1jUa3w1xODSi5+boALfLaxskcF Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH] drm/i915: resurrect panel lid handling X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 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 But disabled by default. This essentially reverts commit bcd5023c961a44c7149936553b6929b2b233dd27 Author: Dave Airlie Date: Mon Mar 14 14:17:55 2011 +1000 drm/i915: disable opregion lid detection for now but leaves the autodetect mode disabled. There's also the explicit lid status option added in commit fca874092597ef946b8f07031d8c31c58b212144 Author: Chris Wilson Date: Thu Feb 17 13:44:48 2011 +0000 drm/i915: Add a module parameter to ignore lid status Which overloaded the meaning for the panel_ignore_lid parameter even more. To fix up this mess, give the non-negative numbers 0,1 the original meaning back and use negative numbers to force a given state. So now we have 1 - disable autodetect, return unknown 0 - enable autodetect -1 - force to disconnected/lid closed -2 - force to connected/lid open v2: My C programmer license has been revoked ... Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=27622 Tested-by: Andreas Sturmlechner Signed-off-by: Daniel Vetter --- drivers/gpu/drm/i915/i915_drv.c | 6 +++--- drivers/gpu/drm/i915/intel_panel.c | 18 +++++++----------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index a3d754d..f5b505a 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -47,11 +47,11 @@ MODULE_PARM_DESC(modeset, unsigned int i915_fbpercrtc __always_unused = 0; module_param_named(fbpercrtc, i915_fbpercrtc, int, 0400); -int i915_panel_ignore_lid __read_mostly = 0; +int i915_panel_ignore_lid __read_mostly = 1; module_param_named(panel_ignore_lid, i915_panel_ignore_lid, int, 0600); MODULE_PARM_DESC(panel_ignore_lid, - "Override lid status (0=autodetect [default], 1=lid open, " - "-1=lid closed)"); + "Override lid status (0=autodetect, 1=autodetect disabled [default], " + "-1=force lid closed, -2=force lid open)"); unsigned int i915_powersave __read_mostly = 1; module_param_named(powersave, i915_powersave, int, 0600); diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 41d4635..4e77a83 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c @@ -275,7 +275,7 @@ static void intel_panel_actually_set_backlight(struct drm_device *dev, u32 level } tmp = I915_READ(BLC_PWM_CTL); - if (INTEL_INFO(dev)->gen < 4) + if (INTEL_INFO(dev)->gen < 4) level <<= 1; tmp &= ~BACKLIGHT_DUTY_CYCLE_MASK; I915_WRITE(BLC_PWM_CTL, tmp | level); @@ -374,24 +374,20 @@ static void intel_panel_init_backlight(struct drm_device *dev) enum drm_connector_status intel_panel_detect(struct drm_device *dev) { -#if 0 struct drm_i915_private *dev_priv = dev->dev_private; -#endif - if (i915_panel_ignore_lid) - return i915_panel_ignore_lid > 0 ? - connector_status_connected : - connector_status_disconnected; + if (i915_panel_ignore_lid == -2) + return connector_status_connected; + else if (i915_panel_ignore_lid == -1) + return connector_status_disconnected; + else if (i915_panel_ignore_lid == 1) + return connector_status_unknown; - /* opregion lid state on HP 2540p is wrong at boot up, - * appears to be either the BIOS or Linux ACPI fault */ -#if 0 /* Assume that the BIOS does not lie through the OpRegion... */ if (dev_priv->opregion.lid_state) return ioread32(dev_priv->opregion.lid_state) & 0x1 ? connector_status_connected : connector_status_disconnected; -#endif return connector_status_unknown; }