Commit 8066eff0 authored by Len Brown's avatar Len Brown

/home/lenb/src/to-linus branch 'acpi-2.6.12'

parents 9a351e30 79cda7d0
...@@ -133,9 +133,10 @@ config ACPI_HOTKEY ...@@ -133,9 +133,10 @@ config ACPI_HOTKEY
depends on ACPI_INTERPRETER depends on ACPI_INTERPRETER
depends on EXPERIMENTAL depends on EXPERIMENTAL
depends on !IA64_SGI_SN depends on !IA64_SGI_SN
default m default n
help help
ACPI generic hotkey Experimental consolidated hotkey driver.
If you are unsure, say N.
config ACPI_FAN config ACPI_FAN
tristate "Fan" tristate "Fan"
......
...@@ -26,6 +26,9 @@ ...@@ -26,6 +26,9 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/types.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <acpi/acpi_bus.h> #include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h> #include <acpi/acpi_drivers.h>
...@@ -33,6 +36,9 @@ ...@@ -33,6 +36,9 @@
#define ACPI_BUTTON_COMPONENT 0x00080000 #define ACPI_BUTTON_COMPONENT 0x00080000
#define ACPI_BUTTON_DRIVER_NAME "ACPI Button Driver" #define ACPI_BUTTON_DRIVER_NAME "ACPI Button Driver"
#define ACPI_BUTTON_CLASS "button" #define ACPI_BUTTON_CLASS "button"
#define ACPI_BUTTON_FILE_INFO "info"
#define ACPI_BUTTON_FILE_STATE "state"
#define ACPI_BUTTON_TYPE_UNKNOWN 0x00
#define ACPI_BUTTON_NOTIFY_STATUS 0x80 #define ACPI_BUTTON_NOTIFY_STATUS 0x80
#define ACPI_BUTTON_SUBCLASS_POWER "power" #define ACPI_BUTTON_SUBCLASS_POWER "power"
...@@ -64,6 +70,8 @@ MODULE_LICENSE("GPL"); ...@@ -64,6 +70,8 @@ MODULE_LICENSE("GPL");
static int acpi_button_add (struct acpi_device *device); static int acpi_button_add (struct acpi_device *device);
static int acpi_button_remove (struct acpi_device *device, int type); static int acpi_button_remove (struct acpi_device *device, int type);
static int acpi_button_info_open_fs(struct inode *inode, struct file *file);
static int acpi_button_state_open_fs(struct inode *inode, struct file *file);
static struct acpi_driver acpi_button_driver = { static struct acpi_driver acpi_button_driver = {
.name = ACPI_BUTTON_DRIVER_NAME, .name = ACPI_BUTTON_DRIVER_NAME,
...@@ -82,6 +90,179 @@ struct acpi_button { ...@@ -82,6 +90,179 @@ struct acpi_button {
unsigned long pushed; unsigned long pushed;
}; };
static struct file_operations acpi_button_info_fops = {
.open = acpi_button_info_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static struct file_operations acpi_button_state_fops = {
.open = acpi_button_state_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
/* --------------------------------------------------------------------------
FS Interface (/proc)
-------------------------------------------------------------------------- */
static struct proc_dir_entry *acpi_button_dir;
static int acpi_button_info_seq_show(struct seq_file *seq, void *offset)
{
struct acpi_button *button = (struct acpi_button *) seq->private;
ACPI_FUNCTION_TRACE("acpi_button_info_seq_show");
if (!button || !button->device)
return_VALUE(0);
seq_printf(seq, "type: %s\n",
acpi_device_name(button->device));
return_VALUE(0);
}
static int acpi_button_info_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, acpi_button_info_seq_show, PDE(inode)->data);
}
static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
{
struct acpi_button *button = (struct acpi_button *) seq->private;
acpi_status status;
unsigned long state;
ACPI_FUNCTION_TRACE("acpi_button_state_seq_show");
if (!button || !button->device)
return_VALUE(0);
status = acpi_evaluate_integer(button->handle,"_LID",NULL,&state);
if (ACPI_FAILURE(status)) {
seq_printf(seq, "state: unsupported\n");
}
else{
seq_printf(seq, "state: %s\n", (state ? "open" : "closed"));
}
return_VALUE(0);
}
static int acpi_button_state_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, acpi_button_state_seq_show, PDE(inode)->data);
}
static struct proc_dir_entry *acpi_power_dir;
static struct proc_dir_entry *acpi_sleep_dir;
static struct proc_dir_entry *acpi_lid_dir;
static int
acpi_button_add_fs (
struct acpi_device *device)
{
struct proc_dir_entry *entry = NULL;
struct acpi_button *button = NULL;
ACPI_FUNCTION_TRACE("acpi_button_add_fs");
if (!device || !acpi_driver_data(device))
return_VALUE(-EINVAL);
button = acpi_driver_data(device);
switch (button->type) {
case ACPI_BUTTON_TYPE_POWER:
case ACPI_BUTTON_TYPE_POWERF:
if (!acpi_power_dir)
acpi_power_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER,
acpi_button_dir);
entry = acpi_power_dir;
break;
case ACPI_BUTTON_TYPE_SLEEP:
case ACPI_BUTTON_TYPE_SLEEPF:
if (!acpi_sleep_dir)
acpi_sleep_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP,
acpi_button_dir);
entry = acpi_sleep_dir;
break;
case ACPI_BUTTON_TYPE_LID:
if (!acpi_lid_dir)
acpi_lid_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_LID,
acpi_button_dir);
entry = acpi_lid_dir;
break;
}
if (!entry)
return_VALUE(-ENODEV);
entry->owner = THIS_MODULE;
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry);
if (!acpi_device_dir(device))
return_VALUE(-ENODEV);
acpi_device_dir(device)->owner = THIS_MODULE;
/* 'info' [R] */
entry = create_proc_entry(ACPI_BUTTON_FILE_INFO,
S_IRUGO, acpi_device_dir(device));
if (!entry)
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unable to create '%s' fs entry\n",
ACPI_BUTTON_FILE_INFO));
else {
entry->proc_fops = &acpi_button_info_fops;
entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
}
/* show lid state [R] */
if (button->type == ACPI_BUTTON_TYPE_LID) {
entry = create_proc_entry(ACPI_BUTTON_FILE_STATE,
S_IRUGO, acpi_device_dir(device));
if (!entry)
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unable to create '%s' fs entry\n",
ACPI_BUTTON_FILE_INFO));
else {
entry->proc_fops = &acpi_button_state_fops;
entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
}
}
return_VALUE(0);
}
static int
acpi_button_remove_fs (
struct acpi_device *device)
{
struct acpi_button *button = NULL;
ACPI_FUNCTION_TRACE("acpi_button_remove_fs");
button = acpi_driver_data(device);
if (acpi_device_dir(device)) {
if (button->type == ACPI_BUTTON_TYPE_LID)
remove_proc_entry(ACPI_BUTTON_FILE_STATE,
acpi_device_dir(device));
remove_proc_entry(ACPI_BUTTON_FILE_INFO,
acpi_device_dir(device));
remove_proc_entry(acpi_device_bid(device),
acpi_device_dir(device)->parent);
acpi_device_dir(device) = NULL;
}
return_VALUE(0);
}
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
Driver Interface Driver Interface
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
...@@ -121,7 +302,8 @@ acpi_button_notify_fixed ( ...@@ -121,7 +302,8 @@ acpi_button_notify_fixed (
ACPI_FUNCTION_TRACE("acpi_button_notify_fixed"); ACPI_FUNCTION_TRACE("acpi_button_notify_fixed");
BUG_ON(!button); if (!button)
return_ACPI_STATUS(AE_BAD_PARAMETER);
acpi_button_notify(button->handle, ACPI_BUTTON_NOTIFY_STATUS, button); acpi_button_notify(button->handle, ACPI_BUTTON_NOTIFY_STATUS, button);
...@@ -197,6 +379,10 @@ acpi_button_add ( ...@@ -197,6 +379,10 @@ acpi_button_add (
goto end; goto end;
} }
result = acpi_button_add_fs(device);
if (result)
goto end;
switch (button->type) { switch (button->type) {
case ACPI_BUTTON_TYPE_POWERF: case ACPI_BUTTON_TYPE_POWERF:
status = acpi_install_fixed_event_handler ( status = acpi_install_fixed_event_handler (
...@@ -240,6 +426,7 @@ acpi_button_add ( ...@@ -240,6 +426,7 @@ acpi_button_add (
end: end:
if (result) { if (result) {
acpi_button_remove_fs(device);
kfree(button); kfree(button);
} }
...@@ -280,6 +467,8 @@ acpi_button_remove (struct acpi_device *device, int type) ...@@ -280,6 +467,8 @@ acpi_button_remove (struct acpi_device *device, int type)
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Error removing notify handler\n")); "Error removing notify handler\n"));
acpi_button_remove_fs(device);
kfree(button); kfree(button);
return_VALUE(0); return_VALUE(0);
...@@ -293,14 +482,20 @@ acpi_button_init (void) ...@@ -293,14 +482,20 @@ acpi_button_init (void)
ACPI_FUNCTION_TRACE("acpi_button_init"); ACPI_FUNCTION_TRACE("acpi_button_init");
acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir);
if (!acpi_button_dir)
return_VALUE(-ENODEV);
acpi_button_dir->owner = THIS_MODULE;
result = acpi_bus_register_driver(&acpi_button_driver); result = acpi_bus_register_driver(&acpi_button_driver);
if (result < 0) { if (result < 0) {
remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
} }
return_VALUE(0); return_VALUE(0);
} }
static void __exit static void __exit
acpi_button_exit (void) acpi_button_exit (void)
{ {
...@@ -308,8 +503,17 @@ acpi_button_exit (void) ...@@ -308,8 +503,17 @@ acpi_button_exit (void)
acpi_bus_unregister_driver(&acpi_button_driver); acpi_bus_unregister_driver(&acpi_button_driver);
if (acpi_power_dir)
remove_proc_entry(ACPI_BUTTON_SUBCLASS_POWER, acpi_button_dir);
if (acpi_sleep_dir)
remove_proc_entry(ACPI_BUTTON_SUBCLASS_SLEEP, acpi_button_dir);
if (acpi_lid_dir)
remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir);
remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
return_VOID; return_VOID;
} }
module_init(acpi_button_init); module_init(acpi_button_init);
module_exit(acpi_button_exit); module_exit(acpi_button_exit);
...@@ -76,13 +76,14 @@ static int acpi_ec_remove (struct acpi_device *device, int type); ...@@ -76,13 +76,14 @@ static int acpi_ec_remove (struct acpi_device *device, int type);
static int acpi_ec_start (struct acpi_device *device); static int acpi_ec_start (struct acpi_device *device);
static int acpi_ec_stop (struct acpi_device *device, int type); static int acpi_ec_stop (struct acpi_device *device, int type);
static int acpi_ec_burst_add ( struct acpi_device *device); static int acpi_ec_burst_add ( struct acpi_device *device);
static int acpi_ec_polling_add ( struct acpi_device *device);
static struct acpi_driver acpi_ec_driver = { static struct acpi_driver acpi_ec_driver = {
.name = ACPI_EC_DRIVER_NAME, .name = ACPI_EC_DRIVER_NAME,
.class = ACPI_EC_CLASS, .class = ACPI_EC_CLASS,
.ids = ACPI_EC_HID, .ids = ACPI_EC_HID,
.ops = { .ops = {
.add = acpi_ec_burst_add, .add = acpi_ec_polling_add,
.remove = acpi_ec_remove, .remove = acpi_ec_remove,
.start = acpi_ec_start, .start = acpi_ec_start,
.stop = acpi_ec_stop, .stop = acpi_ec_stop,
...@@ -164,7 +165,7 @@ static union acpi_ec *ec_ecdt; ...@@ -164,7 +165,7 @@ static union acpi_ec *ec_ecdt;
/* External interfaces use first EC only, so remember */ /* External interfaces use first EC only, so remember */
static struct acpi_device *first_ec; static struct acpi_device *first_ec;
static int acpi_ec_polling_mode; static int acpi_ec_polling_mode = EC_POLLING;
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
Transaction Management Transaction Management
...@@ -1710,11 +1711,24 @@ static int __init acpi_fake_ecdt_setup(char *str) ...@@ -1710,11 +1711,24 @@ static int __init acpi_fake_ecdt_setup(char *str)
acpi_fake_ecdt_enabled = 1; acpi_fake_ecdt_enabled = 1;
return 0; return 0;
} }
__setup("acpi_fake_ecdt", acpi_fake_ecdt_setup); __setup("acpi_fake_ecdt", acpi_fake_ecdt_setup);
static int __init acpi_ec_set_polling_mode(char *str) static int __init acpi_ec_set_polling_mode(char *str)
{ {
int burst;
if (!get_option(&str, &burst))
return 0;
if (burst) {
acpi_ec_polling_mode = EC_BURST;
acpi_ec_driver.ops.add = acpi_ec_burst_add;
} else {
acpi_ec_polling_mode = EC_POLLING; acpi_ec_polling_mode = EC_POLLING;
acpi_ec_driver.ops.add = acpi_ec_polling_add; acpi_ec_driver.ops.add = acpi_ec_polling_add;
}
printk(KERN_INFO PREFIX "EC %s mode.\n",
burst ? "burst": "polling");
return 0; return 0;
} }
__setup("ec_polling", acpi_ec_set_polling_mode); __setup("ec_burst=", acpi_ec_set_polling_mode);
This diff is collapsed.
...@@ -692,7 +692,18 @@ acpi_pci_link_free_irq(acpi_handle handle) ...@@ -692,7 +692,18 @@ acpi_pci_link_free_irq(acpi_handle handle)
return_VALUE(-1); return_VALUE(-1);
} }
#ifdef FUTURE_USE
/*
* The Link reference count allows us to _DISable an unused link
* and suspend time, and set it again on resume.
* However, 2.6.12 still has irq_router.resume
* which blindly restores the link state.
* So we disable the reference count method
* to prevent duplicate acpi_pci_link_set()
* which would harm some systems
*/
link->refcnt --; link->refcnt --;
#endif
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Link %s is dereferenced\n", acpi_device_bid(link->device))); "Link %s is dereferenced\n", acpi_device_bid(link->device)));
......
...@@ -86,12 +86,11 @@ static int set_max_cstate(struct dmi_system_id *id) ...@@ -86,12 +86,11 @@ static int set_max_cstate(struct dmi_system_id *id)
if (max_cstate > ACPI_PROCESSOR_MAX_POWER) if (max_cstate > ACPI_PROCESSOR_MAX_POWER)
return 0; return 0;
printk(KERN_NOTICE PREFIX "%s detected - %s disabled." printk(KERN_NOTICE PREFIX "%s detected - limiting to C%ld max_cstate."
" Override with \"processor.max_cstate=%d\"\n", id->ident, " Override with \"processor.max_cstate=%d\"\n", id->ident,
((int)id->driver_data == 1)? "C2,C3":"C3", (long)id->driver_data, ACPI_PROCESSOR_MAX_POWER + 1);
ACPI_PROCESSOR_MAX_POWER + 1);
max_cstate = (int)id->driver_data; max_cstate = (long)id->driver_data;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment