Commit 95c5e1f1 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:
  toshiba_acpi: close race in toshiba_acpi driver
  ACPICA: disable _BIF warning
  ACPI: delete OSI(Linux) DMI dmesg spam
  ACPICA: Allow _WAK method to return an Integer
  ACPI: thinkpad-acpi: fix fan sleep/resume path
  sony-laptop: printk tweak
  sony-laptop: brightness regression fix
  Revert "ACPI: don't enable control method power button as wakeup device when Fixed Power button is used"
  ACPI suspend: Blacklist boxes that require us to set SCI_EN directly on resume
  ACPI: scheduling in atomic via acpi_evaluate_integer ()
  ACPI: battery: Convert discharge energy rate to current properly
  ACPI: EC: count interrupts only if called from interrupt handler.
parents b31a0fec 23d0a65c
......@@ -174,6 +174,15 @@ static int acpi_battery_get_property(struct power_supply *psy,
break;
case POWER_SUPPLY_PROP_CURRENT_NOW:
val->intval = battery->current_now * 1000;
/* if power units are mW, convert to mA by
dividing by current voltage (mV/1000) */
if (!battery->power_unit) {
if (battery->voltage_now) {
val->intval /= battery->voltage_now;
val->intval *= 1000;
} else
val->intval = -1;
}
break;
case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN:
......
This diff is collapsed.
......@@ -219,7 +219,8 @@ static void gpe_transaction(struct acpi_ec *ec, u8 status)
goto unlock;
err:
/* false interrupt, state didn't change */
++ec->curr->irq_count;
if (in_interrupt())
++ec->curr->irq_count;
unlock:
spin_unlock_irqrestore(&ec->curr_lock, flags);
}
......
......@@ -35,7 +35,6 @@
#include <linux/interrupt.h>
#include <linux/kmod.h>
#include <linux/delay.h>
#include <linux/dmi.h>
#include <linux/workqueue.h>
#include <linux/nmi.h>
#include <linux/acpi.h>
......@@ -97,54 +96,44 @@ static DEFINE_SPINLOCK(acpi_res_lock);
static char osi_additional_string[OSI_STRING_LENGTH_MAX];
/*
* "Ode to _OSI(Linux)"
* The story of _OSI(Linux)
*
* osi_linux -- Control response to BIOS _OSI(Linux) query.
* From pre-history through Linux-2.6.22,
* Linux responded TRUE upon a BIOS OSI(Linux) query.
*
* As Linux evolves, the features that it supports change.
* So an OSI string such as "Linux" is not specific enough
* to be useful across multiple versions of Linux. It
* doesn't identify any particular feature, interface,
* or even any particular version of Linux...
* Unfortunately, reference BIOS writers got wind of this
* and put OSI(Linux) in their example code, quickly exposing
* this string as ill-conceived and opening the door to
* an un-bounded number of BIOS incompatibilities.
*
* Unfortunately, Linux-2.6.22 and earlier responded "yes"
* to a BIOS _OSI(Linux) query. When
* a reference mobile BIOS started using it, its use
* started to spread to many vendor platforms.
* As it is not supportable, we need to halt that spread.
* For example, OSI(Linux) was used on resume to re-POST a
* video card on one system, because Linux at that time
* could not do a speedy restore in its native driver.
* But then upon gaining quick native restore capability,
* Linux has no way to tell the BIOS to skip the time-consuming
* POST -- putting Linux at a permanent performance disadvantage.
* On another system, the BIOS writer used OSI(Linux)
* to infer native OS support for IPMI! On other systems,
* OSI(Linux) simply got in the way of Linux claiming to
* be compatible with other operating systems, exposing
* BIOS issues such as skipped device initialization.
*
* Today, most BIOS references to _OSI(Linux) are noise --
* they have no functional effect and are just dead code
* carried over from the reference BIOS.
*
* The next most common case is that _OSI(Linux) harms Linux,
* usually by causing the BIOS to follow paths that are
* not tested during Windows validation.
*
* Finally, there is a short list of platforms
* where OSI(Linux) benefits Linux.
*
* In Linux-2.6.23, OSI(Linux) is first disabled by default.
* DMI is used to disable the dmesg warning about OSI(Linux)
* on platforms where it is known to have no effect.
* But a dmesg warning remains for systems where
* we do not know if OSI(Linux) is good or bad for the system.
* DMI is also used to enable OSI(Linux) for the machines
* that are known to need it.
* So "Linux" turned out to be a really poor chose of
* OSI string, and from Linux-2.6.23 onward we respond FALSE.
*
* BIOS writers should NOT query _OSI(Linux) on future systems.
* It will be ignored by default, and to get Linux to
* not ignore it will require a kernel source update to
* add a DMI entry, or a boot-time "acpi_osi=Linux" invocation.
* Linux will complain on the console when it sees it, and return FALSE.
* To get Linux to return TRUE for your system will require
* a kernel source update to add a DMI entry,
* or boot with "acpi_osi=Linux"
*/
#define OSI_LINUX_ENABLE 0
static struct osi_linux {
unsigned int enable:1;
unsigned int dmi:1;
unsigned int cmdline:1;
unsigned int known:1;
} osi_linux = { OSI_LINUX_ENABLE, 0, 0, 0};
} osi_linux = { 0, 0, 0, 0};
static void __init acpi_request_region (struct acpi_generic_address *addr,
unsigned int length, char *desc)
......@@ -1296,34 +1285,6 @@ acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object)
return (AE_OK);
}
/**
* acpi_dmi_dump - dump DMI slots needed for blacklist entry
*
* Returns 0 on success
*/
static int acpi_dmi_dump(void)
{
if (!dmi_available)
return -1;
printk(KERN_NOTICE PREFIX "DMI System Vendor: %s\n",
dmi_get_system_info(DMI_SYS_VENDOR));
printk(KERN_NOTICE PREFIX "DMI Product Name: %s\n",
dmi_get_system_info(DMI_PRODUCT_NAME));
printk(KERN_NOTICE PREFIX "DMI Product Version: %s\n",
dmi_get_system_info(DMI_PRODUCT_VERSION));
printk(KERN_NOTICE PREFIX "DMI Board Name: %s\n",
dmi_get_system_info(DMI_BOARD_NAME));
printk(KERN_NOTICE PREFIX "DMI BIOS Vendor: %s\n",
dmi_get_system_info(DMI_BIOS_VENDOR));
printk(KERN_NOTICE PREFIX "DMI BIOS Date: %s\n",
dmi_get_system_info(DMI_BIOS_DATE));
return 0;
}
/******************************************************************************
*
* FUNCTION: acpi_os_validate_interface
......@@ -1350,21 +1311,6 @@ acpi_os_validate_interface (char *interface)
osi_linux.cmdline ? " via cmdline" :
osi_linux.dmi ? " via DMI" : "");
if (!osi_linux.dmi) {
if (acpi_dmi_dump())
printk(KERN_NOTICE PREFIX
"[please extract dmidecode output]\n");
printk(KERN_NOTICE PREFIX
"Please send DMI info above to "
"linux-acpi@vger.kernel.org\n");
}
if (!osi_linux.known && !osi_linux.cmdline) {
printk(KERN_NOTICE PREFIX
"If \"acpi_osi=%sLinux\" works better, "
"please notify linux-acpi@vger.kernel.org\n",
osi_linux.enable ? "!" : "");
}
if (osi_linux.enable)
return AE_OK;
}
......
......@@ -751,16 +751,6 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device)
if (!acpi_match_device_ids(device, button_device_ids))
device->wakeup.flags.run_wake = 1;
/*
* Don't set Power button GPE as run_wake
* if Fixed Power button is used
*/
if (!strcmp(device->pnp.hardware_id, "PNP0C0C") &&
!(acpi_gbl_FADT.flags & ACPI_FADT_POWER_BUTTON)) {
device->wakeup.flags.run_wake = 0;
device->wakeup.flags.valid = 0;
}
end:
if (ACPI_FAILURE(status))
device->flags.wake_capable = 0;
......
......@@ -90,6 +90,18 @@ void __init acpi_old_suspend_ordering(void)
old_suspend_ordering = true;
}
/*
* According to the ACPI specification the BIOS should make sure that ACPI is
* enabled and SCI_EN bit is set on wake-up from S1 - S3 sleep states. Still,
* some BIOSes don't do that and therefore we use acpi_enable() to enable ACPI
* on such systems during resume. Unfortunately that doesn't help in
* particularly pathological cases in which SCI_EN has to be set directly on
* resume, although the specification states very clearly that this flag is
* owned by the hardware. The set_sci_en_on_resume variable will be set in such
* cases.
*/
static bool set_sci_en_on_resume;
/**
* acpi_pm_disable_gpes - Disable the GPEs.
*/
......@@ -235,7 +247,11 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
}
/* If ACPI is not enabled by the BIOS, we need to enable it here. */
acpi_enable();
if (set_sci_en_on_resume)
acpi_set_register(ACPI_BITREG_SCI_ENABLE, 1);
else
acpi_enable();
/* Reprogram control registers and execute _BFS */
acpi_leave_sleep_state_prep(acpi_state);
......@@ -323,6 +339,12 @@ static int __init init_old_suspend_ordering(const struct dmi_system_id *d)
return 0;
}
static int __init init_set_sci_en_on_resume(const struct dmi_system_id *d)
{
set_sci_en_on_resume = true;
return 0;
}
static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
{
.callback = init_old_suspend_ordering,
......@@ -340,6 +362,22 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
DMI_MATCH(DMI_PRODUCT_NAME, "HP xw4600 Workstation"),
},
},
{
.callback = init_set_sci_en_on_resume,
.ident = "Apple MacBook 1,1",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Apple Computer, Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "MacBook1,1"),
},
},
{
.callback = init_set_sci_en_on_resume,
.ident = "Apple MacMini 1,1",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Apple Computer, Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "Macmini1,1"),
},
},
{},
};
#endif /* CONFIG_SUSPEND */
......
......@@ -848,8 +848,6 @@ static int __init toshiba_acpi_init(void)
ret = input_register_polled_device(toshiba_acpi.poll_dev);
if (ret) {
printk(MY_ERR "unable to register kill-switch input device\n");
rfkill_free(toshiba_acpi.rfk_dev);
toshiba_acpi.rfk_dev = NULL;
toshiba_acpi_exit();
return ret;
}
......
......@@ -259,34 +259,26 @@ acpi_evaluate_integer(acpi_handle handle,
struct acpi_object_list *arguments, unsigned long long *data)
{
acpi_status status = AE_OK;
union acpi_object *element;
union acpi_object element;
struct acpi_buffer buffer = { 0, NULL };
if (!data)
return AE_BAD_PARAMETER;
element = kzalloc(sizeof(union acpi_object), irqs_disabled() ? GFP_ATOMIC: GFP_KERNEL);
if (!element)
return AE_NO_MEMORY;
buffer.length = sizeof(union acpi_object);
buffer.pointer = element;
buffer.pointer = &element;
status = acpi_evaluate_object(handle, pathname, arguments, &buffer);
if (ACPI_FAILURE(status)) {
acpi_util_eval_error(handle, pathname, status);
kfree(element);
return status;
}
if (element->type != ACPI_TYPE_INTEGER) {
if (element.type != ACPI_TYPE_INTEGER) {
acpi_util_eval_error(handle, pathname, AE_BAD_DATA);
kfree(element);
return AE_BAD_DATA;
}
*data = element->integer.value;
kfree(element);
*data = element.integer.value;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Return value [%llu]\n", *data));
......
......@@ -1038,8 +1038,8 @@ static int sony_nc_add(struct acpi_device *device)
goto outinput;
}
if (!acpi_video_backlight_support()) {
printk(KERN_INFO DRV_PFX "Sony: Brightness ignored, must be "
if (acpi_video_backlight_support()) {
printk(KERN_INFO DRV_PFX "brightness ignored, must be "
"controlled by ACPI video driver\n");
} else if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "GBRT",
&handle))) {
......
......@@ -5318,6 +5318,7 @@ static enum fan_control_commands fan_control_commands;
static u8 fan_control_initial_status;
static u8 fan_control_desired_level;
static u8 fan_control_resume_level;
static int fan_watchdog_maxinterval;
static struct mutex fan_mutex;
......@@ -5440,8 +5441,8 @@ static int fan_set_level(int level)
case TPACPI_FAN_WR_ACPI_FANS:
case TPACPI_FAN_WR_TPEC:
if ((level != TP_EC_FAN_AUTO) &&
(level != TP_EC_FAN_FULLSPEED) &&
if (!(level & TP_EC_FAN_AUTO) &&
!(level & TP_EC_FAN_FULLSPEED) &&
((level < 0) || (level > 7)))
return -EINVAL;
......@@ -6005,38 +6006,67 @@ static void fan_exit(void)
static void fan_suspend(pm_message_t state)
{
int rc;
if (!fan_control_allowed)
return;
/* Store fan status in cache */
fan_get_status_safe(NULL);
fan_control_resume_level = 0;
rc = fan_get_status_safe(&fan_control_resume_level);
if (rc < 0)
printk(TPACPI_NOTICE
"failed to read fan level for later "
"restore during resume: %d\n", rc);
/* if it is undefined, don't attempt to restore it.
* KEEP THIS LAST */
if (tp_features.fan_ctrl_status_undef)
fan_control_desired_level = TP_EC_FAN_AUTO;
fan_control_resume_level = 0;
}
static void fan_resume(void)
{
u8 saved_fan_level;
u8 current_level = 7;
bool do_set = false;
int rc;
/* DSDT *always* updates status on resume */
tp_features.fan_ctrl_status_undef = 0;
saved_fan_level = fan_control_desired_level;
if (!fan_control_allowed ||
!fan_control_resume_level ||
(fan_get_status_safe(&current_level) < 0))
return;
switch (fan_control_access_mode) {
case TPACPI_FAN_WR_ACPI_SFAN:
do_set = (saved_fan_level > current_level);
/* never decrease fan level */
do_set = (fan_control_resume_level > current_level);
break;
case TPACPI_FAN_WR_ACPI_FANS:
case TPACPI_FAN_WR_TPEC:
do_set = ((saved_fan_level & TP_EC_FAN_FULLSPEED) ||
(saved_fan_level == 7 &&
!(current_level & TP_EC_FAN_FULLSPEED)));
/* never decrease fan level, scale is:
* TP_EC_FAN_FULLSPEED > 7 >= TP_EC_FAN_AUTO
*
* We expect the firmware to set either 7 or AUTO, but we
* handle FULLSPEED out of paranoia.
*
* So, we can safely only restore FULLSPEED or 7, anything
* else could slow the fan. Restoring AUTO is useless, at
* best that's exactly what the DSDT already set (it is the
* slower it uses).
*
* Always keep in mind that the DSDT *will* have set the
* fans to what the vendor supposes is the best level. We
* muck with it only to speed the fan up.
*/
if (fan_control_resume_level != 7 &&
!(fan_control_resume_level & TP_EC_FAN_FULLSPEED))
return;
else
do_set = !(current_level & TP_EC_FAN_FULLSPEED) &&
(current_level != fan_control_resume_level);
break;
default:
return;
......@@ -6044,8 +6074,11 @@ static void fan_resume(void)
if (do_set) {
printk(TPACPI_NOTICE
"restoring fan level to 0x%02x\n",
saved_fan_level);
fan_set_level_safe(saved_fan_level);
fan_control_resume_level);
rc = fan_set_level_safe(fan_control_resume_level);
if (rc < 0)
printk(TPACPI_NOTICE
"failed to restore fan level: %d\n", rc);
}
}
......
......@@ -167,7 +167,7 @@ static const union acpi_predefined_info predefined_names[] = {
{.info = {"_BFS", 1, 0}},
{.info = {"_BIF", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER,
9,
ACPI_RTYPE_STRING, 4, 0}}, /* fixed (9 Int),(4 Str) */
ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER, 4, 0}}, /* fixed (9 Int),(4 Str) */
{.info = {"_BLT", 3, 0}},
{.info = {"_BMC", 1, 0}},
{.info = {"_BMD", 0, ACPI_RTYPE_PACKAGE}}, {.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 5, 0, 0, 0}}, /* fixed (5 Int) */
......@@ -346,7 +346,7 @@ static const union acpi_predefined_info predefined_names[] = {
/* Acpi 1.0 defined _WAK with no return value. Later, it was changed to return a package */
{.info = {"_WAK", 1, ACPI_RTYPE_NONE | ACPI_RTYPE_PACKAGE}},
{.info = {"_WAK", 1, ACPI_RTYPE_NONE | ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE}},
{.ret_info = {ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2, 0, 0, 0}}, /* fixed (2 Int), but is optional */
{.ret_info = {0, 0, 0, 0, 0, 0}} /* Table terminator */
};
......
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