diff options
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/Kconfig | 7 | ||||
-rw-r--r-- | drivers/acpi/Makefile | 2 | ||||
-rw-r--r-- | drivers/acpi/battery.c | 25 | ||||
-rw-r--r-- | drivers/acpi/ec.c | 9 |
4 files changed, 34 insertions, 9 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index a7799a99f2d9..8a851d0f4384 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -254,13 +254,6 @@ config ACPI_PCI_SLOT | |||
254 | help you correlate PCI bus addresses with the physical geography | 254 | help you correlate PCI bus addresses with the physical geography |
255 | of your slots. If you are unsure, say N. | 255 | of your slots. If you are unsure, say N. |
256 | 256 | ||
257 | config ACPI_SYSTEM | ||
258 | bool | ||
259 | default y | ||
260 | help | ||
261 | This driver will enable your system to shut down using ACPI, and | ||
262 | dump your ACPI DSDT table using /proc/acpi/dsdt. | ||
263 | |||
264 | config X86_PM_TIMER | 257 | config X86_PM_TIMER |
265 | bool "Power Management Timer Support" if EMBEDDED | 258 | bool "Power Management Timer Support" if EMBEDDED |
266 | depends on X86 | 259 | depends on X86 |
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index 65d90c720b5a..b130ea0d0759 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile | |||
@@ -52,7 +52,7 @@ obj-$(CONFIG_ACPI_PROCESSOR) += processor.o | |||
52 | obj-$(CONFIG_ACPI_CONTAINER) += container.o | 52 | obj-$(CONFIG_ACPI_CONTAINER) += container.o |
53 | obj-$(CONFIG_ACPI_THERMAL) += thermal.o | 53 | obj-$(CONFIG_ACPI_THERMAL) += thermal.o |
54 | obj-y += power.o | 54 | obj-y += power.o |
55 | obj-$(CONFIG_ACPI_SYSTEM) += system.o event.o | 55 | obj-y += system.o event.o |
56 | obj-$(CONFIG_ACPI_DEBUG) += debug.o | 56 | obj-$(CONFIG_ACPI_DEBUG) += debug.o |
57 | obj-$(CONFIG_ACPI_NUMA) += numa.o | 57 | obj-$(CONFIG_ACPI_NUMA) += numa.o |
58 | obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o | 58 | obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 65132f920459..69cbc57c2d1c 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -138,6 +138,29 @@ static int acpi_battery_technology(struct acpi_battery *battery) | |||
138 | 138 | ||
139 | static int acpi_battery_get_state(struct acpi_battery *battery); | 139 | static int acpi_battery_get_state(struct acpi_battery *battery); |
140 | 140 | ||
141 | static int acpi_battery_is_charged(struct acpi_battery *battery) | ||
142 | { | ||
143 | /* either charging or discharging */ | ||
144 | if (battery->state != 0) | ||
145 | return 0; | ||
146 | |||
147 | /* battery not reporting charge */ | ||
148 | if (battery->capacity_now == ACPI_BATTERY_VALUE_UNKNOWN || | ||
149 | battery->capacity_now == 0) | ||
150 | return 0; | ||
151 | |||
152 | /* good batteries update full_charge as the batteries degrade */ | ||
153 | if (battery->full_charge_capacity == battery->capacity_now) | ||
154 | return 1; | ||
155 | |||
156 | /* fallback to using design values for broken batteries */ | ||
157 | if (battery->design_capacity == battery->capacity_now) | ||
158 | return 1; | ||
159 | |||
160 | /* we don't do any sort of metric based on percentages */ | ||
161 | return 0; | ||
162 | } | ||
163 | |||
141 | static int acpi_battery_get_property(struct power_supply *psy, | 164 | static int acpi_battery_get_property(struct power_supply *psy, |
142 | enum power_supply_property psp, | 165 | enum power_supply_property psp, |
143 | union power_supply_propval *val) | 166 | union power_supply_propval *val) |
@@ -155,7 +178,7 @@ static int acpi_battery_get_property(struct power_supply *psy, | |||
155 | val->intval = POWER_SUPPLY_STATUS_DISCHARGING; | 178 | val->intval = POWER_SUPPLY_STATUS_DISCHARGING; |
156 | else if (battery->state & 0x02) | 179 | else if (battery->state & 0x02) |
157 | val->intval = POWER_SUPPLY_STATUS_CHARGING; | 180 | val->intval = POWER_SUPPLY_STATUS_CHARGING; |
158 | else if (battery->state == 0) | 181 | else if (acpi_battery_is_charged(battery)) |
159 | val->intval = POWER_SUPPLY_STATUS_FULL; | 182 | val->intval = POWER_SUPPLY_STATUS_FULL; |
160 | else | 183 | else |
161 | val->intval = POWER_SUPPLY_STATUS_UNKNOWN; | 184 | val->intval = POWER_SUPPLY_STATUS_UNKNOWN; |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 5c2f5d343be6..2fe15060dcdc 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -120,6 +120,8 @@ static struct acpi_ec { | |||
120 | spinlock_t curr_lock; | 120 | spinlock_t curr_lock; |
121 | } *boot_ec, *first_ec; | 121 | } *boot_ec, *first_ec; |
122 | 122 | ||
123 | static int EC_FLAGS_MSI; /* Out-of-spec MSI controller */ | ||
124 | |||
123 | /* -------------------------------------------------------------------------- | 125 | /* -------------------------------------------------------------------------- |
124 | Transaction Management | 126 | Transaction Management |
125 | -------------------------------------------------------------------------- */ | 127 | -------------------------------------------------------------------------- */ |
@@ -259,6 +261,8 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, | |||
259 | clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); | 261 | clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); |
260 | acpi_disable_gpe(NULL, ec->gpe); | 262 | acpi_disable_gpe(NULL, ec->gpe); |
261 | } | 263 | } |
264 | if (EC_FLAGS_MSI) | ||
265 | udelay(ACPI_EC_DELAY); | ||
262 | /* start transaction */ | 266 | /* start transaction */ |
263 | spin_lock_irqsave(&ec->curr_lock, tmp); | 267 | spin_lock_irqsave(&ec->curr_lock, tmp); |
264 | /* following two actions should be kept atomic */ | 268 | /* following two actions should be kept atomic */ |
@@ -967,6 +971,11 @@ int __init acpi_ec_ecdt_probe(void) | |||
967 | /* | 971 | /* |
968 | * Generate a boot ec context | 972 | * Generate a boot ec context |
969 | */ | 973 | */ |
974 | if (dmi_name_in_vendors("Micro-Star") || | ||
975 | dmi_name_in_vendors("Notebook")) { | ||
976 | pr_info(PREFIX "Enabling special treatment for EC from MSI.\n"); | ||
977 | EC_FLAGS_MSI = 1; | ||
978 | } | ||
970 | status = acpi_get_table(ACPI_SIG_ECDT, 1, | 979 | status = acpi_get_table(ACPI_SIG_ECDT, 1, |
971 | (struct acpi_table_header **)&ecdt_ptr); | 980 | (struct acpi_table_header **)&ecdt_ptr); |
972 | if (ACPI_SUCCESS(status)) { | 981 | if (ACPI_SUCCESS(status)) { |