[RFC PATCH 2/2] drm/i915: override acpi brightness control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/568611

Override acpi brightness control with i915-opregion method.

Signed-off-by: Kamal Mostafa <kamal@xxxxxxxxxxxxx>
---
 drivers/gpu/drm/i915/i915_opregion.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

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)
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux