From patchwork Wed Jun 2 22:11:42 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Mostafa X-Patchwork-Id: 103913 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o52MDChF004859 for ; Wed, 2 Jun 2010 22:13:47 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9E7279EECF for ; Wed, 2 Jun 2010 15:13:12 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from adelie.canonical.com (adelie.canonical.com [91.189.90.139]) by gabe.freedesktop.org (Postfix) with ESMTP id CA5E99EECF for ; Wed, 2 Jun 2010 15:12:06 -0700 (PDT) Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1OJwAQ-0004f4-6l; Wed, 02 Jun 2010 23:12:06 +0100 Received: from c-98-234-57-75.hsd1.ca.comcast.net ([98.234.57.75] helo=canonical.com) by hutte.canonical.com with esmtpsa (TLS-1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1OJwAP-0007Pr-JB; Wed, 02 Jun 2010 23:12:06 +0100 From: Kamal Mostafa To: linux-acpi@vger.kernel.org, intel-gfx@lists.freedesktop.org Date: Wed, 2 Jun 2010 15:11:42 -0700 Message-Id: <1275516702-27090-3-git-send-email-kamal@canonical.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1275516702-27090-1-git-send-email-kamal@canonical.com> References: <1275516702-27090-1-git-send-email-kamal@canonical.com> Subject: [Intel-gfx] [RFC PATCH 2/2] drm/i915: override acpi brightness control 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.3 (demeter.kernel.org [140.211.167.41]); Wed, 02 Jun 2010 22:13:47 +0000 (UTC) diff --git a/drivers/gpu/drm/i915/i915_opregion.c b/drivers/gpu/drm/i915/i915_opregion.c index 7cc8410..a69033e 100644 --- a/drivers/gpu/drm/i915/i915_opregion.c +++ b/drivers/gpu/drm/i915/i915_opregion.c @@ -32,6 +32,9 @@ #include "i915_drm.h" #include "i915_drv.h" +unsigned int i915_brightness = 1; +module_param_named(brightness, i915_brightness, int, 0400); + #define PCI_ASLE 0xe4 #define PCI_LBPC 0xf4 #define PCI_ASLS 0xfc @@ -422,6 +425,18 @@ static void intel_didl_outputs(struct drm_device *dev) opregion->acpi->didl[i] = 0; } +static unsigned int i915_set_brightness(void *dev, unsigned int brightness) +{ + /* Nb. brightness value range is 0 to 255. */ + u32 bclp = ASLE_BCLP_VALID | brightness; + struct drm_device *drmdev = dev; + + if (IS_IRONLAKE(drmdev)) + return asle_set_backlight_ironlake(drmdev, bclp); + else + return asle_set_backlight(drmdev, bclp); +} + int intel_opregion_init(struct drm_device *dev, int resume) { struct drm_i915_private *dev_priv = dev->dev_private; @@ -469,6 +484,10 @@ int intel_opregion_init(struct drm_device *dev, int resume) DRM_DEBUG_DRIVER("ASLE supported\n"); opregion->asle = base + OPREGION_ASLE_OFFSET; opregion_enable_asle(dev); + /* Register the i915-based brightness control with ACPI */ + if (!resume && i915_brightness) + acpi_brightness_hook_register("i915", + i915_set_brightness, dev, 255); } if (!resume)