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