updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / kernel26-kamal / patchs-kamal.diff
blobad0b9c1a85dc0e44babf78c240c1c82daaae80d4
1 diff -Naur linux-2.6.39//drivers/acpi/acpi_igd_opregion.c linux-2.6.39-kamal//drivers/acpi/acpi_igd_opregion.c
2 --- linux-2.6.39//drivers/acpi/acpi_igd_opregion.c 1969-12-31 19:00:00.000000000 -0500
3 +++ linux-2.6.39-kamal//drivers/acpi/acpi_igd_opregion.c 2011-06-18 11:52:38.079928407 -0500
4 @@ -0,0 +1,418 @@
5 +/*
6 + * Copyright 2008 Intel Corporation <hong.liu@intel.com>
7 + * Copyright 2008 Red Hat <mjg@redhat.com>
8 + *
9 + * Permission is hereby granted, free of charge, to any person obtaining
10 + * a copy of this software and associated documentation files (the
11 + * "Software"), to deal in the Software without restriction, including
12 + * without limitation the rights to use, copy, modify, merge, publish,
13 + * distribute, sub license, and/or sell copies of the Software, and to
14 + * permit persons to whom the Software is furnished to do so, subject to
15 + * the following conditions:
16 + *
17 + * The above copyright notice and this permission notice (including the
18 + * next paragraph) shall be included in all copies or substantial
19 + * portions of the Software.
20 + *
21 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 + * NON-INFRINGEMENT. IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE
25 + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
26 + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
27 + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28 + * SOFTWARE.
29 + *
30 + */
32 +#include <linux/acpi.h>
33 +#include <linux/acpi_io.h>
34 +#include <acpi/video.h>
35 +#include <acpi/acpi_igd_opregion.h>
36 +#include <drm/drmP.h>
38 +#define PCI_ASLE 0xe4
39 +#define PCI_ASLS 0xfc
41 +#define OPREGION_HEADER_OFFSET 0
42 +#define OPREGION_ACPI_OFFSET 0x100
43 +#define ACPI_CLID 0x01ac /* current lid state indicator */
44 +#define ACPI_CDCK 0x01b0 /* current docking state indicator */
45 +#define OPREGION_SWSCI_OFFSET 0x200
46 +#define OPREGION_ASLE_OFFSET 0x300
47 +#define OPREGION_VBT_OFFSET 0x400
49 +#define OPREGION_SIGNATURE "IntelGraphicsMem"
50 +#define MBOX_ACPI (1<<0)
51 +#define MBOX_SWSCI (1<<1)
52 +#define MBOX_ASLE (1<<2)
54 +/* ASLE irq request bits */
55 +#define ASLE_SET_ALS_ILLUM (1 << 0)
56 +#define ASLE_SET_BACKLIGHT (1 << 1)
57 +#define ASLE_SET_PFIT (1 << 2)
58 +#define ASLE_SET_PWM_FREQ (1 << 3)
59 +#define ASLE_REQ_MSK 0xf
61 +/* response bits of ASLE irq request */
62 +#define ASLE_ALS_ILLUM_FAILED (1<<10)
63 +#define ASLE_BACKLIGHT_FAILED (1<<12)
64 +#define ASLE_PFIT_FAILED (1<<14)
65 +#define ASLE_PWM_FREQ_FAILED (1<<16)
67 +/* ASLE backlight brightness to set */
68 +#define ASLE_BCLP_VALID (1<<31)
69 +#define ASLE_BCLP_MSK (~(1<<31))
71 +/* ASLE panel fitting request */
72 +#define ASLE_PFIT_VALID (1<<31)
73 +#define ASLE_PFIT_CENTER (1<<0)
74 +#define ASLE_PFIT_STRETCH_TEXT (1<<1)
75 +#define ASLE_PFIT_STRETCH_GFX (1<<2)
77 +/* PWM frequency and minimum brightness */
78 +#define ASLE_PFMB_BRIGHTNESS_MASK (0xff)
79 +#define ASLE_PFMB_BRIGHTNESS_VALID (1<<8)
80 +#define ASLE_PFMB_PWM_MASK (0x7ffffe00)
81 +#define ASLE_PFMB_PWM_VALID (1<<31)
83 +#define ASLE_CBLV_VALID (1<<31)
85 +#define ACPI_OTHER_OUTPUT (0<<8)
86 +#define ACPI_VGA_OUTPUT (1<<8)
87 +#define ACPI_TV_OUTPUT (2<<8)
88 +#define ACPI_DIGITAL_OUTPUT (3<<8)
89 +#define ACPI_LVDS_OUTPUT (4<<8)
91 +#ifdef CONFIG_ACPI
92 +/* Disable asle_set_backlight; let userspace manage the backlight. */
93 +static int asle_backlight_enable = 0;
94 +module_param_named(asle_backlight, asle_backlight_enable, int, 0600);
96 +static u32 asle_set_backlight(struct opregion_dev *dev, u32 bclp)
98 + struct opregion_asle *asle = dev->opregion.asle;
99 + u32 max = dev->max_backlight;
101 + if (asle_backlight_enable == 0)
102 + return 0;
104 + if (!(bclp & ASLE_BCLP_VALID))
105 + return ASLE_BACKLIGHT_FAILED;
107 + bclp &= ASLE_BCLP_MSK;
108 + if (bclp > 255)
109 + return ASLE_BACKLIGHT_FAILED;
111 + if (dev->set_backlight)
112 + dev->set_backlight(dev->drm_dev, bclp * max / 255);
114 + asle->cblv = (bclp*0x64)/0xff | ASLE_CBLV_VALID;
116 + return 0;
119 +static u32 asle_set_als_illum(struct opregion_dev *dev, u32 alsi)
121 + if (dev->set_als_illum)
122 + dev->set_als_illum(dev->drm_dev, alsi);
123 + return 0;
126 +static u32 asle_set_pwm_freq(struct opregion_dev *dev, u32 pfmb)
128 + if (pfmb & ASLE_PFMB_PWM_VALID) {
129 + if (dev->set_pwm_freq)
130 + dev->set_pwm_freq(dev->drm_dev, pfmb);
132 + return 0;
135 +static u32 asle_set_pfit(struct opregion_dev *dev, u32 pfit)
137 + if (!(pfit & ASLE_PFIT_VALID))
138 + return ASLE_PFIT_FAILED;
140 + if (dev->set_pfit)
141 + dev->set_pfit(dev->drm_dev, pfit);
143 + return 0;
146 +void igd_opregion_intr(struct opregion_dev *dev)
148 + struct opregion_asle *asle = dev->opregion.asle;
149 + u32 asle_stat = 0;
150 + u32 asle_req;
152 + if (!asle)
153 + return;
155 + asle_req = asle->aslc & ASLE_REQ_MSK;
157 + if (!asle_req) {
158 + DRM_DEBUG_DRIVER("non asle set request??\n");
159 + return;
162 + if (asle_req & ASLE_SET_ALS_ILLUM)
163 + asle_stat |= asle_set_als_illum(dev, asle->alsi);
165 + if (asle_req & ASLE_SET_BACKLIGHT)
166 + asle_stat |= asle_set_backlight(dev, asle->bclp);
168 + if (asle_req & ASLE_SET_PFIT)
169 + asle_stat |= asle_set_pfit(dev, asle->pfit);
171 + if (asle_req & ASLE_SET_PWM_FREQ)
172 + asle_stat |= asle_set_pwm_freq(dev, asle->pfmb);
174 + asle->aslc = asle_stat;
176 +EXPORT_SYMBOL(igd_opregion_intr);
178 +#define ASLE_ALS_EN (1<<0)
179 +#define ASLE_BLC_EN (1<<1)
180 +#define ASLE_PFIT_EN (1<<2)
181 +#define ASLE_PFMB_EN (1<<3)
183 +void igd_opregion_enable_asle(struct opregion_dev *dev)
185 + struct opregion_asle *asle = dev->opregion.asle;
187 + if (asle && dev->enable_asle) {
188 + dev->enable_asle(dev->drm_dev);
190 + asle->tche = ASLE_ALS_EN | ASLE_BLC_EN | ASLE_PFIT_EN |
191 + ASLE_PFMB_EN;
192 + asle->ardy = 1;
195 +EXPORT_SYMBOL(igd_opregion_enable_asle);
197 +#define ACPI_EV_DISPLAY_SWITCH (1<<0)
198 +#define ACPI_EV_LID (1<<1)
199 +#define ACPI_EV_DOCK (1<<2)
201 +static struct igd_opregion *system_opregion;
203 +static int igd_opregion_video_event(struct notifier_block *nb,
204 + unsigned long val, void *data)
206 + /* The only video events relevant to opregion are 0x80. These indicate
207 + either a docking event, lid switch or display switch request. In
208 + Linux, these are handled by the dock, button and video drivers.
209 + We might want to fix the video driver to be opregion-aware in
210 + future, but right now we just indicate to the firmware that the
211 + request has been handled */
213 + struct opregion_acpi *acpi;
215 + if (!system_opregion)
216 + return NOTIFY_DONE;
218 + acpi = system_opregion->acpi;
219 + acpi->csts = 0;
221 + return NOTIFY_OK;
224 +static struct notifier_block igd_opregion_notifier = {
225 + .notifier_call = igd_opregion_video_event,
229 + * Initialise the DIDL field in opregion. This passes a list of devices to
230 + * the firmware. Values are defined by section B.4.2 of the ACPI specification
231 + * (version 3)
232 + */
234 +static void igd_didl_outputs(struct opregion_dev *dev)
236 + struct igd_opregion *opregion = &dev->opregion;
237 + struct drm_connector *connector;
238 + acpi_handle handle;
239 + struct acpi_device *acpi_dev, *acpi_cdev, *acpi_video_bus = NULL;
240 + unsigned long long device_id;
241 + acpi_status status;
242 + int i = 0;
244 + handle = DEVICE_ACPI_HANDLE(&dev->drm_dev->pdev->dev);
245 + if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &acpi_dev)))
246 + return;
248 + if (acpi_is_video_device(acpi_dev))
249 + acpi_video_bus = acpi_dev;
250 + else {
251 + list_for_each_entry(acpi_cdev, &acpi_dev->children, node) {
252 + if (acpi_is_video_device(acpi_cdev)) {
253 + acpi_video_bus = acpi_cdev;
254 + break;
259 + if (!acpi_video_bus) {
260 + printk(KERN_WARNING "No ACPI video bus found\n");
261 + return;
264 + list_for_each_entry(acpi_cdev, &acpi_video_bus->children, node) {
265 + if (i >= 8) {
266 + dev_printk(KERN_ERR, &dev->drm_dev->pdev->dev,
267 + "More than 8 outputs detected\n");
268 + return;
270 + status =
271 + acpi_evaluate_integer(acpi_cdev->handle, "_ADR",
272 + NULL, &device_id);
273 + if (ACPI_SUCCESS(status)) {
274 + if (!device_id)
275 + goto blind_set;
276 + opregion->acpi->didl[i] = (u32)(device_id & 0x0f0f);
277 + i++;
281 +end:
282 + /* If fewer than 8 outputs, the list must be null terminated */
283 + if (i < 8)
284 + opregion->acpi->didl[i] = 0;
285 + return;
287 +blind_set:
288 + i = 0;
289 + list_for_each_entry(connector, &dev->drm_dev->mode_config.connector_list, head) {
290 + int output_type = ACPI_OTHER_OUTPUT;
291 + if (i >= 8) {
292 + dev_printk(KERN_ERR, &dev->drm_dev->pdev->dev,
293 + "More than 8 outputs detected\n");
294 + return;
296 + switch (connector->connector_type) {
297 + case DRM_MODE_CONNECTOR_VGA:
298 + case DRM_MODE_CONNECTOR_DVIA:
299 + output_type = ACPI_VGA_OUTPUT;
300 + break;
301 + case DRM_MODE_CONNECTOR_Composite:
302 + case DRM_MODE_CONNECTOR_SVIDEO:
303 + case DRM_MODE_CONNECTOR_Component:
304 + case DRM_MODE_CONNECTOR_9PinDIN:
305 + output_type = ACPI_TV_OUTPUT;
306 + break;
307 + case DRM_MODE_CONNECTOR_DVII:
308 + case DRM_MODE_CONNECTOR_DVID:
309 + case DRM_MODE_CONNECTOR_DisplayPort:
310 + case DRM_MODE_CONNECTOR_HDMIA:
311 + case DRM_MODE_CONNECTOR_HDMIB:
312 + output_type = ACPI_DIGITAL_OUTPUT;
313 + break;
314 + case DRM_MODE_CONNECTOR_LVDS:
315 + output_type = ACPI_LVDS_OUTPUT;
316 + break;
318 + opregion->acpi->didl[i] |= (1<<31) | output_type | i;
319 + i++;
321 + goto end;
324 +void igd_opregion_init(struct opregion_dev *dev)
326 + struct igd_opregion *opregion = &dev->opregion;
328 + if (!opregion->header)
329 + return;
331 + if (opregion->acpi) {
332 + if (drm_core_check_feature(dev->drm_dev, DRIVER_MODESET))
333 + igd_didl_outputs(dev);
335 + /* Notify BIOS we are ready to handle ACPI video ext notifs.
336 + * Right now, all the events are handled by the ACPI video module.
337 + * We don't actually need to do anything with them. */
338 + opregion->acpi->csts = 0;
339 + opregion->acpi->drdy = 1;
341 + system_opregion = opregion;
342 + register_acpi_notifier(&igd_opregion_notifier);
345 + if (opregion->asle)
346 + dev->enable_asle(dev->drm_dev);
348 +EXPORT_SYMBOL(igd_opregion_init);
350 +void igd_opregion_fini(struct opregion_dev *dev)
352 + struct igd_opregion *opregion = &dev->opregion;
354 + if (!opregion->header)
355 + return;
357 + if (opregion->acpi) {
358 + opregion->acpi->drdy = 0;
360 + system_opregion = NULL;
361 + unregister_acpi_notifier(&igd_opregion_notifier);
364 + /* just clear all opregion memory pointers now */
365 + iounmap(opregion->header);
366 + opregion->header = NULL;
367 + opregion->acpi = NULL;
368 + opregion->swsci = NULL;
369 + opregion->asle = NULL;
370 + opregion->vbt = NULL;
372 +EXPORT_SYMBOL(igd_opregion_fini);
373 +#endif
375 +int igd_opregion_setup(struct opregion_dev *dev)
377 + struct igd_opregion *opregion = &dev->opregion;
378 + void *base;
379 + u32 asls, mboxes;
380 + int err = 0;
382 + pci_read_config_dword(dev->drm_dev->pdev, PCI_ASLS, &asls);
383 + DRM_DEBUG_DRIVER("graphic opregion physical addr: 0x%x\n", asls);
384 + if (asls == 0) {
385 + DRM_DEBUG_DRIVER("ACPI OpRegion not supported!\n");
386 + return -ENOTSUPP;
389 + base = acpi_os_ioremap(asls, OPREGION_SIZE);
390 + if (!base)
391 + return -ENOMEM;
393 + if (memcmp(base, OPREGION_SIGNATURE, 16)) {
394 + DRM_DEBUG_DRIVER("opregion signature mismatch\n");
395 + err = -EINVAL;
396 + goto err_out;
398 + opregion->header = base;
399 + opregion->vbt = base + OPREGION_VBT_OFFSET;
401 + mboxes = opregion->header->mboxes;
402 + if (mboxes & MBOX_ACPI) {
403 + DRM_DEBUG_DRIVER("Public ACPI methods supported\n");
404 + opregion->acpi = base + OPREGION_ACPI_OFFSET;
407 + if (mboxes & MBOX_SWSCI) {
408 + DRM_DEBUG_DRIVER("SWSCI supported\n");
409 + opregion->swsci = base + OPREGION_SWSCI_OFFSET;
411 + if (mboxes & MBOX_ASLE) {
412 + DRM_DEBUG_DRIVER("ASLE supported\n");
413 + opregion->asle = base + OPREGION_ASLE_OFFSET;
416 + return 0;
418 +err_out:
419 + iounmap(base);
420 + return err;
422 +EXPORT_SYMBOL(igd_opregion_setup);
423 diff -Naur linux-2.6.39//drivers/acpi/Kconfig linux-2.6.39-kamal//drivers/acpi/Kconfig
424 --- linux-2.6.39//drivers/acpi/Kconfig 2011-05-18 23:06:34.000000000 -0500
425 +++ linux-2.6.39-kamal//drivers/acpi/Kconfig 2011-06-18 11:29:54.956612976 -0500
426 @@ -382,4 +382,12 @@
428 source "drivers/acpi/apei/Kconfig"
430 +config ACPI_IGD_OPREGION
431 + tristate "ACPI Integrated Graphics Device OpRegion support"
432 + help
433 + This driver adds support for the Intel ACPI Integrated Graphics
434 + Device OpRegion specification, allowing communication between
435 + the firmware and graphics driver on mobile systems with Intel
436 + graphics
438 endif # ACPI
439 diff -Naur linux-2.6.39//drivers/acpi/Kconfig.orig linux-2.6.39-kamal//drivers/acpi/Kconfig.orig
440 --- linux-2.6.39//drivers/acpi/Kconfig.orig 1969-12-31 19:00:00.000000000 -0500
441 +++ linux-2.6.39-kamal//drivers/acpi/Kconfig.orig 2011-05-18 23:06:34.000000000 -0500
442 @@ -0,0 +1,385 @@
444 +# ACPI Configuration
447 +menuconfig ACPI
448 + bool "ACPI (Advanced Configuration and Power Interface) Support"
449 + depends on !IA64_HP_SIM
450 + depends on IA64 || X86
451 + depends on PCI
452 + select PNP
453 + default y
454 + help
455 + Advanced Configuration and Power Interface (ACPI) support for
456 + Linux requires an ACPI-compliant platform (hardware/firmware),
457 + and assumes the presence of OS-directed configuration and power
458 + management (OSPM) software. This option will enlarge your
459 + kernel by about 70K.
461 + Linux ACPI provides a robust functional replacement for several
462 + legacy configuration and power management interfaces, including
463 + the Plug-and-Play BIOS specification (PnP BIOS), the
464 + MultiProcessor Specification (MPS), and the Advanced Power
465 + Management (APM) specification. If both ACPI and APM support
466 + are configured, ACPI is used.
468 + The project home page for the Linux ACPI subsystem is here:
469 + <http://www.lesswatts.org/projects/acpi/>
471 + Linux support for ACPI is based on Intel Corporation's ACPI
472 + Component Architecture (ACPI CA). For more information on the
473 + ACPI CA, see:
474 + <http://acpica.org/>
476 + ACPI is an open industry specification co-developed by
477 + Hewlett-Packard, Intel, Microsoft, Phoenix, and Toshiba.
478 + The specification is available at:
479 + <http://www.acpi.info>
481 +if ACPI
483 +config ACPI_SLEEP
484 + bool
485 + depends on SUSPEND || HIBERNATION
486 + default y
488 +config ACPI_PROCFS
489 + bool "Deprecated /proc/acpi files"
490 + depends on PROC_FS
491 + help
492 + For backwards compatibility, this option allows
493 + deprecated /proc/acpi/ files to exist, even when
494 + they have been replaced by functions in /sys.
496 + This option has no effect on /proc/acpi/ files
497 + and functions which do not yet exist in /sys.
499 + Say N to delete /proc/acpi/ files that have moved to /sys/
501 +config ACPI_PROCFS_POWER
502 + bool "Deprecated power /proc/acpi directories"
503 + depends on PROC_FS
504 + help
505 + For backwards compatibility, this option allows
506 + deprecated power /proc/acpi/ directories to exist, even when
507 + they have been replaced by functions in /sys.
508 + The deprecated directories (and their replacements) include:
509 + /proc/acpi/battery/* (/sys/class/power_supply/*)
510 + /proc/acpi/ac_adapter/* (sys/class/power_supply/*)
511 + This option has no effect on /proc/acpi/ directories
512 + and functions, which do not yet exist in /sys
513 + This option, together with the proc directories, will be
514 + deleted in 2.6.39.
516 + Say N to delete power /proc/acpi/ directories that have moved to /sys/
518 +config ACPI_POWER_METER
519 + tristate "ACPI 4.0 power meter"
520 + depends on HWMON
521 + help
522 + This driver exposes ACPI 4.0 power meters as hardware monitoring
523 + devices. Say Y (or M) if you have a computer with ACPI 4.0 firmware
524 + and a power meter.
526 + To compile this driver as a module, choose M here:
527 + the module will be called power-meter.
529 +config ACPI_EC_DEBUGFS
530 + tristate "EC read/write access through /sys/kernel/debug/ec"
531 + default n
532 + help
533 + Say N to disable Embedded Controller /sys/kernel/debug interface
535 + Be aware that using this interface can confuse your Embedded
536 + Controller in a way that a normal reboot is not enough. You then
537 + have to power off your system, and remove the laptop battery for
538 + some seconds.
539 + An Embedded Controller typically is available on laptops and reads
540 + sensor values like battery state and temperature.
541 + The kernel accesses the EC through ACPI parsed code provided by BIOS
542 + tables. This option allows to access the EC directly without ACPI
543 + code being involved.
544 + Thus this option is a debug option that helps to write ACPI drivers
545 + and can be used to identify ACPI code or EC firmware bugs.
547 +config ACPI_PROC_EVENT
548 + bool "Deprecated /proc/acpi/event support"
549 + depends on PROC_FS
550 + default y
551 + help
552 + A user-space daemon, acpid, typically reads /proc/acpi/event
553 + and handles all ACPI-generated events.
555 + These events are now delivered to user-space either
556 + via the input layer or as netlink events.
558 + This build option enables the old code for legacy
559 + user-space implementation. After some time, this will
560 + be moved under CONFIG_ACPI_PROCFS, and then deleted.
562 + Say Y here to retain the old behaviour. Say N if your
563 + user-space is newer than kernel 2.6.23 (September 2007).
565 +config ACPI_AC
566 + tristate "AC Adapter"
567 + depends on X86
568 + select POWER_SUPPLY
569 + default y
570 + help
571 + This driver supports the AC Adapter object, which indicates
572 + whether a system is on AC or not. If you have a system that can
573 + switch between A/C and battery, say Y.
575 + To compile this driver as a module, choose M here:
576 + the module will be called ac.
578 +config ACPI_BATTERY
579 + tristate "Battery"
580 + depends on X86
581 + select POWER_SUPPLY
582 + default y
583 + help
584 + This driver adds support for battery information through
585 + /proc/acpi/battery. If you have a mobile system with a battery,
586 + say Y.
588 + To compile this driver as a module, choose M here:
589 + the module will be called battery.
591 +config ACPI_BUTTON
592 + tristate "Button"
593 + depends on INPUT
594 + default y
595 + help
596 + This driver handles events on the power, sleep, and lid buttons.
597 + A daemon reads /proc/acpi/event and perform user-defined actions
598 + such as shutting down the system. This is necessary for
599 + software-controlled poweroff.
601 + To compile this driver as a module, choose M here:
602 + the module will be called button.
604 +config ACPI_VIDEO
605 + tristate "Video"
606 + depends on X86 && BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL
607 + depends on INPUT
608 + select THERMAL
609 + help
610 + This driver implements the ACPI Extensions For Display Adapters
611 + for integrated graphics devices on motherboard, as specified in
612 + ACPI 2.0 Specification, Appendix B. This supports basic operations
613 + such as defining the video POST device, retrieving EDID information,
614 + and setting up a video output.
616 + To compile this driver as a module, choose M here:
617 + the module will be called video.
619 +config ACPI_FAN
620 + tristate "Fan"
621 + select THERMAL
622 + default y
623 + help
624 + This driver supports ACPI fan devices, allowing user-mode
625 + applications to perform basic fan control (on, off, status).
627 + To compile this driver as a module, choose M here:
628 + the module will be called fan.
630 +config ACPI_DOCK
631 + bool "Dock"
632 + depends on EXPERIMENTAL
633 + help
634 + This driver supports ACPI-controlled docking stations and removable
635 + drive bays such as the IBM Ultrabay and the Dell Module Bay.
637 +config ACPI_PROCESSOR
638 + tristate "Processor"
639 + select THERMAL
640 + select CPU_IDLE
641 + default y
642 + help
643 + This driver installs ACPI as the idle handler for Linux and uses
644 + ACPI C2 and C3 processor states to save power on systems that
645 + support it. It is required by several flavors of cpufreq
646 + performance-state drivers.
648 + To compile this driver as a module, choose M here:
649 + the module will be called processor.
650 +config ACPI_IPMI
651 + tristate "IPMI"
652 + depends on EXPERIMENTAL && IPMI_SI && IPMI_HANDLER
653 + default n
654 + help
655 + This driver enables the ACPI to access the BMC controller. And it
656 + uses the IPMI request/response message to communicate with BMC
657 + controller, which can be found on on the server.
659 + To compile this driver as a module, choose M here:
660 + the module will be called as acpi_ipmi.
662 +config ACPI_HOTPLUG_CPU
663 + bool
664 + depends on ACPI_PROCESSOR && HOTPLUG_CPU
665 + select ACPI_CONTAINER
666 + default y
668 +config ACPI_PROCESSOR_AGGREGATOR
669 + tristate "Processor Aggregator"
670 + depends on ACPI_PROCESSOR
671 + depends on EXPERIMENTAL
672 + depends on X86
673 + help
674 + ACPI 4.0 defines processor Aggregator, which enables OS to perform
675 + specific processor configuration and control that applies to all
676 + processors in the platform. Currently only logical processor idling
677 + is defined, which is to reduce power consumption. This driver
678 + supports the new device.
680 +config ACPI_THERMAL
681 + tristate "Thermal Zone"
682 + depends on ACPI_PROCESSOR
683 + select THERMAL
684 + default y
685 + help
686 + This driver supports ACPI thermal zones. Most mobile and
687 + some desktop systems support ACPI thermal zones. It is HIGHLY
688 + recommended that this option be enabled, as your processor(s)
689 + may be damaged without it.
691 + To compile this driver as a module, choose M here:
692 + the module will be called thermal.
694 +config ACPI_NUMA
695 + bool "NUMA support"
696 + depends on NUMA
697 + depends on (X86 || IA64)
698 + default y if IA64_GENERIC || IA64_SGI_SN2
700 +config ACPI_CUSTOM_DSDT_FILE
701 + string "Custom DSDT Table file to include"
702 + default ""
703 + depends on !STANDALONE
704 + help
705 + This option supports a custom DSDT by linking it into the kernel.
706 + See Documentation/acpi/dsdt-override.txt
708 + Enter the full path name to the file which includes the AmlCode
709 + declaration.
711 + If unsure, don't enter a file name.
713 +config ACPI_CUSTOM_DSDT
714 + bool
715 + default ACPI_CUSTOM_DSDT_FILE != ""
717 +config ACPI_BLACKLIST_YEAR
718 + int "Disable ACPI for systems before Jan 1st this year" if X86_32
719 + default 0
720 + help
721 + Enter a 4-digit year, e.g., 2001, to disable ACPI by default
722 + on platforms with DMI BIOS date before January 1st that year.
723 + "acpi=force" can be used to override this mechanism.
725 + Enter 0 to disable this mechanism and allow ACPI to
726 + run by default no matter what the year. (default)
728 +config ACPI_DEBUG
729 + bool "Debug Statements"
730 + default n
731 + help
732 + The ACPI subsystem can produce debug output. Saying Y enables this
733 + output and increases the kernel size by around 50K.
735 + Use the acpi.debug_layer and acpi.debug_level kernel command-line
736 + parameters documented in Documentation/acpi/debug.txt and
737 + Documentation/kernel-parameters.txt to control the type and
738 + amount of debug output.
740 +config ACPI_DEBUG_FUNC_TRACE
741 + bool "Additionally enable ACPI function tracing"
742 + default n
743 + depends on ACPI_DEBUG
744 + help
745 + ACPI Debug Statements slow down ACPI processing. Function trace
746 + is about half of the penalty and is rarely useful.
748 +config ACPI_PCI_SLOT
749 + tristate "PCI slot detection driver"
750 + depends on SYSFS
751 + default n
752 + help
753 + This driver creates entries in /sys/bus/pci/slots/ for all PCI
754 + slots in the system. This can help correlate PCI bus addresses,
755 + i.e., segment/bus/device/function tuples, with physical slots in
756 + the system. If you are unsure, say N.
758 + To compile this driver as a module, choose M here:
759 + the module will be called pci_slot.
761 +config X86_PM_TIMER
762 + bool "Power Management Timer Support" if EXPERT
763 + depends on X86
764 + default y
765 + help
766 + The Power Management Timer is available on all ACPI-capable,
767 + in most cases even if ACPI is unusable or blacklisted.
769 + This timing source is not affected by power management features
770 + like aggressive processor idling, throttling, frequency and/or
771 + voltage scaling, unlike the commonly used Time Stamp Counter
772 + (TSC) timing source.
774 + You should nearly always say Y here because many modern
775 + systems require this timer.
777 +config ACPI_CONTAINER
778 + tristate "Container and Module Devices (EXPERIMENTAL)"
779 + depends on EXPERIMENTAL
780 + default (ACPI_HOTPLUG_MEMORY || ACPI_HOTPLUG_CPU || ACPI_HOTPLUG_IO)
781 + help
782 + This driver supports ACPI Container and Module devices (IDs
783 + ACPI0004, PNP0A05, and PNP0A06).
785 + This helps support hotplug of nodes, CPUs, and memory.
787 + To compile this driver as a module, choose M here:
788 + the module will be called container.
790 +config ACPI_HOTPLUG_MEMORY
791 + tristate "Memory Hotplug"
792 + depends on MEMORY_HOTPLUG
793 + default n
794 + help
795 + This driver supports ACPI memory hotplug. The driver
796 + fields notifications on ACPI memory devices (PNP0C80),
797 + which represent memory ranges that may be onlined or
798 + offlined during runtime.
800 + If your hardware and firmware do not support adding or
801 + removing memory devices at runtime, you need not enable
802 + this driver.
804 + To compile this driver as a module, choose M here:
805 + the module will be called acpi_memhotplug.
807 +config ACPI_SBS
808 + tristate "Smart Battery System"
809 + depends on X86
810 + select POWER_SUPPLY
811 + help
812 + This driver supports the Smart Battery System, another
813 + type of access to battery information, found on some laptops.
815 + To compile this driver as a module, choose M here:
816 + the modules will be called sbs and sbshc.
818 +config ACPI_HED
819 + tristate "Hardware Error Device"
820 + help
821 + This driver supports the Hardware Error Device (PNP0C33),
822 + which is used to report some hardware errors notified via
823 + SCI, mainly the corrected errors.
825 +source "drivers/acpi/apei/Kconfig"
827 +endif # ACPI
828 diff -Naur linux-2.6.39//drivers/acpi/Makefile linux-2.6.39-kamal//drivers/acpi/Makefile
829 --- linux-2.6.39//drivers/acpi/Makefile 2011-05-18 23:06:34.000000000 -0500
830 +++ linux-2.6.39-kamal//drivers/acpi/Makefile 2011-06-18 11:29:54.959946309 -0500
831 @@ -62,6 +62,7 @@
832 obj-$(CONFIG_ACPI_POWER_METER) += power_meter.o
833 obj-$(CONFIG_ACPI_HED) += hed.o
834 obj-$(CONFIG_ACPI_EC_DEBUGFS) += ec_sys.o
835 +obj-$(CONFIG_ACPI_IGD_OPREGION) += acpi_igd_opregion.o
837 # processor has its own "processor." module_param namespace
838 processor-y := processor_driver.o processor_throttling.o
839 diff -Naur linux-2.6.39//drivers/acpi/video_detect.c linux-2.6.39-kamal//drivers/acpi/video_detect.c
840 --- linux-2.6.39//drivers/acpi/video_detect.c 2011-05-18 23:06:34.000000000 -0500
841 +++ linux-2.6.39-kamal//drivers/acpi/video_detect.c 2011-06-18 11:52:32.749928477 -0500
842 @@ -42,7 +42,15 @@
843 ACPI_MODULE_NAME("video");
844 #define _COMPONENT ACPI_VIDEO_COMPONENT
846 +#if 0
847 static long acpi_video_support;
848 +#else
850 + * Set "acpi_backlight=vendor" by default to disable acpi_video0 backlight
851 + * interface and allow use of intel_backlight instead.
852 + */
853 +static long acpi_video_support = ACPI_VIDEO_BACKLIGHT_FORCE_VENDOR;
854 +#endif
855 static bool acpi_video_caps_checked;
857 static acpi_status
858 diff -Naur linux-2.6.39//drivers/gpu/drm/i915/i915_debugfs.c linux-2.6.39-kamal//drivers/gpu/drm/i915/i915_debugfs.c
859 --- linux-2.6.39//drivers/gpu/drm/i915/i915_debugfs.c 2011-05-18 23:06:34.000000000 -0500
860 +++ linux-2.6.39-kamal//drivers/gpu/drm/i915/i915_debugfs.c 2011-06-18 11:29:54.993279642 -0500
861 @@ -1129,7 +1129,7 @@
862 struct drm_info_node *node = (struct drm_info_node *) m->private;
863 struct drm_device *dev = node->minor->dev;
864 drm_i915_private_t *dev_priv = dev->dev_private;
865 - struct intel_opregion *opregion = &dev_priv->opregion;
866 + struct igd_opregion *opregion = &dev_priv->opregion_dev.opregion;
867 int ret;
869 ret = mutex_lock_interruptible(&dev->struct_mutex);
870 diff -Naur linux-2.6.39//drivers/gpu/drm/i915/i915_dma.c linux-2.6.39-kamal//drivers/gpu/drm/i915/i915_dma.c
871 --- linux-2.6.39//drivers/gpu/drm/i915/i915_dma.c 2011-05-18 23:06:34.000000000 -0500
872 +++ linux-2.6.39-kamal//drivers/gpu/drm/i915/i915_dma.c 2011-06-18 11:29:54.993279642 -0500
873 @@ -1990,7 +1990,14 @@
874 /* Try to make sure MCHBAR is enabled before poking at it */
875 intel_setup_mchbar(dev);
876 intel_setup_gmbus(dev);
877 - intel_opregion_setup(dev);
879 + if (IS_MOBILE(dev)) {
880 + dev_priv->opregion_dev.max_backlight = intel_panel_get_max_backlight(dev);
881 + dev_priv->opregion_dev.set_backlight = intel_panel_set_backlight;
883 + dev_priv->opregion_dev.enable_asle = intel_enable_asle;
884 + dev_priv->opregion_dev.drm_dev = dev;
885 + igd_opregion_setup(&dev_priv->opregion_dev);
887 /* Make sure the bios did its job and set up vital registers */
888 intel_setup_bios(dev);
889 @@ -2049,7 +2056,7 @@
892 /* Must be done after probing outputs */
893 - intel_opregion_init(dev);
894 + igd_opregion_init(&dev_priv->opregion_dev);
895 acpi_video_register();
897 setup_timer(&dev_priv->hangcheck_timer, i915_hangcheck_elapsed,
898 @@ -2138,7 +2145,7 @@
899 if (dev->pdev->msi_enabled)
900 pci_disable_msi(dev->pdev);
902 - intel_opregion_fini(dev);
903 + igd_opregion_fini(&dev_priv->opregion_dev);
905 if (drm_core_check_feature(dev, DRIVER_MODESET)) {
906 /* Flush any outstanding unpin_work. */
907 diff -Naur linux-2.6.39//drivers/gpu/drm/i915/i915_drv.c linux-2.6.39-kamal//drivers/gpu/drm/i915/i915_drv.c
908 --- linux-2.6.39//drivers/gpu/drm/i915/i915_drv.c 2011-05-18 23:06:34.000000000 -0500
909 +++ linux-2.6.39-kamal//drivers/gpu/drm/i915/i915_drv.c 2011-06-18 11:29:54.993279642 -0500
910 @@ -316,7 +316,7 @@
912 i915_save_state(dev);
914 - intel_opregion_fini(dev);
915 + igd_opregion_fini(&dev_priv->opregion_dev);
917 /* Modeset on resume, not lid events */
918 dev_priv->modeset_on_lid = 0;
919 @@ -366,7 +366,7 @@
922 i915_restore_state(dev);
923 - intel_opregion_setup(dev);
924 + igd_opregion_setup(&dev_priv->opregion_dev);
926 /* KMS EnterVT equivalent */
927 if (drm_core_check_feature(dev, DRIVER_MODESET)) {
928 @@ -386,7 +386,7 @@
929 ironlake_enable_rc6(dev);
932 - intel_opregion_init(dev);
933 + igd_opregion_init(&dev_priv->opregion_dev);
935 dev_priv->modeset_on_lid = 0;
937 diff -Naur linux-2.6.39//drivers/gpu/drm/i915/i915_drv.h linux-2.6.39-kamal//drivers/gpu/drm/i915/i915_drv.h
938 --- linux-2.6.39//drivers/gpu/drm/i915/i915_drv.h 2011-05-18 23:06:34.000000000 -0500
939 +++ linux-2.6.39-kamal//drivers/gpu/drm/i915/i915_drv.h 2011-06-18 11:36:54.996607459 -0500
940 @@ -33,9 +33,11 @@
941 #include "i915_reg.h"
942 #include "intel_bios.h"
943 #include "intel_ringbuffer.h"
944 +#include <linux/backlight.h>
945 #include <linux/io-mapping.h>
946 #include <linux/i2c.h>
947 #include <drm/intel-gtt.h>
948 +#include <acpi/acpi_igd_opregion.h>
950 /* General customization:
952 @@ -102,21 +104,6 @@
953 struct drm_file *file_priv; /* NULL: free, -1: heap, other: real files */
956 -struct opregion_header;
957 -struct opregion_acpi;
958 -struct opregion_swsci;
959 -struct opregion_asle;
961 -struct intel_opregion {
962 - struct opregion_header *header;
963 - struct opregion_acpi *acpi;
964 - struct opregion_swsci *swsci;
965 - struct opregion_asle *asle;
966 - void *vbt;
967 - u32 __iomem *lid_state;
969 -#define OPREGION_SIZE (8*1024)
971 struct intel_overlay;
972 struct intel_overlay_error_state;
974 @@ -322,7 +309,7 @@
975 int cfb_plane;
976 int cfb_y;
978 - struct intel_opregion opregion;
979 + struct opregion_dev opregion_dev;
981 /* overlay */
982 struct intel_overlay *overlay;
983 @@ -673,6 +660,7 @@
984 int child_dev_num;
985 struct child_device_config *child_dev;
986 struct drm_connector *int_lvds_connector;
987 + struct backlight_device *backlight;
989 bool mchbar_need_disable;
991 @@ -1238,22 +1226,6 @@
993 extern void intel_i2c_reset(struct drm_device *dev);
995 -/* intel_opregion.c */
996 -extern int intel_opregion_setup(struct drm_device *dev);
997 -#ifdef CONFIG_ACPI
998 -extern void intel_opregion_init(struct drm_device *dev);
999 -extern void intel_opregion_fini(struct drm_device *dev);
1000 -extern void intel_opregion_asle_intr(struct drm_device *dev);
1001 -extern void intel_opregion_gse_intr(struct drm_device *dev);
1002 -extern void intel_opregion_enable_asle(struct drm_device *dev);
1003 -#else
1004 -static inline void intel_opregion_init(struct drm_device *dev) { return; }
1005 -static inline void intel_opregion_fini(struct drm_device *dev) { return; }
1006 -static inline void intel_opregion_asle_intr(struct drm_device *dev) { return; }
1007 -static inline void intel_opregion_gse_intr(struct drm_device *dev) { return; }
1008 -static inline void intel_opregion_enable_asle(struct drm_device *dev) { return; }
1009 -#endif
1011 /* intel_acpi.c */
1012 #ifdef CONFIG_ACPI
1013 extern void intel_register_dsm_handler(void);
1014 diff -Naur linux-2.6.39//drivers/gpu/drm/i915/i915_irq.c linux-2.6.39-kamal//drivers/gpu/drm/i915/i915_irq.c
1015 --- linux-2.6.39//drivers/gpu/drm/i915/i915_irq.c 2011-05-18 23:06:34.000000000 -0500
1016 +++ linux-2.6.39-kamal//drivers/gpu/drm/i915/i915_irq.c 2011-06-18 11:45:16.816600869 -0500
1017 @@ -496,7 +496,7 @@
1018 notify_ring(dev, &dev_priv->ring[BCS]);
1020 if (de_iir & DE_GSE)
1021 - intel_opregion_gse_intr(dev);
1022 + igd_opregion_intr(&dev_priv->opregion_dev);
1024 if (de_iir & DE_PLANEA_FLIP_DONE) {
1025 intel_prepare_page_flip(dev, 0);
1026 @@ -1205,7 +1205,7 @@
1029 if (blc_event || (iir & I915_ASLE_INTERRUPT))
1030 - intel_opregion_asle_intr(dev);
1031 + igd_opregion_intr(&dev_priv->opregion_dev);
1033 /* With MSI, interrupts are only generated when iir
1034 * transitions from zero to nonzero. If another bit got
1035 @@ -1762,7 +1762,7 @@
1036 I915_WRITE(PORT_HOTPLUG_EN, hotplug_en);
1039 - intel_opregion_enable_asle(dev);
1040 + igd_opregion_enable_asle(&dev_priv->opregion_dev);
1042 return 0;
1044 diff -Naur linux-2.6.39//drivers/gpu/drm/i915/intel_bios.c linux-2.6.39-kamal//drivers/gpu/drm/i915/intel_bios.c
1045 --- linux-2.6.39//drivers/gpu/drm/i915/intel_bios.c 2011-05-18 23:06:34.000000000 -0500
1046 +++ linux-2.6.39-kamal//drivers/gpu/drm/i915/intel_bios.c 2011-06-18 11:29:54.996612975 -0500
1047 @@ -611,15 +611,15 @@
1049 init_vbt_defaults(dev_priv);
1051 - /* XXX Should this validation be moved to intel_opregion.c? */
1052 - if (dev_priv->opregion.vbt) {
1053 - struct vbt_header *vbt = dev_priv->opregion.vbt;
1054 + /* XXX Should this validation be moved to acpi_igd_opregion.c? */
1055 + if (dev_priv->opregion_dev.opregion.vbt) {
1056 + struct vbt_header *vbt = dev_priv->opregion_dev.opregion.vbt;
1057 if (memcmp(vbt->signature, "$VBT", 4) == 0) {
1058 DRM_DEBUG_DRIVER("Using VBT from OpRegion: %20s\n",
1059 vbt->signature);
1060 bdb = (struct bdb_header *)((char *)vbt + vbt->bdb_offset);
1061 } else
1062 - dev_priv->opregion.vbt = NULL;
1063 + dev_priv->opregion_dev.opregion.vbt = NULL;
1066 if (bdb == NULL) {
1067 diff -Naur linux-2.6.39//drivers/gpu/drm/i915/intel_display.c linux-2.6.39-kamal//drivers/gpu/drm/i915/intel_display.c
1068 --- linux-2.6.39//drivers/gpu/drm/i915/intel_display.c 2011-05-18 23:06:34.000000000 -0500
1069 +++ linux-2.6.39-kamal//drivers/gpu/drm/i915/intel_display.c 2011-06-18 11:29:54.999946308 -0500
1070 @@ -6502,8 +6502,6 @@
1071 encoder->base.possible_clones =
1072 intel_encoder_clones(dev, encoder->clone_mask);
1075 - intel_panel_setup_backlight(dev);
1078 static void intel_user_framebuffer_destroy(struct drm_framebuffer *fb)
1079 diff -Naur linux-2.6.39//drivers/gpu/drm/i915/intel_dp.c linux-2.6.39-kamal//drivers/gpu/drm/i915/intel_dp.c
1080 --- linux-2.6.39//drivers/gpu/drm/i915/intel_dp.c 2011-05-18 23:06:34.000000000 -0500
1081 +++ linux-2.6.39-kamal//drivers/gpu/drm/i915/intel_dp.c 2011-06-18 11:29:55.003279641 -0500
1082 @@ -1747,6 +1747,11 @@
1083 static void
1084 intel_dp_destroy (struct drm_connector *connector)
1086 + struct intel_dp *intel_dp = intel_attached_dp(connector);
1088 + if (is_edp(intel_dp))
1089 + intel_panel_destroy_backlight(connector);
1091 drm_sysfs_connector_remove(connector);
1092 drm_connector_cleanup(connector);
1093 kfree(connector);
1094 @@ -1989,6 +1994,7 @@
1095 DRM_MODE_TYPE_PREFERRED;
1098 + intel_panel_setup_backlight(connector);
1101 intel_dp_add_properties(intel_dp, connector);
1102 diff -Naur linux-2.6.39//drivers/gpu/drm/i915/intel_drv.h linux-2.6.39-kamal//drivers/gpu/drm/i915/intel_drv.h
1103 --- linux-2.6.39//drivers/gpu/drm/i915/intel_drv.h 2011-05-18 23:06:34.000000000 -0500
1104 +++ linux-2.6.39-kamal//drivers/gpu/drm/i915/intel_drv.h 2011-06-18 11:29:55.003279641 -0500
1105 @@ -266,7 +266,8 @@
1106 extern u32 intel_panel_get_max_backlight(struct drm_device *dev);
1107 extern u32 intel_panel_get_backlight(struct drm_device *dev);
1108 extern void intel_panel_set_backlight(struct drm_device *dev, u32 level);
1109 -extern void intel_panel_setup_backlight(struct drm_device *dev);
1110 +extern int intel_panel_setup_backlight(struct drm_connector *dev);
1111 +extern void intel_panel_destroy_backlight(struct drm_connector *dev);
1112 extern void intel_panel_enable_backlight(struct drm_device *dev);
1113 extern void intel_panel_disable_backlight(struct drm_device *dev);
1114 extern enum drm_connector_status intel_panel_detect(struct drm_device *dev);
1115 diff -Naur linux-2.6.39//drivers/gpu/drm/i915/intel_lvds.c linux-2.6.39-kamal//drivers/gpu/drm/i915/intel_lvds.c
1116 --- linux-2.6.39//drivers/gpu/drm/i915/intel_lvds.c 2011-05-18 23:06:34.000000000 -0500
1117 +++ linux-2.6.39-kamal//drivers/gpu/drm/i915/intel_lvds.c 2011-06-18 11:29:55.003279641 -0500
1118 @@ -584,6 +584,9 @@
1120 if (dev_priv->lid_notifier.notifier_call)
1121 acpi_lid_notifier_unregister(&dev_priv->lid_notifier);
1123 + intel_panel_destroy_backlight(connector);
1125 drm_sysfs_connector_remove(connector);
1126 drm_connector_cleanup(connector);
1127 kfree(connector);
1128 @@ -825,7 +828,7 @@
1129 * additional data. Trust that if the VBT was written into
1130 * the OpRegion then they have validated the LVDS's existence.
1132 - if (dev_priv->opregion.vbt)
1133 + if (dev_priv->opregion_dev.opregion.vbt)
1134 return true;
1137 @@ -1033,6 +1036,9 @@
1138 /* keep the LVDS connector */
1139 dev_priv->int_lvds_connector = connector;
1140 drm_sysfs_connector_add(connector);
1142 + intel_panel_setup_backlight(connector);
1144 return true;
1146 failed:
1147 diff -Naur linux-2.6.39//drivers/gpu/drm/i915/intel_opregion.c linux-2.6.39-kamal//drivers/gpu/drm/i915/intel_opregion.c
1148 --- linux-2.6.39//drivers/gpu/drm/i915/intel_opregion.c 2011-05-18 23:06:34.000000000 -0500
1149 +++ linux-2.6.39-kamal//drivers/gpu/drm/i915/intel_opregion.c 1969-12-31 19:00:00.000000000 -0500
1150 @@ -1,516 +0,0 @@
1152 - * Copyright 2008 Intel Corporation <hong.liu@intel.com>
1153 - * Copyright 2008 Red Hat <mjg@redhat.com>
1155 - * Permission is hereby granted, free of charge, to any person obtaining
1156 - * a copy of this software and associated documentation files (the
1157 - * "Software"), to deal in the Software without restriction, including
1158 - * without limitation the rights to use, copy, modify, merge, publish,
1159 - * distribute, sub license, and/or sell copies of the Software, and to
1160 - * permit persons to whom the Software is furnished to do so, subject to
1161 - * the following conditions:
1163 - * The above copyright notice and this permission notice (including the
1164 - * next paragraph) shall be included in all copies or substantial
1165 - * portions of the Software.
1167 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1168 - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1169 - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
1170 - * NON-INFRINGEMENT. IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE
1171 - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
1172 - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1173 - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1174 - * SOFTWARE.
1176 - */
1178 -#include <linux/acpi.h>
1179 -#include <linux/acpi_io.h>
1180 -#include <acpi/video.h>
1182 -#include "drmP.h"
1183 -#include "i915_drm.h"
1184 -#include "i915_drv.h"
1185 -#include "intel_drv.h"
1187 -#define PCI_ASLE 0xe4
1188 -#define PCI_ASLS 0xfc
1190 -#define OPREGION_HEADER_OFFSET 0
1191 -#define OPREGION_ACPI_OFFSET 0x100
1192 -#define ACPI_CLID 0x01ac /* current lid state indicator */
1193 -#define ACPI_CDCK 0x01b0 /* current docking state indicator */
1194 -#define OPREGION_SWSCI_OFFSET 0x200
1195 -#define OPREGION_ASLE_OFFSET 0x300
1196 -#define OPREGION_VBT_OFFSET 0x400
1198 -#define OPREGION_SIGNATURE "IntelGraphicsMem"
1199 -#define MBOX_ACPI (1<<0)
1200 -#define MBOX_SWSCI (1<<1)
1201 -#define MBOX_ASLE (1<<2)
1203 -struct opregion_header {
1204 - u8 signature[16];
1205 - u32 size;
1206 - u32 opregion_ver;
1207 - u8 bios_ver[32];
1208 - u8 vbios_ver[16];
1209 - u8 driver_ver[16];
1210 - u32 mboxes;
1211 - u8 reserved[164];
1212 -} __attribute__((packed));
1214 -/* OpRegion mailbox #1: public ACPI methods */
1215 -struct opregion_acpi {
1216 - u32 drdy; /* driver readiness */
1217 - u32 csts; /* notification status */
1218 - u32 cevt; /* current event */
1219 - u8 rsvd1[20];
1220 - u32 didl[8]; /* supported display devices ID list */
1221 - u32 cpdl[8]; /* currently presented display list */
1222 - u32 cadl[8]; /* currently active display list */
1223 - u32 nadl[8]; /* next active devices list */
1224 - u32 aslp; /* ASL sleep time-out */
1225 - u32 tidx; /* toggle table index */
1226 - u32 chpd; /* current hotplug enable indicator */
1227 - u32 clid; /* current lid state*/
1228 - u32 cdck; /* current docking state */
1229 - u32 sxsw; /* Sx state resume */
1230 - u32 evts; /* ASL supported events */
1231 - u32 cnot; /* current OS notification */
1232 - u32 nrdy; /* driver status */
1233 - u8 rsvd2[60];
1234 -} __attribute__((packed));
1236 -/* OpRegion mailbox #2: SWSCI */
1237 -struct opregion_swsci {
1238 - u32 scic; /* SWSCI command|status|data */
1239 - u32 parm; /* command parameters */
1240 - u32 dslp; /* driver sleep time-out */
1241 - u8 rsvd[244];
1242 -} __attribute__((packed));
1244 -/* OpRegion mailbox #3: ASLE */
1245 -struct opregion_asle {
1246 - u32 ardy; /* driver readiness */
1247 - u32 aslc; /* ASLE interrupt command */
1248 - u32 tche; /* technology enabled indicator */
1249 - u32 alsi; /* current ALS illuminance reading */
1250 - u32 bclp; /* backlight brightness to set */
1251 - u32 pfit; /* panel fitting state */
1252 - u32 cblv; /* current brightness level */
1253 - u16 bclm[20]; /* backlight level duty cycle mapping table */
1254 - u32 cpfm; /* current panel fitting mode */
1255 - u32 epfm; /* enabled panel fitting modes */
1256 - u8 plut[74]; /* panel LUT and identifier */
1257 - u32 pfmb; /* PWM freq and min brightness */
1258 - u8 rsvd[102];
1259 -} __attribute__((packed));
1261 -/* ASLE irq request bits */
1262 -#define ASLE_SET_ALS_ILLUM (1 << 0)
1263 -#define ASLE_SET_BACKLIGHT (1 << 1)
1264 -#define ASLE_SET_PFIT (1 << 2)
1265 -#define ASLE_SET_PWM_FREQ (1 << 3)
1266 -#define ASLE_REQ_MSK 0xf
1268 -/* response bits of ASLE irq request */
1269 -#define ASLE_ALS_ILLUM_FAILED (1<<10)
1270 -#define ASLE_BACKLIGHT_FAILED (1<<12)
1271 -#define ASLE_PFIT_FAILED (1<<14)
1272 -#define ASLE_PWM_FREQ_FAILED (1<<16)
1274 -/* ASLE backlight brightness to set */
1275 -#define ASLE_BCLP_VALID (1<<31)
1276 -#define ASLE_BCLP_MSK (~(1<<31))
1278 -/* ASLE panel fitting request */
1279 -#define ASLE_PFIT_VALID (1<<31)
1280 -#define ASLE_PFIT_CENTER (1<<0)
1281 -#define ASLE_PFIT_STRETCH_TEXT (1<<1)
1282 -#define ASLE_PFIT_STRETCH_GFX (1<<2)
1284 -/* PWM frequency and minimum brightness */
1285 -#define ASLE_PFMB_BRIGHTNESS_MASK (0xff)
1286 -#define ASLE_PFMB_BRIGHTNESS_VALID (1<<8)
1287 -#define ASLE_PFMB_PWM_MASK (0x7ffffe00)
1288 -#define ASLE_PFMB_PWM_VALID (1<<31)
1290 -#define ASLE_CBLV_VALID (1<<31)
1292 -#define ACPI_OTHER_OUTPUT (0<<8)
1293 -#define ACPI_VGA_OUTPUT (1<<8)
1294 -#define ACPI_TV_OUTPUT (2<<8)
1295 -#define ACPI_DIGITAL_OUTPUT (3<<8)
1296 -#define ACPI_LVDS_OUTPUT (4<<8)
1298 -#ifdef CONFIG_ACPI
1299 -static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
1301 - struct drm_i915_private *dev_priv = dev->dev_private;
1302 - struct opregion_asle *asle = dev_priv->opregion.asle;
1303 - u32 max;
1305 - if (!(bclp & ASLE_BCLP_VALID))
1306 - return ASLE_BACKLIGHT_FAILED;
1308 - bclp &= ASLE_BCLP_MSK;
1309 - if (bclp > 255)
1310 - return ASLE_BACKLIGHT_FAILED;
1312 - max = intel_panel_get_max_backlight(dev);
1313 - intel_panel_set_backlight(dev, bclp * max / 255);
1314 - asle->cblv = (bclp*0x64)/0xff | ASLE_CBLV_VALID;
1316 - return 0;
1319 -static u32 asle_set_als_illum(struct drm_device *dev, u32 alsi)
1321 - /* alsi is the current ALS reading in lux. 0 indicates below sensor
1322 - range, 0xffff indicates above sensor range. 1-0xfffe are valid */
1323 - return 0;
1326 -static u32 asle_set_pwm_freq(struct drm_device *dev, u32 pfmb)
1328 - struct drm_i915_private *dev_priv = dev->dev_private;
1329 - if (pfmb & ASLE_PFMB_PWM_VALID) {
1330 - u32 blc_pwm_ctl = I915_READ(BLC_PWM_CTL);
1331 - u32 pwm = pfmb & ASLE_PFMB_PWM_MASK;
1332 - blc_pwm_ctl &= BACKLIGHT_DUTY_CYCLE_MASK;
1333 - pwm = pwm >> 9;
1334 - /* FIXME - what do we do with the PWM? */
1336 - return 0;
1339 -static u32 asle_set_pfit(struct drm_device *dev, u32 pfit)
1341 - /* Panel fitting is currently controlled by the X code, so this is a
1342 - noop until modesetting support works fully */
1343 - if (!(pfit & ASLE_PFIT_VALID))
1344 - return ASLE_PFIT_FAILED;
1345 - return 0;
1348 -void intel_opregion_asle_intr(struct drm_device *dev)
1350 - struct drm_i915_private *dev_priv = dev->dev_private;
1351 - struct opregion_asle *asle = dev_priv->opregion.asle;
1352 - u32 asle_stat = 0;
1353 - u32 asle_req;
1355 - if (!asle)
1356 - return;
1358 - asle_req = asle->aslc & ASLE_REQ_MSK;
1360 - if (!asle_req) {
1361 - DRM_DEBUG_DRIVER("non asle set request??\n");
1362 - return;
1365 - if (asle_req & ASLE_SET_ALS_ILLUM)
1366 - asle_stat |= asle_set_als_illum(dev, asle->alsi);
1368 - if (asle_req & ASLE_SET_BACKLIGHT)
1369 - asle_stat |= asle_set_backlight(dev, asle->bclp);
1371 - if (asle_req & ASLE_SET_PFIT)
1372 - asle_stat |= asle_set_pfit(dev, asle->pfit);
1374 - if (asle_req & ASLE_SET_PWM_FREQ)
1375 - asle_stat |= asle_set_pwm_freq(dev, asle->pfmb);
1377 - asle->aslc = asle_stat;
1380 -/* Only present on Ironlake+ */
1381 -void intel_opregion_gse_intr(struct drm_device *dev)
1383 - struct drm_i915_private *dev_priv = dev->dev_private;
1384 - struct opregion_asle *asle = dev_priv->opregion.asle;
1385 - u32 asle_stat = 0;
1386 - u32 asle_req;
1388 - if (!asle)
1389 - return;
1391 - asle_req = asle->aslc & ASLE_REQ_MSK;
1393 - if (!asle_req) {
1394 - DRM_DEBUG_DRIVER("non asle set request??\n");
1395 - return;
1398 - if (asle_req & ASLE_SET_ALS_ILLUM) {
1399 - DRM_DEBUG_DRIVER("Illum is not supported\n");
1400 - asle_stat |= ASLE_ALS_ILLUM_FAILED;
1403 - if (asle_req & ASLE_SET_BACKLIGHT)
1404 - asle_stat |= asle_set_backlight(dev, asle->bclp);
1406 - if (asle_req & ASLE_SET_PFIT) {
1407 - DRM_DEBUG_DRIVER("Pfit is not supported\n");
1408 - asle_stat |= ASLE_PFIT_FAILED;
1411 - if (asle_req & ASLE_SET_PWM_FREQ) {
1412 - DRM_DEBUG_DRIVER("PWM freq is not supported\n");
1413 - asle_stat |= ASLE_PWM_FREQ_FAILED;
1416 - asle->aslc = asle_stat;
1418 -#define ASLE_ALS_EN (1<<0)
1419 -#define ASLE_BLC_EN (1<<1)
1420 -#define ASLE_PFIT_EN (1<<2)
1421 -#define ASLE_PFMB_EN (1<<3)
1423 -void intel_opregion_enable_asle(struct drm_device *dev)
1425 - struct drm_i915_private *dev_priv = dev->dev_private;
1426 - struct opregion_asle *asle = dev_priv->opregion.asle;
1428 - if (asle) {
1429 - if (IS_MOBILE(dev))
1430 - intel_enable_asle(dev);
1432 - asle->tche = ASLE_ALS_EN | ASLE_BLC_EN | ASLE_PFIT_EN |
1433 - ASLE_PFMB_EN;
1434 - asle->ardy = 1;
1438 -#define ACPI_EV_DISPLAY_SWITCH (1<<0)
1439 -#define ACPI_EV_LID (1<<1)
1440 -#define ACPI_EV_DOCK (1<<2)
1442 -static struct intel_opregion *system_opregion;
1444 -static int intel_opregion_video_event(struct notifier_block *nb,
1445 - unsigned long val, void *data)
1447 - /* The only video events relevant to opregion are 0x80. These indicate
1448 - either a docking event, lid switch or display switch request. In
1449 - Linux, these are handled by the dock, button and video drivers.
1450 - We might want to fix the video driver to be opregion-aware in
1451 - future, but right now we just indicate to the firmware that the
1452 - request has been handled */
1454 - struct opregion_acpi *acpi;
1456 - if (!system_opregion)
1457 - return NOTIFY_DONE;
1459 - acpi = system_opregion->acpi;
1460 - acpi->csts = 0;
1462 - return NOTIFY_OK;
1465 -static struct notifier_block intel_opregion_notifier = {
1466 - .notifier_call = intel_opregion_video_event,
1470 - * Initialise the DIDL field in opregion. This passes a list of devices to
1471 - * the firmware. Values are defined by section B.4.2 of the ACPI specification
1472 - * (version 3)
1473 - */
1475 -static void intel_didl_outputs(struct drm_device *dev)
1477 - struct drm_i915_private *dev_priv = dev->dev_private;
1478 - struct intel_opregion *opregion = &dev_priv->opregion;
1479 - struct drm_connector *connector;
1480 - acpi_handle handle;
1481 - struct acpi_device *acpi_dev, *acpi_cdev, *acpi_video_bus = NULL;
1482 - unsigned long long device_id;
1483 - acpi_status status;
1484 - int i = 0;
1486 - handle = DEVICE_ACPI_HANDLE(&dev->pdev->dev);
1487 - if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &acpi_dev)))
1488 - return;
1490 - if (acpi_is_video_device(acpi_dev))
1491 - acpi_video_bus = acpi_dev;
1492 - else {
1493 - list_for_each_entry(acpi_cdev, &acpi_dev->children, node) {
1494 - if (acpi_is_video_device(acpi_cdev)) {
1495 - acpi_video_bus = acpi_cdev;
1496 - break;
1501 - if (!acpi_video_bus) {
1502 - printk(KERN_WARNING "No ACPI video bus found\n");
1503 - return;
1506 - list_for_each_entry(acpi_cdev, &acpi_video_bus->children, node) {
1507 - if (i >= 8) {
1508 - dev_printk (KERN_ERR, &dev->pdev->dev,
1509 - "More than 8 outputs detected\n");
1510 - return;
1512 - status =
1513 - acpi_evaluate_integer(acpi_cdev->handle, "_ADR",
1514 - NULL, &device_id);
1515 - if (ACPI_SUCCESS(status)) {
1516 - if (!device_id)
1517 - goto blind_set;
1518 - opregion->acpi->didl[i] = (u32)(device_id & 0x0f0f);
1519 - i++;
1523 -end:
1524 - /* If fewer than 8 outputs, the list must be null terminated */
1525 - if (i < 8)
1526 - opregion->acpi->didl[i] = 0;
1527 - return;
1529 -blind_set:
1530 - i = 0;
1531 - list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
1532 - int output_type = ACPI_OTHER_OUTPUT;
1533 - if (i >= 8) {
1534 - dev_printk (KERN_ERR, &dev->pdev->dev,
1535 - "More than 8 outputs detected\n");
1536 - return;
1538 - switch (connector->connector_type) {
1539 - case DRM_MODE_CONNECTOR_VGA:
1540 - case DRM_MODE_CONNECTOR_DVIA:
1541 - output_type = ACPI_VGA_OUTPUT;
1542 - break;
1543 - case DRM_MODE_CONNECTOR_Composite:
1544 - case DRM_MODE_CONNECTOR_SVIDEO:
1545 - case DRM_MODE_CONNECTOR_Component:
1546 - case DRM_MODE_CONNECTOR_9PinDIN:
1547 - output_type = ACPI_TV_OUTPUT;
1548 - break;
1549 - case DRM_MODE_CONNECTOR_DVII:
1550 - case DRM_MODE_CONNECTOR_DVID:
1551 - case DRM_MODE_CONNECTOR_DisplayPort:
1552 - case DRM_MODE_CONNECTOR_HDMIA:
1553 - case DRM_MODE_CONNECTOR_HDMIB:
1554 - output_type = ACPI_DIGITAL_OUTPUT;
1555 - break;
1556 - case DRM_MODE_CONNECTOR_LVDS:
1557 - output_type = ACPI_LVDS_OUTPUT;
1558 - break;
1560 - opregion->acpi->didl[i] |= (1<<31) | output_type | i;
1561 - i++;
1563 - goto end;
1566 -void intel_opregion_init(struct drm_device *dev)
1568 - struct drm_i915_private *dev_priv = dev->dev_private;
1569 - struct intel_opregion *opregion = &dev_priv->opregion;
1571 - if (!opregion->header)
1572 - return;
1574 - if (opregion->acpi) {
1575 - if (drm_core_check_feature(dev, DRIVER_MODESET))
1576 - intel_didl_outputs(dev);
1578 - /* Notify BIOS we are ready to handle ACPI video ext notifs.
1579 - * Right now, all the events are handled by the ACPI video module.
1580 - * We don't actually need to do anything with them. */
1581 - opregion->acpi->csts = 0;
1582 - opregion->acpi->drdy = 1;
1584 - system_opregion = opregion;
1585 - register_acpi_notifier(&intel_opregion_notifier);
1588 - if (opregion->asle)
1589 - intel_opregion_enable_asle(dev);
1592 -void intel_opregion_fini(struct drm_device *dev)
1594 - struct drm_i915_private *dev_priv = dev->dev_private;
1595 - struct intel_opregion *opregion = &dev_priv->opregion;
1597 - if (!opregion->header)
1598 - return;
1600 - if (opregion->acpi) {
1601 - opregion->acpi->drdy = 0;
1603 - system_opregion = NULL;
1604 - unregister_acpi_notifier(&intel_opregion_notifier);
1607 - /* just clear all opregion memory pointers now */
1608 - iounmap(opregion->header);
1609 - opregion->header = NULL;
1610 - opregion->acpi = NULL;
1611 - opregion->swsci = NULL;
1612 - opregion->asle = NULL;
1613 - opregion->vbt = NULL;
1615 -#endif
1617 -int intel_opregion_setup(struct drm_device *dev)
1619 - struct drm_i915_private *dev_priv = dev->dev_private;
1620 - struct intel_opregion *opregion = &dev_priv->opregion;
1621 - void *base;
1622 - u32 asls, mboxes;
1623 - int err = 0;
1625 - pci_read_config_dword(dev->pdev, PCI_ASLS, &asls);
1626 - DRM_DEBUG_DRIVER("graphic opregion physical addr: 0x%x\n", asls);
1627 - if (asls == 0) {
1628 - DRM_DEBUG_DRIVER("ACPI OpRegion not supported!\n");
1629 - return -ENOTSUPP;
1632 - base = acpi_os_ioremap(asls, OPREGION_SIZE);
1633 - if (!base)
1634 - return -ENOMEM;
1636 - if (memcmp(base, OPREGION_SIGNATURE, 16)) {
1637 - DRM_DEBUG_DRIVER("opregion signature mismatch\n");
1638 - err = -EINVAL;
1639 - goto err_out;
1641 - opregion->header = base;
1642 - opregion->vbt = base + OPREGION_VBT_OFFSET;
1644 - opregion->lid_state = base + ACPI_CLID;
1646 - mboxes = opregion->header->mboxes;
1647 - if (mboxes & MBOX_ACPI) {
1648 - DRM_DEBUG_DRIVER("Public ACPI methods supported\n");
1649 - opregion->acpi = base + OPREGION_ACPI_OFFSET;
1652 - if (mboxes & MBOX_SWSCI) {
1653 - DRM_DEBUG_DRIVER("SWSCI supported\n");
1654 - opregion->swsci = base + OPREGION_SWSCI_OFFSET;
1656 - if (mboxes & MBOX_ASLE) {
1657 - DRM_DEBUG_DRIVER("ASLE supported\n");
1658 - opregion->asle = base + OPREGION_ASLE_OFFSET;
1661 - return 0;
1663 -err_out:
1664 - iounmap(base);
1665 - return err;
1667 diff -Naur linux-2.6.39//drivers/gpu/drm/i915/intel_panel.c linux-2.6.39-kamal//drivers/gpu/drm/i915/intel_panel.c
1668 --- linux-2.6.39//drivers/gpu/drm/i915/intel_panel.c 2011-05-18 23:06:34.000000000 -0500
1669 +++ linux-2.6.39-kamal//drivers/gpu/drm/i915/intel_panel.c 2011-06-18 11:51:56.376595621 -0500
1670 @@ -250,6 +250,76 @@
1671 I915_WRITE(BLC_PWM_CTL, tmp | level);
1674 +#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
1675 +static int intel_panel_update_brightness(struct backlight_device *bd)
1677 + struct drm_device *dev = bl_get_data(bd);
1679 + intel_panel_set_backlight(dev, bd->props.brightness);
1680 + return 0;
1683 +static int intel_panel_get_brightness(struct backlight_device *bd)
1685 + struct drm_device *dev = bl_get_data(bd);
1687 + return intel_panel_get_backlight(dev);
1690 +static const struct backlight_ops intel_panel_bl_ops = {
1691 + .update_status = intel_panel_update_brightness,
1692 + .get_brightness = intel_panel_get_brightness,
1695 +int intel_panel_setup_backlight(struct drm_connector *connector)
1697 + struct drm_device *dev = connector->dev;
1698 + struct drm_i915_private *dev_priv = dev->dev_private;
1699 + struct backlight_properties props;
1701 + dev_priv->backlight_level = intel_panel_get_backlight(dev);
1702 + dev_priv->backlight_enabled = dev_priv->backlight_level != 0;
1704 + props.max_brightness = intel_panel_get_max_backlight(dev);
1705 + props.type = BACKLIGHT_RAW;
1706 + dev_priv->backlight = backlight_device_register("intel_backlight",
1707 + &connector->kdev, dev, &intel_panel_bl_ops, &props);
1709 + if (IS_ERR(dev_priv->backlight)) {
1710 + DRM_ERROR("Failed to register backlight: %ld\n",
1711 + PTR_ERR(dev_priv->backlight));
1712 + dev_priv->backlight = NULL;
1713 + return -ENODEV;
1716 + dev_priv->backlight->props.brightness = intel_panel_get_backlight(dev);
1717 + return 0;
1720 +void intel_panel_destroy_backlight(struct drm_connector *connector)
1722 + struct drm_device *dev = connector->dev;
1723 + struct drm_i915_private *dev_priv = dev->dev_private;
1725 + if (dev_priv->backlight)
1726 + backlight_device_unregister(dev_priv->backlight);
1728 +#else
1729 +int intel_panel_setup_backlight(struct drm_connector *connector)
1731 + struct drm_device *dev = connector->dev;
1732 + struct drm_i915_private *dev_priv = dev->dev_private;
1734 + dev_priv->backlight_level = intel_panel_get_backlight(dev);
1735 + dev_priv->backlight_enabled = dev_priv->backlight_level != 0;
1738 +void intel_panel_destroy_backlight(struct drm_connector *connector)
1740 + return;
1742 +#endif
1744 void intel_panel_disable_backlight(struct drm_device *dev)
1746 struct drm_i915_private *dev_priv = dev->dev_private;
1747 @@ -273,14 +343,6 @@
1748 dev_priv->backlight_enabled = true;
1751 -void intel_panel_setup_backlight(struct drm_device *dev)
1753 - struct drm_i915_private *dev_priv = dev->dev_private;
1755 - dev_priv->backlight_level = intel_panel_get_backlight(dev);
1756 - dev_priv->backlight_enabled = dev_priv->backlight_level != 0;
1759 enum drm_connector_status
1760 intel_panel_detect(struct drm_device *dev)
1762 diff -Naur linux-2.6.39//drivers/gpu/drm/i915/Makefile linux-2.6.39-kamal//drivers/gpu/drm/i915/Makefile
1763 --- linux-2.6.39//drivers/gpu/drm/i915/Makefile 2011-05-18 23:06:34.000000000 -0500
1764 +++ linux-2.6.39-kamal//drivers/gpu/drm/i915/Makefile 2011-06-18 11:29:54.989946309 -0500
1765 @@ -28,7 +28,6 @@
1766 intel_dvo.o \
1767 intel_ringbuffer.o \
1768 intel_overlay.o \
1769 - intel_opregion.o \
1770 dvo_ch7xxx.o \
1771 dvo_ch7017.o \
1772 dvo_ivch.o \
1773 diff -Naur linux-2.6.39//drivers/gpu/drm/Kconfig linux-2.6.39-kamal//drivers/gpu/drm/Kconfig
1774 --- linux-2.6.39//drivers/gpu/drm/Kconfig 2011-05-18 23:06:34.000000000 -0500
1775 +++ linux-2.6.39-kamal//drivers/gpu/drm/Kconfig 2011-06-18 11:29:54.976612977 -0500
1776 @@ -101,6 +101,7 @@
1777 select INPUT if ACPI
1778 select ACPI_VIDEO if ACPI
1779 select ACPI_BUTTON if ACPI
1780 + select ACPI_IGD_OPREGION if ACPI
1781 help
1782 Choose this option if you have a system that has "Intel Graphics
1783 Media Accelerator" or "HD Graphics" integrated graphics,
1784 diff -Naur linux-2.6.39//drivers/gpu/drm/radeon/Kconfig.rej linux-2.6.39-kamal//drivers/gpu/drm/radeon/Kconfig.rej
1785 --- linux-2.6.39//drivers/gpu/drm/radeon/Kconfig.rej 1969-12-31 19:00:00.000000000 -0500
1786 +++ linux-2.6.39-kamal//drivers/gpu/drm/radeon/Kconfig.rej 2011-06-18 11:29:37.113279877 -0500
1787 @@ -0,0 +1,10 @@
1788 +--- drivers/gpu/drm/radeon/Kconfig
1789 ++++ drivers/gpu/drm/radeon/Kconfig
1790 +@@ -1,6 +1,7 @@
1791 + config DRM_RADEON_KMS
1792 + bool "Enable modesetting on radeon by default - NEW DRIVER"
1793 + depends on DRM_RADEON
1794 ++ select BACKLIGHT_CLASS_DEVICE
1795 + help
1796 + Choose this option if you want kernel modesetting enabled by default.
1798 diff -Naur linux-2.6.39//include/acpi/acpi_igd_opregion.h linux-2.6.39-kamal//include/acpi/acpi_igd_opregion.h
1799 --- linux-2.6.39//include/acpi/acpi_igd_opregion.h 1969-12-31 19:00:00.000000000 -0500
1800 +++ linux-2.6.39-kamal//include/acpi/acpi_igd_opregion.h 2011-06-18 11:29:55.006612975 -0500
1801 @@ -0,0 +1,105 @@
1802 +#ifndef __ACPI_IGD_OPREGION_H__
1803 +#define __ACPI_IGD_OPREGION_H__
1805 +#include <drm/drmP.h>
1807 +#define OPREGION_SIZE (8*1024)
1809 +struct opregion_header {
1810 + u8 signature[16];
1811 + u32 size;
1812 + u32 opregion_ver;
1813 + u8 bios_ver[32];
1814 + u8 vbios_ver[16];
1815 + u8 driver_ver[16];
1816 + u32 mboxes;
1817 + u8 reserved[164];
1818 +} __packed;
1820 +/* OpRegion mailbox #1: public ACPI methods */
1821 +struct opregion_acpi {
1822 + u32 drdy; /* driver readiness */
1823 + u32 csts; /* notification status */
1824 + u32 cevt; /* current event */
1825 + u8 rsvd1[20];
1826 + u32 didl[8]; /* supported display devices ID list */
1827 + u32 cpdl[8]; /* currently presented display list */
1828 + u32 cadl[8]; /* currently active display list */
1829 + u32 nadl[8]; /* next active devices list */
1830 + u32 aslp; /* ASL sleep time-out */
1831 + u32 tidx; /* toggle table index */
1832 + u32 chpd; /* current hotplug enable indicator */
1833 + u32 clid; /* current lid state*/
1834 + u32 cdck; /* current docking state */
1835 + u32 sxsw; /* Sx state resume */
1836 + u32 evts; /* ASL supported events */
1837 + u32 cnot; /* current OS notification */
1838 + u32 nrdy; /* driver status */
1839 + u8 rsvd2[60];
1840 +} __packed;
1842 +/* OpRegion mailbox #2: SWSCI */
1843 +struct opregion_swsci {
1844 + u32 scic; /* SWSCI command|status|data */
1845 + u32 parm; /* command parameters */
1846 + u32 dslp; /* driver sleep time-out */
1847 + u8 rsvd[244];
1848 +} __packed;
1850 +/* OpRegion mailbox #3: ASLE */
1851 +struct opregion_asle {
1852 + u32 ardy; /* driver readiness */
1853 + u32 aslc; /* ASLE interrupt command */
1854 + u32 tche; /* technology enabled indicator */
1855 + u32 alsi; /* current ALS illuminance reading */
1856 + u32 bclp; /* backlight brightness to set */
1857 + u32 pfit; /* panel fitting state */
1858 + u32 cblv; /* current brightness level */
1859 + u16 bclm[20]; /* backlight level duty cycle mapping table */
1860 + u32 cpfm; /* current panel fitting mode */
1861 + u32 epfm; /* enabled panel fitting modes */
1862 + u8 plut[74]; /* panel LUT and identifier */
1863 + u32 pfmb; /* PWM freq and min brightness */
1864 + u8 rsvd[102];
1865 +} __packed;
1867 +struct igd_opregion {
1868 + struct opregion_header *header;
1869 + struct opregion_acpi *acpi;
1870 + struct opregion_swsci *swsci;
1871 + struct opregion_asle *asle;
1872 + void *vbt;
1875 +struct opregion_dev {
1876 + struct drm_device *drm_dev;
1877 + u32 max_backlight;
1878 + void (*set_backlight)(struct drm_device *dev, u32 value);
1879 + void (*set_als_illum)(struct drm_device *dev, u32 alsi);
1880 + void (*set_pwm_freq)(struct drm_device *dev, u32 pfmb);
1881 + void (*set_pfit)(struct drm_device *dev, u32 pfit);
1882 + void (*enable_asle)(struct drm_device *drm_dev);
1883 + struct igd_opregion opregion;
1886 +#if (defined CONFIG_ACPI_IGD_OPREGION || defined CONFIG_ACPI_IGD_OPREGION_MODULE)
1888 +int igd_opregion_setup(struct opregion_dev *dev);
1889 +void igd_opregion_init(struct opregion_dev *dev);
1890 +void igd_opregion_fini(struct opregion_dev *dev);
1891 +void igd_opregion_intr(struct opregion_dev *dev);
1892 +void igd_opregion_enable_asle(struct opregion_dev *dev);
1894 +#else
1896 +static inline int igd_opregion_setup(struct opregion_dev *dev)
1898 + return 0;
1901 +static inline void igd_opregion_init(struct opregion_dev *dev) {};
1902 +static inline void igd_opregion_fini(struct opregion_dev *dev) {};
1903 +static inline void igd_opregion_intr(struct opregion_dev *dev) {};
1904 +static inline void igd_opregion_enable_asle(struct opregion_dev *dev) {};
1905 +#endif
1906 +#endif
1907 --- linux-2.6.39/../config 2011-06-18 12:31:53.539897468 -0500
1908 +++ linux-2.6.39/../config-2 2011-06-18 12:39:10.646558395 -0500
1909 @@ -498,6 +498,7 @@
1910 CONFIG_ACPI_APEI_PCIEAER=y
1911 CONFIG_ACPI_APEI_EINJ=m
1912 CONFIG_ACPI_APEI_ERST_DEBUG=m
1913 +CONFIG_ACPI_IGD_OPREGION=m
1914 CONFIG_SFI=y
1915 CONFIG_X86_APM_BOOT=y
1916 CONFIG_APM=y
1917 --- linux-2.6.39/../config.x86_64 2011-06-18 12:32:15.536563848 -0500
1918 +++ linux-2.6.39/../config.x86_64-2 2011-06-18 12:39:04.799891804 -0500
1919 @@ -491,6 +491,7 @@
1920 CONFIG_ACPI_APEI_PCIEAER=y
1921 CONFIG_ACPI_APEI_EINJ=m
1922 CONFIG_ACPI_APEI_ERST_DEBUG=m
1923 +CONFIG_ACPI_IGD_OPREGION=m
1924 CONFIG_SFI=y