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: 103911 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o52MC6dF004460 for ; Wed, 2 Jun 2010 22:12:08 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758786Ab0FBWMH (ORCPT ); Wed, 2 Jun 2010 18:12:07 -0400 Received: from adelie.canonical.com ([91.189.90.139]:49463 "EHLO adelie.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758756Ab0FBWMH (ORCPT ); Wed, 2 Jun 2010 18:12:07 -0400 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 Cc: Kamal Mostafa Subject: [RFC PATCH 2/2] drm/i915: override acpi brightness control 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> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.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:12:08 +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)