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_BUS_NAME "Video Bus"
44 #define ACPI_VIDEO_DEVICE_NAME "Video Device"
45 #define ACPI_VIDEO_NOTIFY_SWITCH 0x80
46 #define ACPI_VIDEO_NOTIFY_PROBE 0x81
47 #define ACPI_VIDEO_NOTIFY_CYCLE 0x82
48 #define ACPI_VIDEO_NOTIFY_NEXT_OUTPUT 0x83
49 #define ACPI_VIDEO_NOTIFY_PREV_OUTPUT 0x84
51 #define ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS 0x85
52 #define ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS 0x86
53 #define ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS 0x87
54 #define ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS 0x88
55 #define ACPI_VIDEO_NOTIFY_DISPLAY_OFF 0x89
57 #define ACPI_VIDEO_HEAD_INVALID (~0u - 1)
58 #define ACPI_VIDEO_HEAD_END (~0u)
59 #define MAX_NAME_LEN 20
61 #define ACPI_VIDEO_DISPLAY_CRT 1
62 #define ACPI_VIDEO_DISPLAY_TV 2
63 #define ACPI_VIDEO_DISPLAY_DVI 3
64 #define ACPI_VIDEO_DISPLAY_LCD 4
66 #define _COMPONENT ACPI_VIDEO_COMPONENT
67 ACPI_MODULE_NAME("video");
69 MODULE_AUTHOR("Bruno Ducrot");
70 MODULE_DESCRIPTION("ACPI Video Driver");
71 MODULE_LICENSE("GPL");
73 static int acpi_video_bus_add(struct acpi_device *device);
74 static int acpi_video_bus_remove(struct acpi_device *device, int type);
76 static struct acpi_driver acpi_video_bus = {
78 .class = ACPI_VIDEO_CLASS,
79 .ids = ACPI_VIDEO_HID,
81 .add = acpi_video_bus_add,
82 .remove = acpi_video_bus_remove,
86 struct acpi_video_bus_flags {
87 u8 multihead:1; /* can switch video heads */
88 u8 rom:1; /* can retrieve a video rom */
89 u8 post:1; /* can configure the head to */
93 struct acpi_video_bus_cap {
94 u8 _DOS:1; /*Enable/Disable output switching */
95 u8 _DOD:1; /*Enumerate all devices attached to display adapter */
96 u8 _ROM:1; /*Get ROM Data */
97 u8 _GPD:1; /*Get POST Device */
98 u8 _SPD:1; /*Set POST Device */
99 u8 _VPO:1; /*Video POST Options */
103 struct acpi_video_device_attrib {
104 u32 display_index:4; /* A zero-based instance of the Display */
105 u32 display_port_attachment:4; /*This field differenates displays type */
106 u32 display_type:4; /*Describe the specific type in use */
107 u32 vendor_specific:4; /*Chipset Vendor Specifi */
108 u32 bios_can_detect:1; /*BIOS can detect the device */
109 u32 depend_on_vga:1; /*Non-VGA output device whose power is related to
111 u32 pipe_id:3; /*For VGA multiple-head devices. */
112 u32 reserved:10; /*Must be 0 */
113 u32 device_id_scheme:1; /*Device ID Scheme */
116 struct acpi_video_enumerated_device {
119 struct acpi_video_device_attrib attrib;
121 struct acpi_video_device *bind_info;
124 struct acpi_video_bus {
125 struct acpi_device *device;
127 struct acpi_video_enumerated_device *attached_array;
129 struct acpi_video_bus_cap cap;
130 struct acpi_video_bus_flags flags;
131 struct semaphore sem;
132 struct list_head video_device_list;
133 struct proc_dir_entry *dir;
136 struct acpi_video_device_flags {
146 struct acpi_video_device_cap {
147 u8 _ADR:1; /*Return the unique ID */
148 u8 _BCL:1; /*Query list of brightness control levels supported */
149 u8 _BCM:1; /*Set the brightness level */
150 u8 _BQC:1; /* Get current brightness level */
151 u8 _DDC:1; /*Return the EDID for this device */
152 u8 _DCS:1; /*Return status of output device */
153 u8 _DGS:1; /*Query graphics state */
154 u8 _DSS:1; /*Device state set */
157 struct acpi_video_device_brightness {
163 struct acpi_video_device {
164 unsigned long device_id;
165 struct acpi_video_device_flags flags;
166 struct acpi_video_device_cap cap;
167 struct list_head entry;
168 struct acpi_video_bus *video;
169 struct acpi_device *dev;
170 struct acpi_video_device_brightness *brightness;
171 struct backlight_device *backlight;
172 struct backlight_properties *data;
176 static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file);
177 static struct file_operations acpi_video_bus_info_fops = {
178 .open = acpi_video_bus_info_open_fs,
181 .release = single_release,
184 static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file);
185 static struct file_operations acpi_video_bus_ROM_fops = {
186 .open = acpi_video_bus_ROM_open_fs,
189 .release = single_release,
192 static int acpi_video_bus_POST_info_open_fs(struct inode *inode,
194 static struct file_operations acpi_video_bus_POST_info_fops = {
195 .open = acpi_video_bus_POST_info_open_fs,
198 .release = single_release,
201 static int acpi_video_bus_POST_open_fs(struct inode *inode, struct file *file);
202 static struct file_operations acpi_video_bus_POST_fops = {
203 .open = acpi_video_bus_POST_open_fs,
206 .release = single_release,
209 static int acpi_video_bus_DOS_open_fs(struct inode *inode, struct file *file);
210 static struct file_operations acpi_video_bus_DOS_fops = {
211 .open = acpi_video_bus_DOS_open_fs,
214 .release = single_release,
218 static int acpi_video_device_info_open_fs(struct inode *inode,
220 static struct file_operations acpi_video_device_info_fops = {
221 .open = acpi_video_device_info_open_fs,
224 .release = single_release,
227 static int acpi_video_device_state_open_fs(struct inode *inode,
229 static struct file_operations acpi_video_device_state_fops = {
230 .open = acpi_video_device_state_open_fs,
233 .release = single_release,
236 static int acpi_video_device_brightness_open_fs(struct inode *inode,
238 static struct file_operations acpi_video_device_brightness_fops = {
239 .open = acpi_video_device_brightness_open_fs,
242 .release = single_release,
245 static int acpi_video_device_EDID_open_fs(struct inode *inode,
247 static struct file_operations acpi_video_device_EDID_fops = {
248 .open = acpi_video_device_EDID_open_fs,
251 .release = single_release,
254 static char device_decode[][30] = {
255 "motherboard VGA device",
261 static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data);
262 static void acpi_video_device_rebind(struct acpi_video_bus *video);
263 static void acpi_video_device_bind(struct acpi_video_bus *video,
264 struct acpi_video_device *device);
265 static int acpi_video_device_enumerate(struct acpi_video_bus *video);
266 static int acpi_video_switch_output(struct acpi_video_bus *video, int event);
267 static int acpi_video_device_lcd_set_level(struct acpi_video_device *device,
269 static int acpi_video_device_lcd_get_level_current(
270 struct acpi_video_device *device,
271 unsigned long *level);
272 static int acpi_video_get_next_level(struct acpi_video_device *device,
273 u32 level_current, u32 event);
274 static void acpi_video_switch_brightness(struct acpi_video_device *device,
277 /*backlight device sysfs support*/
278 static int acpi_video_get_brightness(struct backlight_device *bd)
280 unsigned long cur_level;
281 struct acpi_video_device *vd =
282 (struct acpi_video_device *)class_get_devdata(&bd->class_dev);
283 acpi_video_device_lcd_get_level_current(vd, &cur_level);
284 return (int) cur_level;
287 static int acpi_video_set_brightness(struct backlight_device *bd)
289 int request_level = bd->props->brightness;
290 struct acpi_video_device *vd =
291 (struct acpi_video_device *)class_get_devdata(&bd->class_dev);
292 acpi_video_device_lcd_set_level(vd, request_level);
296 /* --------------------------------------------------------------------------
298 -------------------------------------------------------------------------- */
303 acpi_video_device_query(struct acpi_video_device *device, unsigned long *state)
307 status = acpi_evaluate_integer(device->dev->handle, "_DGS", NULL, state);
313 acpi_video_device_get_state(struct acpi_video_device *device,
314 unsigned long *state)
318 status = acpi_evaluate_integer(device->dev->handle, "_DCS", NULL, state);
324 acpi_video_device_set_state(struct acpi_video_device *device, int state)
327 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
328 struct acpi_object_list args = { 1, &arg0 };
332 arg0.integer.value = state;
333 status = acpi_evaluate_integer(device->dev->handle, "_DSS", &args, &ret);
339 acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
340 union acpi_object **levels)
343 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
344 union acpi_object *obj;
349 status = acpi_evaluate_object(device->dev->handle, "_BCL", NULL, &buffer);
350 if (!ACPI_SUCCESS(status))
352 obj = (union acpi_object *)buffer.pointer;
353 if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) {
354 printk(KERN_ERR PREFIX "Invalid _BCL data\n");
364 kfree(buffer.pointer);
370 acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level)
373 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
374 struct acpi_object_list args = { 1, &arg0 };
377 arg0.integer.value = level;
378 status = acpi_evaluate_object(device->dev->handle, "_BCM", &args, NULL);
380 printk(KERN_DEBUG "set_level status: %x\n", status);
385 acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
386 unsigned long *level)
390 status = acpi_evaluate_integer(device->dev->handle, "_BQC", NULL, level);
396 acpi_video_device_EDID(struct acpi_video_device *device,
397 union acpi_object **edid, ssize_t length)
400 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
401 union acpi_object *obj;
402 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
403 struct acpi_object_list args = { 1, &arg0 };
411 arg0.integer.value = 1;
412 else if (length == 256)
413 arg0.integer.value = 2;
417 status = acpi_evaluate_object(device->dev->handle, "_DDC", &args, &buffer);
418 if (ACPI_FAILURE(status))
421 obj = buffer.pointer;
423 if (obj && obj->type == ACPI_TYPE_BUFFER)
426 printk(KERN_ERR PREFIX "Invalid _DDC data\n");
437 acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option)
441 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
442 struct acpi_object_list args = { 1, &arg0 };
445 arg0.integer.value = option;
447 status = acpi_evaluate_integer(video->device->handle, "_SPD", &args, &tmp);
448 if (ACPI_SUCCESS(status))
449 status = tmp ? (-EINVAL) : (AE_OK);
455 acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long *id)
459 status = acpi_evaluate_integer(video->device->handle, "_GPD", NULL, id);
465 acpi_video_bus_POST_options(struct acpi_video_bus *video,
466 unsigned long *options)
470 status = acpi_evaluate_integer(video->device->handle, "_VPO", NULL, options);
478 * video : video bus device pointer
480 * 0. The system BIOS should NOT automatically switch(toggle)
481 * the active display output.
482 * 1. The system BIOS should automatically switch (toggle) the
483 * active display output. No swich event.
484 * 2. The _DGS value should be locked.
485 * 3. The system BIOS should not automatically switch (toggle) the
486 * active display output, but instead generate the display switch
489 * 0. The system BIOS should automatically control the brightness level
490 * of the LCD, when the power changes from AC to DC
491 * 1. The system BIOS should NOT automatically control the brightness
492 * level of the LCD, when the power changes from AC to DC.
498 acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag)
500 acpi_integer status = 0;
501 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
502 struct acpi_object_list args = { 1, &arg0 };
505 if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1) {
509 arg0.integer.value = (lcd_flag << 2) | bios_flag;
510 video->dos_setting = arg0.integer.value;
511 acpi_evaluate_object(video->device->handle, "_DOS", &args, NULL);
519 * device : video output device (LCD, CRT, ..)
524 * Find out all required AML method defined under the output
528 static void acpi_video_device_find_cap(struct acpi_video_device *device)
531 acpi_handle h_dummy1;
534 union acpi_object *obj = NULL;
535 struct acpi_video_device_brightness *br = NULL;
538 memset(&device->cap, 0, 4);
540 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_ADR", &h_dummy1))) {
541 device->cap._ADR = 1;
543 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCL", &h_dummy1))) {
544 device->cap._BCL = 1;
546 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCM", &h_dummy1))) {
547 device->cap._BCM = 1;
549 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle,"_BQC",&h_dummy1)))
550 device->cap._BQC = 1;
551 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DDC", &h_dummy1))) {
552 device->cap._DDC = 1;
554 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DCS", &h_dummy1))) {
555 device->cap._DCS = 1;
557 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DGS", &h_dummy1))) {
558 device->cap._DGS = 1;
560 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DSS", &h_dummy1))) {
561 device->cap._DSS = 1;
564 status = acpi_video_device_lcd_query_levels(device, &obj);
566 if (obj && obj->type == ACPI_TYPE_PACKAGE && obj->package.count >= 2) {
568 union acpi_object *o;
570 br = kzalloc(sizeof(*br), GFP_KERNEL);
572 printk(KERN_ERR "can't allocate memory\n");
574 br->levels = kmalloc(obj->package.count *
575 sizeof *(br->levels), GFP_KERNEL);
579 for (i = 0; i < obj->package.count; i++) {
580 o = (union acpi_object *)&obj->package.
582 if (o->type != ACPI_TYPE_INTEGER) {
583 printk(KERN_ERR PREFIX "Invalid data\n");
586 br->levels[count] = (u32) o->integer.value;
587 if (br->levels[count] > max_level)
588 max_level = br->levels[count];
597 device->brightness = br;
598 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
599 "found %d brightness levels\n",
607 if (device->cap._BCL && device->cap._BCM && device->cap._BQC){
609 static int count = 0;
611 struct backlight_properties *acpi_video_data;
613 name = kzalloc(MAX_NAME_LEN, GFP_KERNEL);
617 acpi_video_data = kzalloc(
618 sizeof(struct backlight_properties),
620 if (!acpi_video_data){
624 acpi_video_data->get_brightness =
625 acpi_video_get_brightness;
626 acpi_video_data->update_status =
627 acpi_video_set_brightness;
628 sprintf(name, "acpi_video%d", count++);
629 device->data = acpi_video_data;
630 acpi_video_data->max_brightness = max_level;
631 acpi_video_device_lcd_get_level_current(device, &tmp);
632 acpi_video_data->brightness = (int)tmp;
633 device->backlight = backlight_device_register(name,
634 NULL, device, acpi_video_data);
642 * device : video output device (VGA)
647 * Find out all required AML method defined under the video bus device.
650 static void acpi_video_bus_find_cap(struct acpi_video_bus *video)
652 acpi_handle h_dummy1;
654 memset(&video->cap, 0, 4);
655 if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOS", &h_dummy1))) {
658 if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOD", &h_dummy1))) {
661 if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_ROM", &h_dummy1))) {
664 if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_GPD", &h_dummy1))) {
667 if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_SPD", &h_dummy1))) {
670 if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_VPO", &h_dummy1))) {
676 * Check whether the video bus device has required AML method to
677 * support the desired features
680 static int acpi_video_bus_check(struct acpi_video_bus *video)
682 acpi_status status = -ENOENT;
688 /* Since there is no HID, CID and so on for VGA driver, we have
689 * to check well known required nodes.
692 /* Does this device able to support video switching ? */
693 if (video->cap._DOS) {
694 video->flags.multihead = 1;
698 /* Does this device able to retrieve a retrieve a video ROM ? */
699 if (video->cap._ROM) {
700 video->flags.rom = 1;
704 /* Does this device able to configure which video device to POST ? */
705 if (video->cap._GPD && video->cap._SPD && video->cap._VPO) {
706 video->flags.post = 1;
713 /* --------------------------------------------------------------------------
715 -------------------------------------------------------------------------- */
717 static struct proc_dir_entry *acpi_video_dir;
721 static int acpi_video_device_info_seq_show(struct seq_file *seq, void *offset)
723 struct acpi_video_device *dev = seq->private;
729 seq_printf(seq, "device_id: 0x%04x\n", (u32) dev->device_id);
730 seq_printf(seq, "type: ");
732 seq_printf(seq, "CRT\n");
733 else if (dev->flags.lcd)
734 seq_printf(seq, "LCD\n");
735 else if (dev->flags.tvout)
736 seq_printf(seq, "TVOUT\n");
737 else if (dev->flags.dvi)
738 seq_printf(seq, "DVI\n");
740 seq_printf(seq, "UNKNOWN\n");
742 seq_printf(seq, "known by bios: %s\n", dev->flags.bios ? "yes" : "no");
749 acpi_video_device_info_open_fs(struct inode *inode, struct file *file)
751 return single_open(file, acpi_video_device_info_seq_show,
755 static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset)
758 struct acpi_video_device *dev = seq->private;
765 status = acpi_video_device_get_state(dev, &state);
766 seq_printf(seq, "state: ");
767 if (ACPI_SUCCESS(status))
768 seq_printf(seq, "0x%02lx\n", state);
770 seq_printf(seq, "<not supported>\n");
772 status = acpi_video_device_query(dev, &state);
773 seq_printf(seq, "query: ");
774 if (ACPI_SUCCESS(status))
775 seq_printf(seq, "0x%02lx\n", state);
777 seq_printf(seq, "<not supported>\n");
784 acpi_video_device_state_open_fs(struct inode *inode, struct file *file)
786 return single_open(file, acpi_video_device_state_seq_show,
791 acpi_video_device_write_state(struct file *file,
792 const char __user * buffer,
793 size_t count, loff_t * data)
796 struct seq_file *m = file->private_data;
797 struct acpi_video_device *dev = m->private;
798 char str[12] = { 0 };
802 if (!dev || count + 1 > sizeof str)
805 if (copy_from_user(str, buffer, count))
809 state = simple_strtoul(str, NULL, 0);
810 state &= ((1ul << 31) | (1ul << 30) | (1ul << 0));
812 status = acpi_video_device_set_state(dev, state);
821 acpi_video_device_brightness_seq_show(struct seq_file *seq, void *offset)
823 struct acpi_video_device *dev = seq->private;
827 if (!dev || !dev->brightness) {
828 seq_printf(seq, "<not supported>\n");
832 seq_printf(seq, "levels: ");
833 for (i = 0; i < dev->brightness->count; i++)
834 seq_printf(seq, " %d", dev->brightness->levels[i]);
835 seq_printf(seq, "\ncurrent: %d\n", dev->brightness->curr);
841 acpi_video_device_brightness_open_fs(struct inode *inode, struct file *file)
843 return single_open(file, acpi_video_device_brightness_seq_show,
848 acpi_video_device_write_brightness(struct file *file,
849 const char __user * buffer,
850 size_t count, loff_t * data)
852 struct seq_file *m = file->private_data;
853 struct acpi_video_device *dev = m->private;
855 unsigned int level = 0;
859 if (!dev || !dev->brightness || count + 1 > sizeof str)
862 if (copy_from_user(str, buffer, count))
866 level = simple_strtoul(str, NULL, 0);
871 /* validate though the list of available levels */
872 for (i = 0; i < dev->brightness->count; i++)
873 if (level == dev->brightness->levels[i]) {
875 (acpi_video_device_lcd_set_level(dev, level)))
876 dev->brightness->curr = level;
883 static int acpi_video_device_EDID_seq_show(struct seq_file *seq, void *offset)
885 struct acpi_video_device *dev = seq->private;
888 union acpi_object *edid = NULL;
894 status = acpi_video_device_EDID(dev, &edid, 128);
895 if (ACPI_FAILURE(status)) {
896 status = acpi_video_device_EDID(dev, &edid, 256);
899 if (ACPI_FAILURE(status)) {
903 if (edid && edid->type == ACPI_TYPE_BUFFER) {
904 for (i = 0; i < edid->buffer.length; i++)
905 seq_putc(seq, edid->buffer.pointer[i]);
910 seq_printf(seq, "<not supported>\n");
918 acpi_video_device_EDID_open_fs(struct inode *inode, struct file *file)
920 return single_open(file, acpi_video_device_EDID_seq_show,
924 static int acpi_video_device_add_fs(struct acpi_device *device)
926 struct proc_dir_entry *entry = NULL;
927 struct acpi_video_device *vid_dev;
933 vid_dev = acpi_driver_data(device);
937 if (!acpi_device_dir(device)) {
938 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
939 vid_dev->video->dir);
940 if (!acpi_device_dir(device))
942 acpi_device_dir(device)->owner = THIS_MODULE;
946 entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device));
950 entry->proc_fops = &acpi_video_device_info_fops;
951 entry->data = acpi_driver_data(device);
952 entry->owner = THIS_MODULE;
957 create_proc_entry("state", S_IFREG | S_IRUGO | S_IWUSR,
958 acpi_device_dir(device));
962 acpi_video_device_state_fops.write = acpi_video_device_write_state;
963 entry->proc_fops = &acpi_video_device_state_fops;
964 entry->data = acpi_driver_data(device);
965 entry->owner = THIS_MODULE;
968 /* 'brightness' [R/W] */
970 create_proc_entry("brightness", S_IFREG | S_IRUGO | S_IWUSR,
971 acpi_device_dir(device));
975 acpi_video_device_brightness_fops.write = acpi_video_device_write_brightness;
976 entry->proc_fops = &acpi_video_device_brightness_fops;
977 entry->data = acpi_driver_data(device);
978 entry->owner = THIS_MODULE;
982 entry = create_proc_entry("EDID", S_IRUGO, acpi_device_dir(device));
986 entry->proc_fops = &acpi_video_device_EDID_fops;
987 entry->data = acpi_driver_data(device);
988 entry->owner = THIS_MODULE;
994 static int acpi_video_device_remove_fs(struct acpi_device *device)
996 struct acpi_video_device *vid_dev;
998 vid_dev = acpi_driver_data(device);
999 if (!vid_dev || !vid_dev->video || !vid_dev->video->dir)
1002 if (acpi_device_dir(device)) {
1003 remove_proc_entry("info", acpi_device_dir(device));
1004 remove_proc_entry("state", acpi_device_dir(device));
1005 remove_proc_entry("brightness", acpi_device_dir(device));
1006 remove_proc_entry("EDID", acpi_device_dir(device));
1007 remove_proc_entry(acpi_device_bid(device), vid_dev->video->dir);
1008 acpi_device_dir(device) = NULL;
1015 static int acpi_video_bus_info_seq_show(struct seq_file *seq, void *offset)
1017 struct acpi_video_bus *video = seq->private;
1023 seq_printf(seq, "Switching heads: %s\n",
1024 video->flags.multihead ? "yes" : "no");
1025 seq_printf(seq, "Video ROM: %s\n",
1026 video->flags.rom ? "yes" : "no");
1027 seq_printf(seq, "Device to be POSTed on boot: %s\n",
1028 video->flags.post ? "yes" : "no");
1034 static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file)
1036 return single_open(file, acpi_video_bus_info_seq_show,
1040 static int acpi_video_bus_ROM_seq_show(struct seq_file *seq, void *offset)
1042 struct acpi_video_bus *video = seq->private;
1048 printk(KERN_INFO PREFIX "Please implement %s\n", __FUNCTION__);
1049 seq_printf(seq, "<TODO>\n");
1055 static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file)
1057 return single_open(file, acpi_video_bus_ROM_seq_show, PDE(inode)->data);
1060 static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset)
1062 struct acpi_video_bus *video = seq->private;
1063 unsigned long options;
1070 status = acpi_video_bus_POST_options(video, &options);
1071 if (ACPI_SUCCESS(status)) {
1072 if (!(options & 1)) {
1073 printk(KERN_WARNING PREFIX
1074 "The motherboard VGA device is not listed as a possible POST device.\n");
1075 printk(KERN_WARNING PREFIX
1076 "This indicate a BIOS bug. Please contact the manufacturer.\n");
1078 printk("%lx\n", options);
1079 seq_printf(seq, "can POST: <intgrated video>");
1081 seq_printf(seq, " <PCI video>");
1083 seq_printf(seq, " <AGP video>");
1084 seq_putc(seq, '\n');
1086 seq_printf(seq, "<not supported>\n");
1092 acpi_video_bus_POST_info_open_fs(struct inode *inode, struct file *file)
1094 return single_open(file, acpi_video_bus_POST_info_seq_show,
1098 static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset)
1100 struct acpi_video_bus *video = seq->private;
1108 status = acpi_video_bus_get_POST(video, &id);
1109 if (!ACPI_SUCCESS(status)) {
1110 seq_printf(seq, "<not supported>\n");
1113 seq_printf(seq, "device posted is <%s>\n", device_decode[id & 3]);
1119 static int acpi_video_bus_DOS_seq_show(struct seq_file *seq, void *offset)
1121 struct acpi_video_bus *video = seq->private;
1124 seq_printf(seq, "DOS setting: <%d>\n", video->dos_setting);
1129 static int acpi_video_bus_POST_open_fs(struct inode *inode, struct file *file)
1131 return single_open(file, acpi_video_bus_POST_seq_show,
1135 static int acpi_video_bus_DOS_open_fs(struct inode *inode, struct file *file)
1137 return single_open(file, acpi_video_bus_DOS_seq_show, PDE(inode)->data);
1141 acpi_video_bus_write_POST(struct file *file,
1142 const char __user * buffer,
1143 size_t count, loff_t * data)
1146 struct seq_file *m = file->private_data;
1147 struct acpi_video_bus *video = m->private;
1148 char str[12] = { 0 };
1149 unsigned long opt, options;
1152 if (!video || count + 1 > sizeof str)
1155 status = acpi_video_bus_POST_options(video, &options);
1156 if (!ACPI_SUCCESS(status))
1159 if (copy_from_user(str, buffer, count))
1163 opt = strtoul(str, NULL, 0);
1167 /* just in case an OEM 'forget' the motherboard... */
1170 if (options & (1ul << opt)) {
1171 status = acpi_video_bus_set_POST(video, opt);
1172 if (!ACPI_SUCCESS(status))
1181 acpi_video_bus_write_DOS(struct file *file,
1182 const char __user * buffer,
1183 size_t count, loff_t * data)
1186 struct seq_file *m = file->private_data;
1187 struct acpi_video_bus *video = m->private;
1188 char str[12] = { 0 };
1192 if (!video || count + 1 > sizeof str)
1195 if (copy_from_user(str, buffer, count))
1199 opt = strtoul(str, NULL, 0);
1203 status = acpi_video_bus_DOS(video, opt & 0x3, (opt & 0x4) >> 2);
1205 if (!ACPI_SUCCESS(status))
1211 static int acpi_video_bus_add_fs(struct acpi_device *device)
1213 struct proc_dir_entry *entry = NULL;
1214 struct acpi_video_bus *video;
1217 video = acpi_driver_data(device);
1219 if (!acpi_device_dir(device)) {
1220 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
1222 if (!acpi_device_dir(device))
1224 video->dir = acpi_device_dir(device);
1225 acpi_device_dir(device)->owner = THIS_MODULE;
1229 entry = create_proc_entry("info", S_IRUGO, acpi_device_dir(device));
1233 entry->proc_fops = &acpi_video_bus_info_fops;
1234 entry->data = acpi_driver_data(device);
1235 entry->owner = THIS_MODULE;
1239 entry = create_proc_entry("ROM", S_IRUGO, acpi_device_dir(device));
1243 entry->proc_fops = &acpi_video_bus_ROM_fops;
1244 entry->data = acpi_driver_data(device);
1245 entry->owner = THIS_MODULE;
1248 /* 'POST_info' [R] */
1250 create_proc_entry("POST_info", S_IRUGO, acpi_device_dir(device));
1254 entry->proc_fops = &acpi_video_bus_POST_info_fops;
1255 entry->data = acpi_driver_data(device);
1256 entry->owner = THIS_MODULE;
1261 create_proc_entry("POST", S_IFREG | S_IRUGO | S_IRUSR,
1262 acpi_device_dir(device));
1266 acpi_video_bus_POST_fops.write = acpi_video_bus_write_POST;
1267 entry->proc_fops = &acpi_video_bus_POST_fops;
1268 entry->data = acpi_driver_data(device);
1269 entry->owner = THIS_MODULE;
1274 create_proc_entry("DOS", S_IFREG | S_IRUGO | S_IRUSR,
1275 acpi_device_dir(device));
1279 acpi_video_bus_DOS_fops.write = acpi_video_bus_write_DOS;
1280 entry->proc_fops = &acpi_video_bus_DOS_fops;
1281 entry->data = acpi_driver_data(device);
1282 entry->owner = THIS_MODULE;
1288 static int acpi_video_bus_remove_fs(struct acpi_device *device)
1290 struct acpi_video_bus *video;
1293 video = acpi_driver_data(device);
1295 if (acpi_device_dir(device)) {
1296 remove_proc_entry("info", acpi_device_dir(device));
1297 remove_proc_entry("ROM", acpi_device_dir(device));
1298 remove_proc_entry("POST_info", acpi_device_dir(device));
1299 remove_proc_entry("POST", acpi_device_dir(device));
1300 remove_proc_entry("DOS", acpi_device_dir(device));
1301 remove_proc_entry(acpi_device_bid(device), acpi_video_dir);
1302 acpi_device_dir(device) = NULL;
1308 /* --------------------------------------------------------------------------
1310 -------------------------------------------------------------------------- */
1312 /* device interface */
1313 static struct acpi_video_device_attrib*
1314 acpi_video_get_device_attr(struct acpi_video_bus *video, unsigned long device_id)
1318 for(count = 0; count < video->attached_count; count++)
1319 if((video->attached_array[count].value.int_val & 0xffff) == device_id)
1320 return &(video->attached_array[count].value.attrib);
1325 acpi_video_bus_get_one_device(struct acpi_device *device,
1326 struct acpi_video_bus *video)
1328 unsigned long device_id;
1330 struct acpi_video_device *data;
1331 struct acpi_video_device_attrib* attribute;
1333 if (!device || !video)
1337 acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id);
1338 if (ACPI_SUCCESS(status)) {
1340 data = kzalloc(sizeof(struct acpi_video_device), GFP_KERNEL);
1344 strcpy(acpi_device_name(device), ACPI_VIDEO_DEVICE_NAME);
1345 strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
1346 acpi_driver_data(device) = data;
1348 data->device_id = device_id;
1349 data->video = video;
1352 attribute = acpi_video_get_device_attr(video, device_id);
1354 if((attribute != NULL) && attribute->device_id_scheme) {
1355 switch (attribute->display_type) {
1356 case ACPI_VIDEO_DISPLAY_CRT:
1357 data->flags.crt = 1;
1359 case ACPI_VIDEO_DISPLAY_TV:
1360 data->flags.tvout = 1;
1362 case ACPI_VIDEO_DISPLAY_DVI:
1363 data->flags.dvi = 1;
1365 case ACPI_VIDEO_DISPLAY_LCD:
1366 data->flags.lcd = 1;
1369 data->flags.unknown = 1;
1372 if(attribute->bios_can_detect)
1373 data->flags.bios = 1;
1375 data->flags.unknown = 1;
1377 acpi_video_device_bind(video, data);
1378 acpi_video_device_find_cap(data);
1380 status = acpi_install_notify_handler(device->handle,
1382 acpi_video_device_notify,
1384 if (ACPI_FAILURE(status)) {
1385 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
1386 "Error installing notify handler\n"));
1387 if(data->brightness)
1388 kfree(data->brightness->levels);
1389 kfree(data->brightness);
1395 list_add_tail(&data->entry, &video->video_device_list);
1398 acpi_video_device_add_fs(device);
1408 * video : video bus device
1413 * Enumerate the video device list of the video bus,
1414 * bind the ids with the corresponding video devices
1415 * under the video bus.
1418 static void acpi_video_device_rebind(struct acpi_video_bus *video)
1420 struct list_head *node, *next;
1421 list_for_each_safe(node, next, &video->video_device_list) {
1422 struct acpi_video_device *dev =
1423 container_of(node, struct acpi_video_device, entry);
1424 acpi_video_device_bind(video, dev);
1430 * video : video bus device
1431 * device : video output device under the video
1437 * Bind the ids with the corresponding video devices
1438 * under the video bus.
1442 acpi_video_device_bind(struct acpi_video_bus *video,
1443 struct acpi_video_device *device)
1447 #define IDS_VAL(i) video->attached_array[i].value.int_val
1448 #define IDS_BIND(i) video->attached_array[i].bind_info
1450 for (i = 0; IDS_VAL(i) != ACPI_VIDEO_HEAD_INVALID &&
1451 i < video->attached_count; i++) {
1452 if (device->device_id == (IDS_VAL(i) & 0xffff)) {
1453 IDS_BIND(i) = device;
1454 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "device_bind %d\n", i));
1463 * video : video bus device
1468 * Call _DOD to enumerate all devices attached to display adapter
1472 static int acpi_video_device_enumerate(struct acpi_video_bus *video)
1477 struct acpi_video_enumerated_device *active_device_list;
1478 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
1479 union acpi_object *dod = NULL;
1480 union acpi_object *obj;
1482 status = acpi_evaluate_object(video->device->handle, "_DOD", NULL, &buffer);
1483 if (!ACPI_SUCCESS(status)) {
1484 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _DOD"));
1488 dod = buffer.pointer;
1489 if (!dod || (dod->type != ACPI_TYPE_PACKAGE)) {
1490 ACPI_EXCEPTION((AE_INFO, status, "Invalid _DOD data"));
1495 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d video heads in _DOD\n",
1496 dod->package.count));
1498 active_device_list = kmalloc((1 +
1499 dod->package.count) *
1501 acpi_video_enumerated_device),
1504 if (!active_device_list) {
1510 for (i = 0; i < dod->package.count; i++) {
1511 obj = &dod->package.elements[i];
1513 if (obj->type != ACPI_TYPE_INTEGER) {
1514 printk(KERN_ERR PREFIX "Invalid _DOD data\n");
1515 active_device_list[i].value.int_val =
1516 ACPI_VIDEO_HEAD_INVALID;
1518 active_device_list[i].value.int_val = obj->integer.value;
1519 active_device_list[i].bind_info = NULL;
1520 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "dod element[%d] = %d\n", i,
1521 (int)obj->integer.value));
1524 active_device_list[count].value.int_val = ACPI_VIDEO_HEAD_END;
1526 kfree(video->attached_array);
1528 video->attached_array = active_device_list;
1529 video->attached_count = count;
1531 kfree(buffer.pointer);
1537 * video : video bus device
1538 * event : Nontify Event
1543 * 1. Find out the current active output device.
1544 * 2. Identify the next output device to switch
1545 * 3. call _DSS to do actual switch.
1548 static int acpi_video_switch_output(struct acpi_video_bus *video, int event)
1550 struct list_head *node, *next;
1551 struct acpi_video_device *dev = NULL;
1552 struct acpi_video_device *dev_next = NULL;
1553 struct acpi_video_device *dev_prev = NULL;
1554 unsigned long state;
1558 list_for_each_safe(node, next, &video->video_device_list) {
1559 dev = container_of(node, struct acpi_video_device, entry);
1560 status = acpi_video_device_get_state(dev, &state);
1563 container_of(node->next, struct acpi_video_device,
1566 container_of(node->prev, struct acpi_video_device,
1571 dev_next = container_of(node->next, struct acpi_video_device, entry);
1572 dev_prev = container_of(node->prev, struct acpi_video_device, entry);
1575 case ACPI_VIDEO_NOTIFY_CYCLE:
1576 case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT:
1577 acpi_video_device_set_state(dev, 0);
1578 acpi_video_device_set_state(dev_next, 0x80000001);
1580 case ACPI_VIDEO_NOTIFY_PREV_OUTPUT:
1581 acpi_video_device_set_state(dev, 0);
1582 acpi_video_device_set_state(dev_prev, 0x80000001);
1591 acpi_video_get_next_level(struct acpi_video_device *device,
1592 u32 level_current, u32 event)
1594 int min, max, min_above, max_below, i, l;
1595 max = max_below = 0;
1596 min = min_above = 255;
1597 for (i = 0; i < device->brightness->count; i++) {
1598 l = device->brightness->levels[i];
1603 if (l < min_above && l > level_current)
1605 if (l > max_below && l < level_current)
1610 case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS:
1611 return (level_current < max) ? min_above : min;
1612 case ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS:
1613 return (level_current < max) ? min_above : max;
1614 case ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS:
1615 return (level_current > min) ? max_below : min;
1616 case ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS:
1617 case ACPI_VIDEO_NOTIFY_DISPLAY_OFF:
1620 return level_current;
1625 acpi_video_switch_brightness(struct acpi_video_device *device, int event)
1627 unsigned long level_current, level_next;
1628 acpi_video_device_lcd_get_level_current(device, &level_current);
1629 level_next = acpi_video_get_next_level(device, level_current, event);
1630 acpi_video_device_lcd_set_level(device, level_next);
1634 acpi_video_bus_get_devices(struct acpi_video_bus *video,
1635 struct acpi_device *device)
1638 struct list_head *node, *next;
1641 acpi_video_device_enumerate(video);
1643 list_for_each_safe(node, next, &device->children) {
1644 struct acpi_device *dev =
1645 list_entry(node, struct acpi_device, node);
1650 status = acpi_video_bus_get_one_device(dev, video);
1651 if (ACPI_FAILURE(status)) {
1652 ACPI_EXCEPTION((AE_INFO, status, "Cant attach device"));
1660 static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
1663 struct acpi_video_bus *video;
1666 if (!device || !device->video)
1669 video = device->video;
1672 list_del(&device->entry);
1674 acpi_video_device_remove_fs(device->dev);
1676 status = acpi_remove_notify_handler(device->dev->handle,
1678 acpi_video_device_notify);
1679 if (device->backlight){
1680 backlight_device_unregister(device->backlight);
1681 kfree(device->data);
1686 static int acpi_video_bus_put_devices(struct acpi_video_bus *video)
1689 struct list_head *node, *next;
1692 list_for_each_safe(node, next, &video->video_device_list) {
1693 struct acpi_video_device *data =
1694 list_entry(node, struct acpi_video_device, entry);
1698 status = acpi_video_bus_put_one_device(data);
1699 if (ACPI_FAILURE(status))
1700 printk(KERN_WARNING PREFIX
1701 "hhuuhhuu bug in acpi video driver.\n");
1703 if (data->brightness)
1704 kfree(data->brightness->levels);
1705 kfree(data->brightness);
1712 /* acpi_video interface */
1714 static int acpi_video_bus_start_devices(struct acpi_video_bus *video)
1716 return acpi_video_bus_DOS(video, 1, 0);
1719 static int acpi_video_bus_stop_devices(struct acpi_video_bus *video)
1721 return acpi_video_bus_DOS(video, 0, 1);
1724 static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
1726 struct acpi_video_bus *video = data;
1727 struct acpi_device *device = NULL;
1729 printk("video bus notify\n");
1734 device = video->device;
1737 case ACPI_VIDEO_NOTIFY_SWITCH: /* User request that a switch occur,
1738 * most likely via hotkey. */
1739 acpi_bus_generate_event(device, event, 0);
1742 case ACPI_VIDEO_NOTIFY_PROBE: /* User plug or remove a video
1744 acpi_video_device_enumerate(video);
1745 acpi_video_device_rebind(video);
1746 acpi_video_switch_output(video, event);
1747 acpi_bus_generate_event(device, event, 0);
1750 case ACPI_VIDEO_NOTIFY_CYCLE: /* Cycle Display output hotkey pressed. */
1751 case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: /* Next Display output hotkey pressed. */
1752 case ACPI_VIDEO_NOTIFY_PREV_OUTPUT: /* previous Display output hotkey pressed. */
1753 acpi_video_switch_output(video, event);
1754 acpi_bus_generate_event(device, event, 0);
1758 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
1759 "Unsupported event [0x%x]\n", event));
1766 static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
1768 struct acpi_video_device *video_device = data;
1769 struct acpi_device *device = NULL;
1774 device = video_device->dev;
1777 case ACPI_VIDEO_NOTIFY_SWITCH: /* change in status (cycle output device) */
1778 case ACPI_VIDEO_NOTIFY_PROBE: /* change in status (output device status) */
1779 acpi_bus_generate_event(device, event, 0);
1781 case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS: /* Cycle brightness */
1782 case ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS: /* Increase brightness */
1783 case ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS: /* Decrease brightness */
1784 case ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS: /* zero brightnesss */
1785 case ACPI_VIDEO_NOTIFY_DISPLAY_OFF: /* display device off */
1786 acpi_video_switch_brightness(video_device, event);
1787 acpi_bus_generate_event(device, event, 0);
1790 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
1791 "Unsupported event [0x%x]\n", event));
1797 static int acpi_video_bus_add(struct acpi_device *device)
1800 acpi_status status = 0;
1801 struct acpi_video_bus *video = NULL;
1807 video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL);
1811 video->device = device;
1812 strcpy(acpi_device_name(device), ACPI_VIDEO_BUS_NAME);
1813 strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
1814 acpi_driver_data(device) = video;
1816 acpi_video_bus_find_cap(video);
1817 result = acpi_video_bus_check(video);
1821 result = acpi_video_bus_add_fs(device);
1825 init_MUTEX(&video->sem);
1826 INIT_LIST_HEAD(&video->video_device_list);
1828 acpi_video_bus_get_devices(video, device);
1829 acpi_video_bus_start_devices(video);
1831 status = acpi_install_notify_handler(device->handle,
1833 acpi_video_bus_notify, video);
1834 if (ACPI_FAILURE(status)) {
1835 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
1836 "Error installing notify handler\n"));
1837 acpi_video_bus_stop_devices(video);
1838 acpi_video_bus_put_devices(video);
1839 kfree(video->attached_array);
1840 acpi_video_bus_remove_fs(device);
1845 printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n",
1846 ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device),
1847 video->flags.multihead ? "yes" : "no",
1848 video->flags.rom ? "yes" : "no",
1849 video->flags.post ? "yes" : "no");
1858 static int acpi_video_bus_remove(struct acpi_device *device, int type)
1860 acpi_status status = 0;
1861 struct acpi_video_bus *video = NULL;
1864 if (!device || !acpi_driver_data(device))
1867 video = acpi_driver_data(device);
1869 acpi_video_bus_stop_devices(video);
1871 status = acpi_remove_notify_handler(video->device->handle,
1873 acpi_video_bus_notify);
1875 acpi_video_bus_put_devices(video);
1876 acpi_video_bus_remove_fs(device);
1878 kfree(video->attached_array);
1884 static int __init acpi_video_init(void)
1890 acpi_dbg_level = 0xFFFFFFFF;
1891 acpi_dbg_layer = 0x08000000;
1894 acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir);
1895 if (!acpi_video_dir)
1897 acpi_video_dir->owner = THIS_MODULE;
1899 result = acpi_bus_register_driver(&acpi_video_bus);
1901 remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir);
1908 static void __exit acpi_video_exit(void)
1911 acpi_bus_unregister_driver(&acpi_video_bus);
1913 remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir);
1918 module_init(acpi_video_init);
1919 module_exit(acpi_video_exit);