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>
7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or (at
12 * your option) any later version.
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
23 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26 #include <linux/kernel.h>
27 #include <linux/module.h>
28 #include <linux/init.h>
29 #include <linux/types.h>
30 #include <linux/list.h>
31 #include <linux/proc_fs.h>
32 #include <linux/seq_file.h>
34 #include <asm/uaccess.h>
36 #include <acpi/acpi_bus.h>
37 #include <acpi/acpi_drivers.h>
39 #define ACPI_VIDEO_COMPONENT 0x08000000
40 #define ACPI_VIDEO_CLASS "video"
41 #define ACPI_VIDEO_DRIVER_NAME "ACPI Video Driver"
42 #define ACPI_VIDEO_BUS_NAME "Video Bus"
43 #define ACPI_VIDEO_DEVICE_NAME "Video Device"
44 #define ACPI_VIDEO_NOTIFY_SWITCH 0x80
45 #define ACPI_VIDEO_NOTIFY_PROBE 0x81
46 #define ACPI_VIDEO_NOTIFY_CYCLE 0x82
47 #define ACPI_VIDEO_NOTIFY_NEXT_OUTPUT 0x83
48 #define ACPI_VIDEO_NOTIFY_PREV_OUTPUT 0x84
50 #define ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS 0x82
51 #define ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS 0x83
52 #define ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS 0x84
53 #define ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS 0x85
54 #define ACPI_VIDEO_NOTIFY_DISPLAY_OFF 0x86
56 #define ACPI_VIDEO_HEAD_INVALID (~0u - 1)
57 #define ACPI_VIDEO_HEAD_END (~0u)
59 #define _COMPONENT ACPI_VIDEO_COMPONENT
60 ACPI_MODULE_NAME("acpi_video")
62 MODULE_AUTHOR("Bruno Ducrot");
63 MODULE_DESCRIPTION(ACPI_VIDEO_DRIVER_NAME
);
64 MODULE_LICENSE("GPL");
66 static int acpi_video_bus_add(struct acpi_device
*device
);
67 static int acpi_video_bus_remove(struct acpi_device
*device
, int type
);
69 static struct acpi_driver acpi_video_bus
= {
70 .name
= ACPI_VIDEO_DRIVER_NAME
,
71 .class = ACPI_VIDEO_CLASS
,
72 .ids
= ACPI_VIDEO_HID
,
74 .add
= acpi_video_bus_add
,
75 .remove
= acpi_video_bus_remove
,
79 struct acpi_video_bus_flags
{
80 u8 multihead
:1; /* can switch video heads */
81 u8 rom
:1; /* can retrieve a video rom */
82 u8 post
:1; /* can configure the head to */
86 struct acpi_video_bus_cap
{
87 u8 _DOS
:1; /*Enable/Disable output switching */
88 u8 _DOD
:1; /*Enumerate all devices attached to display adapter */
89 u8 _ROM
:1; /*Get ROM Data */
90 u8 _GPD
:1; /*Get POST Device */
91 u8 _SPD
:1; /*Set POST Device */
92 u8 _VPO
:1; /*Video POST Options */
96 struct acpi_video_device_attrib
{
97 u32 display_index
:4; /* A zero-based instance of the Display */
98 u32 display_port_attachment
:4; /*This field differenates displays type */
99 u32 display_type
:4; /*Describe the specific type in use */
100 u32 vendor_specific
:4; /*Chipset Vendor Specifi */
101 u32 bios_can_detect
:1; /*BIOS can detect the device */
102 u32 depend_on_vga
:1; /*Non-VGA output device whose power is related to
104 u32 pipe_id
:3; /*For VGA multiple-head devices. */
105 u32 reserved
:10; /*Must be 0 */
106 u32 device_id_scheme
:1; /*Device ID Scheme */
109 struct acpi_video_enumerated_device
{
112 struct acpi_video_device_attrib attrib
;
114 struct acpi_video_device
*bind_info
;
117 struct acpi_video_bus
{
118 struct acpi_device
*device
;
120 struct acpi_video_enumerated_device
*attached_array
;
122 struct acpi_video_bus_cap cap
;
123 struct acpi_video_bus_flags flags
;
124 struct semaphore sem
;
125 struct list_head video_device_list
;
126 struct proc_dir_entry
*dir
;
129 struct acpi_video_device_flags
{
138 struct acpi_video_device_cap
{
139 u8 _ADR
:1; /*Return the unique ID */
140 u8 _BCL
:1; /*Query list of brightness control levels supported */
141 u8 _BCM
:1; /*Set the brightness level */
142 u8 _DDC
:1; /*Return the EDID for this device */
143 u8 _DCS
:1; /*Return status of output device */
144 u8 _DGS
:1; /*Query graphics state */
145 u8 _DSS
:1; /*Device state set */
149 struct acpi_video_device_brightness
{
155 struct acpi_video_device
{
156 unsigned long device_id
;
157 struct acpi_video_device_flags flags
;
158 struct acpi_video_device_cap cap
;
159 struct list_head entry
;
160 struct acpi_video_bus
*video
;
161 struct acpi_device
*dev
;
162 struct acpi_video_device_brightness
*brightness
;
166 static int acpi_video_bus_info_open_fs(struct inode
*inode
, struct file
*file
);
167 static struct file_operations acpi_video_bus_info_fops
= {
168 .open
= acpi_video_bus_info_open_fs
,
171 .release
= single_release
,
174 static int acpi_video_bus_ROM_open_fs(struct inode
*inode
, struct file
*file
);
175 static struct file_operations acpi_video_bus_ROM_fops
= {
176 .open
= acpi_video_bus_ROM_open_fs
,
179 .release
= single_release
,
182 static int acpi_video_bus_POST_info_open_fs(struct inode
*inode
,
184 static struct file_operations acpi_video_bus_POST_info_fops
= {
185 .open
= acpi_video_bus_POST_info_open_fs
,
188 .release
= single_release
,
191 static int acpi_video_bus_POST_open_fs(struct inode
*inode
, struct file
*file
);
192 static struct file_operations acpi_video_bus_POST_fops
= {
193 .open
= acpi_video_bus_POST_open_fs
,
196 .release
= single_release
,
199 static int acpi_video_bus_DOS_open_fs(struct inode
*inode
, struct file
*file
);
200 static struct file_operations acpi_video_bus_DOS_fops
= {
201 .open
= acpi_video_bus_DOS_open_fs
,
204 .release
= single_release
,
208 static int acpi_video_device_info_open_fs(struct inode
*inode
,
210 static struct file_operations acpi_video_device_info_fops
= {
211 .open
= acpi_video_device_info_open_fs
,
214 .release
= single_release
,
217 static int acpi_video_device_state_open_fs(struct inode
*inode
,
219 static struct file_operations acpi_video_device_state_fops
= {
220 .open
= acpi_video_device_state_open_fs
,
223 .release
= single_release
,
226 static int acpi_video_device_brightness_open_fs(struct inode
*inode
,
228 static struct file_operations acpi_video_device_brightness_fops
= {
229 .open
= acpi_video_device_brightness_open_fs
,
232 .release
= single_release
,
235 static int acpi_video_device_EDID_open_fs(struct inode
*inode
,
237 static struct file_operations acpi_video_device_EDID_fops
= {
238 .open
= acpi_video_device_EDID_open_fs
,
241 .release
= single_release
,
244 static char device_decode
[][30] = {
245 "motherboard VGA device",
251 static void acpi_video_device_notify(acpi_handle handle
, u32 event
, void *data
);
252 static void acpi_video_device_rebind(struct acpi_video_bus
*video
);
253 static void acpi_video_device_bind(struct acpi_video_bus
*video
,
254 struct acpi_video_device
*device
);
255 static int acpi_video_device_enumerate(struct acpi_video_bus
*video
);
256 static int acpi_video_switch_output(struct acpi_video_bus
*video
, int event
);
257 static int acpi_video_get_next_level(struct acpi_video_device
*device
,
258 u32 level_current
, u32 event
);
259 static void acpi_video_switch_brightness(struct acpi_video_device
*device
,
262 /* --------------------------------------------------------------------------
264 -------------------------------------------------------------------------- */
269 acpi_video_device_query(struct acpi_video_device
*device
, unsigned long *state
)
273 status
= acpi_evaluate_integer(device
->dev
->handle
, "_DGS", NULL
, state
);
279 acpi_video_device_get_state(struct acpi_video_device
*device
,
280 unsigned long *state
)
284 status
= acpi_evaluate_integer(device
->dev
->handle
, "_DCS", NULL
, state
);
290 acpi_video_device_set_state(struct acpi_video_device
*device
, int state
)
293 union acpi_object arg0
= { ACPI_TYPE_INTEGER
};
294 struct acpi_object_list args
= { 1, &arg0
};
298 arg0
.integer
.value
= state
;
299 status
= acpi_evaluate_integer(device
->dev
->handle
, "_DSS", &args
, &ret
);
305 acpi_video_device_lcd_query_levels(struct acpi_video_device
*device
,
306 union acpi_object
**levels
)
309 struct acpi_buffer buffer
= { ACPI_ALLOCATE_BUFFER
, NULL
};
310 union acpi_object
*obj
;
315 status
= acpi_evaluate_object(device
->dev
->handle
, "_BCL", NULL
, &buffer
);
316 if (!ACPI_SUCCESS(status
))
318 obj
= (union acpi_object
*)buffer
.pointer
;
319 if (!obj
|| (obj
->type
!= ACPI_TYPE_PACKAGE
)) {
320 printk(KERN_ERR PREFIX
"Invalid _BCL data\n");
330 kfree(buffer
.pointer
);
336 acpi_video_device_lcd_set_level(struct acpi_video_device
*device
, int level
)
339 union acpi_object arg0
= { ACPI_TYPE_INTEGER
};
340 struct acpi_object_list args
= { 1, &arg0
};
343 arg0
.integer
.value
= level
;
344 status
= acpi_evaluate_object(device
->dev
->handle
, "_BCM", &args
, NULL
);
346 printk(KERN_DEBUG
"set_level status: %x\n", status
);
351 acpi_video_device_lcd_get_level_current(struct acpi_video_device
*device
,
352 unsigned long *level
)
356 status
= acpi_evaluate_integer(device
->dev
->handle
, "_BQC", NULL
, level
);
362 acpi_video_device_EDID(struct acpi_video_device
*device
,
363 union acpi_object
**edid
, ssize_t length
)
366 struct acpi_buffer buffer
= { ACPI_ALLOCATE_BUFFER
, NULL
};
367 union acpi_object
*obj
;
368 union acpi_object arg0
= { ACPI_TYPE_INTEGER
};
369 struct acpi_object_list args
= { 1, &arg0
};
377 arg0
.integer
.value
= 1;
378 else if (length
== 256)
379 arg0
.integer
.value
= 2;
383 status
= acpi_evaluate_object(device
->dev
->handle
, "_DDC", &args
, &buffer
);
384 if (ACPI_FAILURE(status
))
387 obj
= (union acpi_object
*)buffer
.pointer
;
389 if (obj
&& obj
->type
== ACPI_TYPE_BUFFER
)
392 printk(KERN_ERR PREFIX
"Invalid _DDC data\n");
403 acpi_video_bus_set_POST(struct acpi_video_bus
*video
, unsigned long option
)
407 union acpi_object arg0
= { ACPI_TYPE_INTEGER
};
408 struct acpi_object_list args
= { 1, &arg0
};
411 arg0
.integer
.value
= option
;
413 status
= acpi_evaluate_integer(video
->device
->handle
, "_SPD", &args
, &tmp
);
414 if (ACPI_SUCCESS(status
))
415 status
= tmp
? (-EINVAL
) : (AE_OK
);
421 acpi_video_bus_get_POST(struct acpi_video_bus
*video
, unsigned long *id
)
425 status
= acpi_evaluate_integer(video
->device
->handle
, "_GPD", NULL
, id
);
431 acpi_video_bus_POST_options(struct acpi_video_bus
*video
,
432 unsigned long *options
)
436 status
= acpi_evaluate_integer(video
->device
->handle
, "_VPO", NULL
, options
);
444 * video : video bus device pointer
446 * 0. The system BIOS should NOT automatically switch(toggle)
447 * the active display output.
448 * 1. The system BIOS should automatically switch (toggle) the
449 * active display output. No swich event.
450 * 2. The _DGS value should be locked.
451 * 3. The system BIOS should not automatically switch (toggle) the
452 * active display output, but instead generate the display switch
455 * 0. The system BIOS should automatically control the brightness level
456 * of the LCD, when the power changes from AC to DC
457 * 1. The system BIOS should NOT automatically control the brightness
458 * level of the LCD, when the power changes from AC to DC.
464 acpi_video_bus_DOS(struct acpi_video_bus
*video
, int bios_flag
, int lcd_flag
)
466 acpi_integer status
= 0;
467 union acpi_object arg0
= { ACPI_TYPE_INTEGER
};
468 struct acpi_object_list args
= { 1, &arg0
};
471 if (bios_flag
< 0 || bios_flag
> 3 || lcd_flag
< 0 || lcd_flag
> 1) {
475 arg0
.integer
.value
= (lcd_flag
<< 2) | bios_flag
;
476 video
->dos_setting
= arg0
.integer
.value
;
477 acpi_evaluate_object(video
->device
->handle
, "_DOS", &args
, NULL
);
485 * device : video output device (LCD, CRT, ..)
490 * Find out all required AML method defined under the output
494 static void acpi_video_device_find_cap(struct acpi_video_device
*device
)
497 acpi_handle h_dummy1
;
499 union acpi_object
*obj
= NULL
;
500 struct acpi_video_device_brightness
*br
= NULL
;
503 memset(&device
->cap
, 0, 4);
505 if (ACPI_SUCCESS(acpi_get_handle(device
->dev
->handle
, "_ADR", &h_dummy1
))) {
506 device
->cap
._ADR
= 1;
508 if (ACPI_SUCCESS(acpi_get_handle(device
->dev
->handle
, "_BCL", &h_dummy1
))) {
509 device
->cap
._BCL
= 1;
511 if (ACPI_SUCCESS(acpi_get_handle(device
->dev
->handle
, "_BCM", &h_dummy1
))) {
512 device
->cap
._BCM
= 1;
514 if (ACPI_SUCCESS(acpi_get_handle(device
->dev
->handle
, "_DDC", &h_dummy1
))) {
515 device
->cap
._DDC
= 1;
517 if (ACPI_SUCCESS(acpi_get_handle(device
->dev
->handle
, "_DCS", &h_dummy1
))) {
518 device
->cap
._DCS
= 1;
520 if (ACPI_SUCCESS(acpi_get_handle(device
->dev
->handle
, "_DGS", &h_dummy1
))) {
521 device
->cap
._DGS
= 1;
523 if (ACPI_SUCCESS(acpi_get_handle(device
->dev
->handle
, "_DSS", &h_dummy1
))) {
524 device
->cap
._DSS
= 1;
527 status
= acpi_video_device_lcd_query_levels(device
, &obj
);
529 if (obj
&& obj
->type
== ACPI_TYPE_PACKAGE
&& obj
->package
.count
>= 2) {
531 union acpi_object
*o
;
533 br
= kmalloc(sizeof(*br
), GFP_KERNEL
);
535 printk(KERN_ERR
"can't allocate memory\n");
537 memset(br
, 0, sizeof(*br
));
538 br
->levels
= kmalloc(obj
->package
.count
*
539 sizeof *(br
->levels
), GFP_KERNEL
);
543 for (i
= 0; i
< obj
->package
.count
; i
++) {
544 o
= (union acpi_object
*)&obj
->package
.
546 if (o
->type
!= ACPI_TYPE_INTEGER
) {
547 printk(KERN_ERR PREFIX
"Invalid data\n");
550 br
->levels
[count
] = (u32
) o
->integer
.value
;
559 device
->brightness
= br
;
560 ACPI_DEBUG_PRINT((ACPI_DB_INFO
,
561 "found %d brightness levels\n",
574 * device : video output device (VGA)
579 * Find out all required AML method defined under the video bus device.
582 static void acpi_video_bus_find_cap(struct acpi_video_bus
*video
)
584 acpi_handle h_dummy1
;
586 memset(&video
->cap
, 0, 4);
587 if (ACPI_SUCCESS(acpi_get_handle(video
->device
->handle
, "_DOS", &h_dummy1
))) {
590 if (ACPI_SUCCESS(acpi_get_handle(video
->device
->handle
, "_DOD", &h_dummy1
))) {
593 if (ACPI_SUCCESS(acpi_get_handle(video
->device
->handle
, "_ROM", &h_dummy1
))) {
596 if (ACPI_SUCCESS(acpi_get_handle(video
->device
->handle
, "_GPD", &h_dummy1
))) {
599 if (ACPI_SUCCESS(acpi_get_handle(video
->device
->handle
, "_SPD", &h_dummy1
))) {
602 if (ACPI_SUCCESS(acpi_get_handle(video
->device
->handle
, "_VPO", &h_dummy1
))) {
608 * Check whether the video bus device has required AML method to
609 * support the desired features
612 static int acpi_video_bus_check(struct acpi_video_bus
*video
)
614 acpi_status status
= -ENOENT
;
620 /* Since there is no HID, CID and so on for VGA driver, we have
621 * to check well known required nodes.
624 /* Does this device able to support video switching ? */
625 if (video
->cap
._DOS
) {
626 video
->flags
.multihead
= 1;
630 /* Does this device able to retrieve a retrieve a video ROM ? */
631 if (video
->cap
._ROM
) {
632 video
->flags
.rom
= 1;
636 /* Does this device able to configure which video device to POST ? */
637 if (video
->cap
._GPD
&& video
->cap
._SPD
&& video
->cap
._VPO
) {
638 video
->flags
.post
= 1;
645 /* --------------------------------------------------------------------------
647 -------------------------------------------------------------------------- */
649 static struct proc_dir_entry
*acpi_video_dir
;
653 static int acpi_video_device_info_seq_show(struct seq_file
*seq
, void *offset
)
655 struct acpi_video_device
*dev
=
656 (struct acpi_video_device
*)seq
->private;
662 seq_printf(seq
, "device_id: 0x%04x\n", (u32
) dev
->device_id
);
663 seq_printf(seq
, "type: ");
665 seq_printf(seq
, "CRT\n");
666 else if (dev
->flags
.lcd
)
667 seq_printf(seq
, "LCD\n");
668 else if (dev
->flags
.tvout
)
669 seq_printf(seq
, "TVOUT\n");
671 seq_printf(seq
, "UNKNOWN\n");
673 seq_printf(seq
, "known by bios: %s\n", dev
->flags
.bios
? "yes" : "no");
680 acpi_video_device_info_open_fs(struct inode
*inode
, struct file
*file
)
682 return single_open(file
, acpi_video_device_info_seq_show
,
686 static int acpi_video_device_state_seq_show(struct seq_file
*seq
, void *offset
)
689 struct acpi_video_device
*dev
=
690 (struct acpi_video_device
*)seq
->private;
697 status
= acpi_video_device_get_state(dev
, &state
);
698 seq_printf(seq
, "state: ");
699 if (ACPI_SUCCESS(status
))
700 seq_printf(seq
, "0x%02lx\n", state
);
702 seq_printf(seq
, "<not supported>\n");
704 status
= acpi_video_device_query(dev
, &state
);
705 seq_printf(seq
, "query: ");
706 if (ACPI_SUCCESS(status
))
707 seq_printf(seq
, "0x%02lx\n", state
);
709 seq_printf(seq
, "<not supported>\n");
716 acpi_video_device_state_open_fs(struct inode
*inode
, struct file
*file
)
718 return single_open(file
, acpi_video_device_state_seq_show
,
723 acpi_video_device_write_state(struct file
*file
,
724 const char __user
* buffer
,
725 size_t count
, loff_t
* data
)
728 struct seq_file
*m
= (struct seq_file
*)file
->private_data
;
729 struct acpi_video_device
*dev
= (struct acpi_video_device
*)m
->private;
730 char str
[12] = { 0 };
734 if (!dev
|| count
+ 1 > sizeof str
)
737 if (copy_from_user(str
, buffer
, count
))
741 state
= simple_strtoul(str
, NULL
, 0);
742 state
&= ((1ul << 31) | (1ul << 30) | (1ul << 0));
744 status
= acpi_video_device_set_state(dev
, state
);
753 acpi_video_device_brightness_seq_show(struct seq_file
*seq
, void *offset
)
755 struct acpi_video_device
*dev
=
756 (struct acpi_video_device
*)seq
->private;
760 if (!dev
|| !dev
->brightness
) {
761 seq_printf(seq
, "<not supported>\n");
765 seq_printf(seq
, "levels: ");
766 for (i
= 0; i
< dev
->brightness
->count
; i
++)
767 seq_printf(seq
, " %d", dev
->brightness
->levels
[i
]);
768 seq_printf(seq
, "\ncurrent: %d\n", dev
->brightness
->curr
);
774 acpi_video_device_brightness_open_fs(struct inode
*inode
, struct file
*file
)
776 return single_open(file
, acpi_video_device_brightness_seq_show
,
781 acpi_video_device_write_brightness(struct file
*file
,
782 const char __user
* buffer
,
783 size_t count
, loff_t
* data
)
785 struct seq_file
*m
= (struct seq_file
*)file
->private_data
;
786 struct acpi_video_device
*dev
= (struct acpi_video_device
*)m
->private;
788 unsigned int level
= 0;
792 if (!dev
|| !dev
->brightness
|| count
+ 1 > sizeof str
)
795 if (copy_from_user(str
, buffer
, count
))
799 level
= simple_strtoul(str
, NULL
, 0);
804 /* validate though the list of available levels */
805 for (i
= 0; i
< dev
->brightness
->count
; i
++)
806 if (level
== dev
->brightness
->levels
[i
]) {
808 (acpi_video_device_lcd_set_level(dev
, level
)))
809 dev
->brightness
->curr
= level
;
816 static int acpi_video_device_EDID_seq_show(struct seq_file
*seq
, void *offset
)
818 struct acpi_video_device
*dev
=
819 (struct acpi_video_device
*)seq
->private;
822 union acpi_object
*edid
= NULL
;
828 status
= acpi_video_device_EDID(dev
, &edid
, 128);
829 if (ACPI_FAILURE(status
)) {
830 status
= acpi_video_device_EDID(dev
, &edid
, 256);
833 if (ACPI_FAILURE(status
)) {
837 if (edid
&& edid
->type
== ACPI_TYPE_BUFFER
) {
838 for (i
= 0; i
< edid
->buffer
.length
; i
++)
839 seq_putc(seq
, edid
->buffer
.pointer
[i
]);
844 seq_printf(seq
, "<not supported>\n");
852 acpi_video_device_EDID_open_fs(struct inode
*inode
, struct file
*file
)
854 return single_open(file
, acpi_video_device_EDID_seq_show
,
858 static int acpi_video_device_add_fs(struct acpi_device
*device
)
860 struct proc_dir_entry
*entry
= NULL
;
861 struct acpi_video_device
*vid_dev
;
867 vid_dev
= (struct acpi_video_device
*)acpi_driver_data(device
);
871 if (!acpi_device_dir(device
)) {
872 acpi_device_dir(device
) = proc_mkdir(acpi_device_bid(device
),
873 vid_dev
->video
->dir
);
874 if (!acpi_device_dir(device
))
876 acpi_device_dir(device
)->owner
= THIS_MODULE
;
880 entry
= create_proc_entry("info", S_IRUGO
, acpi_device_dir(device
));
884 entry
->proc_fops
= &acpi_video_device_info_fops
;
885 entry
->data
= acpi_driver_data(device
);
886 entry
->owner
= THIS_MODULE
;
891 create_proc_entry("state", S_IFREG
| S_IRUGO
| S_IWUSR
,
892 acpi_device_dir(device
));
896 acpi_video_device_state_fops
.write
= acpi_video_device_write_state
;
897 entry
->proc_fops
= &acpi_video_device_state_fops
;
898 entry
->data
= acpi_driver_data(device
);
899 entry
->owner
= THIS_MODULE
;
902 /* 'brightness' [R/W] */
904 create_proc_entry("brightness", S_IFREG
| S_IRUGO
| S_IWUSR
,
905 acpi_device_dir(device
));
909 acpi_video_device_brightness_fops
.write
= acpi_video_device_write_brightness
;
910 entry
->proc_fops
= &acpi_video_device_brightness_fops
;
911 entry
->data
= acpi_driver_data(device
);
912 entry
->owner
= THIS_MODULE
;
916 entry
= create_proc_entry("EDID", S_IRUGO
, acpi_device_dir(device
));
920 entry
->proc_fops
= &acpi_video_device_EDID_fops
;
921 entry
->data
= acpi_driver_data(device
);
922 entry
->owner
= THIS_MODULE
;
928 static int acpi_video_device_remove_fs(struct acpi_device
*device
)
930 struct acpi_video_device
*vid_dev
;
932 vid_dev
= (struct acpi_video_device
*)acpi_driver_data(device
);
933 if (!vid_dev
|| !vid_dev
->video
|| !vid_dev
->video
->dir
)
936 if (acpi_device_dir(device
)) {
937 remove_proc_entry("info", acpi_device_dir(device
));
938 remove_proc_entry("state", acpi_device_dir(device
));
939 remove_proc_entry("brightness", acpi_device_dir(device
));
940 remove_proc_entry("EDID", acpi_device_dir(device
));
941 remove_proc_entry(acpi_device_bid(device
), vid_dev
->video
->dir
);
942 acpi_device_dir(device
) = NULL
;
949 static int acpi_video_bus_info_seq_show(struct seq_file
*seq
, void *offset
)
951 struct acpi_video_bus
*video
= (struct acpi_video_bus
*)seq
->private;
957 seq_printf(seq
, "Switching heads: %s\n",
958 video
->flags
.multihead
? "yes" : "no");
959 seq_printf(seq
, "Video ROM: %s\n",
960 video
->flags
.rom
? "yes" : "no");
961 seq_printf(seq
, "Device to be POSTed on boot: %s\n",
962 video
->flags
.post
? "yes" : "no");
968 static int acpi_video_bus_info_open_fs(struct inode
*inode
, struct file
*file
)
970 return single_open(file
, acpi_video_bus_info_seq_show
,
974 static int acpi_video_bus_ROM_seq_show(struct seq_file
*seq
, void *offset
)
976 struct acpi_video_bus
*video
= (struct acpi_video_bus
*)seq
->private;
982 printk(KERN_INFO PREFIX
"Please implement %s\n", __FUNCTION__
);
983 seq_printf(seq
, "<TODO>\n");
989 static int acpi_video_bus_ROM_open_fs(struct inode
*inode
, struct file
*file
)
991 return single_open(file
, acpi_video_bus_ROM_seq_show
, PDE(inode
)->data
);
994 static int acpi_video_bus_POST_info_seq_show(struct seq_file
*seq
, void *offset
)
996 struct acpi_video_bus
*video
= (struct acpi_video_bus
*)seq
->private;
997 unsigned long options
;
1004 status
= acpi_video_bus_POST_options(video
, &options
);
1005 if (ACPI_SUCCESS(status
)) {
1006 if (!(options
& 1)) {
1007 printk(KERN_WARNING PREFIX
1008 "The motherboard VGA device is not listed as a possible POST device.\n");
1009 printk(KERN_WARNING PREFIX
1010 "This indicate a BIOS bug. Please contact the manufacturer.\n");
1012 printk("%lx\n", options
);
1013 seq_printf(seq
, "can POST: <intgrated video>");
1015 seq_printf(seq
, " <PCI video>");
1017 seq_printf(seq
, " <AGP video>");
1018 seq_putc(seq
, '\n');
1020 seq_printf(seq
, "<not supported>\n");
1026 acpi_video_bus_POST_info_open_fs(struct inode
*inode
, struct file
*file
)
1028 return single_open(file
, acpi_video_bus_POST_info_seq_show
,
1032 static int acpi_video_bus_POST_seq_show(struct seq_file
*seq
, void *offset
)
1034 struct acpi_video_bus
*video
= (struct acpi_video_bus
*)seq
->private;
1042 status
= acpi_video_bus_get_POST(video
, &id
);
1043 if (!ACPI_SUCCESS(status
)) {
1044 seq_printf(seq
, "<not supported>\n");
1047 seq_printf(seq
, "device posted is <%s>\n", device_decode
[id
& 3]);
1053 static int acpi_video_bus_DOS_seq_show(struct seq_file
*seq
, void *offset
)
1055 struct acpi_video_bus
*video
= (struct acpi_video_bus
*)seq
->private;
1058 seq_printf(seq
, "DOS setting: <%d>\n", video
->dos_setting
);
1063 static int acpi_video_bus_POST_open_fs(struct inode
*inode
, struct file
*file
)
1065 return single_open(file
, acpi_video_bus_POST_seq_show
,
1069 static int acpi_video_bus_DOS_open_fs(struct inode
*inode
, struct file
*file
)
1071 return single_open(file
, acpi_video_bus_DOS_seq_show
, PDE(inode
)->data
);
1075 acpi_video_bus_write_POST(struct file
*file
,
1076 const char __user
* buffer
,
1077 size_t count
, loff_t
* data
)
1080 struct seq_file
*m
= (struct seq_file
*)file
->private_data
;
1081 struct acpi_video_bus
*video
= (struct acpi_video_bus
*)m
->private;
1082 char str
[12] = { 0 };
1083 unsigned long opt
, options
;
1086 if (!video
|| count
+ 1 > sizeof str
)
1089 status
= acpi_video_bus_POST_options(video
, &options
);
1090 if (!ACPI_SUCCESS(status
))
1093 if (copy_from_user(str
, buffer
, count
))
1097 opt
= strtoul(str
, NULL
, 0);
1101 /* just in case an OEM 'forget' the motherboard... */
1104 if (options
& (1ul << opt
)) {
1105 status
= acpi_video_bus_set_POST(video
, opt
);
1106 if (!ACPI_SUCCESS(status
))
1115 acpi_video_bus_write_DOS(struct file
*file
,
1116 const char __user
* buffer
,
1117 size_t count
, loff_t
* data
)
1120 struct seq_file
*m
= (struct seq_file
*)file
->private_data
;
1121 struct acpi_video_bus
*video
= (struct acpi_video_bus
*)m
->private;
1122 char str
[12] = { 0 };
1126 if (!video
|| count
+ 1 > sizeof str
)
1129 if (copy_from_user(str
, buffer
, count
))
1133 opt
= strtoul(str
, NULL
, 0);
1137 status
= acpi_video_bus_DOS(video
, opt
& 0x3, (opt
& 0x4) >> 2);
1139 if (!ACPI_SUCCESS(status
))
1145 static int acpi_video_bus_add_fs(struct acpi_device
*device
)
1147 struct proc_dir_entry
*entry
= NULL
;
1148 struct acpi_video_bus
*video
;
1151 video
= (struct acpi_video_bus
*)acpi_driver_data(device
);
1153 if (!acpi_device_dir(device
)) {
1154 acpi_device_dir(device
) = proc_mkdir(acpi_device_bid(device
),
1156 if (!acpi_device_dir(device
))
1158 video
->dir
= acpi_device_dir(device
);
1159 acpi_device_dir(device
)->owner
= THIS_MODULE
;
1163 entry
= create_proc_entry("info", S_IRUGO
, acpi_device_dir(device
));
1167 entry
->proc_fops
= &acpi_video_bus_info_fops
;
1168 entry
->data
= acpi_driver_data(device
);
1169 entry
->owner
= THIS_MODULE
;
1173 entry
= create_proc_entry("ROM", S_IRUGO
, acpi_device_dir(device
));
1177 entry
->proc_fops
= &acpi_video_bus_ROM_fops
;
1178 entry
->data
= acpi_driver_data(device
);
1179 entry
->owner
= THIS_MODULE
;
1182 /* 'POST_info' [R] */
1184 create_proc_entry("POST_info", S_IRUGO
, acpi_device_dir(device
));
1188 entry
->proc_fops
= &acpi_video_bus_POST_info_fops
;
1189 entry
->data
= acpi_driver_data(device
);
1190 entry
->owner
= THIS_MODULE
;
1195 create_proc_entry("POST", S_IFREG
| S_IRUGO
| S_IRUSR
,
1196 acpi_device_dir(device
));
1200 acpi_video_bus_POST_fops
.write
= acpi_video_bus_write_POST
;
1201 entry
->proc_fops
= &acpi_video_bus_POST_fops
;
1202 entry
->data
= acpi_driver_data(device
);
1203 entry
->owner
= THIS_MODULE
;
1208 create_proc_entry("DOS", S_IFREG
| S_IRUGO
| S_IRUSR
,
1209 acpi_device_dir(device
));
1213 acpi_video_bus_DOS_fops
.write
= acpi_video_bus_write_DOS
;
1214 entry
->proc_fops
= &acpi_video_bus_DOS_fops
;
1215 entry
->data
= acpi_driver_data(device
);
1216 entry
->owner
= THIS_MODULE
;
1222 static int acpi_video_bus_remove_fs(struct acpi_device
*device
)
1224 struct acpi_video_bus
*video
;
1227 video
= (struct acpi_video_bus
*)acpi_driver_data(device
);
1229 if (acpi_device_dir(device
)) {
1230 remove_proc_entry("info", acpi_device_dir(device
));
1231 remove_proc_entry("ROM", acpi_device_dir(device
));
1232 remove_proc_entry("POST_info", acpi_device_dir(device
));
1233 remove_proc_entry("POST", acpi_device_dir(device
));
1234 remove_proc_entry("DOS", acpi_device_dir(device
));
1235 remove_proc_entry(acpi_device_bid(device
), acpi_video_dir
);
1236 acpi_device_dir(device
) = NULL
;
1242 /* --------------------------------------------------------------------------
1244 -------------------------------------------------------------------------- */
1246 /* device interface */
1249 acpi_video_bus_get_one_device(struct acpi_device
*device
,
1250 struct acpi_video_bus
*video
)
1252 unsigned long device_id
;
1254 struct acpi_video_device
*data
;
1257 if (!device
|| !video
)
1261 acpi_evaluate_integer(device
->handle
, "_ADR", NULL
, &device_id
);
1262 if (ACPI_SUCCESS(status
)) {
1264 data
= kmalloc(sizeof(struct acpi_video_device
), GFP_KERNEL
);
1268 memset(data
, 0, sizeof(struct acpi_video_device
));
1270 strcpy(acpi_device_name(device
), ACPI_VIDEO_DEVICE_NAME
);
1271 strcpy(acpi_device_class(device
), ACPI_VIDEO_CLASS
);
1272 acpi_driver_data(device
) = data
;
1274 data
->device_id
= device_id
;
1275 data
->video
= video
;
1278 switch (device_id
& 0xffff) {
1280 data
->flags
.crt
= 1;
1283 data
->flags
.lcd
= 1;
1286 data
->flags
.tvout
= 1;
1289 data
->flags
.unknown
= 1;
1293 acpi_video_device_bind(video
, data
);
1294 acpi_video_device_find_cap(data
);
1296 status
= acpi_install_notify_handler(device
->handle
,
1298 acpi_video_device_notify
,
1300 if (ACPI_FAILURE(status
)) {
1301 ACPI_DEBUG_PRINT((ACPI_DB_ERROR
,
1302 "Error installing notify handler\n"));
1303 if(data
->brightness
)
1304 kfree(data
->brightness
->levels
);
1305 kfree(data
->brightness
);
1311 list_add_tail(&data
->entry
, &video
->video_device_list
);
1314 acpi_video_device_add_fs(device
);
1324 * video : video bus device
1329 * Enumerate the video device list of the video bus,
1330 * bind the ids with the corresponding video devices
1331 * under the video bus.
1334 static void acpi_video_device_rebind(struct acpi_video_bus
*video
)
1336 struct list_head
*node
, *next
;
1337 list_for_each_safe(node
, next
, &video
->video_device_list
) {
1338 struct acpi_video_device
*dev
=
1339 container_of(node
, struct acpi_video_device
, entry
);
1340 acpi_video_device_bind(video
, dev
);
1346 * video : video bus device
1347 * device : video output device under the video
1353 * Bind the ids with the corresponding video devices
1354 * under the video bus.
1358 acpi_video_device_bind(struct acpi_video_bus
*video
,
1359 struct acpi_video_device
*device
)
1363 #define IDS_VAL(i) video->attached_array[i].value.int_val
1364 #define IDS_BIND(i) video->attached_array[i].bind_info
1366 for (i
= 0; IDS_VAL(i
) != ACPI_VIDEO_HEAD_INVALID
&&
1367 i
< video
->attached_count
; i
++) {
1368 if (device
->device_id
== (IDS_VAL(i
) & 0xffff)) {
1369 IDS_BIND(i
) = device
;
1370 ACPI_DEBUG_PRINT((ACPI_DB_INFO
, "device_bind %d\n", i
));
1379 * video : video bus device
1384 * Call _DOD to enumerate all devices attached to display adapter
1388 static int acpi_video_device_enumerate(struct acpi_video_bus
*video
)
1393 struct acpi_video_enumerated_device
*active_device_list
;
1394 struct acpi_buffer buffer
= { ACPI_ALLOCATE_BUFFER
, NULL
};
1395 union acpi_object
*dod
= NULL
;
1396 union acpi_object
*obj
;
1398 status
= acpi_evaluate_object(video
->device
->handle
, "_DOD", NULL
, &buffer
);
1399 if (!ACPI_SUCCESS(status
)) {
1400 ACPI_EXCEPTION((AE_INFO
, status
, "Evaluating _DOD"));
1404 dod
= (union acpi_object
*)buffer
.pointer
;
1405 if (!dod
|| (dod
->type
!= ACPI_TYPE_PACKAGE
)) {
1406 ACPI_EXCEPTION((AE_INFO
, status
, "Invalid _DOD data"));
1411 ACPI_DEBUG_PRINT((ACPI_DB_INFO
, "Found %d video heads in _DOD\n",
1412 dod
->package
.count
));
1414 active_device_list
= kmalloc((1 +
1415 dod
->package
.count
) *
1417 acpi_video_enumerated_device
),
1420 if (!active_device_list
) {
1426 for (i
= 0; i
< dod
->package
.count
; i
++) {
1427 obj
= (union acpi_object
*)&dod
->package
.elements
[i
];
1429 if (obj
->type
!= ACPI_TYPE_INTEGER
) {
1430 printk(KERN_ERR PREFIX
"Invalid _DOD data\n");
1431 active_device_list
[i
].value
.int_val
=
1432 ACPI_VIDEO_HEAD_INVALID
;
1434 active_device_list
[i
].value
.int_val
= obj
->integer
.value
;
1435 active_device_list
[i
].bind_info
= NULL
;
1436 ACPI_DEBUG_PRINT((ACPI_DB_INFO
, "dod element[%d] = %d\n", i
,
1437 (int)obj
->integer
.value
));
1440 active_device_list
[count
].value
.int_val
= ACPI_VIDEO_HEAD_END
;
1442 kfree(video
->attached_array
);
1444 video
->attached_array
= active_device_list
;
1445 video
->attached_count
= count
;
1447 kfree(buffer
.pointer
);
1453 * video : video bus device
1454 * event : Nontify Event
1459 * 1. Find out the current active output device.
1460 * 2. Identify the next output device to switch
1461 * 3. call _DSS to do actual switch.
1464 static int acpi_video_switch_output(struct acpi_video_bus
*video
, int event
)
1466 struct list_head
*node
, *next
;
1467 struct acpi_video_device
*dev
= NULL
;
1468 struct acpi_video_device
*dev_next
= NULL
;
1469 struct acpi_video_device
*dev_prev
= NULL
;
1470 unsigned long state
;
1474 list_for_each_safe(node
, next
, &video
->video_device_list
) {
1475 dev
= container_of(node
, struct acpi_video_device
, entry
);
1476 status
= acpi_video_device_get_state(dev
, &state
);
1479 container_of(node
->next
, struct acpi_video_device
,
1482 container_of(node
->prev
, struct acpi_video_device
,
1487 dev_next
= container_of(node
->next
, struct acpi_video_device
, entry
);
1488 dev_prev
= container_of(node
->prev
, struct acpi_video_device
, entry
);
1491 case ACPI_VIDEO_NOTIFY_CYCLE
:
1492 case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT
:
1493 acpi_video_device_set_state(dev
, 0);
1494 acpi_video_device_set_state(dev_next
, 0x80000001);
1496 case ACPI_VIDEO_NOTIFY_PREV_OUTPUT
:
1497 acpi_video_device_set_state(dev
, 0);
1498 acpi_video_device_set_state(dev_prev
, 0x80000001);
1507 acpi_video_get_next_level(struct acpi_video_device
*device
,
1508 u32 level_current
, u32 event
)
1511 return level_current
;
1515 acpi_video_switch_brightness(struct acpi_video_device
*device
, int event
)
1517 unsigned long level_current
, level_next
;
1518 acpi_video_device_lcd_get_level_current(device
, &level_current
);
1519 level_next
= acpi_video_get_next_level(device
, level_current
, event
);
1520 acpi_video_device_lcd_set_level(device
, level_next
);
1524 acpi_video_bus_get_devices(struct acpi_video_bus
*video
,
1525 struct acpi_device
*device
)
1528 struct list_head
*node
, *next
;
1531 acpi_video_device_enumerate(video
);
1533 list_for_each_safe(node
, next
, &device
->children
) {
1534 struct acpi_device
*dev
=
1535 list_entry(node
, struct acpi_device
, node
);
1540 status
= acpi_video_bus_get_one_device(dev
, video
);
1541 if (ACPI_FAILURE(status
)) {
1542 ACPI_EXCEPTION((AE_INFO
, status
, "Cant attach device"));
1550 static int acpi_video_bus_put_one_device(struct acpi_video_device
*device
)
1553 struct acpi_video_bus
*video
;
1556 if (!device
|| !device
->video
)
1559 video
= device
->video
;
1562 list_del(&device
->entry
);
1564 acpi_video_device_remove_fs(device
->dev
);
1566 status
= acpi_remove_notify_handler(device
->dev
->handle
,
1568 acpi_video_device_notify
);
1573 static int acpi_video_bus_put_devices(struct acpi_video_bus
*video
)
1576 struct list_head
*node
, *next
;
1579 list_for_each_safe(node
, next
, &video
->video_device_list
) {
1580 struct acpi_video_device
*data
=
1581 list_entry(node
, struct acpi_video_device
, entry
);
1585 status
= acpi_video_bus_put_one_device(data
);
1586 if (ACPI_FAILURE(status
))
1587 printk(KERN_WARNING PREFIX
1588 "hhuuhhuu bug in acpi video driver.\n");
1590 if (data
->brightness
)
1591 kfree(data
->brightness
->levels
);
1592 kfree(data
->brightness
);
1599 /* acpi_video interface */
1601 static int acpi_video_bus_start_devices(struct acpi_video_bus
*video
)
1603 return acpi_video_bus_DOS(video
, 1, 0);
1606 static int acpi_video_bus_stop_devices(struct acpi_video_bus
*video
)
1608 return acpi_video_bus_DOS(video
, 0, 1);
1611 static void acpi_video_bus_notify(acpi_handle handle
, u32 event
, void *data
)
1613 struct acpi_video_bus
*video
= (struct acpi_video_bus
*)data
;
1614 struct acpi_device
*device
= NULL
;
1616 printk("video bus notify\n");
1621 device
= video
->device
;
1624 case ACPI_VIDEO_NOTIFY_SWITCH
: /* User request that a switch occur,
1625 * most likely via hotkey. */
1626 acpi_bus_generate_event(device
, event
, 0);
1629 case ACPI_VIDEO_NOTIFY_PROBE
: /* User plug or remove a video
1631 acpi_video_device_enumerate(video
);
1632 acpi_video_device_rebind(video
);
1633 acpi_video_switch_output(video
, event
);
1634 acpi_bus_generate_event(device
, event
, 0);
1637 case ACPI_VIDEO_NOTIFY_CYCLE
: /* Cycle Display output hotkey pressed. */
1638 case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT
: /* Next Display output hotkey pressed. */
1639 case ACPI_VIDEO_NOTIFY_PREV_OUTPUT
: /* previous Display output hotkey pressed. */
1640 acpi_video_switch_output(video
, event
);
1641 acpi_bus_generate_event(device
, event
, 0);
1645 ACPI_DEBUG_PRINT((ACPI_DB_INFO
,
1646 "Unsupported event [0x%x]\n", event
));
1653 static void acpi_video_device_notify(acpi_handle handle
, u32 event
, void *data
)
1655 struct acpi_video_device
*video_device
=
1656 (struct acpi_video_device
*)data
;
1657 struct acpi_device
*device
= NULL
;
1660 printk("video device notify\n");
1664 device
= video_device
->dev
;
1667 case ACPI_VIDEO_NOTIFY_SWITCH
: /* change in status (cycle output device) */
1668 case ACPI_VIDEO_NOTIFY_PROBE
: /* change in status (output device status) */
1669 acpi_bus_generate_event(device
, event
, 0);
1671 case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS
: /* Cycle brightness */
1672 case ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS
: /* Increase brightness */
1673 case ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS
: /* Decrease brightness */
1674 case ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS
: /* zero brightnesss */
1675 case ACPI_VIDEO_NOTIFY_DISPLAY_OFF
: /* display device off */
1676 acpi_video_switch_brightness(video_device
, event
);
1677 acpi_bus_generate_event(device
, event
, 0);
1680 ACPI_DEBUG_PRINT((ACPI_DB_INFO
,
1681 "Unsupported event [0x%x]\n", event
));
1687 static int acpi_video_bus_add(struct acpi_device
*device
)
1690 acpi_status status
= 0;
1691 struct acpi_video_bus
*video
= NULL
;
1697 video
= kmalloc(sizeof(struct acpi_video_bus
), GFP_KERNEL
);
1700 memset(video
, 0, sizeof(struct acpi_video_bus
));
1702 video
->device
= device
;
1703 strcpy(acpi_device_name(device
), ACPI_VIDEO_BUS_NAME
);
1704 strcpy(acpi_device_class(device
), ACPI_VIDEO_CLASS
);
1705 acpi_driver_data(device
) = video
;
1707 acpi_video_bus_find_cap(video
);
1708 result
= acpi_video_bus_check(video
);
1712 result
= acpi_video_bus_add_fs(device
);
1716 init_MUTEX(&video
->sem
);
1717 INIT_LIST_HEAD(&video
->video_device_list
);
1719 acpi_video_bus_get_devices(video
, device
);
1720 acpi_video_bus_start_devices(video
);
1722 status
= acpi_install_notify_handler(device
->handle
,
1724 acpi_video_bus_notify
, video
);
1725 if (ACPI_FAILURE(status
)) {
1726 ACPI_DEBUG_PRINT((ACPI_DB_ERROR
,
1727 "Error installing notify handler\n"));
1728 acpi_video_bus_stop_devices(video
);
1729 acpi_video_bus_put_devices(video
);
1730 kfree(video
->attached_array
);
1731 acpi_video_bus_remove_fs(device
);
1736 printk(KERN_INFO PREFIX
"%s [%s] (multi-head: %s rom: %s post: %s)\n",
1737 ACPI_VIDEO_DEVICE_NAME
, acpi_device_bid(device
),
1738 video
->flags
.multihead
? "yes" : "no",
1739 video
->flags
.rom
? "yes" : "no",
1740 video
->flags
.post
? "yes" : "no");
1749 static int acpi_video_bus_remove(struct acpi_device
*device
, int type
)
1751 acpi_status status
= 0;
1752 struct acpi_video_bus
*video
= NULL
;
1755 if (!device
|| !acpi_driver_data(device
))
1758 video
= (struct acpi_video_bus
*)acpi_driver_data(device
);
1760 acpi_video_bus_stop_devices(video
);
1762 status
= acpi_remove_notify_handler(video
->device
->handle
,
1764 acpi_video_bus_notify
);
1766 acpi_video_bus_put_devices(video
);
1767 acpi_video_bus_remove_fs(device
);
1769 kfree(video
->attached_array
);
1775 static int __init
acpi_video_init(void)
1781 acpi_dbg_level = 0xFFFFFFFF;
1782 acpi_dbg_layer = 0x08000000;
1785 acpi_video_dir
= proc_mkdir(ACPI_VIDEO_CLASS
, acpi_root_dir
);
1786 if (!acpi_video_dir
)
1788 acpi_video_dir
->owner
= THIS_MODULE
;
1790 result
= acpi_bus_register_driver(&acpi_video_bus
);
1792 remove_proc_entry(ACPI_VIDEO_CLASS
, acpi_root_dir
);
1799 static void __exit
acpi_video_exit(void)
1802 acpi_bus_unregister_driver(&acpi_video_bus
);
1804 remove_proc_entry(ACPI_VIDEO_CLASS
, acpi_root_dir
);
1809 module_init(acpi_video_init
);
1810 module_exit(acpi_video_exit
);