diff options
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/battery.c | 14 | ||||
-rw-r--r-- | drivers/acpi/ec.c | 2 | ||||
-rw-r--r-- | drivers/acpi/pci_link.c | 39 | ||||
-rw-r--r-- | drivers/acpi/sbs.c | 31 | ||||
-rw-r--r-- | drivers/acpi/sleep.c | 51 |
5 files changed, 71 insertions, 66 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 65132f920459..7aa9f119f8dc 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -92,7 +92,7 @@ struct acpi_battery { #endif struct acpi_device *device; unsigned long update_time; - int current_now; + int rate_now; int capacity_now; int voltage_now; int design_capacity; @@ -173,7 +173,8 @@ static int acpi_battery_get_property(struct power_supply *psy, val->intval = battery->voltage_now * 1000; break; case POWER_SUPPLY_PROP_CURRENT_NOW: - val->intval = battery->current_now * 1000; + case POWER_SUPPLY_PROP_POWER_NOW: + val->intval = battery->rate_now * 1000; break; case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN: case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN: @@ -223,7 +224,8 @@ static enum power_supply_property energy_battery_props[] = { POWER_SUPPLY_PROP_TECHNOLOGY, POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, POWER_SUPPLY_PROP_VOLTAGE_NOW, - POWER_SUPPLY_PROP_CURRENT_NOW, + POWER_SUPPLY_PROP_CURRENT_NOW, /* to be removed in 2.6.29 */ + POWER_SUPPLY_PROP_POWER_NOW, POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, POWER_SUPPLY_PROP_ENERGY_FULL, POWER_SUPPLY_PROP_ENERGY_NOW, @@ -250,7 +252,7 @@ struct acpi_offsets { static struct acpi_offsets state_offsets[] = { {offsetof(struct acpi_battery, state), 0}, - {offsetof(struct acpi_battery, current_now), 0}, + {offsetof(struct acpi_battery, rate_now), 0}, {offsetof(struct acpi_battery, capacity_now), 0}, {offsetof(struct acpi_battery, voltage_now), 0}, }; @@ -582,11 +584,11 @@ static int acpi_battery_print_state(struct seq_file *seq, int result) else seq_printf(seq, "charging state: charged\n"); - if (battery->current_now == ACPI_BATTERY_VALUE_UNKNOWN) + if (battery->rate_now == ACPI_BATTERY_VALUE_UNKNOWN) seq_printf(seq, "present rate: unknown\n"); else seq_printf(seq, "present rate: %d %s\n", - battery->current_now, acpi_battery_units(battery)); + battery->rate_now, acpi_battery_units(battery)); if (battery->capacity_now == ACPI_BATTERY_VALUE_UNKNOWN) seq_printf(seq, "remaining capacity: unknown\n"); diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index a2b82c90a683..5c2f5d343be6 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -982,7 +982,7 @@ int __init acpi_ec_ecdt_probe(void) saved_ec = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL); if (!saved_ec) return -ENOMEM; - memcpy(&saved_ec, boot_ec, sizeof(saved_ec)); + memcpy(saved_ec, boot_ec, sizeof(*saved_ec)); /* fall through */ } /* This workaround is needed only on some broken machines, diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 1c6e73c7865e..4b084d8dc85b 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c @@ -414,7 +414,8 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) link->irq.active = irq; } - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Set IRQ %d\n", link->irq.active)); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link %s set to IRQ %d\n", + acpi_device_bid(link->device), link->irq.active)); end: kfree(resource); @@ -649,6 +650,9 @@ acpi_pci_link_allocate_irq(acpi_handle handle, return -1; } link->refcnt++; + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Link %s is referenced %d\n", + acpi_device_bid(link->device), link->refcnt)); mutex_unlock(&acpi_link_lock); if (triggering) @@ -657,9 +661,6 @@ acpi_pci_link_allocate_irq(acpi_handle handle, *polarity = link->irq.polarity; if (name) *name = acpi_device_bid(link->device); - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Link %s is referenced\n", - acpi_device_bid(link->device))); return (link->irq.active); } @@ -692,23 +693,15 @@ int acpi_pci_link_free_irq(acpi_handle handle) printk(KERN_ERR PREFIX "Link isn't initialized\n"); return -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--; -#endif ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Link %s is dereferenced\n", - acpi_device_bid(link->device))); + "Link %s is dereferenced %d\n", + acpi_device_bid(link->device), link->refcnt)); if (link->refcnt == 0) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Link %s is disabled\n", + acpi_device_bid(link->device))); acpi_evaluate_object(link->device->handle, "_DIS", NULL, NULL); } mutex_unlock(&acpi_link_lock); @@ -782,13 +775,17 @@ static int acpi_pci_link_add(struct acpi_device *device) return result; } -static int acpi_pci_link_resume(struct acpi_pci_link *link) +static void acpi_pci_link_resume(struct acpi_pci_link *link) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link %s resume ref %d act %d ini %d\n", + acpi_device_bid(link->device), link->refcnt, + link->irq.active, link->irq.initialized)); + if (link->refcnt && link->irq.active && link->irq.initialized) - return (acpi_pci_link_set(link, link->irq.active)); - else - return 0; + acpi_pci_link_set(link, link->irq.active); + + return; } static int irqrouter_resume(struct sys_device *dev) diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index 6050ce481873..e3b00872cddc 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c @@ -102,8 +102,8 @@ struct acpi_battery { u16 cycle_count; u16 temp_now; u16 voltage_now; - s16 current_now; - s16 current_avg; + s16 rate_now; + s16 rate_avg; u16 capacity_now; u16 state_of_charge; u16 state; @@ -202,9 +202,9 @@ static int acpi_sbs_battery_get_property(struct power_supply *psy, return -ENODEV; switch (psp) { case POWER_SUPPLY_PROP_STATUS: - if (battery->current_now < 0) + if (battery->rate_now < 0) val->intval = POWER_SUPPLY_STATUS_DISCHARGING; - else if (battery->current_now > 0) + else if (battery->rate_now > 0) val->intval = POWER_SUPPLY_STATUS_CHARGING; else val->intval = POWER_SUPPLY_STATUS_FULL; @@ -224,11 +224,13 @@ static int acpi_sbs_battery_get_property(struct power_supply *psy, acpi_battery_vscale(battery) * 1000; break; case POWER_SUPPLY_PROP_CURRENT_NOW: - val->intval = abs(battery->current_now) * + case POWER_SUPPLY_PROP_POWER_NOW: + val->intval = abs(battery->rate_now) * acpi_battery_ipscale(battery) * 1000; break; case POWER_SUPPLY_PROP_CURRENT_AVG: - val->intval = abs(battery->current_avg) * + case POWER_SUPPLY_PROP_POWER_AVG: + val->intval = abs(battery->rate_avg) * acpi_battery_ipscale(battery) * 1000; break; case POWER_SUPPLY_PROP_CAPACITY: @@ -291,8 +293,10 @@ static enum power_supply_property sbs_energy_battery_props[] = { POWER_SUPPLY_PROP_TECHNOLOGY, POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, POWER_SUPPLY_PROP_VOLTAGE_NOW, - POWER_SUPPLY_PROP_CURRENT_NOW, - POWER_SUPPLY_PROP_CURRENT_AVG, + POWER_SUPPLY_PROP_CURRENT_NOW, /* to be removed in 2.6.29 */ + POWER_SUPPLY_PROP_CURRENT_AVG, /* to be removed in 2.6.29 */ + POWER_SUPPLY_PROP_POWER_NOW, + POWER_SUPPLY_PROP_POWER_AVG, POWER_SUPPLY_PROP_CAPACITY, POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, POWER_SUPPLY_PROP_ENERGY_FULL, @@ -301,6 +305,7 @@ static enum power_supply_property sbs_energy_battery_props[] = { POWER_SUPPLY_PROP_MODEL_NAME, POWER_SUPPLY_PROP_MANUFACTURER, }; + #endif /* -------------------------------------------------------------------------- @@ -330,8 +335,8 @@ static struct acpi_battery_reader info_readers[] = { static struct acpi_battery_reader state_readers[] = { {0x08, SMBUS_READ_WORD, offsetof(struct acpi_battery, temp_now)}, {0x09, SMBUS_READ_WORD, offsetof(struct acpi_battery, voltage_now)}, - {0x0a, SMBUS_READ_WORD, offsetof(struct acpi_battery, current_now)}, - {0x0b, SMBUS_READ_WORD, offsetof(struct acpi_battery, current_avg)}, + {0x0a, SMBUS_READ_WORD, offsetof(struct acpi_battery, rate_now)}, + {0x0b, SMBUS_READ_WORD, offsetof(struct acpi_battery, rate_avg)}, {0x0f, SMBUS_READ_WORD, offsetof(struct acpi_battery, capacity_now)}, {0x0e, SMBUS_READ_WORD, offsetof(struct acpi_battery, state_of_charge)}, {0x16, SMBUS_READ_WORD, offsetof(struct acpi_battery, state)}, @@ -589,9 +594,9 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset) seq_printf(seq, "capacity state: %s\n", (battery->state & 0x0010) ? "critical" : "ok"); seq_printf(seq, "charging state: %s\n", - (battery->current_now < 0) ? "discharging" : - ((battery->current_now > 0) ? "charging" : "charged")); - rate = abs(battery->current_now) * acpi_battery_ipscale(battery); + (battery->rate_now < 0) ? "discharging" : + ((battery->rate_now > 0) ? "charging" : "charged")); + rate = abs(battery->rate_now) * acpi_battery_ipscale(battery); rate *= (acpi_battery_mode(battery))?(battery->voltage_now * acpi_battery_vscale(battery)/1000):1; seq_printf(seq, "present rate: %d%s\n", rate, diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 7e3c609cbef2..af85f5ba1be7 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -90,31 +90,6 @@ 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; -/* - * The ACPI specification wants us to save NVS memory regions during hibernation - * and to restore them during the subsequent resume. However, it is not certain - * if this mechanism is going to work on all machines, so we allow the user to - * disable this mechanism using the 'acpi_sleep=s4_nonvs' kernel command line - * option. - */ -static bool s4_no_nvs; - -void __init acpi_s4_no_nvs(void) -{ - s4_no_nvs = true; -} - /** * acpi_pm_disable_gpes - Disable the GPEs. */ @@ -193,6 +168,18 @@ static void acpi_pm_end(void) #endif /* CONFIG_ACPI_SLEEP */ #ifdef CONFIG_SUSPEND +/* + * 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; + extern void do_suspend_lowlevel(void); static u32 acpi_suspend_states[] = { @@ -396,6 +383,20 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = { #endif /* CONFIG_SUSPEND */ #ifdef CONFIG_HIBERNATION +/* + * The ACPI specification wants us to save NVS memory regions during hibernation + * and to restore them during the subsequent resume. However, it is not certain + * if this mechanism is going to work on all machines, so we allow the user to + * disable this mechanism using the 'acpi_sleep=s4_nonvs' kernel command line + * option. + */ +static bool s4_no_nvs; + +void __init acpi_s4_no_nvs(void) +{ + s4_no_nvs = true; +} + static unsigned long s4_hardware_signature; static struct acpi_table_facs *facs; static bool nosigcheck; |