Commit 6b410160 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: (39 commits)
  ACPI: EC: Workaround for optimized controllers (version 3)
  ACPI: EC: use printk_ratelimit(), add some DEBUG mode messages
  Revert "ACPI: EC: Workaround for optimized controllers"
  ACPI: fix two IRQ8 issues in IOAPIC mode
  ACPI: Add missing spaces to printk format
  cpuidle: fix HP nx6125 regression
  cpuidle: add sched_clock_idle_[sleep|wakeup]_event() hooks
  cpuidle: fix C3 for no bus-master control case
  ACPI: thinkpad-acpi: fix oops when a module parameter has no value
  Revert "Fix very high interrupt rate for IRQ8 (rtc) unless pnpacpi=off"
  ACPI: EC: Don't init EC early if it has no _INI
  Revert "acpi: make ACPI_PROCFS default to y"
  Revert "ACPI: add documentation for deprecated /proc/acpi/battery in ACPI_PROCFS"
  ACPI: Split out control for /proc/acpi entries from battery, ac, and sbs.
  ACPI: Video: Increase buffer size for writes to brightness proc file.
  ACPI: EC: Workaround for optimized controllers
  ACPI: SBS: Fix retval warning
  ACPI: Enable MSR (FixedHW) support for T-States
  ACPI: Get throttling info from BIOS only after evaluating _PDC
  ACPI: Use _TSS for throttling control, when present. Add error checks.
  ...
parents 9ccc2362 a3f095ad
ThinkPad ACPI Extras Driver ThinkPad ACPI Extras Driver
Version 0.16 Version 0.17
August 2nd, 2007 October 04th, 2007
Borislav Deianov <borislav@users.sf.net> Borislav Deianov <borislav@users.sf.net>
Henrique de Moraes Holschuh <hmh@hmh.eng.br> Henrique de Moraes Holschuh <hmh@hmh.eng.br>
...@@ -923,19 +923,34 @@ sysfs backlight device "thinkpad_screen" ...@@ -923,19 +923,34 @@ sysfs backlight device "thinkpad_screen"
This feature allows software control of the LCD brightness on ThinkPad This feature allows software control of the LCD brightness on ThinkPad
models which don't have a hardware brightness slider. models which don't have a hardware brightness slider.
It has some limitations: the LCD backlight cannot be actually turned on or off It has some limitations: the LCD backlight cannot be actually turned on or
by this interface, and in many ThinkPad models, the "dim while on battery" off by this interface, and in many ThinkPad models, the "dim while on
functionality will be enabled by the BIOS when this interface is used, and battery" functionality will be enabled by the BIOS when this interface is
cannot be controlled. used, and cannot be controlled.
The backlight control has eight levels, ranging from 0 to 7. Some of the On IBM (and some of the earlier Lenovo) ThinkPads, the backlight control
levels may not be distinct. has eight brightness levels, ranging from 0 to 7. Some of the levels
may not be distinct. Later Lenovo models that implement the ACPI
There are two interfaces to the firmware for brightness control, EC and CMOS. display backlight brightness control methods have 16 levels, ranging
To select which one should be used, use the brightness_mode module parameter: from 0 to 15.
brightness_mode=1 selects EC mode, brightness_mode=2 selects CMOS mode,
brightness_mode=3 selects both EC and CMOS. The driver tries to autodetect There are two interfaces to the firmware for direct brightness control,
which interface to use. EC and CMOS. To select which one should be used, use the
brightness_mode module parameter: brightness_mode=1 selects EC mode,
brightness_mode=2 selects CMOS mode, brightness_mode=3 selects both EC
and CMOS. The driver tries to autodetect which interface to use.
When display backlight brightness controls are available through the
standard ACPI interface, it is best to use it instead of this direct
ThinkPad-specific interface. The driver will disable its native
backlight brightness control interface if it detects that the standard
ACPI interface is available in the ThinkPad.
The brightness_enable module parameter can be used to control whether
the LCD brightness control feature will be enabled when available.
brightness_enable=0 forces it to be disabled. brightness_enable=1
forces it to be enabled when available, even if the standard ACPI
interface is also available.
Procfs notes: Procfs notes:
...@@ -947,11 +962,11 @@ Procfs notes: ...@@ -947,11 +962,11 @@ Procfs notes:
Sysfs notes: Sysfs notes:
The interface is implemented through the backlight sysfs class, which is poorly The interface is implemented through the backlight sysfs class, which is
documented at this time. poorly documented at this time.
Locate the thinkpad_screen device under /sys/class/backlight, and inside it Locate the thinkpad_screen device under /sys/class/backlight, and inside
there will be the following attributes: it there will be the following attributes:
max_brightness: max_brightness:
Reads the maximum brightness the hardware can be set to. Reads the maximum brightness the hardware can be set to.
...@@ -961,17 +976,19 @@ there will be the following attributes: ...@@ -961,17 +976,19 @@ there will be the following attributes:
Reads what brightness the screen is set to at this instant. Reads what brightness the screen is set to at this instant.
brightness: brightness:
Writes request the driver to change brightness to the given Writes request the driver to change brightness to the
value. Reads will tell you what brightness the driver is trying given value. Reads will tell you what brightness the
to set the display to when "power" is set to zero and the display driver is trying to set the display to when "power" is set
has not been dimmed by a kernel power management event. to zero and the display has not been dimmed by a kernel
power management event.
power: power:
power management mode, where 0 is "display on", and 1 to 3 will power management mode, where 0 is "display on", and 1 to 3
dim the display backlight to brightness level 0 because will dim the display backlight to brightness level 0
thinkpad-acpi cannot really turn the backlight off. Kernel because thinkpad-acpi cannot really turn the backlight
power management events can temporarily increase the current off. Kernel power management events can temporarily
power management level, i.e. they can dim the display. increase the current power management level, i.e. they can
dim the display.
Volume control -- /proc/acpi/ibm/volume Volume control -- /proc/acpi/ibm/volume
......
...@@ -49,6 +49,9 @@ static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c) ...@@ -49,6 +49,9 @@ static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c)
if (cpu_has(c, X86_FEATURE_EST)) if (cpu_has(c, X86_FEATURE_EST))
buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP; buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP;
if (cpu_has(c, X86_FEATURE_ACPI))
buf[2] |= ACPI_PDC_T_FFH;
obj->type = ACPI_TYPE_BUFFER; obj->type = ACPI_TYPE_BUFFER;
obj->buffer.length = 12; obj->buffer.length = 12;
obj->buffer.pointer = (u8 *) buf; obj->buffer.pointer = (u8 *) buf;
......
...@@ -115,6 +115,3 @@ static int __init acpi_sleep_setup(char *str) ...@@ -115,6 +115,3 @@ static int __init acpi_sleep_setup(char *str)
__setup("acpi_sleep=", acpi_sleep_setup); __setup("acpi_sleep=", acpi_sleep_setup);
void acpi_pci_link_exit(void)
{
}
...@@ -962,7 +962,7 @@ static int EISA_ELCR(unsigned int irq) ...@@ -962,7 +962,7 @@ static int EISA_ELCR(unsigned int irq)
#define default_MCA_trigger(idx) (1) #define default_MCA_trigger(idx) (1)
#define default_MCA_polarity(idx) (0) #define default_MCA_polarity(idx) (0)
static int __init MPBIOS_polarity(int idx) static int MPBIOS_polarity(int idx)
{ {
int bus = mp_irqs[idx].mpc_srcbus; int bus = mp_irqs[idx].mpc_srcbus;
int polarity; int polarity;
...@@ -2830,6 +2830,25 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a ...@@ -2830,6 +2830,25 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
return 0; return 0;
} }
int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity)
{
int i;
if (skip_ioapic_setup)
return -1;
for (i = 0; i < mp_irq_entries; i++)
if (mp_irqs[i].mpc_irqtype == mp_INT &&
mp_irqs[i].mpc_srcbusirq == bus_irq)
break;
if (i >= mp_irq_entries)
return -1;
*trigger = irq_trigger(i);
*polarity = irq_polarity(i);
return 0;
}
#endif /* CONFIG_ACPI */ #endif /* CONFIG_ACPI */
static int __init parse_disable_timer_pin_1(char *arg) static int __init parse_disable_timer_pin_1(char *arg)
......
...@@ -546,7 +546,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin) ...@@ -546,7 +546,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin)
#define default_PCI_trigger(idx) (1) #define default_PCI_trigger(idx) (1)
#define default_PCI_polarity(idx) (1) #define default_PCI_polarity(idx) (1)
static int __init MPBIOS_polarity(int idx) static int MPBIOS_polarity(int idx)
{ {
int bus = mp_irqs[idx].mpc_srcbus; int bus = mp_irqs[idx].mpc_srcbus;
int polarity; int polarity;
...@@ -2222,8 +2222,27 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int p ...@@ -2222,8 +2222,27 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int p
return 0; return 0;
} }
#endif /* CONFIG_ACPI */
int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity)
{
int i;
if (skip_ioapic_setup)
return -1;
for (i = 0; i < mp_irq_entries; i++)
if (mp_irqs[i].mpc_irqtype == mp_INT &&
mp_irqs[i].mpc_srcbusirq == bus_irq)
break;
if (i >= mp_irq_entries)
return -1;
*trigger = irq_trigger(i);
*polarity = irq_polarity(i);
return 0;
}
#endif /* CONFIG_ACPI */
/* /*
* This function currently is only a helper for the i386 smp boot process where * This function currently is only a helper for the i386 smp boot process where
...@@ -2260,3 +2279,4 @@ void __init setup_ioapic_dest(void) ...@@ -2260,3 +2279,4 @@ void __init setup_ioapic_dest(void)
} }
} }
#endif #endif
...@@ -13,7 +13,7 @@ static int __devinit can_skip_ioresource_align(const struct dmi_system_id *d) ...@@ -13,7 +13,7 @@ static int __devinit can_skip_ioresource_align(const struct dmi_system_id *d)
return 0; return 0;
} }
static struct dmi_system_id acpi_pciprobe_dmi_table[] = { static struct dmi_system_id acpi_pciprobe_dmi_table[] __devinitdata = {
/* /*
* Systems where PCI IO resource ISA alignment can be skipped * Systems where PCI IO resource ISA alignment can be skipped
* when the ISA enable bit in the bridge control is not set * when the ISA enable bit in the bridge control is not set
......
...@@ -50,7 +50,6 @@ config ACPI_SLEEP ...@@ -50,7 +50,6 @@ config ACPI_SLEEP
config ACPI_PROCFS config ACPI_PROCFS
bool "Deprecated /proc/acpi files" bool "Deprecated /proc/acpi files"
depends on PROC_FS depends on PROC_FS
default y
---help--- ---help---
For backwards compatibility, this option allows For backwards compatibility, this option allows
deprecated /proc/acpi/ files to exist, even when deprecated /proc/acpi/ files to exist, even when
...@@ -61,7 +60,6 @@ config ACPI_PROCFS ...@@ -61,7 +60,6 @@ config ACPI_PROCFS
/proc/acpi/info (/sys/modules/acpi/parameters/acpica_version) /proc/acpi/info (/sys/modules/acpi/parameters/acpica_version)
/proc/acpi/dsdt (/sys/firmware/acpi/tables/DSDT) /proc/acpi/dsdt (/sys/firmware/acpi/tables/DSDT)
/proc/acpi/fadt (/sys/firmware/acpi/tables/FACP) /proc/acpi/fadt (/sys/firmware/acpi/tables/FACP)
/proc/acpi/battery (/sys/class/power_supply)
/proc/acpi/debug_layer (/sys/module/acpi/parameters/debug_layer) /proc/acpi/debug_layer (/sys/module/acpi/parameters/debug_layer)
/proc/acpi/debug_level (/sys/module/acpi/parameters/debug_level) /proc/acpi/debug_level (/sys/module/acpi/parameters/debug_level)
...@@ -69,7 +67,21 @@ config ACPI_PROCFS ...@@ -69,7 +67,21 @@ config ACPI_PROCFS
and functions which do not yet exist in /sys. and functions which do not yet exist in /sys.
Say N to delete /proc/acpi/ files that have moved to /sys/ Say N to delete /proc/acpi/ files that have moved to /sys/
config ACPI_PROCFS_POWER
bool "Deprecated power /proc/acpi folders"
depends on PROC_FS
default y
---help---
For backwards compatibility, this option allows
deprecated power /proc/acpi/ folders to exist, even when
they have been replaced by functions in /sys.
The deprecated folders (and their replacements) include:
/proc/acpi/battery/* (/sys/class/power_supply/*)
/proc/acpi/ac_adapter/* (sys/class/power_supply/*)
This option has no effect on /proc/acpi/ folders
and functions, which do not yet exist in /sys
Say N to delete power /proc/acpi/ folders that have moved to /sys/
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
......
...@@ -58,6 +58,6 @@ obj-$(CONFIG_ACPI_NUMA) += numa.o ...@@ -58,6 +58,6 @@ obj-$(CONFIG_ACPI_NUMA) += numa.o
obj-$(CONFIG_ACPI_ASUS) += asus_acpi.o obj-$(CONFIG_ACPI_ASUS) += asus_acpi.o
obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o
obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o
obj-y += cm_sbs.o obj-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o
obj-$(CONFIG_ACPI_SBS) += sbs.o obj-$(CONFIG_ACPI_SBS) += sbs.o
obj-$(CONFIG_ACPI_SBS) += sbshc.o obj-$(CONFIG_ACPI_SBS) += sbshc.o
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/types.h> #include <linux/types.h>
#ifdef CONFIG_ACPI_PROCFS #ifdef CONFIG_ACPI_PROCFS_POWER
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#endif #endif
...@@ -51,7 +51,7 @@ MODULE_AUTHOR("Paul Diefenbaugh"); ...@@ -51,7 +51,7 @@ MODULE_AUTHOR("Paul Diefenbaugh");
MODULE_DESCRIPTION("ACPI AC Adapter Driver"); MODULE_DESCRIPTION("ACPI AC Adapter Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
#ifdef CONFIG_ACPI_PROCFS #ifdef CONFIG_ACPI_PROCFS_POWER
extern struct proc_dir_entry *acpi_lock_ac_dir(void); extern struct proc_dir_entry *acpi_lock_ac_dir(void);
extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir); extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir);
static int acpi_ac_open_fs(struct inode *inode, struct file *file); static int acpi_ac_open_fs(struct inode *inode, struct file *file);
...@@ -86,7 +86,7 @@ struct acpi_ac { ...@@ -86,7 +86,7 @@ struct acpi_ac {
#define to_acpi_ac(x) container_of(x, struct acpi_ac, charger); #define to_acpi_ac(x) container_of(x, struct acpi_ac, charger);
#ifdef CONFIG_ACPI_PROCFS #ifdef CONFIG_ACPI_PROCFS_POWER
static const struct file_operations acpi_ac_fops = { static const struct file_operations acpi_ac_fops = {
.open = acpi_ac_open_fs, .open = acpi_ac_open_fs,
.read = seq_read, .read = seq_read,
...@@ -136,7 +136,7 @@ static int acpi_ac_get_state(struct acpi_ac *ac) ...@@ -136,7 +136,7 @@ static int acpi_ac_get_state(struct acpi_ac *ac)
return 0; return 0;
} }
#ifdef CONFIG_ACPI_PROCFS #ifdef CONFIG_ACPI_PROCFS_POWER
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
FS Interface (/proc) FS Interface (/proc)
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
...@@ -275,7 +275,7 @@ static int acpi_ac_add(struct acpi_device *device) ...@@ -275,7 +275,7 @@ static int acpi_ac_add(struct acpi_device *device)
if (result) if (result)
goto end; goto end;
#ifdef CONFIG_ACPI_PROCFS #ifdef CONFIG_ACPI_PROCFS_POWER
result = acpi_ac_add_fs(device); result = acpi_ac_add_fs(device);
#endif #endif
if (result) if (result)
...@@ -300,7 +300,7 @@ static int acpi_ac_add(struct acpi_device *device) ...@@ -300,7 +300,7 @@ static int acpi_ac_add(struct acpi_device *device)
end: end:
if (result) { if (result) {
#ifdef CONFIG_ACPI_PROCFS #ifdef CONFIG_ACPI_PROCFS_POWER
acpi_ac_remove_fs(device); acpi_ac_remove_fs(device);
#endif #endif
kfree(ac); kfree(ac);
...@@ -339,7 +339,7 @@ static int acpi_ac_remove(struct acpi_device *device, int type) ...@@ -339,7 +339,7 @@ static int acpi_ac_remove(struct acpi_device *device, int type)
ACPI_ALL_NOTIFY, acpi_ac_notify); ACPI_ALL_NOTIFY, acpi_ac_notify);
if (ac->charger.dev) if (ac->charger.dev)
power_supply_unregister(&ac->charger); power_supply_unregister(&ac->charger);
#ifdef CONFIG_ACPI_PROCFS #ifdef CONFIG_ACPI_PROCFS_POWER
acpi_ac_remove_fs(device); acpi_ac_remove_fs(device);
#endif #endif
...@@ -355,7 +355,7 @@ static int __init acpi_ac_init(void) ...@@ -355,7 +355,7 @@ static int __init acpi_ac_init(void)
if (acpi_disabled) if (acpi_disabled)
return -ENODEV; return -ENODEV;
#ifdef CONFIG_ACPI_PROCFS #ifdef CONFIG_ACPI_PROCFS_POWER
acpi_ac_dir = acpi_lock_ac_dir(); acpi_ac_dir = acpi_lock_ac_dir();
if (!acpi_ac_dir) if (!acpi_ac_dir)
return -ENODEV; return -ENODEV;
...@@ -363,7 +363,7 @@ static int __init acpi_ac_init(void) ...@@ -363,7 +363,7 @@ static int __init acpi_ac_init(void)
result = acpi_bus_register_driver(&acpi_ac_driver); result = acpi_bus_register_driver(&acpi_ac_driver);
if (result < 0) { if (result < 0) {
#ifdef CONFIG_ACPI_PROCFS #ifdef CONFIG_ACPI_PROCFS_POWER
acpi_unlock_ac_dir(acpi_ac_dir); acpi_unlock_ac_dir(acpi_ac_dir);
#endif #endif
return -ENODEV; return -ENODEV;
...@@ -377,7 +377,7 @@ static void __exit acpi_ac_exit(void) ...@@ -377,7 +377,7 @@ static void __exit acpi_ac_exit(void)
acpi_bus_unregister_driver(&acpi_ac_driver); acpi_bus_unregister_driver(&acpi_ac_driver);
#ifdef CONFIG_ACPI_PROCFS #ifdef CONFIG_ACPI_PROCFS_POWER
acpi_unlock_ac_dir(acpi_ac_dir); acpi_unlock_ac_dir(acpi_ac_dir);
#endif #endif
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
#ifdef CONFIG_ACPI_PROCFS #ifdef CONFIG_ACPI_PROCFS_POWER
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -63,7 +63,7 @@ static unsigned int cache_time = 1000; ...@@ -63,7 +63,7 @@ static unsigned int cache_time = 1000;
module_param(cache_time, uint, 0644); module_param(cache_time, uint, 0644);
MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
#ifdef CONFIG_ACPI_PROCFS #ifdef CONFIG_ACPI_PROCFS_POWER
extern struct proc_dir_entry *acpi_lock_battery_dir(void); extern struct proc_dir_entry *acpi_lock_battery_dir(void);
extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir); extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir);
...@@ -153,6 +153,8 @@ static int acpi_battery_get_property(struct power_supply *psy, ...@@ -153,6 +153,8 @@ static int acpi_battery_get_property(struct power_supply *psy,
val->intval = POWER_SUPPLY_STATUS_CHARGING; val->intval = POWER_SUPPLY_STATUS_CHARGING;
else if (battery->state == 0) else if (battery->state == 0)
val->intval = POWER_SUPPLY_STATUS_FULL; val->intval = POWER_SUPPLY_STATUS_FULL;
else
val->intval = POWER_SUPPLY_STATUS_UNKNOWN;
break; break;
case POWER_SUPPLY_PROP_PRESENT: case POWER_SUPPLY_PROP_PRESENT:
val->intval = acpi_battery_present(battery); val->intval = acpi_battery_present(battery);
...@@ -221,7 +223,7 @@ static enum power_supply_property energy_battery_props[] = { ...@@ -221,7 +223,7 @@ static enum power_supply_property energy_battery_props[] = {
POWER_SUPPLY_PROP_MANUFACTURER, POWER_SUPPLY_PROP_MANUFACTURER,
}; };
#ifdef CONFIG_ACPI_PROCFS #ifdef CONFIG_ACPI_PROCFS_POWER
inline char *acpi_battery_units(struct acpi_battery *battery) inline char *acpi_battery_units(struct acpi_battery *battery)
{ {
return (battery->power_unit)?"mA":"mW"; return (battery->power_unit)?"mA":"mW";
...@@ -479,7 +481,7 @@ static int acpi_battery_update(struct acpi_battery *battery) ...@@ -479,7 +481,7 @@ static int acpi_battery_update(struct acpi_battery *battery)
FS Interface (/proc) FS Interface (/proc)
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
#ifdef CONFIG_ACPI_PROCFS #ifdef CONFIG_ACPI_PROCFS_POWER
static struct proc_dir_entry *acpi_battery_dir; static struct proc_dir_entry *acpi_battery_dir;
static int acpi_battery_print_info(struct seq_file *seq, int result) static int acpi_battery_print_info(struct seq_file *seq, int result)
...@@ -786,7 +788,7 @@ static int acpi_battery_add(struct acpi_device *device) ...@@ -786,7 +788,7 @@ static int acpi_battery_add(struct acpi_device *device)
acpi_driver_data(device) = battery; acpi_driver_data(device) = battery;
mutex_init(&battery->lock); mutex_init(&battery->lock);
acpi_battery_update(battery); acpi_battery_update(battery);
#ifdef CONFIG_ACPI_PROCFS #ifdef CONFIG_ACPI_PROCFS_POWER
result = acpi_battery_add_fs(device); result = acpi_battery_add_fs(device);
if (result) if (result)
goto end; goto end;
...@@ -804,7 +806,7 @@ static int acpi_battery_add(struct acpi_device *device) ...@@ -804,7 +806,7 @@ static int acpi_battery_add(struct acpi_device *device)
device->status.battery_present ? "present" : "absent"); device->status.battery_present ? "present" : "absent");
end: end:
if (result) { if (result) {
#ifdef CONFIG_ACPI_PROCFS #ifdef CONFIG_ACPI_PROCFS_POWER
acpi_battery_remove_fs(device); acpi_battery_remove_fs(device);
#endif #endif
kfree(battery); kfree(battery);
...@@ -823,7 +825,7 @@ static int acpi_battery_remove(struct acpi_device *device, int type) ...@@ -823,7 +825,7 @@ static int acpi_battery_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_ALL_NOTIFY,
acpi_battery_notify); acpi_battery_notify);
#ifdef CONFIG_ACPI_PROCFS #ifdef CONFIG_ACPI_PROCFS_POWER
acpi_battery_remove_fs(device); acpi_battery_remove_fs(device);
#endif #endif
sysfs_remove_battery(battery); sysfs_remove_battery(battery);
...@@ -859,13 +861,13 @@ static int __init acpi_battery_init(void) ...@@ -859,13 +861,13 @@ static int __init acpi_battery_init(void)
{ {
if (acpi_disabled) if (acpi_disabled)
return -ENODEV; return -ENODEV;
#ifdef CONFIG_ACPI_PROCFS #ifdef CONFIG_ACPI_PROCFS_POWER
acpi_battery_dir = acpi_lock_battery_dir(); acpi_battery_dir = acpi_lock_battery_dir();
if (!acpi_battery_dir) if (!acpi_battery_dir)
return -ENODEV; return -ENODEV;
#endif #endif
if (acpi_bus_register_driver(&acpi_battery_driver) < 0) { if (acpi_bus_register_driver(&acpi_battery_driver) < 0) {
#ifdef CONFIG_ACPI_PROCFS #ifdef CONFIG_ACPI_PROCFS_POWER
acpi_unlock_battery_dir(acpi_battery_dir); acpi_unlock_battery_dir(acpi_battery_dir);
#endif #endif
return -ENODEV; return -ENODEV;
...@@ -876,7 +878,7 @@ static int __init acpi_battery_init(void) ...@@ -876,7 +878,7 @@ static int __init acpi_battery_init(void)
static void __exit acpi_battery_exit(void) static void __exit acpi_battery_exit(void)
{ {
acpi_bus_unregister_driver(&acpi_battery_driver); acpi_bus_unregister_driver(&acpi_battery_driver);
#ifdef CONFIG_ACPI_PROCFS #ifdef CONFIG_ACPI_PROCFS_POWER
acpi_unlock_battery_dir(acpi_battery_dir); acpi_unlock_battery_dir(acpi_battery_dir);
#endif #endif
} }
......
...@@ -47,6 +47,9 @@ ...@@ -47,6 +47,9 @@
#undef PREFIX #undef PREFIX
#define PREFIX "ACPI: EC: " #define PREFIX "ACPI: EC: "
/* Uncomment next line to get verbose print outs*/
/* #define DEBUG */
/* EC status register */ /* EC status register */
#define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */ #define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */
#define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */ #define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */
...@@ -75,7 +78,10 @@ enum { ...@@ -75,7 +78,10 @@ enum {
EC_FLAGS_WAIT_GPE = 0, /* Don't check status until GPE arrives */ EC_FLAGS_WAIT_GPE = 0, /* Don't check status until GPE arrives */
EC_FLAGS_QUERY_PENDING, /* Query is pending */ EC_FLAGS_QUERY_PENDING, /* Query is pending */
EC_FLAGS_GPE_MODE, /* Expect GPE to be sent for status change */ EC_FLAGS_GPE_MODE, /* Expect GPE to be sent for status change */
EC_FLAGS_ONLY_IBF_GPE, /* Expect GPE only for IBF = 0 event */ EC_FLAGS_NO_ADDRESS_GPE, /* Expect GPE only for non-address event */
EC_FLAGS_ADDRESS, /* Address is being written */
EC_FLAGS_NO_WDATA_GPE, /* Don't expect WDATA GPE event */
EC_FLAGS_WDATA, /* Data is being written */
}; };
static int acpi_ec_remove(struct acpi_device *device, int type); static int acpi_ec_remove(struct acpi_device *device, int type);
...@@ -131,21 +137,27 @@ static struct acpi_ec { ...@@ -131,21 +137,27 @@ static struct acpi_ec {