aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/Kconfig12
-rw-r--r--drivers/acpi/asus_acpi.c7
-rw-r--r--drivers/acpi/ibm_acpi.c32
-rw-r--r--drivers/acpi/resources/rscreate.c25
-rw-r--r--drivers/acpi/toshiba_acpi.c7
-rw-r--r--drivers/acpi/video.c36
6 files changed, 81 insertions, 38 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index e942ffe8b57e..4a3220b218d8 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -149,6 +149,7 @@ config ACPI_DOCK
149config ACPI_BAY 149config ACPI_BAY
150 tristate "Removable Drive Bay (EXPERIMENTAL)" 150 tristate "Removable Drive Bay (EXPERIMENTAL)"
151 depends on EXPERIMENTAL 151 depends on EXPERIMENTAL
152 depends on ACPI_DOCK
152 help 153 help
153 This driver adds support for ACPI controlled removable drive 154 This driver adds support for ACPI controlled removable drive
154 bays such as the IBM ultrabay or the Dell Module Bay. 155 bays such as the IBM ultrabay or the Dell Module Bay.
@@ -242,6 +243,17 @@ config ACPI_IBM_DOCK
242 243
243 If you are not sure, say N here. 244 If you are not sure, say N here.
244 245
246config ACPI_IBM_BAY
247 bool "Legacy Removable Bay Support"
248 depends on ACPI_IBM
249 default y
250 ---help---
251 Allows the ibm_acpi driver to handle removable bays. It will allow
252 disabling the device in the bay, and also generate notifications when
253 the bay lever is ejected or inserted.
254
255 If you are not sure, say Y here.
256
245config ACPI_TOSHIBA 257config ACPI_TOSHIBA
246 tristate "Toshiba Laptop Extras" 258 tristate "Toshiba Laptop Extras"
247 depends on X86 259 depends on X86
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
index 772299fb5f9d..b770deab968c 100644
--- a/drivers/acpi/asus_acpi.c
+++ b/drivers/acpi/asus_acpi.c
@@ -848,7 +848,7 @@ out:
848 848
849static int set_brightness_status(struct backlight_device *bd) 849static int set_brightness_status(struct backlight_device *bd)
850{ 850{
851 return set_brightness(bd->props->brightness); 851 return set_brightness(bd->props.brightness);
852} 852}
853 853
854static int 854static int
@@ -1352,11 +1352,9 @@ static int asus_hotk_remove(struct acpi_device *device, int type)
1352 return 0; 1352 return 0;
1353} 1353}
1354 1354
1355static struct backlight_properties asus_backlight_data = { 1355static struct backlight_ops asus_backlight_data = {
1356 .owner = THIS_MODULE,
1357 .get_brightness = read_brightness, 1356 .get_brightness = read_brightness,
1358 .update_status = set_brightness_status, 1357 .update_status = set_brightness_status,
1359 .max_brightness = 15,
1360}; 1358};
1361 1359
1362static void __exit asus_acpi_exit(void) 1360static void __exit asus_acpi_exit(void)
@@ -1410,6 +1408,7 @@ static int __init asus_acpi_init(void)
1410 asus_backlight_device = NULL; 1408 asus_backlight_device = NULL;
1411 asus_acpi_exit(); 1409 asus_acpi_exit();
1412 } 1410 }
1411 asus_backlight_device->props.max_brightness = 15;
1413 1412
1414 return 0; 1413 return 0;
1415} 1414}
diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c
index 1a0ed3dc409c..36901362fd24 100644
--- a/drivers/acpi/ibm_acpi.c
+++ b/drivers/acpi/ibm_acpi.c
@@ -86,6 +86,7 @@
86 86
87#include <linux/proc_fs.h> 87#include <linux/proc_fs.h>
88#include <linux/backlight.h> 88#include <linux/backlight.h>
89#include <linux/fb.h>
89#include <asm/uaccess.h> 90#include <asm/uaccess.h>
90 91
91#include <linux/dmi.h> 92#include <linux/dmi.h>
@@ -157,6 +158,7 @@ IBM_HANDLE(dock, root, "\\_SB.GDCK", /* X30, X31, X40 */
157 "\\_SB.PCI.ISA.SLCE", /* 570 */ 158 "\\_SB.PCI.ISA.SLCE", /* 570 */
158 ); /* A21e,G4x,R30,R31,R32,R40,R40e,R50e */ 159 ); /* A21e,G4x,R30,R31,R32,R40,R40e,R50e */
159#endif 160#endif
161#ifdef CONFIG_ACPI_IBM_BAY
160IBM_HANDLE(bay, root, "\\_SB.PCI.IDE.SECN.MAST", /* 570 */ 162IBM_HANDLE(bay, root, "\\_SB.PCI.IDE.SECN.MAST", /* 570 */
161 "\\_SB.PCI0.IDE0.IDES.IDSM", /* 600e/x, 770e, 770x */ 163 "\\_SB.PCI0.IDE0.IDES.IDSM", /* 600e/x, 770e, 770x */
162 "\\_SB.PCI0.SATA.SCND.MSTR", /* T60, X60, Z60 */ 164 "\\_SB.PCI0.SATA.SCND.MSTR", /* T60, X60, Z60 */
@@ -174,6 +176,7 @@ IBM_HANDLE(bay2, root, "\\_SB.PCI0.IDE0.PRIM.SLAV", /* A3x, R32 */
174IBM_HANDLE(bay2_ej, bay2, "_EJ3", /* 600e/x, 770e, A3x */ 176IBM_HANDLE(bay2_ej, bay2, "_EJ3", /* 600e/x, 770e, A3x */
175 "_EJ0", /* 770x */ 177 "_EJ0", /* 770x */
176 ); /* all others */ 178 ); /* all others */
179#endif /* CONFIG_ACPI_IBM_BAY */
177 180
178/* don't list other alternatives as we install a notify handler on the 570 */ 181/* don't list other alternatives as we install a notify handler on the 570 */
179IBM_HANDLE(pci, root, "\\_SB.PCI"); /* 570 */ 182IBM_HANDLE(pci, root, "\\_SB.PCI"); /* 570 */
@@ -1044,6 +1047,7 @@ static int light_write(char *buf)
1044 return 0; 1047 return 0;
1045} 1048}
1046 1049
1050#if defined(CONFIG_ACPI_IBM_DOCK) || defined(CONFIG_ACPI_IBM_BAY)
1047static int _sta(acpi_handle handle) 1051static int _sta(acpi_handle handle)
1048{ 1052{
1049 int status; 1053 int status;
@@ -1053,6 +1057,7 @@ static int _sta(acpi_handle handle)
1053 1057
1054 return status; 1058 return status;
1055} 1059}
1060#endif
1056 1061
1057#ifdef CONFIG_ACPI_IBM_DOCK 1062#ifdef CONFIG_ACPI_IBM_DOCK
1058#define dock_docked() (_sta(dock_handle) & 1) 1063#define dock_docked() (_sta(dock_handle) & 1)
@@ -1119,6 +1124,7 @@ static void dock_notify(struct ibm_struct *ibm, u32 event)
1119} 1124}
1120#endif 1125#endif
1121 1126
1127#ifdef CONFIG_ACPI_IBM_BAY
1122static int bay_status_supported; 1128static int bay_status_supported;
1123static int bay_status2_supported; 1129static int bay_status2_supported;
1124static int bay_eject_supported; 1130static int bay_eject_supported;
@@ -1194,6 +1200,7 @@ static void bay_notify(struct ibm_struct *ibm, u32 event)
1194{ 1200{
1195 acpi_bus_generate_event(ibm->device, event, 0); 1201 acpi_bus_generate_event(ibm->device, event, 0);
1196} 1202}
1203#endif /* CONFIG_ACPI_IBM_BAY */
1197 1204
1198static int cmos_read(char *p) 1205static int cmos_read(char *p)
1199{ 1206{
@@ -1701,18 +1708,25 @@ static int brightness_write(char *buf)
1701 1708
1702static int brightness_update_status(struct backlight_device *bd) 1709static int brightness_update_status(struct backlight_device *bd)
1703{ 1710{
1704 return brightness_set(bd->props->brightness); 1711 return brightness_set(
1712 (bd->props.fb_blank == FB_BLANK_UNBLANK &&
1713 bd->props.power == FB_BLANK_UNBLANK) ?
1714 bd->props.brightness : 0);
1705} 1715}
1706 1716
1707static struct backlight_properties ibm_backlight_data = { 1717static struct backlight_ops ibm_backlight_data = {
1708 .owner = THIS_MODULE,
1709 .get_brightness = brightness_get, 1718 .get_brightness = brightness_get,
1710 .update_status = brightness_update_status, 1719 .update_status = brightness_update_status,
1711 .max_brightness = 7,
1712}; 1720};
1713 1721
1714static int brightness_init(void) 1722static int brightness_init(void)
1715{ 1723{
1724 int b;
1725
1726 b = brightness_get(NULL);
1727 if (b < 0)
1728 return b;
1729
1716 ibm_backlight_device = backlight_device_register("ibm", NULL, NULL, 1730 ibm_backlight_device = backlight_device_register("ibm", NULL, NULL,
1717 &ibm_backlight_data); 1731 &ibm_backlight_data);
1718 if (IS_ERR(ibm_backlight_device)) { 1732 if (IS_ERR(ibm_backlight_device)) {
@@ -1720,6 +1734,10 @@ static int brightness_init(void)
1720 return PTR_ERR(ibm_backlight_device); 1734 return PTR_ERR(ibm_backlight_device);
1721 } 1735 }
1722 1736
1737 ibm_backlight_device->props.max_brightness = 7;
1738 ibm_backlight_device->props.brightness = b;
1739 backlight_update_status(ibm_backlight_device);
1740
1723 return 0; 1741 return 0;
1724} 1742}
1725 1743
@@ -2353,6 +2371,7 @@ static struct ibm_struct ibms[] = {
2353 .type = ACPI_SYSTEM_NOTIFY, 2371 .type = ACPI_SYSTEM_NOTIFY,
2354 }, 2372 },
2355#endif 2373#endif
2374#ifdef CONFIG_ACPI_IBM_BAY
2356 { 2375 {
2357 .name = "bay", 2376 .name = "bay",
2358 .init = bay_init, 2377 .init = bay_init,
@@ -2362,6 +2381,7 @@ static struct ibm_struct ibms[] = {
2362 .handle = &bay_handle, 2381 .handle = &bay_handle,
2363 .type = ACPI_SYSTEM_NOTIFY, 2382 .type = ACPI_SYSTEM_NOTIFY,
2364 }, 2383 },
2384#endif /* CONFIG_ACPI_IBM_BAY */
2365 { 2385 {
2366 .name = "cmos", 2386 .name = "cmos",
2367 .read = cmos_read, 2387 .read = cmos_read,
@@ -2647,7 +2667,9 @@ IBM_PARAM(light);
2647#ifdef CONFIG_ACPI_IBM_DOCK 2667#ifdef CONFIG_ACPI_IBM_DOCK
2648IBM_PARAM(dock); 2668IBM_PARAM(dock);
2649#endif 2669#endif
2670#ifdef CONFIG_ACPI_IBM_BAY
2650IBM_PARAM(bay); 2671IBM_PARAM(bay);
2672#endif /* CONFIG_ACPI_IBM_BAY */
2651IBM_PARAM(cmos); 2673IBM_PARAM(cmos);
2652IBM_PARAM(led); 2674IBM_PARAM(led);
2653IBM_PARAM(beep); 2675IBM_PARAM(beep);
@@ -2723,12 +2745,14 @@ static int __init acpi_ibm_init(void)
2723 IBM_HANDLE_INIT(dock); 2745 IBM_HANDLE_INIT(dock);
2724#endif 2746#endif
2725 IBM_HANDLE_INIT(pci); 2747 IBM_HANDLE_INIT(pci);
2748#ifdef CONFIG_ACPI_IBM_BAY
2726 IBM_HANDLE_INIT(bay); 2749 IBM_HANDLE_INIT(bay);
2727 if (bay_handle) 2750 if (bay_handle)
2728 IBM_HANDLE_INIT(bay_ej); 2751 IBM_HANDLE_INIT(bay_ej);
2729 IBM_HANDLE_INIT(bay2); 2752 IBM_HANDLE_INIT(bay2);
2730 if (bay2_handle) 2753 if (bay2_handle)
2731 IBM_HANDLE_INIT(bay2_ej); 2754 IBM_HANDLE_INIT(bay2_ej);
2755#endif /* CONFIG_ACPI_IBM_BAY */
2732 IBM_HANDLE_INIT(beep); 2756 IBM_HANDLE_INIT(beep);
2733 IBM_HANDLE_INIT(ecrd); 2757 IBM_HANDLE_INIT(ecrd);
2734 IBM_HANDLE_INIT(ecwr); 2758 IBM_HANDLE_INIT(ecwr);
diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c
index 1358c06a969c..cc48ab05676c 100644
--- a/drivers/acpi/resources/rscreate.c
+++ b/drivers/acpi/resources/rscreate.c
@@ -191,6 +191,9 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
191 user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); 191 user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer);
192 192
193 for (index = 0; index < number_of_elements; index++) { 193 for (index = 0; index < number_of_elements; index++) {
194 int source_name_index = 2;
195 int source_index_index = 3;
196
194 /* 197 /*
195 * Point user_prt past this current structure 198 * Point user_prt past this current structure
196 * 199 *
@@ -261,10 +264,28 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
261 } 264 }
262 265
263 /* 266 /*
267 * If BIOS erroneously reversed the _PRT source_name and source_index,
268 * then reverse them back.
269 */
270 if (ACPI_GET_OBJECT_TYPE (sub_object_list[3]) != ACPI_TYPE_INTEGER) {
271 if (acpi_gbl_enable_interpreter_slack) {
272 source_name_index = 3;
273 source_index_index = 2;
274 printk(KERN_WARNING "ACPI: Handling Garbled _PRT entry\n");
275 } else {
276 ACPI_ERROR((AE_INFO,
277 "(PRT[%X].source_index) Need Integer, found %s",
278 index,
279 acpi_ut_get_object_type_name(sub_object_list[3])));
280 return_ACPI_STATUS(AE_BAD_DATA);
281 }
282 }
283
284 /*
264 * 3) Third subobject: Dereference the PRT.source_name 285 * 3) Third subobject: Dereference the PRT.source_name
265 * The name may be unresolved (slack mode), so allow a null object 286 * The name may be unresolved (slack mode), so allow a null object
266 */ 287 */
267 obj_desc = sub_object_list[2]; 288 obj_desc = sub_object_list[source_name_index];
268 if (obj_desc) { 289 if (obj_desc) {
269 switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { 290 switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
270 case ACPI_TYPE_LOCAL_REFERENCE: 291 case ACPI_TYPE_LOCAL_REFERENCE:
@@ -339,7 +360,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
339 360
340 /* 4) Fourth subobject: Dereference the PRT.source_index */ 361 /* 4) Fourth subobject: Dereference the PRT.source_index */
341 362
342 obj_desc = sub_object_list[3]; 363 obj_desc = sub_object_list[source_index_index];
343 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { 364 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
344 user_prt->source_index = (u32) obj_desc->integer.value; 365 user_prt->source_index = (u32) obj_desc->integer.value;
345 } else { 366 } else {
diff --git a/drivers/acpi/toshiba_acpi.c b/drivers/acpi/toshiba_acpi.c
index faf8a5232d8e..3906d47b9783 100644
--- a/drivers/acpi/toshiba_acpi.c
+++ b/drivers/acpi/toshiba_acpi.c
@@ -315,7 +315,7 @@ static int set_lcd(int value)
315 315
316static int set_lcd_status(struct backlight_device *bd) 316static int set_lcd_status(struct backlight_device *bd)
317{ 317{
318 return set_lcd(bd->props->brightness); 318 return set_lcd(bd->props.brightness);
319} 319}
320 320
321static unsigned long write_lcd(const char *buffer, unsigned long count) 321static unsigned long write_lcd(const char *buffer, unsigned long count)
@@ -533,11 +533,9 @@ static acpi_status __exit remove_device(void)
533 return AE_OK; 533 return AE_OK;
534} 534}
535 535
536static struct backlight_properties toshiba_backlight_data = { 536static struct backlight_ops toshiba_backlight_data = {
537 .owner = THIS_MODULE,
538 .get_brightness = get_lcd, 537 .get_brightness = get_lcd,
539 .update_status = set_lcd_status, 538 .update_status = set_lcd_status,
540 .max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1,
541}; 539};
542 540
543static void __exit toshiba_acpi_exit(void) 541static void __exit toshiba_acpi_exit(void)
@@ -597,6 +595,7 @@ static int __init toshiba_acpi_init(void)
597 toshiba_backlight_device = NULL; 595 toshiba_backlight_device = NULL;
598 toshiba_acpi_exit(); 596 toshiba_acpi_exit();
599 } 597 }
598 toshiba_backlight_device->props.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1;
600 599
601 return (ACPI_SUCCESS(status)) ? 0 : -ENODEV; 600 return (ACPI_SUCCESS(status)) ? 0 : -ENODEV;
602} 601}
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index bf525cca3b63..0771b434feb2 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -169,7 +169,6 @@ struct acpi_video_device {
169 struct acpi_device *dev; 169 struct acpi_device *dev;
170 struct acpi_video_device_brightness *brightness; 170 struct acpi_video_device_brightness *brightness;
171 struct backlight_device *backlight; 171 struct backlight_device *backlight;
172 struct backlight_properties *data;
173}; 172};
174 173
175/* bus */ 174/* bus */
@@ -286,13 +285,18 @@ static int acpi_video_get_brightness(struct backlight_device *bd)
286 285
287static int acpi_video_set_brightness(struct backlight_device *bd) 286static int acpi_video_set_brightness(struct backlight_device *bd)
288{ 287{
289 int request_level = bd->props->brightness; 288 int request_level = bd->props.brightness;
290 struct acpi_video_device *vd = 289 struct acpi_video_device *vd =
291 (struct acpi_video_device *)class_get_devdata(&bd->class_dev); 290 (struct acpi_video_device *)class_get_devdata(&bd->class_dev);
292 acpi_video_device_lcd_set_level(vd, request_level); 291 acpi_video_device_lcd_set_level(vd, request_level);
293 return 0; 292 return 0;
294} 293}
295 294
295static struct backlight_ops acpi_backlight_ops = {
296 .get_brightness = acpi_video_get_brightness,
297 .update_status = acpi_video_set_brightness,
298};
299
296/* -------------------------------------------------------------------------- 300/* --------------------------------------------------------------------------
297 Video Management 301 Video Management
298 -------------------------------------------------------------------------- */ 302 -------------------------------------------------------------------------- */
@@ -608,31 +612,18 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
608 unsigned long tmp; 612 unsigned long tmp;
609 static int count = 0; 613 static int count = 0;
610 char *name; 614 char *name;
611 struct backlight_properties *acpi_video_data;
612
613 name = kzalloc(MAX_NAME_LEN, GFP_KERNEL); 615 name = kzalloc(MAX_NAME_LEN, GFP_KERNEL);
614 if (!name) 616 if (!name)
615 return; 617 return;
616 618
617 acpi_video_data = kzalloc(
618 sizeof(struct backlight_properties),
619 GFP_KERNEL);
620 if (!acpi_video_data){
621 kfree(name);
622 return;
623 }
624 acpi_video_data->owner = THIS_MODULE;
625 acpi_video_data->get_brightness =
626 acpi_video_get_brightness;
627 acpi_video_data->update_status =
628 acpi_video_set_brightness;
629 sprintf(name, "acpi_video%d", count++); 619 sprintf(name, "acpi_video%d", count++);
630 device->data = acpi_video_data;
631 acpi_video_data->max_brightness = max_level;
632 acpi_video_device_lcd_get_level_current(device, &tmp); 620 acpi_video_device_lcd_get_level_current(device, &tmp);
633 acpi_video_data->brightness = (int)tmp;
634 device->backlight = backlight_device_register(name, 621 device->backlight = backlight_device_register(name,
635 NULL, device, acpi_video_data); 622 NULL, device, &acpi_backlight_ops);
623 device->backlight->props.max_brightness = max_level;
624 device->backlight->props.brightness = (int)tmp;
625 backlight_update_status(device->backlight);
626
636 kfree(name); 627 kfree(name);
637 } 628 }
638 return; 629 return;
@@ -1677,10 +1668,7 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
1677 status = acpi_remove_notify_handler(device->dev->handle, 1668 status = acpi_remove_notify_handler(device->dev->handle,
1678 ACPI_DEVICE_NOTIFY, 1669 ACPI_DEVICE_NOTIFY,
1679 acpi_video_device_notify); 1670 acpi_video_device_notify);
1680 if (device->backlight){ 1671 backlight_device_unregister(device->backlight);
1681 backlight_device_unregister(device->backlight);
1682 kfree(device->data);
1683 }
1684 return 0; 1672 return 0;
1685} 1673}
1686 1674