Commit 417009f6 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6

* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6:
  pnpacpi: print resource shortage message only once
  PM: ACPI and APM must not be enabled at the same time
  ACPI: apply quirk_ich6_lpc_acpi to more ICH8 and ICH9
  ACPICA: fix acpi_serialize hang regression
  ACPI : Not register gsi for PCI IDE controller in legacy mode
  ACPI: Reintroduce run time configurable max_cstate for !CPU_IDLE case
  ACPI: Make sysfs interface in ACPI power optional.
  ACPI: EC: Enable boot EC before bus_scan
  increase PNP_MAX_PORT to 40 from 24
parents ba67a39e 55d1bb9a
...@@ -2256,14 +2256,12 @@ static int __init apm_init(void) ...@@ -2256,14 +2256,12 @@ static int __init apm_init(void)
apm_info.disabled = 1; apm_info.disabled = 1;
return -ENODEV; return -ENODEV;
} }
if (PM_IS_ACTIVE()) { if (pm_flags & PM_ACPI) {
printk(KERN_NOTICE "apm: overridden by ACPI.\n"); printk(KERN_NOTICE "apm: overridden by ACPI.\n");
apm_info.disabled = 1; apm_info.disabled = 1;
return -ENODEV; return -ENODEV;
} }
#ifdef CONFIG_PM_LEGACY pm_flags |= PM_APM;
pm_active = 1;
#endif
/* /*
* Set up a segment that references the real mode segment 0x40 * Set up a segment that references the real mode segment 0x40
...@@ -2366,9 +2364,7 @@ static void __exit apm_exit(void) ...@@ -2366,9 +2364,7 @@ static void __exit apm_exit(void)
kthread_stop(kapmd_task); kthread_stop(kapmd_task);
kapmd_task = NULL; kapmd_task = NULL;
} }
#ifdef CONFIG_PM_LEGACY pm_flags &= ~PM_APM;
pm_active = 0;
#endif
} }
module_init(apm_init); module_init(apm_init);
......
...@@ -82,6 +82,12 @@ config ACPI_PROCFS_POWER ...@@ -82,6 +82,12 @@ config ACPI_PROCFS_POWER
and functions, which do not yet exist in /sys and functions, which do not yet exist in /sys
Say N to delete power /proc/acpi/ folders that have moved to /sys/ Say N to delete power /proc/acpi/ folders that have moved to /sys/
config ACPI_SYSFS_POWER
bool "Future power /sys interface"
select POWER_SUPPLY
default y
---help---
Say N to disable power /sys interface
config ACPI_PROC_EVENT config ACPI_PROC_EVENT
bool "Deprecated /proc/acpi/event support" bool "Deprecated /proc/acpi/event support"
depends on PROC_FS depends on PROC_FS
...@@ -103,7 +109,6 @@ config ACPI_PROC_EVENT ...@@ -103,7 +109,6 @@ config ACPI_PROC_EVENT
config ACPI_AC config ACPI_AC
tristate "AC Adapter" tristate "AC Adapter"
depends on X86 depends on X86
select POWER_SUPPLY
default y default y
help help
This driver adds support for the AC Adapter object, which indicates This driver adds support for the AC Adapter object, which indicates
...@@ -113,7 +118,6 @@ config ACPI_AC ...@@ -113,7 +118,6 @@ config ACPI_AC
config ACPI_BATTERY config ACPI_BATTERY
tristate "Battery" tristate "Battery"
depends on X86 depends on X86
select POWER_SUPPLY
default y default y
help help
This driver adds support for battery information through This driver adds support for battery information through
...@@ -368,7 +372,6 @@ config ACPI_HOTPLUG_MEMORY ...@@ -368,7 +372,6 @@ config ACPI_HOTPLUG_MEMORY
config ACPI_SBS config ACPI_SBS
tristate "Smart Battery System" tristate "Smart Battery System"
depends on X86 depends on X86
select POWER_SUPPLY
help help
This driver adds support for the Smart Battery System, another This driver adds support for the Smart Battery System, another
type of access to battery information, found on some laptops. type of access to battery information, found on some laptops.
......
...@@ -31,7 +31,9 @@ ...@@ -31,7 +31,9 @@
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#endif #endif
#ifdef CONFIG_ACPI_SYSFS_POWER
#include <linux/power_supply.h> #include <linux/power_supply.h>
#endif
#include <acpi/acpi_bus.h> #include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h> #include <acpi/acpi_drivers.h>
...@@ -79,7 +81,9 @@ static struct acpi_driver acpi_ac_driver = { ...@@ -79,7 +81,9 @@ static struct acpi_driver acpi_ac_driver = {
}; };
struct acpi_ac { struct acpi_ac {
#ifdef CONFIG_ACPI_SYSFS_POWER
struct power_supply charger; struct power_supply charger;
#endif
struct acpi_device * device; struct acpi_device * device;
unsigned long state; unsigned long state;
}; };
...@@ -94,7 +98,7 @@ static const struct file_operations acpi_ac_fops = { ...@@ -94,7 +98,7 @@ static const struct file_operations acpi_ac_fops = {
.release = single_release, .release = single_release,
}; };
#endif #endif
#ifdef CONFIG_ACPI_SYSFS_POWER
static int get_ac_property(struct power_supply *psy, static int get_ac_property(struct power_supply *psy,
enum power_supply_property psp, enum power_supply_property psp,
union power_supply_propval *val) union power_supply_propval *val)
...@@ -113,7 +117,7 @@ static int get_ac_property(struct power_supply *psy, ...@@ -113,7 +117,7 @@ static int get_ac_property(struct power_supply *psy,
static enum power_supply_property ac_props[] = { static enum power_supply_property ac_props[] = {
POWER_SUPPLY_PROP_ONLINE, POWER_SUPPLY_PROP_ONLINE,
}; };
#endif
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
AC Adapter Management AC Adapter Management
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
...@@ -241,7 +245,9 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data) ...@@ -241,7 +245,9 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
acpi_bus_generate_netlink_event(device->pnp.device_class, acpi_bus_generate_netlink_event(device->pnp.device_class,
device->dev.bus_id, event, device->dev.bus_id, event,
(u32) ac->state); (u32) ac->state);
#ifdef CONFIG_ACPI_SYSFS_POWER
kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
#endif
break; break;
default: default:
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
...@@ -280,12 +286,14 @@ static int acpi_ac_add(struct acpi_device *device) ...@@ -280,12 +286,14 @@ static int acpi_ac_add(struct acpi_device *device)
#endif #endif
if (result) if (result)
goto end; goto end;
#ifdef CONFIG_ACPI_SYSFS_POWER
ac->charger.name = acpi_device_bid(device); ac->charger.name = acpi_device_bid(device);
ac->charger.type = POWER_SUPPLY_TYPE_MAINS; ac->charger.type = POWER_SUPPLY_TYPE_MAINS;
ac->charger.properties = ac_props; ac->charger.properties = ac_props;
ac->charger.num_properties = ARRAY_SIZE(ac_props); ac->charger.num_properties = ARRAY_SIZE(ac_props);
ac->charger.get_property = get_ac_property; ac->charger.get_property = get_ac_property;
power_supply_register(&ac->device->dev, &ac->charger); power_supply_register(&ac->device->dev, &ac->charger);
#endif
status = acpi_install_notify_handler(device->handle, status = acpi_install_notify_handler(device->handle,
ACPI_ALL_NOTIFY, acpi_ac_notify, ACPI_ALL_NOTIFY, acpi_ac_notify,
ac); ac);
...@@ -319,8 +327,10 @@ static int acpi_ac_resume(struct acpi_device *device) ...@@ -319,8 +327,10 @@ static int acpi_ac_resume(struct acpi_device *device)
old_state = ac->state; old_state = ac->state;
if (acpi_ac_get_state(ac)) if (acpi_ac_get_state(ac))
return 0; return 0;
#ifdef CONFIG_ACPI_SYSFS_POWER
if (old_state != ac->state) if (old_state != ac->state)
kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
#endif
return 0; return 0;
} }
...@@ -337,8 +347,10 @@ static int acpi_ac_remove(struct acpi_device *device, int type) ...@@ -337,8 +347,10 @@ static int acpi_ac_remove(struct acpi_device *device, int type)
status = acpi_remove_notify_handler(device->handle, status = acpi_remove_notify_handler(device->handle,
ACPI_ALL_NOTIFY, acpi_ac_notify); ACPI_ALL_NOTIFY, acpi_ac_notify);
#ifdef CONFIG_ACPI_SYSFS_POWER
if (ac->charger.dev) if (ac->charger.dev)
power_supply_unregister(&ac->charger); power_supply_unregister(&ac->charger);
#endif
#ifdef CONFIG_ACPI_PROCFS_POWER #ifdef CONFIG_ACPI_PROCFS_POWER
acpi_ac_remove_fs(device); acpi_ac_remove_fs(device);
#endif #endif
......
...@@ -40,7 +40,9 @@ ...@@ -40,7 +40,9 @@
#include <acpi/acpi_bus.h> #include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h> #include <acpi/acpi_drivers.h>
#ifdef CONFIG_ACPI_SYSFS_POWER
#include <linux/power_supply.h> #include <linux/power_supply.h>
#endif
#define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF #define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF
...@@ -86,7 +88,9 @@ MODULE_DEVICE_TABLE(acpi, battery_device_ids); ...@@ -86,7 +88,9 @@ MODULE_DEVICE_TABLE(acpi, battery_device_ids);
struct acpi_battery { struct acpi_battery {
struct mutex lock; struct mutex lock;
#ifdef CONFIG_ACPI_SYSFS_POWER
struct power_supply bat; struct power_supply bat;
#endif
struct acpi_device *device; struct acpi_device *device;
unsigned long update_time; unsigned long update_time;
int current_now; int current_now;
...@@ -117,6 +121,7 @@ inline int acpi_battery_present(struct acpi_battery *battery) ...@@ -117,6 +121,7 @@ inline int acpi_battery_present(struct acpi_battery *battery)
return battery->device->status.battery_present; return battery->device->status.battery_present;
} }
#ifdef CONFIG_ACPI_SYSFS_POWER
static int acpi_battery_technology(struct acpi_battery *battery) static int acpi_battery_technology(struct acpi_battery *battery)
{ {
if (!strcasecmp("NiCd", battery->type)) if (!strcasecmp("NiCd", battery->type))
...@@ -222,6 +227,7 @@ static enum power_supply_property energy_battery_props[] = { ...@@ -222,6 +227,7 @@ static enum power_supply_property energy_battery_props[] = {
POWER_SUPPLY_PROP_MODEL_NAME, POWER_SUPPLY_PROP_MODEL_NAME,
POWER_SUPPLY_PROP_MANUFACTURER, POWER_SUPPLY_PROP_MANUFACTURER,
}; };
#endif
#ifdef CONFIG_ACPI_PROCFS_POWER #ifdef CONFIG_ACPI_PROCFS_POWER
inline char *acpi_battery_units(struct acpi_battery *battery) inline char *acpi_battery_units(struct acpi_battery *battery)
...@@ -398,6 +404,7 @@ static int acpi_battery_init_alarm(struct acpi_battery *battery) ...@@ -398,6 +404,7 @@ static int acpi_battery_init_alarm(struct acpi_battery *battery)
return acpi_battery_set_alarm(battery); return acpi_battery_set_alarm(battery);
} }
#ifdef CONFIG_ACPI_SYSFS_POWER
static ssize_t acpi_battery_alarm_show(struct device *dev, static ssize_t acpi_battery_alarm_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
...@@ -429,11 +436,6 @@ static int sysfs_add_battery(struct acpi_battery *battery) ...@@ -429,11 +436,6 @@ static int sysfs_add_battery(struct acpi_battery *battery)
{ {
int result; int result;
battery->update_time = 0;
result = acpi_battery_get_info(battery);
acpi_battery_init_alarm(battery);
if (result)
return result;
if (battery->power_unit) { if (battery->power_unit) {
battery->bat.properties = charge_battery_props; battery->bat.properties = charge_battery_props;
battery->bat.num_properties = battery->bat.num_properties =
...@@ -462,18 +464,31 @@ static void sysfs_remove_battery(struct acpi_battery *battery) ...@@ -462,18 +464,31 @@ static void sysfs_remove_battery(struct acpi_battery *battery)
power_supply_unregister(&battery->bat); power_supply_unregister(&battery->bat);
battery->bat.dev = NULL; battery->bat.dev = NULL;
} }
#endif
static int acpi_battery_update(struct acpi_battery *battery) static int acpi_battery_update(struct acpi_battery *battery)
{ {
int result = acpi_battery_get_status(battery); int result;
result = acpi_battery_get_status(battery);
if (result) if (result)
return result; return result;
#ifdef CONFIG_ACPI_SYSFS_POWER
if (!acpi_battery_present(battery)) { if (!acpi_battery_present(battery)) {
sysfs_remove_battery(battery); sysfs_remove_battery(battery);
battery->update_time = 0;
return 0; return 0;
} }
#endif
if (!battery->update_time) {
result = acpi_battery_get_info(battery);
if (result)
return result;
acpi_battery_init_alarm(battery);
}
#ifdef CONFIG_ACPI_SYSFS_POWER
if (!battery->bat.dev) if (!battery->bat.dev)
sysfs_add_battery(battery); sysfs_add_battery(battery);
#endif
return acpi_battery_get_state(battery); return acpi_battery_get_state(battery);
} }
...@@ -767,9 +782,11 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data) ...@@ -767,9 +782,11 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
acpi_bus_generate_netlink_event(device->pnp.device_class, acpi_bus_generate_netlink_event(device->pnp.device_class,
device->dev.bus_id, event, device->dev.bus_id, event,
acpi_battery_present(battery)); acpi_battery_present(battery));
#ifdef CONFIG_ACPI_SYSFS_POWER
/* acpi_batter_update could remove power_supply object */ /* acpi_batter_update could remove power_supply object */
if (battery->bat.dev) if (battery->bat.dev)
kobject_uevent(&battery->bat.dev->kobj, KOBJ_CHANGE); kobject_uevent(&battery->bat.dev->kobj, KOBJ_CHANGE);
#endif
} }
static int acpi_battery_add(struct acpi_device *device) static int acpi_battery_add(struct acpi_device *device)
...@@ -828,7 +845,9 @@ static int acpi_battery_remove(struct acpi_device *device, int type) ...@@ -828,7 +845,9 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
#ifdef CONFIG_ACPI_PROCFS_POWER #ifdef CONFIG_ACPI_PROCFS_POWER
acpi_battery_remove_fs(device); acpi_battery_remove_fs(device);
#endif #endif
#ifdef CONFIG_ACPI_SYSFS_POWER
sysfs_remove_battery(battery); sysfs_remove_battery(battery);
#endif
mutex_destroy(&battery->lock); mutex_destroy(&battery->lock);
kfree(battery); kfree(battery);
return 0; return 0;
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/pm_legacy.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#ifdef CONFIG_X86 #ifdef CONFIG_X86
...@@ -764,16 +763,14 @@ static int __init acpi_init(void) ...@@ -764,16 +763,14 @@ static int __init acpi_init(void)
result = acpi_bus_init(); result = acpi_bus_init();
if (!result) { if (!result) {
#ifdef CONFIG_PM_LEGACY if (!(pm_flags & PM_APM))
if (!PM_IS_ACTIVE()) pm_flags |= PM_ACPI;
pm_active = 1;
else { else {
printk(KERN_INFO PREFIX printk(KERN_INFO PREFIX
"APM is already active, exiting\n"); "APM is already active, exiting\n");
disable_acpi(); disable_acpi();
result = -ENODEV; result = -ENODEV;
} }
#endif
} else } else
disable_acpi(); disable_acpi();
......
...@@ -892,6 +892,17 @@ static int acpi_ec_stop(struct acpi_device *device, int type) ...@@ -892,6 +892,17 @@ static int acpi_ec_stop(struct acpi_device *device, int type)
return 0; return 0;
} }
int __init acpi_boot_ec_enable(void)
{
if (!boot_ec || boot_ec->handlers_installed)
return 0;
if (!ec_install_handlers(boot_ec)) {
first_ec = boot_ec;
return 0;
}
return -EFAULT;
}
int __init acpi_ec_ecdt_probe(void) int __init acpi_ec_ecdt_probe(void)
{ {
int ret; int ret;
...@@ -924,9 +935,10 @@ int __init acpi_ec_ecdt_probe(void) ...@@ -924,9 +935,10 @@ int __init acpi_ec_ecdt_probe(void)
goto error; goto error;
/* We really need to limit this workaround, the only ASUS, /* We really need to limit this workaround, the only ASUS,
* which needs it, has fake EC._INI method, so use it as flag. * which needs it, has fake EC._INI method, so use it as flag.
* Keep boot_ec struct as it will be needed soon.
*/ */
if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &x))) if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &x)))
goto error; return -ENODEV;
} }
ret = ec_install_handlers(boot_ec); ret = ec_install_handlers(boot_ec);
......
...@@ -344,7 +344,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, ...@@ -344,7 +344,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
* setup will potentially execute control methods * setup will potentially execute control methods
* (e.g., _REG method for this region) * (e.g., _REG method for this region)
*/ */
acpi_ex_relinquish_interpreter(); acpi_ex_exit_interpreter();
status = region_setup(region_obj, ACPI_REGION_ACTIVATE, status = region_setup(region_obj, ACPI_REGION_ACTIVATE,
handler_desc->address_space.context, handler_desc->address_space.context,
...@@ -352,7 +352,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, ...@@ -352,7 +352,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
/* Re-enter the interpreter */ /* Re-enter the interpreter */
acpi_ex_reacquire_interpreter(); acpi_ex_enter_interpreter();
/* Check for failure of the Region Setup */ /* Check for failure of the Region Setup */
...@@ -405,7 +405,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, ...@@ -405,7 +405,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
* exit the interpreter because the handler *might* block -- we don't * exit the interpreter because the handler *might* block -- we don't
* know what it will do, so we can't hold the lock on the intepreter. * know what it will do, so we can't hold the lock on the intepreter.
*/ */
acpi_ex_relinquish_interpreter(); acpi_ex_exit_interpreter();
} }
/* Call the handler */ /* Call the handler */
...@@ -426,7 +426,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, ...@@ -426,7 +426,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
* We just returned from a non-default handler, we must re-enter the * We just returned from a non-default handler, we must re-enter the
* interpreter * interpreter
*/ */
acpi_ex_reacquire_interpreter(); acpi_ex_enter_interpreter();
} }
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
......
...@@ -429,6 +429,15 @@ int acpi_pci_irq_enable(struct pci_dev *dev) ...@@ -429,6 +429,15 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
&polarity, &link, &polarity, &link,
acpi_pci_allocate_irq); acpi_pci_allocate_irq);
if (irq < 0) {
/*
* IDE legacy mode controller IRQs are magic. Why do compat
* extensions always make such a nasty mess.
*/
if (dev->class >> 8 == PCI_CLASS_STORAGE_IDE &&
(dev->class & 0x05) == 0)
return 0;
}
/* /*
* No IRQ known to the ACPI subsystem - maybe the BIOS / * No IRQ known to the ACPI subsystem - maybe the BIOS /
* driver reported one, then use it. Exit in any case. * driver reported one, then use it. Exit in any case.
......
...@@ -76,7 +76,11 @@ static void (*pm_idle_save) (void) __read_mostly; ...@@ -76,7 +76,11 @@ static void (*pm_idle_save) (void) __read_mostly;
#define PM_TIMER_TICKS_TO_US(p) (((p) * 1000)/(PM_TIMER_FREQUENCY/1000)) #define PM_TIMER_TICKS_TO_US(p) (((p) * 1000)/(PM_TIMER_FREQUENCY/1000))
static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER; static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER;
#ifdef CONFIG_CPU_IDLE
module_param(max_cstate, uint, 0000); module_param(max_cstate, uint, 0000);
#else
module_param(max_cstate, uint, 0644);
#endif
static unsigned int nocst __read_mostly; static unsigned int nocst __read_mostly;
module_param(nocst, uint, 0000); module_param(nocst, uint, 0000);
......
...@@ -40,7 +40,9 @@ ...@@ -40,7 +40,9 @@
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/delay.h> #include <linux/delay.h>
#ifdef CONFIG_ACPI_SYSFS_POWER
#include <linux/power_supply.h> #include <linux/power_supply.h>
#endif
#include "sbshc.h" #include "sbshc.h"
...@@ -80,7 +82,9 @@ static const struct acpi_device_id sbs_device_ids[] = { ...@@ -80,7 +82,9 @@ static const struct acpi_device_id sbs_device_ids[] = {
MODULE_DEVICE_TABLE(acpi, sbs_device_ids); MODULE_DEVICE_TABLE(acpi, sbs_device_ids);
struct acpi_battery { struct acpi_battery {
#ifdef CONFIG_ACPI_SYSFS_POWER
struct power_supply bat; struct power_supply bat;
#endif
struct acpi_sbs *sbs; struct acpi_sbs *sbs;
#ifdef CONFIG_ACPI_PROCFS_POWER #ifdef CONFIG_ACPI_PROCFS_POWER
struct proc_dir_entry *proc_entry; struct proc_dir_entry *proc_entry;
...@@ -113,7 +117,9 @@ struct acpi_battery { ...@@ -113,7 +117,9 @@ struct acpi_battery {
#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat);
struct acpi_sbs { struct acpi_sbs {
#ifdef CONFIG_ACPI_SYSFS_POWER
struct power_supply charger; struct power_supply charger;
#endif
struct acpi_device *device; struct acpi_device *device;
struct acpi_smb_hc *hc; struct acpi_smb_hc *hc;
struct mutex lock; struct mutex lock;
...@@ -157,6 +163,7 @@ static inline int acpi_battery_scale(struct acpi_battery *battery) ...@@ -157,6 +163,7 @@ static inline int acpi_battery_scale(struct acpi_battery *battery)
acpi_battery_ipscale(battery); acpi_battery_ipscale(battery);
} }
#ifdef CONFIG_ACPI_SYSFS_POWER
static int sbs_get_ac_property(struct power_supply *psy, static int sbs_get_ac_property(struct power_supply *psy,
enum power_supply_property psp, enum power_supply_property psp,
union power_supply_propval *val) union power_supply_propval *val)
...@@ -294,6 +301,7 @@ static enum power_supply_property sbs_energy_battery_props[] = { ...@@ -294,6 +301,7 @@ static enum power_supply_property sbs_energy_battery_props[] = {
POWER_SUPPLY_PROP_MODEL_NAME, POWER_SUPPLY_PROP_MODEL_NAME,
POWER_SUPPLY_PROP_MANUFACTURER, POWER_SUPPLY_PROP_MANUFACTURER,
}; };
#endif
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
Smart Battery System Management Smart Battery System Management
...@@ -429,6 +437,7 @@ static int acpi_ac_get_present(struct acpi_sbs *sbs) ...@@ -429,6 +437,7 @@ static int acpi_ac_get_present(struct acpi_sbs *sbs)
return result; return result;
} }
#ifdef CONFIG_ACPI_SYSFS_POWER
static ssize_t acpi_battery_alarm_show(struct device *dev, static ssize_t acpi_battery_alarm_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
...@@ -458,6 +467,7 @@ static struct device_attribute alarm_attr = { ...@@ -458,6 +467,7 @@ static struct device_attribute alarm_attr = {
.show = acpi_battery_alarm_show, .show = acpi_battery_alarm_show,
.store = acpi_battery_alarm_store, .store = acpi_battery_alarm_store,
}; };
#endif
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
FS Interface (/proc/acpi) FS Interface (/proc/acpi)
...@@ -793,6 +803,7 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) ...@@ -793,6 +803,7 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
&acpi_battery_state_fops, &acpi_battery_alarm_fops, &acpi_battery_state_fops, &acpi_battery_alarm_fops,
battery); battery);
#endif #endif
#ifdef CONFIG_ACPI_SYSFS_POWER
battery->bat.name = battery->name; battery->bat.name = battery->name;
battery->bat.type = POWER_SUPPLY_TYPE_BATTERY; battery->bat.type = POWER_SUPPLY_TYPE_BATTERY;
if (!acpi_battery_mode(battery)) { if (!acpi_battery_mode(battery)) {
...@@ -813,6 +824,7 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) ...@@ -813,6 +824,7 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
goto end; goto end;
battery->have_sysfs_alarm = 1; battery->have_sysfs_alarm = 1;
end: end:
#endif
printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n", printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n",
ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device),
battery->name, sbs->battery->present ? "present" : "absent"); battery->name, sbs->battery->present ? "present" : "absent");
...@@ -822,12 +834,13 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) ...@@ -822,12 +834,13 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
static void acpi_battery_remove(struct acpi_sbs *sbs, int id) static void acpi_battery_remove(struct acpi_sbs *sbs, int id)
{ {
struct acpi_battery *battery = &sbs->battery[id]; struct acpi_battery *battery = &sbs->battery[id];
#ifdef CONFIG_ACPI_SYSFS_POWER
if (battery->bat.dev) { if (battery->bat.dev) {
if (battery->have_sysfs_alarm) if (battery->have_sysfs_alarm)
device_remove_file(battery->bat.dev, &alarm_attr); device_remove_file(battery->bat.dev, &alarm_attr);
power_supply_unregister(&battery->bat); power_supply_unregister(&battery->bat);
} }
#endif
#ifdef CONFIG_ACPI_PROCFS_POWER #ifdef CONFIG_ACPI_PROCFS_POWER
if (battery->proc_entry) if (battery->proc_entry)
acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir); acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir);
...@@ -848,12 +861,14 @@ static int acpi_charger_add(struct acpi_sbs *sbs) ...@@ -848,12 +861,14 @@ static int acpi_charger_add(struct acpi_sbs *sbs)
if (result) if (result)
goto end; goto end;
#endif #endif
#ifdef CONFIG_ACPI_SYSFS_POWER
sbs->charger.name = "sbs-charger"; sbs->charger.name = "sbs-charger";
sbs->charger.type = POWER_SUPPLY_TYPE_MAINS; sbs->charger.type = POWER_SUPPLY_TYPE_MAINS;
sbs->charger.properties = sbs_ac_props; sbs->charger.properties = sbs_ac_props;
sbs->charger.num_properties = ARRAY_SIZE(sbs_ac_props); sbs->charger.num_properties = ARRAY_SIZE(sbs_ac_props);
sbs->charger.get_property = sbs_get_ac_property; sbs->charger.get_property = sbs_get_ac_property;
power_supply_register(&sbs->device->dev, &sbs->charger); power_supply_register(&sbs->device->dev, &sbs->charger);
#endif
printk(KERN_INFO PREFIX "%s [%s]: AC Adapter [%s] (%s)\n", printk(KERN_INFO PREFIX "%s [%s]: AC Adapter [%s] (%s)\n",
ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device),
ACPI_AC_DIR_NAME, sbs->charger_present ? "on-line" : "off-line"); ACPI_AC_DIR_NAME, sbs->charger_present ? "on-line" : "off-line");
...@@ -863,8 +878,10 @@ static int acpi_charger_add(struct acpi_sbs *sbs) ...@@ -863,8 +878,10 @@ static int acpi_charger_add(struct acpi_sbs *sbs)
static void acpi_charger_remove(struct acpi_sbs *sbs) static void acpi_charger_remove(struct acpi_sbs *sbs)
{ {
#ifdef CONFIG_ACPI_SYSFS_POWER
if (sbs->charger.dev) if (sbs->charger.dev)
power_supply_unregister(&sbs->charger); power_supply_unregister(&sbs->charger);
#endif
#ifdef CONFIG_ACPI_PROCFS_POWER #ifdef CONFIG_ACPI_PROCFS_POWER
if (sbs->charger_entry) if (sbs->charger_entry)
acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir); acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir);
...@@ -885,7 +902,9 @@ void acpi_sbs_callback(void *context) ...@@ -885,7 +902,9 @@ void acpi_sbs_callback(void *context)
ACPI_SBS_NOTIFY_STATUS, ACPI_SBS_NOTIFY_STATUS,
sbs->charger_present); sbs->charger_present);
#endif #endif
#ifdef CONFIG_ACPI_SYSFS_POWER
kobject_uevent(&sbs->charger.dev->kobj, KOBJ_CHANGE); kobject_uevent(&sbs->charger.dev->kobj, KOBJ_CHANGE);
#endif
} }
if (sbs->manager_present) { if (sbs->manager_present) {
for (id = 0; id < MAX_SBS_BAT; ++id) { for (id = 0; id < MAX_SBS_BAT; ++id) {
...@@ -902,7 +921,9 @@ void acpi_sbs_callback(void *context) ...@@ -902,7 +921,9 @@ void acpi_sbs_callback(void *context)
ACPI_SBS_NOTIFY_STATUS, ACPI_SBS_NOTIFY_STATUS,
bat->present); bat->present);
#endif #endif
#ifdef CONFIG_ACPI_SYSFS_POWER
kobject_uevent(&bat->bat.dev->kobj, KOBJ_CHANGE); kobject_uevent(&bat->bat.dev->kobj, KOBJ_CHANGE);
#endif
} }
} }
} }
......
...@@ -1449,6 +1449,8 @@ static int acpi_bus_scan_fixed(struct acpi_device *root) ...@@ -1449,6 +1449,8 @@ static int acpi_bus_scan_fixed(struct acpi_device *root)
return result; return result;
} }
int __init acpi_boot_ec_enable(void);
static int __init acpi_scan_init(void) static int __init acpi_scan_init(void)
{ {
int result; int result;
...@@ -1480,6 +1482,10 @@ static int __init acpi_scan_init(void) ...@@ -1480,6 +1482,10 @@ static int __init acpi_scan_init(void)
* Enumerate devices in the ACPI namespace. * Enumerate devices in the ACPI namespace.
*/ */
result = acpi_bus_scan_fixed(acpi_root); result = acpi_bus_scan_fixed(acpi_root);
/* EC region might be needed at bus_scan, so enable it now */
acpi_boot_ec_enable();
if (!result) if (!result)
result = acpi_bus_scan(acpi_root, &ops); result = acpi_bus_scan(acpi_root, &ops);
......
...@@ -465,6 +465,12 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_31, quirk ...@@ -465,6 +465,12 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_31, quirk
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_0, quirk_ich6_lpc_acpi ); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_0, quirk_ich6_lpc_acpi );
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_2, quirk_ich6_lpc_acpi ); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_2, quirk_ich6_lpc_acpi );
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_3, quirk_ich6_lpc_acpi ); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_3, quirk_ich6_lpc_acpi );
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_1, quirk_ich6_lpc_acpi );
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_4, quirk_ich6_lpc_acpi );
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_2, quirk_ich6_lpc_acpi );
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_4, quirk_ich6_lpc_acpi );
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_7, quirk_ich6_lpc_acpi );
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_8, quirk_ich6_lpc_acpi );
/* /*
* VIA ACPI: One IO region pointed to by longword at * VIA ACPI: One IO region pointed to by longword at
......
...@@ -76,6 +76,7 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, ...@@ -76,6 +76,7 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res,
int i = 0; int i = 0;
int irq; int irq;
int p, t; int p, t;
static unsigned char warned;
if (!valid_IRQ(gsi)) if (!valid_IRQ(gsi))
return; return;
...@@ -83,9 +84,10 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, ...@@ -83,9 +84,10 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res,
while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) && while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) &&
i < PNP_MAX_IRQ) i < PNP_MAX_IRQ)
i++; i++;
if (i >= PNP_MAX_IRQ) { if (i >= PNP_MAX_IRQ && !warned) {
printk(KERN_ERR "pnpacpi: exceeded the max number of IRQ " printk(KERN_ERR "pnpacpi: exceeded the max number of IRQ "
"resources: %d \n", PNP_MAX_IRQ); "resources: %d \n", PNP_MAX_IRQ);
warned = 1;
return; return;
} }
/* /*
...@@ -169,6 +171,7 @@ static void pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, ...@@ -169,6 +171,7 @@ static void pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res,
int bus_master, int transfer) int bus_master, int transfer)
{ {
int i = 0; int i = 0;
static unsigned char warned;
while (i < PNP_MAX_DMA && while (i < PNP_MAX_DMA &&
!(res->dma_resource[i].flags & IORESOURCE_UNSET)) !(res->dma_resource[i].flags & IORESOURCE_UNSET))
...@@ -183,9 +186,10 @@ static void pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, ...@@ -183,9 +186,10 @@ static void pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res,
} }
res->dma_resource[i].start = dma; res->dma_resource[i].start = dma;
res->dma_resource[i].end = dma; res->dma_resource[i].end = dma;
} else { } else if (!warned) {
printk(KERN_ERR "pnpacpi: exceeded the max number of DMA " printk(KERN_ERR "pnpacpi: exceeded the max number of DMA "
"resources: %d \n", PNP_MAX_DMA); "resources: %d \n", PNP_MAX_DMA);
warned = 1;
} }
} }
...@@ -193,6 +197,7 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res, ...@@ -193,6 +197,7 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
u64 io, u64 len, int io_decode) u64 io, u64 len, int io_decode)
{ {
int i = 0; int i = 0;
static unsigned char warned;
while (!(res->port_resource[i].flags & IORESOURCE_UNSET) && while (!(res->port_resource[i].flags & IORESOURCE_UNSET) &&
i < PNP_MAX_PORT) i < PNP_MAX_PORT)
...@@ -207,7 +212,7 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res, ...@@ -207,7 +212,7 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
} }
res->port_resource[i].start = io; res->port_resource[i].start = io;
res->port_resource[i].end = io + len - 1; res->port_resource[i].end = io + len - 1;
} else { } else if (!warned) {
printk(KERN_ERR "pnpacpi: exceeded the max number of IO " printk(KERN_ERR "pnpacpi: exceeded the max number of IO "
"resources: %d \n", PNP_MAX_PORT); "resources: %d \n", PNP_MAX_PORT);
} }
...@@ -218,6 +223,7 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res, ...@@ -218,6 +223,7 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
int write_protect) int write_protect)
{ {
int i = 0; int i = 0;
static unsigned char warned;
while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) && while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) &&
(i < PNP_MAX_MEM)) (i < PNP_MAX_MEM))
...@@ -233,7 +239,7 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res, ...@@ -233,7 +239,7 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
res->mem_resource[i].start = mem; res->mem_resource[i].start = mem;
res->mem_resource[i].end = mem + len - 1; res->mem_resource[i].end = mem + len - 1;
} else { } else if (!warned) {
printk(KERN_ERR "pnpacpi: exceeded the max number of mem " printk(KERN_ERR "pnpacpi: exceeded the max number of mem "
"resources: %d\n", PNP_MAX_MEM); "resources: %d\n", PNP_MAX_MEM);
} }
......
...@@ -2322,6 +2322,8 @@ ...@@ -2322,6 +2322,8 @@
#define PCI_DEVICE_ID_INTEL_ICH9_4 0x2914 #define PCI_DEVICE_ID_INTEL_ICH9_4 0x2914
#define PCI_DEVICE_ID_INTEL_ICH9_5 0x2919 #define PCI_DEVICE_ID_INTEL_ICH9_5 0x2919
#define PCI_DEVICE_ID_INTEL_ICH9_6 0x2930 #define PCI_DEVICE_ID_INTEL_ICH9_6 0x2930
#define PCI_DEVICE_ID_INTEL_ICH9_7 0x2916
#define PCI_DEVICE_ID_INTEL_ICH9_8 0x2918
#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340 #define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340
#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575 #define PCI_DEVICE_ID_INTEL_82830_HB 0x3575
#define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577 #define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577
......
...@@ -246,6 +246,15 @@ static inline int call_platform_enable_wakeup(struct device *dev, int is_on) ...@@ -246,6 +246,15 @@ static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
device_set_wakeup_enable(dev,val); \ device_set_wakeup_enable(dev,val); \
} while(0) } while(0)
/*
* Global Power Management flags
* Used to keep APM and ACPI from both being active
*/
extern unsigned int pm_flags;
#define PM_APM 1
#define PM_ACPI 2
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* _LINUX_PM_H */ #endif /* _LINUX_PM_H */
...@@ -4,10 +4,6 @@ ...@@ -4,10 +4,6 @@
#ifdef CONFIG_PM_LEGACY #ifdef CONFIG_PM_LEGACY
extern int pm_active;
#define PM_IS_ACTIVE() (pm_active != 0)
/* /*
* Register a device with power management * Register a device with power management
*/ */
...@@ -21,8 +17,6 @@ int __deprecated pm_send_all(pm_request_t rqst, void *data); ...@@ -21,8 +17,6 @@ int __deprecated pm_send_all(pm_request_t rqst, void *data);
#else /* CONFIG_PM_LEGACY */ #else /* CONFIG_PM_LEGACY */
#define PM_IS_ACTIVE() 0
static inline struct pm_dev *pm_register(pm_dev_t type, static inline struct pm_dev *pm_register(pm_dev_t type,
unsigned long id, unsigned long id,
pm_callback callback) pm_callback callback)
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/mod_devicetable.h> #include <linux/mod_devicetable.h>
#define PNP_MAX_PORT 24 #define PNP_MAX_PORT 40
#define PNP_MAX_MEM 12 #define PNP_MAX_MEM 12
#define PNP_MAX_IRQ 2 #define PNP_MAX_IRQ 2
#define PNP_MAX_DMA 2 #define PNP_MAX_DMA 2
......
...@@ -28,6 +28,9 @@ BLOCKING_NOTIFIER_HEAD(pm_chain_head); ...@@ -28,6 +28,9 @@ BLOCKING_NOTIFIER_HEAD(pm_chain_head);
DEFINE_MUTEX(pm_mutex); DEFINE_MUTEX(pm_mutex);
unsigned int pm_flags;
EXPORT_SYMBOL(pm_flags);
#ifdef CONFIG_SUSPEND #ifdef CONFIG_SUSPEND
/* This is just an arbitrary number */ /* This is just an arbitrary number */
......
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/mutex.h> #include <linux/mutex.h>
int pm_active;
/* /*
* Locking notes: * Locking notes:
* pm_devs_lock can be a semaphore providing pm ops are not called * pm_devs_lock can be a semaphore providing pm ops are not called
...@@ -204,6 +202,4 @@ int pm_send_all(pm_request_t rqst, void *data) ...@@ -204,6 +202,4 @@ int pm_send_all(pm_request_t rqst, void *data)
EXPORT_SYMBOL(pm_register); EXPORT_SYMBOL(pm_register);
EXPORT_SYMBOL(pm_send_all); EXPORT_SYMBOL(pm_send_all);
EXPORT_SYMBOL(pm_active);
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