aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2007-03-09 23:17:46 -0500
committerLen Brown <len.brown@intel.com>2007-03-09 23:17:46 -0500
commit5cb69bcacea70024252138a9cb4229a142a93389 (patch)
tree651f2d65b885b6cbc124cb2637fd648eb2ce0175 /drivers/acpi
parentc207908fcc451e31d7fbba31541bd04f93787eb4 (diff)
parentc9bf296b6467968ecb9d988e7ed754a19c2e63d9 (diff)
Pull ibm into release branch
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/Kconfig11
-rw-r--r--drivers/acpi/ibm_acpi.c28
2 files changed, 37 insertions, 2 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 7c49e103cf8f..4a3220b218d8 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -243,6 +243,17 @@ config ACPI_IBM_DOCK
243 243
244 If you are not sure, say N here. 244 If you are not sure, say N here.
245 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
246config ACPI_TOSHIBA 257config ACPI_TOSHIBA
247 tristate "Toshiba Laptop Extras" 258 tristate "Toshiba Laptop Extras"
248 depends on X86 259 depends on X86
diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c
index 4cc534e36e81..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,7 +1708,10 @@ 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_ops ibm_backlight_data = { 1717static struct backlight_ops ibm_backlight_data = {
@@ -1711,6 +1721,12 @@ static struct backlight_ops ibm_backlight_data = {
1711 1721
1712static int brightness_init(void) 1722static int brightness_init(void)
1713{ 1723{
1724 int b;
1725
1726 b = brightness_get(NULL);
1727 if (b < 0)
1728 return b;
1729
1714 ibm_backlight_device = backlight_device_register("ibm", NULL, NULL, 1730 ibm_backlight_device = backlight_device_register("ibm", NULL, NULL,
1715 &ibm_backlight_data); 1731 &ibm_backlight_data);
1716 if (IS_ERR(ibm_backlight_device)) { 1732 if (IS_ERR(ibm_backlight_device)) {
@@ -1718,7 +1734,9 @@ static int brightness_init(void)
1718 return PTR_ERR(ibm_backlight_device); 1734 return PTR_ERR(ibm_backlight_device);
1719 } 1735 }
1720 1736
1721 ibm_backlight_device->props.max_brightness = 7; 1737 ibm_backlight_device->props.max_brightness = 7;
1738 ibm_backlight_device->props.brightness = b;
1739 backlight_update_status(ibm_backlight_device);
1722 1740
1723 return 0; 1741 return 0;
1724} 1742}
@@ -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);