2 * video.c - ACPI Video Driver ($Revision:$)
4 * Copyright (C) 2004 Luming Yu <luming.yu@intel.com>
5 * Copyright (C) 2004 Bruno Ducrot <ducrot@poupinou.org>
6 * Copyright (C) 2006 Thomas Tuttle <linux-kernel@ttuttle.net>
8 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or (at
13 * your option) any later version.
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
24 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27 #include <linux/kernel.h>
28 #include <linux/module.h>
29 #include <linux/init.h>
30 #include <linux/types.h>
31 #include <linux/list.h>
32 #include <linux/proc_fs.h>
33 #include <linux/seq_file.h>
35 #include <linux/backlight.h>
36 #include <asm/uaccess.h>
38 #include <acpi/acpi_bus.h>
39 #include <acpi/acpi_drivers.h>
41 #define ACPI_VIDEO_COMPONENT 0x08000000
42 #define ACPI_VIDEO_CLASS "video"
43 #define ACPI_VIDEO_DRIVER_NAME "ACPI Video Driver"
44 #define ACPI_VIDEO_BUS_NAME "Video Bus"
45 #define ACPI_VIDEO_DEVICE_NAME "Video Device"
46 #define ACPI_VIDEO_NOTIFY_SWITCH 0x80
47 #define ACPI_VIDEO_NOTIFY_PROBE 0x81
48 #define ACPI_VIDEO_NOTIFY_CYCLE 0x82
49 #define ACPI_VIDEO_NOTIFY_NEXT_OUTPUT 0x83
50 #define ACPI_VIDEO_NOTIFY_PREV_OUTPUT 0x84
52 #define ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS 0x85
53 #define ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS 0x86
54 #define ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS 0x87
55 #define ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS 0x88
56 #define ACPI_VIDEO_NOTIFY_DISPLAY_OFF 0x89
58 #define ACPI_VIDEO_HEAD_INVALID (~0u - 1)
59 #define ACPI_VIDEO_HEAD_END (~0u)
60 #define MAX_NAME_LEN 20
62 #define _COMPONENT ACPI_VIDEO_COMPONENT
63 ACPI_MODULE_NAME("acpi_video")
65 MODULE_AUTHOR("Bruno Ducrot");
66 MODULE_DESCRIPTION(ACPI_VIDEO_DRIVER_NAME);
67 MODULE_LICENSE("GPL");
69 static int acpi_video_bus_add(struct acpi_device *device);
70 static int acpi_video_bus_remove(struct acpi_device *device, int type);
71 static int acpi_video_bus_match(struct acpi_device *device,
72 struct acpi_driver *driver);
74 static struct acpi_driver acpi_video_bus = {
75 .name = ACPI_VIDEO_DRIVER_NAME,
76 .class = ACPI_VIDEO_CLASS,
78 .add = acpi_video_bus_add,
79 .remove = acpi_video_bus_remove,
80 .match = acpi_video_bus_match,
84 struct acpi_video_bus_flags {
85 u8 multihead:1; /* can switch video heads */
86 u8 rom:1; /* can retrieve a video rom */
87 u8 post:1; /* can configure the head to */
91 struct acpi_video_bus_cap {
92 u8 _DOS:1; /*Enable/Disable output switching */
93 u8 _DOD:1; /*Enumerate all devices attached to display adapter */
94 u8 _ROM:1; /*Get ROM Data */
95 u8 _GPD:1; /*Get POST Device */
96 u8 _SPD:1; /*Set POST Device */
97 u8 _VPO:1; /*Video POST Options */
101 struct acpi_video_device_attrib {
102 u32 display_index:4; /* A zero-based instance of the Display */
103 u32 display_port_attachment:4; /*This field differenates displays type */
104 u32 display_type:4; /*Describe the specific type in use */
105 u32 vendor_specific:4; /*Chipset Vendor Specifi */
106 u32 bios_can_detect:1; /*BIOS can detect the device */
107 u32 depend_on_vga:1; /*Non-VGA output device whose power is related to
109 u32 pipe_id:3; /*For VGA multiple-head devices. */
110 u32 reserved:10; /*Must be 0 */
111 u32 device_id_scheme:1; /*Device ID Scheme */
114 struct acpi_video_enumerated_device {
117 struct acpi_video_device_attrib attrib;
119 struct acpi_video_device *bind_info;
122 struct acpi_video_bus {
123 struct acpi_device *device;
125 struct acpi_video_enumerated_device *attached_array;
127 struct acpi_video_bus_cap cap;
128 struct acpi_video_bus_flags flags;
129 struct semaphore sem;
130 struct list_head video_device_list;
131 struct proc_dir_entry *dir;
134 struct acpi_video_device_flags {
143 struct acpi_video_device_cap {
144 u8 _ADR:1; /*Return the unique ID */
145 u8 _BCL:1; /*Query list of brightness control levels supported */
146 u8 _BCM:1; /*Set the brightness level */
147 u8 _BQC:1; /* Get current brightness level */
148 u8 _DDC:1; /*Return the EDID for this device */
149 u8 _DCS:1; /*Return status of output device */
150 u8 _DGS:1; /*Query graphics state */
151 u8 _DSS:1; /*Device state set */
154 struct acpi_video_device_brightness {
160 struct acpi_video_device {
161 unsigned long device_id;
162 struct acpi_video_device_flags flags;
163 struct acpi_video_device_cap cap;
164 struct list_head entry;
165 struct acpi_video_bus *video;
166 struct acpi_device *dev;
167 struct acpi_video_device_brightness *brightness;
168 struct backlight_device *backlight;
169 struct backlight_properties *data;
173 static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file);
174 static struct file_operations acpi_video_bus_info_fops = {
175 .open = acpi_video_bus_info_open_fs,
178 .release = single_release,
181 static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file);
182 static struct file_operations acpi_video_bus_ROM_fops = {
183 .open = acpi_video_bus_ROM_open_fs,
186 .release = single_release,
189 static int acpi_video_bus_POST_info_open_fs(struct inode *inode,
191 static struct file_operations acpi_video_bus_POST_info_fops = {
192 .open = acpi_video_bus_POST_info_open_fs,
195 .release = single_release,
198 static int acpi_video_bus_POST_open_fs(struct inode *inode, struct file *file);
199 static struct file_operations acpi_video_bus_POST_fops = {
200 .open = acpi_video_bus_POST_open_fs,
203 .release = single_release,
206 static int acpi_video_bus_DOS_open_fs(struct inode *inode, struct file *file);
207 static struct file_operations acpi_video_bus_DOS_fops = {
208 .open = acpi_video_bus_DOS_open_fs,
211 .release = single_release,
215 static int acpi_video_device_info_open_fs(struct inode *inode,
217 static struct file_operations acpi_video_device_info_fops = {
218 .open = acpi_video_device_info_open_fs,
221 .release = single_release,
224 static int acpi_video_device_state_open_fs(struct inode *inode,
226 static struct file_operations acpi_video_device_state_fops = {
227 .open = acpi_video_device_state_open_fs,
230 .release = single_release,
233 static int acpi_video_device_brightness_open_fs(struct inode *inode,
235 static struct file_operations acpi_video_device_brightness_fops = {
236 .open = acpi_video_device_brightness_open_fs,
239 .release = single_release,
242 static int acpi_video_device_EDID_open_fs(struct inode *inode,
244 static struct file_operations acpi_video_device_EDID_fops = {
245 .open = acpi_video_device_EDID_open_fs,
248 .release = single_release,
251 static char device_decode[][30] = {
252 "motherboard VGA device",
258 static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data);
259 static void acpi_video_device_rebind(struct acpi_video_bus *video);
260 static void acpi_video_device_bind(struct acpi_video_bus *video,
261 struct acpi_video_device *device);
262 static int acpi_video_device_enumerate(struct acpi_video_bus *video);
263 static int acpi_video_switch_output(struct acpi_video_bus *video, int event);
264 static int acpi_video_device_lcd_set_level(struct acpi_video_device *device,
266 static int acpi_video_device_lcd_get_level_current(
267 struct acpi_video_device *device,
268 unsigned long *level);
269 static int acpi_video_get_next_level(struct acpi_video_device *device,
270 u32 level_current, u32 event);
271 static void acpi_video_switch_brightness(struct acpi_video_device *device,
274 /*backlight device sysfs support*/
275 static int acpi_video_get_brightness(struct backlight_device *bd)
277 unsigned long cur_level;
278 struct acpi_video_device *vd =
279 (struct acpi_video_device *)class_get_devdata(&bd->class_dev);
280 acpi_video_device_lcd_get_level_current(vd, &cur_level);
281 return (int) cur_level;
284 static int acpi_video_set_brightness(struct backlight_device *bd)
286 int request_level = bd->props->brightness;
287 struct acpi_video_device *vd =
288 (struct acpi_video_device *)class_get_devdata(&bd->class_dev);
289 acpi_video_device_lcd_set_level(vd, request_level);
293 /* --------------------------------------------------------------------------
295 -------------------------------------------------------------------------- */
300 acpi_video_device_query(struct acpi_video_device *device, unsigned long *state)
304 status = acpi_evaluate_integer(device->dev->handle, "_DGS", NULL, state);
310 acpi_video_device_get_state(struct acpi_video_device *device,
311 unsigned long *state)
315 status = acpi_evaluate_integer(device->dev->handle, "_DCS", NULL, state);
321 acpi_video_device_set_state(struct acpi_video_device *device, int state)
324 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
325 struct acpi_object_list args = { 1, &arg0 };
329 arg0.integer.value = state;
330 status = acpi_evaluate_integer(device->dev->handle, "_DSS", &args, &ret);
336 acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
337 union acpi_object **levels)
340 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
341 union acpi_object *obj;
346 status = acpi_evaluate_object(device->dev->handle, "_BCL", NULL, &buffer);
347 if (!ACPI_SUCCESS(status))
349 obj = (union acpi_object *)buffer.pointer;
350 if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) {
351 printk(KERN_ERR PREFIX "Invalid _BCL data\n");
361 kfree(buffer.pointer);
367 acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level)
370 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
371 struct acpi_object_list args = { 1, &arg0 };
374 arg0.integer.value = level;
375 status = acpi_evaluate_object(device->dev->handle, "_BCM", &args, NULL);
377 printk(KERN_DEBUG "set_level status: %x\n", status);
382 acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
383 unsigned long *level)
387 status = acpi_evaluate_integer(device->dev->handle, "_BQC", NULL, level);
393 acpi_video_device_EDID(struct acpi_video_device *device,
394 union acpi_object **edid, ssize_t length)
397 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
398 union acpi_object *obj;
399 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
400 struct acpi_object_list args = { 1, &arg0 };
408 arg0.integer.value = 1;
409 else if (length == 256)
410 arg0.integer.value = 2;
414 status = acpi_evaluate_object(device->dev->handle, "_DDC", &args, &buffer);
415 if (ACPI_FAILURE(status))
418 obj = buffer.pointer;
420 if (obj && obj->type == ACPI_TYPE_BUFFER)
423 printk(KERN_ERR PREFIX "Invalid _DDC data\n");
434 acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option)
438 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
439 struct acpi_object_list args = { 1, &arg0 };
442 arg0.integer.value = option;
444 status = acpi_evaluate_integer(video->device->handle, "_SPD", &args, &tmp);
445 if (ACPI_SUCCESS(status))
446 status = tmp ? (-EINVAL) : (AE_OK);
452 acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long *id)
456 status = acpi_evaluate_integer(video->device->handle, "_GPD", NULL, id);
462 acpi_video_bus_POST_options(struct acpi_video_bus *video,
463 unsigned long *options)
467 status = acpi_evaluate_integer(video->device->handle, "_VPO", NULL, options);
475 * video : video bus device pointer
477 * 0. The system BIOS should NOT automatically switch(toggle)
478 * the active display output.
479 * 1. The system BIOS should automatically switch (toggle) the
480 * active display output. No swich event.
481 * 2. The _DGS value should be locked.
482 * 3. The system BIOS should not automatically switch (toggle) the
483 * active display output, but instead generate the display switch
486 * 0. The system BIOS should automatically control the brightness level
487 * of the LCD, when the power changes from AC to DC
488 * 1. The system BIOS should NOT automatically control the brightness
489 * level of the LCD, when the power changes from AC to DC.
495 acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag)
497 acpi_integer status = 0;
498 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
499 struct acpi_object_list args = { 1, &arg0 };
502 if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1) {
506 arg0.integer.value = (lcd_flag << 2) | bios_flag;
507 video->dos_setting = arg0.integer.value;
508 acpi_evaluate_object(video->device->handle, "_DOS", &args, NULL);
516 * device : video output device (LCD, CRT, ..)
521 * Find out all required AML method defined under the output
525 static void acpi_video_device_find_cap(struct acpi_video_device *device)
528 acpi_handle h_dummy1;
531 union acpi_object *obj = NULL;
532 struct acpi_video_device_brightness *br = NULL;
535 memset(&device->cap, 0, 4);
537 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_ADR", &h_dummy1))) {
538 device->cap._ADR = 1;
540 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCL", &h_dummy1))) {
541 device->cap._BCL = 1;
543 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCM", &h_dummy1))) {
544 device->cap._BCM = 1;
546 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle,"_BQC",&h_dummy1)))
547 device->cap._BQC = 1;
548 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DDC", &h_dummy1))) {
549 device->cap._DDC = 1;
551 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DCS", &h_dummy1))) {
552 device->cap._DCS = 1;
554 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DGS", &h_dummy1))) {
555 device->cap._DGS = 1;
557 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DSS", &h_dummy1))) {
558 device->cap._DSS = 1;
561 status = acpi_video_device_lcd_query_levels(device, &obj);
563 if (obj && obj->type == ACPI_TYPE_PACKAGE && obj->package.count >= 2) {
565 union acpi_object *o;
567 br = kzalloc(sizeof(*br), GFP_KERNEL);
569 printk(KERN_ERR "can't allocate memory\n");
571 br->levels = kmalloc(obj->package.count *
572 sizeof *(br->levels), GFP_KERNEL);
576 for (i = 0; i < obj->package.count; i++) {
577 o = (union acpi_object *)&obj->package.
579 if (o->type != ACPI_TYPE_INTEGER) {
580 printk(KERN_ERR PREFIX "Invalid data\n");
583 br->levels[count] = (u32) o->integer.value;
584 if (br->levels[count] > max_level)
585 max_level = br->levels[count];
594 device->brightness = br;
595 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
596 "found %d brightness levels\n",
604 if (device->cap._BCL && device->cap._BCM && device->cap._BQC){
606 static int count = 0;
608 struct backlight_properties *acpi_video_data;
610 name = kzalloc(MAX_NAME_LEN, GFP_KERNEL);
614 acpi_video_data = kzalloc(
615 sizeof(struct backlight_properties),
617 if (!acpi_video_data){
621 acpi_video_data->owner = THIS_MODULE;
622 acpi_video_data->get_brightness =
623 acpi_video_get_brightness;
624 acpi_video_data->update_status =
625 acpi_video_set_brightness;
626 sprintf(name, "acpi_video%d", count++);
627 device->data = acpi_video_data;
628 acpi_video_data->max_brightness = max_level;
629 acpi_video_device_lcd_get_level_current(device, &tmp);
630 acpi_video_data->brightness = (int)tmp;
631 device->backlight = backlight_device_register(name,
632 NULL, device, acpi_video_data);
640 * device : video output device (VGA)
645 * Find out all required AML method defined under the video bus device.
648 static void acpi_video_bus_find_cap(struct acpi_video_bus *video)
650 acpi_handle h_dummy1;
652 memset(&video->cap, 0, 4);
653 if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOS", &h_dummy1))) {
656 if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOD", &h_dummy1))) {
659 if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_ROM", &h_dummy1))) {
662 if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_GPD", &h_dummy1))) {
665 if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_SPD", &h_dummy1))) {
668 if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_VPO", &h_dummy1))) {
674 * Check whether the video bus device has required AML method to
675 * support the desired features
678 static int acpi_video_bus_check(struct acpi_video_bus *video)
680 acpi_status status = -ENOENT;
686 /* Since there is no HID, CID and so on for VGA driver, we have
687 * to check well known required nodes.
690 /* Does this device able to support video switching ? */
691 if (video->cap._DOS) {
692 video->flags.multihead = 1;
696 /* Does this device able to retrieve a retrieve a video ROM ? */
697 if (video->cap._ROM) {
698 video->flags.rom = 1;
702 /* Does this device able to configure which video device to POST ? */
703 if (video->cap._GPD && video->cap._SPD && video->cap._VPO) {
704 video->flags.post = 1;
711 /* --------------------------------------------------------------------------
713 -------------------------------------------------------------------------- */
715 static struct proc_dir_entry *acpi_video_dir;
719 static int acpi_video_device_info_seq_show(struct seq_file *seq, void *offset)
721 struct acpi_video_device *dev = seq->private;
727 seq_printf(seq, "device_id: 0x%04x\n", (u32) dev->device_id);
728 seq_printf(seq, "type: ");
730 seq_printf(seq, "CRT\n");
731 else if (dev->flags.lcd)
732 seq_printf(seq, "LCD\n");
733 else if (dev->flags.tvout)
734 seq_printf(seq, "TVOUT\n");
736 seq_printf(seq, "UNKNOWN\n");
738 seq_printf(seq, "known by bios: %s\n", dev->flags.bios ? "yes" : "no");
745 acpi_video_device_info_open_fs(struct inode *inode, struct file *file)
747 return single_open(file, acpi_video_device_info_seq_show,
751 static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset)
754 struct acpi_video_device *dev = seq->private;
761 status = acpi_video_device_get_state(dev, &state);
762 seq_printf(seq, "state: ");
763 if (ACPI_SUCCESS(status))
764 seq_printf(seq, "0x%02lx\n", state);
766 seq_printf(seq, "<not supported>\n");
768 status = acpi_video_device_query(dev, &state);
769 seq_printf(seq, "query: ");
770 if (ACPI_SUCCESS(status))
771 seq_printf(seq, "0x%02lx\n", state);
773 seq_printf(seq, "<not supported>\n");
780 acpi_video_device_state_open_fs(struct inode *inode, struct file *file)
782 return single_open(file, acpi_video_device_state_seq_show,
787 acpi_video_device_write_state(struct file *file,
788 const char __user * buffer,
789 size_t count, loff_t * data)
792 struct seq_file *m = file->private_data;
793 struct acpi_video_device *dev = m->private;
794 char str[12] = { 0 };
798 if (!dev || count + 1 > sizeof str)
801 if (copy_from_user(str, buffer, count))
805 state = simple_strtoul(str, NULL, 0);
806 state &= ((1ul << 31) | (1ul << 30) | (1ul << 0));
808 status = acpi_video_device_set_state(dev, state);
817 acpi_video_device_brightness_seq_show(struct seq_file *seq, void *offset)
819 struct acpi_video_device *dev = seq->private;
823 if (!dev || !dev->brightness) {
824 seq_printf(seq, "<not supported>\n");
828 seq_printf(seq, "levels: ");
829 for (i = 0; i < dev->brightness->count; i++)
830 seq_printf(seq, " %d", dev->brightness->levels[i]);
831 seq_printf(seq, "\ncurrent: %d\n", dev->brightness->curr);
837 acpi_video_device_brightness_open_fs(struct inode *inode, struct file *file)
839 return single_open(file, acpi_video_device_brightness_seq_show,
844 acpi_video_device_write_brightness(struct file *file,
845 const char __user * buffer,
846 size_t count, loff_t * data)
848 struct seq_file *m = file->private_data;
849 struct acpi_video_device *dev = m->private;
851 unsigned int level = 0;
855 if (!dev || !dev->brightness || count + 1 > sizeof str)
858 if (copy_from_user(str, buffer, count))
862 level = simple_strtoul(str, NULL, 0);
867 /* validate though the list of available levels */
868 for (i = 0; i < dev->brightness->count; i++)
869 if (level == dev->brightness->levels[i]) {
871 (acpi_video_device_lcd_set_level(dev, level)))
872 dev->brightness->curr = level;
879 static int acpi_video_device_EDID_seq_show(struct seq_file *seq, void *offset)
881 struct acpi_video_device *dev = seq->private;
884 union acpi_object *edid = NULL;
890 status = acpi_video_device_EDID(dev, &edid, 128);
891 if (ACPI_FAILURE(status)) {
892 status = acpi_video_device_EDID(dev, &edid, 256);
895 if (ACPI_FAILURE(status)) {
899 if (edid && edid->type == ACPI_TYPE_BUFFER) {
900 for (i = 0; i < edid->buffer.length; i++)
901 seq_putc(seq, edid->buffer.pointer[i]);
906 seq_printf(seq, "<not supported>\n");
914 acpi_video_device_EDID_open_fs(struct inode *inode, struct file *file)
916 return single_open(file, acpi_video_device_EDID_seq_show,
920 static int acpi_video_device_add_fs(struct acpi_device *device)
922 struct proc_dir_entry *entry = NULL;
923 struct acpi_video_device *vid_dev;
929 vid_dev = acpi_driver_data(device);
933 if (!acpi_device_dir(device)) {
934 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
935 vid_dev->video->dir);
936 if (!acpi_device_dir(device))
938 acpi_device_dir(device)->owner = THIS_MODULE;
942 entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device));
946 entry->proc_fops = &acpi_video_device_info_fops;
947 entry->data = acpi_driver_data(device);
948 entry->owner = THIS_MODULE;
953 create_proc_entry("state", S_IFREG | S_IRUGO | S_IWUSR,
954 acpi_device_dir(device));
958 acpi_video_device_state_fops.write = acpi_video_device_write_state;
959 entry->proc_fops = &acpi_video_device_state_fops;
960 entry->data = acpi_driver_data(device);
961 entry->owner = THIS_MODULE;
964 /* 'brightness' [R/W] */
966 create_proc_entry("brightness", S_IFREG | S_IRUGO | S_IWUSR,
967 acpi_device_dir(device));
971 acpi_video_device_brightness_fops.write = acpi_video_device_write_brightness;
972 entry->proc_fops = &acpi_video_device_brightness_fops;
973 entry->data = acpi_driver_data(device);
974 entry->owner = THIS_MODULE;
978 entry = create_proc_entry("EDID", S_IRUGO, acpi_device_dir(device));
982 entry->proc_fops = &acpi_video_device_EDID_fops;
983 entry->data = acpi_driver_data(device);
984 entry->owner = THIS_MODULE;
990 static int acpi_video_device_remove_fs(struct acpi_device *device)
992 struct acpi_video_device *vid_dev;
994 vid_dev = acpi_driver_data(device);
995 if (!vid_dev || !vid_dev->video || !vid_dev->video->dir)
998 if (acpi_device_dir(device)) {
999 remove_proc_entry("info", acpi_device_dir(device));
1000 remove_proc_entry("state", acpi_device_dir(device));
1001 remove_proc_entry("brightness", acpi_device_dir(device));
1002 remove_proc_entry("EDID", acpi_device_dir(device));
1003 remove_proc_entry(acpi_device_bid(device), vid_dev->video->dir);
1004 acpi_device_dir(device) = NULL;
1011 static int acpi_video_bus_info_seq_show(struct seq_file *seq, void *offset)
1013 struct acpi_video_bus *video = seq->private;
1019 seq_printf(seq, "Switching heads: %s\n",
1020 video->flags.multihead ? "yes" : "no");
1021 seq_printf(seq, "Video ROM: %s\n",
1022 video->flags.rom ? "yes" : "no");
1023 seq_printf(seq, "Device to be POSTed on boot: %s\n",
1024 video->flags.post ? "yes" : "no");
1030 static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file)
1032 return single_open(file, acpi_video_bus_info_seq_show,
1036 static int acpi_video_bus_ROM_seq_show(struct seq_file *seq, void *offset)
1038 struct acpi_video_bus *video = seq->private;
1044 printk(KERN_INFO PREFIX "Please implement %s\n", __FUNCTION__);
1045 seq_printf(seq, "<TODO>\n");
1051 static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file)
1053 return single_open(file, acpi_video_bus_ROM_seq_show, PDE(inode)->data);
1056 static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset)
1058 struct acpi_video_bus *video = seq->private;
1059 unsigned long options;
1066 status = acpi_video_bus_POST_options(video, &options);
1067 if (ACPI_SUCCESS(status)) {
1068 if (!(options & 1)) {
1069 printk(KERN_WARNING PREFIX
1070 "The motherboard VGA device is not listed as a possible POST device.\n");
1071 printk(KERN_WARNING PREFIX
1072 "This indicate a BIOS bug. Please contact the manufacturer.\n");
1074 printk("%lx\n", options);
1075 seq_printf(seq, "can POST: <intgrated video>");
1077 seq_printf(seq, " <PCI video>");
1079 seq_printf(seq, " <AGP video>");
1080 seq_putc(seq, '\n');
1082 seq_printf(seq, "<not supported>\n");
1088 acpi_video_bus_POST_info_open_fs(struct inode *inode, struct file *file)
1090 return single_open(file, acpi_video_bus_POST_info_seq_show,
1094 static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset)
1096 struct acpi_video_bus *video = seq->private;
1104 status = acpi_video_bus_get_POST(video, &id);
1105 if (!ACPI_SUCCESS(status)) {
1106 seq_printf(seq, "<not supported>\n");
1109 seq_printf(seq, "device posted is <%s>\n", device_decode[id & 3]);
1115 static int acpi_video_bus_DOS_seq_show(struct seq_file *seq, void *offset)
1117 struct acpi_video_bus *video = seq->private;
1120 seq_printf(seq, "DOS setting: <%d>\n", video->dos_setting);
1125 static int acpi_video_bus_POST_open_fs(struct inode *inode, struct file *file)
1127 return single_open(file, acpi_video_bus_POST_seq_show,
1131 static int acpi_video_bus_DOS_open_fs(struct inode *inode, struct file *file)
1133 return single_open(file, acpi_video_bus_DOS_seq_show, PDE(inode)->data);
1137 acpi_video_bus_write_POST(struct file *file,
1138 const char __user * buffer,
1139 size_t count, loff_t * data)
1142 struct seq_file *m = file->private_data;
1143 struct acpi_video_bus *video = m->private;
1144 char str[12] = { 0 };
1145 unsigned long opt, options;
1148 if (!video || count + 1 > sizeof str)
1151 status = acpi_video_bus_POST_options(video, &options);
1152 if (!ACPI_SUCCESS(status))
1155 if (copy_from_user(str, buffer, count))
1159 opt = strtoul(str, NULL, 0);
1163 /* just in case an OEM 'forget' the motherboard... */
1166 if (options & (1ul << opt)) {
1167 status = acpi_video_bus_set_POST(video, opt);
1168 if (!ACPI_SUCCESS(status))
1177 acpi_video_bus_write_DOS(struct file *file,
1178 const char __user * buffer,
1179 size_t count, loff_t * data)
1182 struct seq_file *m = file->private_data;
1183 struct acpi_video_bus *video = m->private;
1184 char str[12] = { 0 };
1188 if (!video || count + 1 > sizeof str)
1191 if (copy_from_user(str, buffer, count))
1195 opt = strtoul(str, NULL, 0);
1199 status = acpi_video_bus_DOS(video, opt & 0x3, (opt & 0x4) >> 2);
1201 if (!ACPI_SUCCESS(status))
1207 static int acpi_video_bus_add_fs(struct acpi_device *device)
1209 struct proc_dir_entry *entry = NULL;
1210 struct acpi_video_bus *video;
1213 video = acpi_driver_data(device);
1215 if (!acpi_device_dir(device)) {
1216 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
1218 if (!acpi_device_dir(device))
1220 video->dir = acpi_device_dir(device);
1221 acpi_device_dir(device)->owner = THIS_MODULE;
1225 entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device));
1229 entry->proc_fops = &acpi_video_bus_info_fops;
1230 entry->data = acpi_driver_data(device);
1231 entry->owner = THIS_MODULE;
1235 entry = create_proc_entry("ROM", S_IRUGO, acpi_device_dir(device));
1239 entry->proc_fops = &acpi_video_bus_ROM_fops;
1240 entry->data = acpi_driver_data(device);
1241 entry->owner = THIS_MODULE;
1244 /* 'POST_info' [R] */
1246 create_proc_entry("POST_info", S_IRUGO, acpi_device_dir(device));
1250 entry->proc_fops = &acpi_video_bus_POST_info_fops;
1251 entry->data = acpi_driver_data(device);
1252 entry->owner = THIS_MODULE;
1257 create_proc_entry("POST", S_IFREG | S_IRUGO | S_IRUSR,
1258 acpi_device_dir(device));
1262 acpi_video_bus_POST_fops.write = acpi_video_bus_write_POST;
1263 entry->proc_fops = &acpi_video_bus_POST_fops;
1264 entry->data = acpi_driver_data(device);
1265 entry->owner = THIS_MODULE;
1270 create_proc_entry("DOS", S_IFREG | S_IRUGO | S_IRUSR,
1271 acpi_device_dir(device));
1275 acpi_video_bus_DOS_fops.write = acpi_video_bus_write_DOS;
1276 entry->proc_fops = &acpi_video_bus_DOS_fops;
1277 entry->data = acpi_driver_data(device);
1278 entry->owner = THIS_MODULE;
1284 static int acpi_video_bus_remove_fs(struct acpi_device *device)
1286 struct acpi_video_bus *video;
1289 video = acpi_driver_data(device);
1291 if (acpi_device_dir(device)) {
1292 remove_proc_entry("info", acpi_device_dir(device));
1293 remove_proc_entry("ROM", acpi_device_dir(device));
1294 remove_proc_entry("POST_info", acpi_device_dir(device));
1295 remove_proc_entry("POST", acpi_device_dir(device));
1296 remove_proc_entry("DOS", acpi_device_dir(device));
1297 remove_proc_entry(acpi_device_bid(device), acpi_video_dir);
1298 acpi_device_dir(device) = NULL;
1304 /* --------------------------------------------------------------------------
1306 -------------------------------------------------------------------------- */
1308 /* device interface */
1311 acpi_video_bus_get_one_device(struct acpi_device *device,
1312 struct acpi_video_bus *video)
1314 unsigned long device_id;
1316 struct acpi_video_device *data;
1319 if (!device || !video)
1323 acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id);
1324 if (ACPI_SUCCESS(status)) {
1326 data = kzalloc(sizeof(struct acpi_video_device), GFP_KERNEL);
1330 strcpy(acpi_device_name(device), ACPI_VIDEO_DEVICE_NAME);
1331 strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
1332 acpi_driver_data(device) = data;
1334 data->device_id = device_id;
1335 data->video = video;
1338 switch (device_id & 0xffff) {
1340 data->flags.crt = 1;
1343 data->flags.lcd = 1;
1346 data->flags.tvout = 1;
1349 data->flags.unknown = 1;
1353 acpi_video_device_bind(video, data);
1354 acpi_video_device_find_cap(data);
1356 status = acpi_install_notify_handler(device->handle,
1358 acpi_video_device_notify,
1360 if (ACPI_FAILURE(status)) {
1361 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
1362 "Error installing notify handler\n"));
1363 if(data->brightness)
1364 kfree(data->brightness->levels);
1365 kfree(data->brightness);
1371 list_add_tail(&data->entry, &video->video_device_list);
1374 acpi_video_device_add_fs(device);
1384 * video : video bus device
1389 * Enumerate the video device list of the video bus,
1390 * bind the ids with the corresponding video devices
1391 * under the video bus.
1394 static void acpi_video_device_rebind(struct acpi_video_bus *video)
1396 struct list_head *node, *next;
1397 list_for_each_safe(node, next, &video->video_device_list) {
1398 struct acpi_video_device *dev =
1399 container_of(node, struct acpi_video_device, entry);
1400 acpi_video_device_bind(video, dev);
1406 * video : video bus device
1407 * device : video output device under the video
1413 * Bind the ids with the corresponding video devices
1414 * under the video bus.
1418 acpi_video_device_bind(struct acpi_video_bus *video,
1419 struct acpi_video_device *device)
1423 #define IDS_VAL(i) video->attached_array[i].value.int_val
1424 #define IDS_BIND(i) video->attached_array[i].bind_info
1426 for (i = 0; IDS_VAL(i) != ACPI_VIDEO_HEAD_INVALID &&
1427 i < video->attached_count; i++) {
1428 if (device->device_id == (IDS_VAL(i) & 0xffff)) {
1429 IDS_BIND(i) = device;
1430 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "device_bind %d\n", i));
1439 * video : video bus device
1444 * Call _DOD to enumerate all devices attached to display adapter
1448 static int acpi_video_device_enumerate(struct acpi_video_bus *video)
1453 struct acpi_video_enumerated_device *active_device_list;
1454 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
1455 union acpi_object *dod = NULL;
1456 union acpi_object *obj;
1458 status = acpi_evaluate_object(video->device->handle, "_DOD", NULL, &buffer);
1459 if (!ACPI_SUCCESS(status)) {
1460 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _DOD"));
1464 dod = buffer.pointer;
1465 if (!dod || (dod->type != ACPI_TYPE_PACKAGE)) {
1466 ACPI_EXCEPTION((AE_INFO, status, "Invalid _DOD data"));
1471 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d video heads in _DOD\n",
1472 dod->package.count));
1474 active_device_list = kmalloc((1 +
1475 dod->package.count) *
1477 acpi_video_enumerated_device),
1480 if (!active_device_list) {
1486 for (i = 0; i < dod->package.count; i++) {
1487 obj = &dod->package.elements[i];
1489 if (obj->type != ACPI_TYPE_INTEGER) {
1490 printk(KERN_ERR PREFIX "Invalid _DOD data\n");
1491 active_device_list[i].value.int_val =
1492 ACPI_VIDEO_HEAD_INVALID;
1494 active_device_list[i].value.int_val = obj->integer.value;
1495 active_device_list[i].bind_info = NULL;
1496 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "dod element[%d] = %d\n", i,
1497 (int)obj->integer.value));
1500 active_device_list[count].value.int_val = ACPI_VIDEO_HEAD_END;
1502 kfree(video->attached_array);
1504 video->attached_array = active_device_list;
1505 video->attached_count = count;
1507 kfree(buffer.pointer);
1513 * video : video bus device
1514 * event : Nontify Event
1519 * 1. Find out the current active output device.
1520 * 2. Identify the next output device to switch
1521 * 3. call _DSS to do actual switch.
1524 static int acpi_video_switch_output(struct acpi_video_bus *video, int event)
1526 struct list_head *node, *next;
1527 struct acpi_video_device *dev = NULL;
1528 struct acpi_video_device *dev_next = NULL;
1529 struct acpi_video_device *dev_prev = NULL;
1530 unsigned long state;
1534 list_for_each_safe(node, next, &video->video_device_list) {
1535 dev = container_of(node, struct acpi_video_device, entry);
1536 status = acpi_video_device_get_state(dev, &state);
1539 container_of(node->next, struct acpi_video_device,
1542 container_of(node->prev, struct acpi_video_device,
1547 dev_next = container_of(node->next, struct acpi_video_device, entry);
1548 dev_prev = container_of(node->prev, struct acpi_video_device, entry);
1551 case ACPI_VIDEO_NOTIFY_CYCLE:
1552 case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT:
1553 acpi_video_device_set_state(dev, 0);
1554 acpi_video_device_set_state(dev_next, 0x80000001);
1556 case ACPI_VIDEO_NOTIFY_PREV_OUTPUT:
1557 acpi_video_device_set_state(dev, 0);
1558 acpi_video_device_set_state(dev_prev, 0x80000001);
1567 acpi_video_get_next_level(struct acpi_video_device *device,
1568 u32 level_current, u32 event)
1570 int min, max, min_above, max_below, i, l;
1571 max = max_below = 0;
1572 min = min_above = 255;
1573 for (i = 0; i < device->brightness->count; i++) {
1574 l = device->brightness->levels[i];
1579 if (l < min_above && l > level_current)
1581 if (l > max_below && l < level_current)
1586 case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS:
1587 return (level_current < max) ? min_above : min;
1588 case ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS:
1589 return (level_current < max) ? min_above : max;
1590 case ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS:
1591 return (level_current > min) ? max_below : min;
1592 case ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS:
1593 case ACPI_VIDEO_NOTIFY_DISPLAY_OFF:
1596 return level_current;
1601 acpi_video_switch_brightness(struct acpi_video_device *device, int event)
1603 unsigned long level_current, level_next;
1604 acpi_video_device_lcd_get_level_current(device, &level_current);
1605 level_next = acpi_video_get_next_level(device, level_current, event);
1606 acpi_video_device_lcd_set_level(device, level_next);
1610 acpi_video_bus_get_devices(struct acpi_video_bus *video,
1611 struct acpi_device *device)
1614 struct list_head *node, *next;
1617 acpi_video_device_enumerate(video);
1619 list_for_each_safe(node, next, &device->children) {
1620 struct acpi_device *dev =
1621 list_entry(node, struct acpi_device, node);
1626 status = acpi_video_bus_get_one_device(dev, video);
1627 if (ACPI_FAILURE(status)) {
1628 ACPI_EXCEPTION((AE_INFO, status, "Cant attach device"));
1636 static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
1639 struct acpi_video_bus *video;
1642 if (!device || !device->video)
1645 video = device->video;
1648 list_del(&device->entry);
1650 acpi_video_device_remove_fs(device->dev);
1652 status = acpi_remove_notify_handler(device->dev->handle,
1654 acpi_video_device_notify);
1655 if (device->backlight){
1656 backlight_device_unregister(device->backlight);
1657 kfree(device->data);
1662 static int acpi_video_bus_put_devices(struct acpi_video_bus *video)
1665 struct list_head *node, *next;
1668 list_for_each_safe(node, next, &video->video_device_list) {
1669 struct acpi_video_device *data =
1670 list_entry(node, struct acpi_video_device, entry);
1674 status = acpi_video_bus_put_one_device(data);
1675 if (ACPI_FAILURE(status))
1676 printk(KERN_WARNING PREFIX
1677 "hhuuhhuu bug in acpi video driver.\n");
1679 if (data->brightness)
1680 kfree(data->brightness->levels);
1681 kfree(data->brightness);
1688 /* acpi_video interface */
1690 static int acpi_video_bus_start_devices(struct acpi_video_bus *video)
1692 return acpi_video_bus_DOS(video, 1, 0);
1695 static int acpi_video_bus_stop_devices(struct acpi_video_bus *video)
1697 return acpi_video_bus_DOS(video, 0, 1);
1700 static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
1702 struct acpi_video_bus *video = data;
1703 struct acpi_device *device = NULL;
1705 printk("video bus notify\n");
1710 device = video->device;
1713 case ACPI_VIDEO_NOTIFY_SWITCH: /* User request that a switch occur,
1714 * most likely via hotkey. */
1715 acpi_bus_generate_event(device, event, 0);
1718 case ACPI_VIDEO_NOTIFY_PROBE: /* User plug or remove a video
1720 acpi_video_device_enumerate(video);
1721 acpi_video_device_rebind(video);
1722 acpi_video_switch_output(video, event);
1723 acpi_bus_generate_event(device, event, 0);
1726 case ACPI_VIDEO_NOTIFY_CYCLE: /* Cycle Display output hotkey pressed. */
1727 case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: /* Next Display output hotkey pressed. */
1728 case ACPI_VIDEO_NOTIFY_PREV_OUTPUT: /* previous Display output hotkey pressed. */
1729 acpi_video_switch_output(video, event);
1730 acpi_bus_generate_event(device, event, 0);
1734 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
1735 "Unsupported event [0x%x]\n", event));
1742 static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
1744 struct acpi_video_device *video_device = data;
1745 struct acpi_device *device = NULL;
1750 device = video_device->dev;
1753 case ACPI_VIDEO_NOTIFY_SWITCH: /* change in status (cycle output device) */
1754 case ACPI_VIDEO_NOTIFY_PROBE: /* change in status (output device status) */
1755 acpi_bus_generate_event(device, event, 0);
1757 case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS: /* Cycle brightness */
1758 case ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS: /* Increase brightness */
1759 case ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS: /* Decrease brightness */
1760 case ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS: /* zero brightnesss */
1761 case ACPI_VIDEO_NOTIFY_DISPLAY_OFF: /* display device off */
1762 acpi_video_switch_brightness(video_device, event);
1763 acpi_bus_generate_event(device, event, 0);
1766 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
1767 "Unsupported event [0x%x]\n", event));
1773 static int acpi_video_bus_add(struct acpi_device *device)
1776 acpi_status status = 0;
1777 struct acpi_video_bus *video = NULL;
1783 video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL);
1787 video->device = device;
1788 strcpy(acpi_device_name(device), ACPI_VIDEO_BUS_NAME);
1789 strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
1790 acpi_driver_data(device) = video;
1792 acpi_video_bus_find_cap(video);
1793 result = acpi_video_bus_check(video);
1797 result = acpi_video_bus_add_fs(device);
1801 init_MUTEX(&video->sem);
1802 INIT_LIST_HEAD(&video->video_device_list);
1804 acpi_video_bus_get_devices(video, device);
1805 acpi_video_bus_start_devices(video);
1807 status = acpi_install_notify_handler(device->handle,
1809 acpi_video_bus_notify, video);
1810 if (ACPI_FAILURE(status)) {
1811 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
1812 "Error installing notify handler\n"));
1813 acpi_video_bus_stop_devices(video);
1814 acpi_video_bus_put_devices(video);
1815 kfree(video->attached_array);
1816 acpi_video_bus_remove_fs(device);
1821 printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n",
1822 ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device),
1823 video->flags.multihead ? "yes" : "no",
1824 video->flags.rom ? "yes" : "no",
1825 video->flags.post ? "yes" : "no");
1834 static int acpi_video_bus_remove(struct acpi_device *device, int type)
1836 acpi_status status = 0;
1837 struct acpi_video_bus *video = NULL;
1840 if (!device || !acpi_driver_data(device))
1843 video = acpi_driver_data(device);
1845 acpi_video_bus_stop_devices(video);
1847 status = acpi_remove_notify_handler(video->device->handle,
1849 acpi_video_bus_notify);
1851 acpi_video_bus_put_devices(video);
1852 acpi_video_bus_remove_fs(device);
1854 kfree(video->attached_array);
1861 acpi_video_bus_match(struct acpi_device *device, struct acpi_driver *driver)
1863 acpi_handle h_dummy1;
1864 acpi_handle h_dummy2;
1865 acpi_handle h_dummy3;
1868 if (!device || !driver)
1871 /* Since there is no HID, CID for ACPI Video drivers, we have
1872 * to check well known required nodes for each feature we support.
1875 /* Does this device able to support video switching ? */
1876 if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy1)) &&
1877 ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy2)))
1880 /* Does this device able to retrieve a video ROM ? */
1881 if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy1)))
1884 /* Does this device able to configure which video head to be POSTed ? */
1885 if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_VPO", &h_dummy1)) &&
1886 ACPI_SUCCESS(acpi_get_handle(device->handle, "_GPD", &h_dummy2)) &&
1887 ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy3)))
1893 static int __init acpi_video_init(void)
1899 acpi_dbg_level = 0xFFFFFFFF;
1900 acpi_dbg_layer = 0x08000000;
1903 acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir);
1904 if (!acpi_video_dir)
1906 acpi_video_dir->owner = THIS_MODULE;
1908 result = acpi_bus_register_driver(&acpi_video_bus);
1910 remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir);
1917 static void __exit acpi_video_exit(void)
1920 acpi_bus_unregister_driver(&acpi_video_bus);
1922 remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir);
1927 module_init(acpi_video_init);
1928 module_exit(acpi_video_exit);