diff options
Diffstat (limited to 'drivers/acpi/video.c')
-rw-r--r-- | drivers/acpi/video.c | 141 |
1 files changed, 86 insertions, 55 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 9865d46f49a8..67dec0c675aa 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -152,7 +152,9 @@ struct acpi_video_bus { | |||
152 | struct acpi_video_bus_flags flags; | 152 | struct acpi_video_bus_flags flags; |
153 | struct list_head video_device_list; | 153 | struct list_head video_device_list; |
154 | struct mutex device_list_lock; /* protects video_device_list */ | 154 | struct mutex device_list_lock; /* protects video_device_list */ |
155 | #ifdef CONFIG_ACPI_PROCFS | ||
155 | struct proc_dir_entry *dir; | 156 | struct proc_dir_entry *dir; |
157 | #endif | ||
156 | struct input_dev *input; | 158 | struct input_dev *input; |
157 | char phys[32]; /* for input device */ | 159 | char phys[32]; /* for input device */ |
158 | struct notifier_block pm_nb; | 160 | struct notifier_block pm_nb; |
@@ -208,6 +210,7 @@ struct acpi_video_device { | |||
208 | struct output_device *output_dev; | 210 | struct output_device *output_dev; |
209 | }; | 211 | }; |
210 | 212 | ||
213 | #ifdef CONFIG_ACPI_PROCFS | ||
211 | /* bus */ | 214 | /* bus */ |
212 | static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file); | 215 | static int acpi_video_bus_info_open_fs(struct inode *inode, struct file *file); |
213 | static const struct file_operations acpi_video_bus_info_fops = { | 216 | static const struct file_operations acpi_video_bus_info_fops = { |
@@ -307,6 +310,7 @@ static const struct file_operations acpi_video_device_EDID_fops = { | |||
307 | .llseek = seq_lseek, | 310 | .llseek = seq_lseek, |
308 | .release = single_release, | 311 | .release = single_release, |
309 | }; | 312 | }; |
313 | #endif /* CONFIG_ACPI_PROCFS */ | ||
310 | 314 | ||
311 | static const char device_decode[][30] = { | 315 | static const char device_decode[][30] = { |
312 | "motherboard VGA device", | 316 | "motherboard VGA device", |
@@ -450,16 +454,6 @@ static struct thermal_cooling_device_ops video_cooling_ops = { | |||
450 | /* device */ | 454 | /* device */ |
451 | 455 | ||
452 | static int | 456 | static int |
453 | acpi_video_device_query(struct acpi_video_device *device, unsigned long long *state) | ||
454 | { | ||
455 | int status; | ||
456 | |||
457 | status = acpi_evaluate_integer(device->dev->handle, "_DGS", NULL, state); | ||
458 | |||
459 | return status; | ||
460 | } | ||
461 | |||
462 | static int | ||
463 | acpi_video_device_get_state(struct acpi_video_device *device, | 457 | acpi_video_device_get_state(struct acpi_video_device *device, |
464 | unsigned long long *state) | 458 | unsigned long long *state) |
465 | { | 459 | { |
@@ -698,46 +692,6 @@ acpi_video_device_EDID(struct acpi_video_device *device, | |||
698 | 692 | ||
699 | /* bus */ | 693 | /* bus */ |
700 | 694 | ||
701 | static int | ||
702 | acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option) | ||
703 | { | ||
704 | int status; | ||
705 | unsigned long long tmp; | ||
706 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; | ||
707 | struct acpi_object_list args = { 1, &arg0 }; | ||
708 | |||
709 | |||
710 | arg0.integer.value = option; | ||
711 | |||
712 | status = acpi_evaluate_integer(video->device->handle, "_SPD", &args, &tmp); | ||
713 | if (ACPI_SUCCESS(status)) | ||
714 | status = tmp ? (-EINVAL) : (AE_OK); | ||
715 | |||
716 | return status; | ||
717 | } | ||
718 | |||
719 | static int | ||
720 | acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long long *id) | ||
721 | { | ||
722 | int status; | ||
723 | |||
724 | status = acpi_evaluate_integer(video->device->handle, "_GPD", NULL, id); | ||
725 | |||
726 | return status; | ||
727 | } | ||
728 | |||
729 | static int | ||
730 | acpi_video_bus_POST_options(struct acpi_video_bus *video, | ||
731 | unsigned long long *options) | ||
732 | { | ||
733 | int status; | ||
734 | |||
735 | status = acpi_evaluate_integer(video->device->handle, "_VPO", NULL, options); | ||
736 | *options &= 3; | ||
737 | |||
738 | return status; | ||
739 | } | ||
740 | |||
741 | /* | 695 | /* |
742 | * Arg: | 696 | * Arg: |
743 | * video : video bus device pointer | 697 | * video : video bus device pointer |
@@ -1159,6 +1113,7 @@ static int acpi_video_bus_check(struct acpi_video_bus *video) | |||
1159 | /* -------------------------------------------------------------------------- | 1113 | /* -------------------------------------------------------------------------- |
1160 | FS Interface (/proc) | 1114 | FS Interface (/proc) |
1161 | -------------------------------------------------------------------------- */ | 1115 | -------------------------------------------------------------------------- */ |
1116 | #ifdef CONFIG_ACPI_PROCFS | ||
1162 | 1117 | ||
1163 | static struct proc_dir_entry *acpi_video_dir; | 1118 | static struct proc_dir_entry *acpi_video_dir; |
1164 | 1119 | ||
@@ -1198,6 +1153,18 @@ acpi_video_device_info_open_fs(struct inode *inode, struct file *file) | |||
1198 | PDE(inode)->data); | 1153 | PDE(inode)->data); |
1199 | } | 1154 | } |
1200 | 1155 | ||
1156 | static int | ||
1157 | acpi_video_device_query(struct acpi_video_device *device, | ||
1158 | unsigned long long *state) | ||
1159 | { | ||
1160 | int status; | ||
1161 | |||
1162 | status = acpi_evaluate_integer(device->dev->handle, "_DGS", | ||
1163 | NULL, state); | ||
1164 | |||
1165 | return status; | ||
1166 | } | ||
1167 | |||
1201 | static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset) | 1168 | static int acpi_video_device_state_seq_show(struct seq_file *seq, void *offset) |
1202 | { | 1169 | { |
1203 | int status; | 1170 | int status; |
@@ -1492,6 +1459,19 @@ static int acpi_video_bus_ROM_open_fs(struct inode *inode, struct file *file) | |||
1492 | return single_open(file, acpi_video_bus_ROM_seq_show, PDE(inode)->data); | 1459 | return single_open(file, acpi_video_bus_ROM_seq_show, PDE(inode)->data); |
1493 | } | 1460 | } |
1494 | 1461 | ||
1462 | static int | ||
1463 | acpi_video_bus_POST_options(struct acpi_video_bus *video, | ||
1464 | unsigned long long *options) | ||
1465 | { | ||
1466 | int status; | ||
1467 | |||
1468 | status = acpi_evaluate_integer(video->device->handle, "_VPO", | ||
1469 | NULL, options); | ||
1470 | *options &= 3; | ||
1471 | |||
1472 | return status; | ||
1473 | } | ||
1474 | |||
1495 | static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset) | 1475 | static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset) |
1496 | { | 1476 | { |
1497 | struct acpi_video_bus *video = seq->private; | 1477 | struct acpi_video_bus *video = seq->private; |
@@ -1530,6 +1510,16 @@ acpi_video_bus_POST_info_open_fs(struct inode *inode, struct file *file) | |||
1530 | PDE(inode)->data); | 1510 | PDE(inode)->data); |
1531 | } | 1511 | } |
1532 | 1512 | ||
1513 | static int | ||
1514 | acpi_video_bus_get_POST(struct acpi_video_bus *video, unsigned long long *id) | ||
1515 | { | ||
1516 | int status; | ||
1517 | |||
1518 | status = acpi_evaluate_integer(video->device->handle, "_GPD", NULL, id); | ||
1519 | |||
1520 | return status; | ||
1521 | } | ||
1522 | |||
1533 | static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset) | 1523 | static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset) |
1534 | { | 1524 | { |
1535 | struct acpi_video_bus *video = seq->private; | 1525 | struct acpi_video_bus *video = seq->private; |
@@ -1572,6 +1562,25 @@ static int acpi_video_bus_DOS_open_fs(struct inode *inode, struct file *file) | |||
1572 | return single_open(file, acpi_video_bus_DOS_seq_show, PDE(inode)->data); | 1562 | return single_open(file, acpi_video_bus_DOS_seq_show, PDE(inode)->data); |
1573 | } | 1563 | } |
1574 | 1564 | ||
1565 | static int | ||
1566 | acpi_video_bus_set_POST(struct acpi_video_bus *video, unsigned long option) | ||
1567 | { | ||
1568 | int status; | ||
1569 | unsigned long long tmp; | ||
1570 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; | ||
1571 | struct acpi_object_list args = { 1, &arg0 }; | ||
1572 | |||
1573 | |||
1574 | arg0.integer.value = option; | ||
1575 | |||
1576 | status = acpi_evaluate_integer(video->device->handle, "_SPD", | ||
1577 | &args, &tmp); | ||
1578 | if (ACPI_SUCCESS(status)) | ||
1579 | status = tmp ? (-EINVAL) : (AE_OK); | ||
1580 | |||
1581 | return status; | ||
1582 | } | ||
1583 | |||
1575 | static ssize_t | 1584 | static ssize_t |
1576 | acpi_video_bus_write_POST(struct file *file, | 1585 | acpi_video_bus_write_POST(struct file *file, |
1577 | const char __user * buffer, | 1586 | const char __user * buffer, |
@@ -1722,6 +1731,24 @@ static int acpi_video_bus_remove_fs(struct acpi_device *device) | |||
1722 | 1731 | ||
1723 | return 0; | 1732 | return 0; |
1724 | } | 1733 | } |
1734 | #else | ||
1735 | static inline int acpi_video_device_add_fs(struct acpi_device *device) | ||
1736 | { | ||
1737 | return 0; | ||
1738 | } | ||
1739 | static inline int acpi_video_device_remove_fs(struct acpi_device *device) | ||
1740 | { | ||
1741 | return 0; | ||
1742 | } | ||
1743 | static inline int acpi_video_bus_add_fs(struct acpi_device *device) | ||
1744 | { | ||
1745 | return 0; | ||
1746 | } | ||
1747 | static inline int acpi_video_bus_remove_fs(struct acpi_device *device) | ||
1748 | { | ||
1749 | return 0; | ||
1750 | } | ||
1751 | #endif /* CONFIG_ACPI_PROCFS */ | ||
1725 | 1752 | ||
1726 | /* -------------------------------------------------------------------------- | 1753 | /* -------------------------------------------------------------------------- |
1727 | Driver Interface | 1754 | Driver Interface |
@@ -2140,7 +2167,7 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video, | |||
2140 | status = acpi_video_bus_get_one_device(dev, video); | 2167 | status = acpi_video_bus_get_one_device(dev, video); |
2141 | if (ACPI_FAILURE(status)) { | 2168 | if (ACPI_FAILURE(status)) { |
2142 | printk(KERN_WARNING PREFIX | 2169 | printk(KERN_WARNING PREFIX |
2143 | "Cant attach device"); | 2170 | "Cant attach device\n"); |
2144 | continue; | 2171 | continue; |
2145 | } | 2172 | } |
2146 | } | 2173 | } |
@@ -2150,19 +2177,19 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video, | |||
2150 | static int acpi_video_bus_put_one_device(struct acpi_video_device *device) | 2177 | static int acpi_video_bus_put_one_device(struct acpi_video_device *device) |
2151 | { | 2178 | { |
2152 | acpi_status status; | 2179 | acpi_status status; |
2153 | struct acpi_video_bus *video; | ||
2154 | |||
2155 | 2180 | ||
2156 | if (!device || !device->video) | 2181 | if (!device || !device->video) |
2157 | return -ENOENT; | 2182 | return -ENOENT; |
2158 | 2183 | ||
2159 | video = device->video; | ||
2160 | |||
2161 | acpi_video_device_remove_fs(device->dev); | 2184 | acpi_video_device_remove_fs(device->dev); |
2162 | 2185 | ||
2163 | status = acpi_remove_notify_handler(device->dev->handle, | 2186 | status = acpi_remove_notify_handler(device->dev->handle, |
2164 | ACPI_DEVICE_NOTIFY, | 2187 | ACPI_DEVICE_NOTIFY, |
2165 | acpi_video_device_notify); | 2188 | acpi_video_device_notify); |
2189 | if (ACPI_FAILURE(status)) { | ||
2190 | printk(KERN_WARNING PREFIX | ||
2191 | "Cant remove video notify handler\n"); | ||
2192 | } | ||
2166 | if (device->backlight) { | 2193 | if (device->backlight) { |
2167 | sysfs_remove_link(&device->backlight->dev.kobj, "device"); | 2194 | sysfs_remove_link(&device->backlight->dev.kobj, "device"); |
2168 | backlight_device_unregister(device->backlight); | 2195 | backlight_device_unregister(device->backlight); |
@@ -2557,9 +2584,11 @@ int acpi_video_register(void) | |||
2557 | return 0; | 2584 | return 0; |
2558 | } | 2585 | } |
2559 | 2586 | ||
2587 | #ifdef CONFIG_ACPI_PROCFS | ||
2560 | acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir); | 2588 | acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir); |
2561 | if (!acpi_video_dir) | 2589 | if (!acpi_video_dir) |
2562 | return -ENODEV; | 2590 | return -ENODEV; |
2591 | #endif | ||
2563 | 2592 | ||
2564 | result = acpi_bus_register_driver(&acpi_video_bus); | 2593 | result = acpi_bus_register_driver(&acpi_video_bus); |
2565 | if (result < 0) { | 2594 | if (result < 0) { |
@@ -2588,7 +2617,9 @@ void acpi_video_unregister(void) | |||
2588 | } | 2617 | } |
2589 | acpi_bus_unregister_driver(&acpi_video_bus); | 2618 | acpi_bus_unregister_driver(&acpi_video_bus); |
2590 | 2619 | ||
2620 | #ifdef CONFIG_ACPI_PROCFS | ||
2591 | remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir); | 2621 | remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir); |
2622 | #endif | ||
2592 | 2623 | ||
2593 | register_count = 0; | 2624 | register_count = 0; |
2594 | 2625 | ||