diff options
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/battery.c | 2 | ||||
-rw-r--r-- | drivers/acpi/numa.c | 4 | ||||
-rw-r--r-- | drivers/acpi/pci_bind.c | 3 | ||||
-rw-r--r-- | drivers/acpi/sbs.c | 27 | ||||
-rw-r--r-- | drivers/acpi/sbshc.c | 17 | ||||
-rw-r--r-- | drivers/acpi/sbshc.h | 6 | ||||
-rw-r--r-- | drivers/acpi/video.c | 4 |
7 files changed, 36 insertions, 27 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 7d6be23eff89..8f7505d304b5 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -125,7 +125,7 @@ static int acpi_battery_technology(struct acpi_battery *battery) | |||
125 | return POWER_SUPPLY_TECHNOLOGY_NiMH; | 125 | return POWER_SUPPLY_TECHNOLOGY_NiMH; |
126 | if (!strcasecmp("LION", battery->type)) | 126 | if (!strcasecmp("LION", battery->type)) |
127 | return POWER_SUPPLY_TECHNOLOGY_LION; | 127 | return POWER_SUPPLY_TECHNOLOGY_LION; |
128 | if (!strcasecmp("LI-ION", battery->type)) | 128 | if (!strncasecmp("LI-ION", battery->type, 6)) |
129 | return POWER_SUPPLY_TECHNOLOGY_LION; | 129 | return POWER_SUPPLY_TECHNOLOGY_LION; |
130 | if (!strcasecmp("LiP", battery->type)) | 130 | if (!strcasecmp("LiP", battery->type)) |
131 | return POWER_SUPPLY_TECHNOLOGY_LIPO; | 131 | return POWER_SUPPLY_TECHNOLOGY_LIPO; |
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c index ab04d848b19d..0822d9fc1cb4 100644 --- a/drivers/acpi/numa.c +++ b/drivers/acpi/numa.c | |||
@@ -38,9 +38,9 @@ ACPI_MODULE_NAME("numa"); | |||
38 | static nodemask_t nodes_found_map = NODE_MASK_NONE; | 38 | static nodemask_t nodes_found_map = NODE_MASK_NONE; |
39 | 39 | ||
40 | /* maps to convert between proximity domain and logical node ID */ | 40 | /* maps to convert between proximity domain and logical node ID */ |
41 | static int __cpuinitdata pxm_to_node_map[MAX_PXM_DOMAINS] | 41 | static int pxm_to_node_map[MAX_PXM_DOMAINS] |
42 | = { [0 ... MAX_PXM_DOMAINS - 1] = NID_INVAL }; | 42 | = { [0 ... MAX_PXM_DOMAINS - 1] = NID_INVAL }; |
43 | static int __cpuinitdata node_to_pxm_map[MAX_NUMNODES] | 43 | static int node_to_pxm_map[MAX_NUMNODES] |
44 | = { [0 ... MAX_NUMNODES - 1] = PXM_INVAL }; | 44 | = { [0 ... MAX_NUMNODES - 1] = PXM_INVAL }; |
45 | 45 | ||
46 | int pxm_to_node(int pxm) | 46 | int pxm_to_node(int pxm) |
diff --git a/drivers/acpi/pci_bind.c b/drivers/acpi/pci_bind.c index 028969370bbf..388300de005d 100644 --- a/drivers/acpi/pci_bind.c +++ b/drivers/acpi/pci_bind.c | |||
@@ -294,9 +294,6 @@ int acpi_pci_unbind(struct acpi_device *device) | |||
294 | acpi_get_data(device->handle, acpi_pci_data_handler, | 294 | acpi_get_data(device->handle, acpi_pci_data_handler, |
295 | (void **)&data); | 295 | (void **)&data); |
296 | if (ACPI_FAILURE(status)) { | 296 | if (ACPI_FAILURE(status)) { |
297 | ACPI_EXCEPTION((AE_INFO, status, | ||
298 | "Unable to get data from device %s", | ||
299 | acpi_device_bid(device))); | ||
300 | result = -ENODEV; | 297 | result = -ENODEV; |
301 | goto end; | 298 | goto end; |
302 | } | 299 | } |
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index 6045cdbe176b..22cb95b349e4 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c | |||
@@ -54,12 +54,6 @@ | |||
54 | #define ACPI_BATTERY_DIR_NAME "BAT%i" | 54 | #define ACPI_BATTERY_DIR_NAME "BAT%i" |
55 | #define ACPI_AC_DIR_NAME "AC0" | 55 | #define ACPI_AC_DIR_NAME "AC0" |
56 | 56 | ||
57 | enum acpi_sbs_device_addr { | ||
58 | ACPI_SBS_CHARGER = 0x9, | ||
59 | ACPI_SBS_MANAGER = 0xa, | ||
60 | ACPI_SBS_BATTERY = 0xb, | ||
61 | }; | ||
62 | |||
63 | #define ACPI_SBS_NOTIFY_STATUS 0x80 | 57 | #define ACPI_SBS_NOTIFY_STATUS 0x80 |
64 | #define ACPI_SBS_NOTIFY_INFO 0x81 | 58 | #define ACPI_SBS_NOTIFY_INFO 0x81 |
65 | 59 | ||
@@ -539,7 +533,7 @@ static struct proc_dir_entry *acpi_battery_dir = NULL; | |||
539 | 533 | ||
540 | static inline char *acpi_battery_units(struct acpi_battery *battery) | 534 | static inline char *acpi_battery_units(struct acpi_battery *battery) |
541 | { | 535 | { |
542 | return acpi_battery_mode(battery) ? " mWh" : " mAh"; | 536 | return acpi_battery_mode(battery) ? " mW" : " mA"; |
543 | } | 537 | } |
544 | 538 | ||
545 | 539 | ||
@@ -556,10 +550,10 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset) | |||
556 | if (!battery->present) | 550 | if (!battery->present) |
557 | goto end; | 551 | goto end; |
558 | 552 | ||
559 | seq_printf(seq, "design capacity: %i%s\n", | 553 | seq_printf(seq, "design capacity: %i%sh\n", |
560 | battery->design_capacity * acpi_battery_scale(battery), | 554 | battery->design_capacity * acpi_battery_scale(battery), |
561 | acpi_battery_units(battery)); | 555 | acpi_battery_units(battery)); |
562 | seq_printf(seq, "last full capacity: %i%s\n", | 556 | seq_printf(seq, "last full capacity: %i%sh\n", |
563 | battery->full_charge_capacity * acpi_battery_scale(battery), | 557 | battery->full_charge_capacity * acpi_battery_scale(battery), |
564 | acpi_battery_units(battery)); | 558 | acpi_battery_units(battery)); |
565 | seq_printf(seq, "battery technology: rechargeable\n"); | 559 | seq_printf(seq, "battery technology: rechargeable\n"); |
@@ -590,7 +584,7 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset) | |||
590 | { | 584 | { |
591 | struct acpi_battery *battery = seq->private; | 585 | struct acpi_battery *battery = seq->private; |
592 | struct acpi_sbs *sbs = battery->sbs; | 586 | struct acpi_sbs *sbs = battery->sbs; |
593 | int result = 0; | 587 | int rate; |
594 | 588 | ||
595 | mutex_lock(&sbs->lock); | 589 | mutex_lock(&sbs->lock); |
596 | seq_printf(seq, "present: %s\n", | 590 | seq_printf(seq, "present: %s\n", |
@@ -604,9 +598,12 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset) | |||
604 | seq_printf(seq, "charging state: %s\n", | 598 | seq_printf(seq, "charging state: %s\n", |
605 | (battery->current_now < 0) ? "discharging" : | 599 | (battery->current_now < 0) ? "discharging" : |
606 | ((battery->current_now > 0) ? "charging" : "charged")); | 600 | ((battery->current_now > 0) ? "charging" : "charged")); |
607 | seq_printf(seq, "present rate: %d mA\n", | 601 | rate = abs(battery->current_now) * acpi_battery_ipscale(battery); |
608 | abs(battery->current_now) * acpi_battery_ipscale(battery)); | 602 | rate *= (acpi_battery_mode(battery))?(battery->voltage_now * |
609 | seq_printf(seq, "remaining capacity: %i%s\n", | 603 | acpi_battery_vscale(battery)/1000):1; |
604 | seq_printf(seq, "present rate: %d%s\n", rate, | ||
605 | acpi_battery_units(battery)); | ||
606 | seq_printf(seq, "remaining capacity: %i%sh\n", | ||
610 | battery->capacity_now * acpi_battery_scale(battery), | 607 | battery->capacity_now * acpi_battery_scale(battery), |
611 | acpi_battery_units(battery)); | 608 | acpi_battery_units(battery)); |
612 | seq_printf(seq, "present voltage: %i mV\n", | 609 | seq_printf(seq, "present voltage: %i mV\n", |
@@ -614,7 +611,7 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset) | |||
614 | 611 | ||
615 | end: | 612 | end: |
616 | mutex_unlock(&sbs->lock); | 613 | mutex_unlock(&sbs->lock); |
617 | return result; | 614 | return 0; |
618 | } | 615 | } |
619 | 616 | ||
620 | static int acpi_battery_state_open_fs(struct inode *inode, struct file *file) | 617 | static int acpi_battery_state_open_fs(struct inode *inode, struct file *file) |
@@ -638,7 +635,7 @@ static int acpi_battery_read_alarm(struct seq_file *seq, void *offset) | |||
638 | acpi_battery_get_alarm(battery); | 635 | acpi_battery_get_alarm(battery); |
639 | seq_printf(seq, "alarm: "); | 636 | seq_printf(seq, "alarm: "); |
640 | if (battery->alarm_capacity) | 637 | if (battery->alarm_capacity) |
641 | seq_printf(seq, "%i%s\n", | 638 | seq_printf(seq, "%i%sh\n", |
642 | battery->alarm_capacity * | 639 | battery->alarm_capacity * |
643 | acpi_battery_scale(battery), | 640 | acpi_battery_scale(battery), |
644 | acpi_battery_units(battery)); | 641 | acpi_battery_units(battery)); |
diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c index 046d7c3ed356..fd40b6a1d639 100644 --- a/drivers/acpi/sbshc.c +++ b/drivers/acpi/sbshc.c | |||
@@ -202,10 +202,9 @@ int acpi_smbus_unregister_callback(struct acpi_smb_hc *hc) | |||
202 | 202 | ||
203 | EXPORT_SYMBOL_GPL(acpi_smbus_unregister_callback); | 203 | EXPORT_SYMBOL_GPL(acpi_smbus_unregister_callback); |
204 | 204 | ||
205 | static void acpi_smbus_callback(void *context) | 205 | static inline void acpi_smbus_callback(void *context) |
206 | { | 206 | { |
207 | struct acpi_smb_hc *hc = context; | 207 | struct acpi_smb_hc *hc = context; |
208 | |||
209 | if (hc->callback) | 208 | if (hc->callback) |
210 | hc->callback(hc->context); | 209 | hc->callback(hc->context); |
211 | } | 210 | } |
@@ -214,6 +213,7 @@ static int smbus_alarm(void *context) | |||
214 | { | 213 | { |
215 | struct acpi_smb_hc *hc = context; | 214 | struct acpi_smb_hc *hc = context; |
216 | union acpi_smb_status status; | 215 | union acpi_smb_status status; |
216 | u8 address; | ||
217 | if (smb_hc_read(hc, ACPI_SMB_STATUS, &status.raw)) | 217 | if (smb_hc_read(hc, ACPI_SMB_STATUS, &status.raw)) |
218 | return 0; | 218 | return 0; |
219 | /* Check if it is only a completion notify */ | 219 | /* Check if it is only a completion notify */ |
@@ -222,9 +222,18 @@ static int smbus_alarm(void *context) | |||
222 | if (!status.fields.alarm) | 222 | if (!status.fields.alarm) |
223 | return 0; | 223 | return 0; |
224 | mutex_lock(&hc->lock); | 224 | mutex_lock(&hc->lock); |
225 | smb_hc_read(hc, ACPI_SMB_ALARM_ADDRESS, &address); | ||
226 | status.fields.alarm = 0; | ||
225 | smb_hc_write(hc, ACPI_SMB_STATUS, status.raw); | 227 | smb_hc_write(hc, ACPI_SMB_STATUS, status.raw); |
226 | if (hc->callback) | 228 | /* We are only interested in events coming from known devices */ |
227 | acpi_os_execute(OSL_GPE_HANDLER, acpi_smbus_callback, hc); | 229 | switch (address >> 1) { |
230 | case ACPI_SBS_CHARGER: | ||
231 | case ACPI_SBS_MANAGER: | ||
232 | case ACPI_SBS_BATTERY: | ||
233 | acpi_os_execute(OSL_GPE_HANDLER, | ||
234 | acpi_smbus_callback, hc); | ||
235 | default:; | ||
236 | } | ||
228 | mutex_unlock(&hc->lock); | 237 | mutex_unlock(&hc->lock); |
229 | return 0; | 238 | return 0; |
230 | } | 239 | } |
diff --git a/drivers/acpi/sbshc.h b/drivers/acpi/sbshc.h index 3bda3491a97b..a57b0762dd7f 100644 --- a/drivers/acpi/sbshc.h +++ b/drivers/acpi/sbshc.h | |||
@@ -16,6 +16,12 @@ enum acpi_smb_protocol { | |||
16 | 16 | ||
17 | static const u8 SMBUS_PEC = 0x80; | 17 | static const u8 SMBUS_PEC = 0x80; |
18 | 18 | ||
19 | enum acpi_sbs_device_addr { | ||
20 | ACPI_SBS_CHARGER = 0x9, | ||
21 | ACPI_SBS_MANAGER = 0xa, | ||
22 | ACPI_SBS_BATTERY = 0xb, | ||
23 | }; | ||
24 | |||
19 | typedef void (*smbus_alarm_callback)(void *context); | 25 | typedef void (*smbus_alarm_callback)(void *context); |
20 | 26 | ||
21 | extern int acpi_smbus_read(struct acpi_smb_hc *hc, u8 protocol, u8 address, | 27 | extern int acpi_smbus_read(struct acpi_smb_hc *hc, u8 protocol, u8 address, |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 44a0d9ba9bd6..bd77e81e81c1 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -577,7 +577,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
577 | struct acpi_video_device_brightness *br = NULL; | 577 | struct acpi_video_device_brightness *br = NULL; |
578 | 578 | ||
579 | 579 | ||
580 | memset(&device->cap, 0, 4); | 580 | memset(&device->cap, 0, sizeof(device->cap)); |
581 | 581 | ||
582 | if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_ADR", &h_dummy1))) { | 582 | if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_ADR", &h_dummy1))) { |
583 | device->cap._ADR = 1; | 583 | device->cap._ADR = 1; |
@@ -697,7 +697,7 @@ static void acpi_video_bus_find_cap(struct acpi_video_bus *video) | |||
697 | { | 697 | { |
698 | acpi_handle h_dummy1; | 698 | acpi_handle h_dummy1; |
699 | 699 | ||
700 | memset(&video->cap, 0, 4); | 700 | memset(&video->cap, 0, sizeof(video->cap)); |
701 | if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOS", &h_dummy1))) { | 701 | if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOS", &h_dummy1))) { |
702 | video->cap._DOS = 1; | 702 | video->cap._DOS = 1; |
703 | } | 703 | } |