diff options
| author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-05-26 22:00:52 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-05-26 22:00:52 -0400 |
| commit | 45f6bc5ff9c3387387f048ec85dcb4e69acf0b03 (patch) | |
| tree | d04952bb05b53a362bcd165fb910c5c1441b4c5d /drivers/acpi | |
| parent | 3138887bd8d18173f3c2baf1e43621c49090cd27 (diff) | |
| parent | e4aa937ec75df0eea0bee03bffa3303ad36c986b (diff) | |
Merge 3.10-rc3 into usb-next
We want these fixes.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/acpi')
| -rw-r--r-- | drivers/acpi/Makefile | 3 | ||||
| -rw-r--r-- | drivers/acpi/ac.c | 33 | ||||
| -rw-r--r-- | drivers/acpi/acpi_lpss.c | 26 | ||||
| -rw-r--r-- | drivers/acpi/csrt.c | 159 | ||||
| -rw-r--r-- | drivers/acpi/device_pm.c | 126 | ||||
| -rw-r--r-- | drivers/acpi/ec.c | 4 | ||||
| -rw-r--r-- | drivers/acpi/internal.h | 1 | ||||
| -rw-r--r-- | drivers/acpi/pci_root.c | 4 | ||||
| -rw-r--r-- | drivers/acpi/processor_driver.c | 8 | ||||
| -rw-r--r-- | drivers/acpi/processor_idle.c | 29 | ||||
| -rw-r--r-- | drivers/acpi/scan.c | 4 | ||||
| -rw-r--r-- | drivers/acpi/video.c | 8 | ||||
| -rw-r--r-- | drivers/acpi/video_detect.c | 8 |
13 files changed, 165 insertions, 248 deletions
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index ecb743bf05a5..536562c626a2 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile | |||
| @@ -24,7 +24,7 @@ acpi-y += nvs.o | |||
| 24 | # Power management related files | 24 | # Power management related files |
| 25 | acpi-y += wakeup.o | 25 | acpi-y += wakeup.o |
| 26 | acpi-y += sleep.o | 26 | acpi-y += sleep.o |
| 27 | acpi-$(CONFIG_PM) += device_pm.o | 27 | acpi-y += device_pm.o |
| 28 | acpi-$(CONFIG_ACPI_SLEEP) += proc.o | 28 | acpi-$(CONFIG_ACPI_SLEEP) += proc.o |
| 29 | 29 | ||
| 30 | 30 | ||
| @@ -38,7 +38,6 @@ acpi-y += processor_core.o | |||
| 38 | acpi-y += ec.o | 38 | acpi-y += ec.o |
| 39 | acpi-$(CONFIG_ACPI_DOCK) += dock.o | 39 | acpi-$(CONFIG_ACPI_DOCK) += dock.o |
| 40 | acpi-y += pci_root.o pci_link.o pci_irq.o | 40 | acpi-y += pci_root.o pci_link.o pci_irq.o |
| 41 | acpi-y += csrt.o | ||
| 42 | acpi-$(CONFIG_X86_INTEL_LPSS) += acpi_lpss.o | 41 | acpi-$(CONFIG_X86_INTEL_LPSS) += acpi_lpss.o |
| 43 | acpi-y += acpi_platform.o | 42 | acpi-y += acpi_platform.o |
| 44 | acpi-y += power.o | 43 | acpi-y += power.o |
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index 00d2efd674df..4f4e741d34b2 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
| @@ -28,6 +28,8 @@ | |||
| 28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
| 29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
| 30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
| 31 | #include <linux/dmi.h> | ||
| 32 | #include <linux/delay.h> | ||
| 31 | #ifdef CONFIG_ACPI_PROCFS_POWER | 33 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 32 | #include <linux/proc_fs.h> | 34 | #include <linux/proc_fs.h> |
| 33 | #include <linux/seq_file.h> | 35 | #include <linux/seq_file.h> |
| @@ -74,6 +76,8 @@ static int acpi_ac_resume(struct device *dev); | |||
| 74 | #endif | 76 | #endif |
| 75 | static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume); | 77 | static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume); |
| 76 | 78 | ||
| 79 | static int ac_sleep_before_get_state_ms; | ||
| 80 | |||
| 77 | static struct acpi_driver acpi_ac_driver = { | 81 | static struct acpi_driver acpi_ac_driver = { |
| 78 | .name = "ac", | 82 | .name = "ac", |
| 79 | .class = ACPI_AC_CLASS, | 83 | .class = ACPI_AC_CLASS, |
| @@ -252,6 +256,16 @@ static void acpi_ac_notify(struct acpi_device *device, u32 event) | |||
| 252 | case ACPI_AC_NOTIFY_STATUS: | 256 | case ACPI_AC_NOTIFY_STATUS: |
| 253 | case ACPI_NOTIFY_BUS_CHECK: | 257 | case ACPI_NOTIFY_BUS_CHECK: |
| 254 | case ACPI_NOTIFY_DEVICE_CHECK: | 258 | case ACPI_NOTIFY_DEVICE_CHECK: |
| 259 | /* | ||
| 260 | * A buggy BIOS may notify AC first and then sleep for | ||
| 261 | * a specific time before doing actual operations in the | ||
| 262 | * EC event handler (_Qxx). This will cause the AC state | ||
| 263 | * reported by the ACPI event to be incorrect, so wait for a | ||
| 264 | * specific time for the EC event handler to make progress. | ||
| 265 | */ | ||
| 266 | if (ac_sleep_before_get_state_ms > 0) | ||
| 267 | msleep(ac_sleep_before_get_state_ms); | ||
| 268 | |||
| 255 | acpi_ac_get_state(ac); | 269 | acpi_ac_get_state(ac); |
| 256 | acpi_bus_generate_proc_event(device, event, (u32) ac->state); | 270 | acpi_bus_generate_proc_event(device, event, (u32) ac->state); |
| 257 | acpi_bus_generate_netlink_event(device->pnp.device_class, | 271 | acpi_bus_generate_netlink_event(device->pnp.device_class, |
| @@ -264,6 +278,24 @@ static void acpi_ac_notify(struct acpi_device *device, u32 event) | |||
| 264 | return; | 278 | return; |
| 265 | } | 279 | } |
| 266 | 280 | ||
| 281 | static int thinkpad_e530_quirk(const struct dmi_system_id *d) | ||
| 282 | { | ||
| 283 | ac_sleep_before_get_state_ms = 1000; | ||
| 284 | return 0; | ||
| 285 | } | ||
| 286 | |||
| 287 | static struct dmi_system_id ac_dmi_table[] = { | ||
| 288 | { | ||
| 289 | .callback = thinkpad_e530_quirk, | ||
| 290 | .ident = "thinkpad e530", | ||
| 291 | .matches = { | ||
| 292 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
| 293 | DMI_MATCH(DMI_PRODUCT_NAME, "32597CG"), | ||
| 294 | }, | ||
| 295 | }, | ||
| 296 | {}, | ||
| 297 | }; | ||
| 298 | |||
| 267 | static int acpi_ac_add(struct acpi_device *device) | 299 | static int acpi_ac_add(struct acpi_device *device) |
| 268 | { | 300 | { |
| 269 | int result = 0; | 301 | int result = 0; |
| @@ -312,6 +344,7 @@ static int acpi_ac_add(struct acpi_device *device) | |||
| 312 | kfree(ac); | 344 | kfree(ac); |
| 313 | } | 345 | } |
| 314 | 346 | ||
| 347 | dmi_check_system(ac_dmi_table); | ||
| 315 | return result; | 348 | return result; |
| 316 | } | 349 | } |
| 317 | 350 | ||
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index b1c95422ce74..652fd5ce303c 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c | |||
| @@ -35,11 +35,16 @@ ACPI_MODULE_NAME("acpi_lpss"); | |||
| 35 | 35 | ||
| 36 | struct lpss_device_desc { | 36 | struct lpss_device_desc { |
| 37 | bool clk_required; | 37 | bool clk_required; |
| 38 | const char *clk_parent; | 38 | const char *clkdev_name; |
| 39 | bool ltr_required; | 39 | bool ltr_required; |
| 40 | unsigned int prv_offset; | 40 | unsigned int prv_offset; |
| 41 | }; | 41 | }; |
| 42 | 42 | ||
| 43 | static struct lpss_device_desc lpss_dma_desc = { | ||
| 44 | .clk_required = true, | ||
| 45 | .clkdev_name = "hclk", | ||
| 46 | }; | ||
| 47 | |||
| 43 | struct lpss_private_data { | 48 | struct lpss_private_data { |
| 44 | void __iomem *mmio_base; | 49 | void __iomem *mmio_base; |
| 45 | resource_size_t mmio_size; | 50 | resource_size_t mmio_size; |
| @@ -49,7 +54,6 @@ struct lpss_private_data { | |||
| 49 | 54 | ||
| 50 | static struct lpss_device_desc lpt_dev_desc = { | 55 | static struct lpss_device_desc lpt_dev_desc = { |
| 51 | .clk_required = true, | 56 | .clk_required = true, |
| 52 | .clk_parent = "lpss_clk", | ||
| 53 | .prv_offset = 0x800, | 57 | .prv_offset = 0x800, |
| 54 | .ltr_required = true, | 58 | .ltr_required = true, |
| 55 | }; | 59 | }; |
| @@ -60,6 +64,9 @@ static struct lpss_device_desc lpt_sdio_dev_desc = { | |||
| 60 | }; | 64 | }; |
| 61 | 65 | ||
| 62 | static const struct acpi_device_id acpi_lpss_device_ids[] = { | 66 | static const struct acpi_device_id acpi_lpss_device_ids[] = { |
| 67 | /* Generic LPSS devices */ | ||
| 68 | { "INTL9C60", (unsigned long)&lpss_dma_desc }, | ||
| 69 | |||
| 63 | /* Lynxpoint LPSS devices */ | 70 | /* Lynxpoint LPSS devices */ |
| 64 | { "INT33C0", (unsigned long)&lpt_dev_desc }, | 71 | { "INT33C0", (unsigned long)&lpt_dev_desc }, |
| 65 | { "INT33C1", (unsigned long)&lpt_dev_desc }, | 72 | { "INT33C1", (unsigned long)&lpt_dev_desc }, |
| @@ -91,16 +98,27 @@ static int register_device_clock(struct acpi_device *adev, | |||
| 91 | struct lpss_private_data *pdata) | 98 | struct lpss_private_data *pdata) |
| 92 | { | 99 | { |
| 93 | const struct lpss_device_desc *dev_desc = pdata->dev_desc; | 100 | const struct lpss_device_desc *dev_desc = pdata->dev_desc; |
| 101 | struct lpss_clk_data *clk_data; | ||
| 94 | 102 | ||
| 95 | if (!lpss_clk_dev) | 103 | if (!lpss_clk_dev) |
| 96 | lpt_register_clock_device(); | 104 | lpt_register_clock_device(); |
| 97 | 105 | ||
| 98 | if (!dev_desc->clk_parent || !pdata->mmio_base | 106 | clk_data = platform_get_drvdata(lpss_clk_dev); |
| 107 | if (!clk_data) | ||
| 108 | return -ENODEV; | ||
| 109 | |||
| 110 | if (dev_desc->clkdev_name) { | ||
| 111 | clk_register_clkdev(clk_data->clk, dev_desc->clkdev_name, | ||
| 112 | dev_name(&adev->dev)); | ||
| 113 | return 0; | ||
| 114 | } | ||
| 115 | |||
| 116 | if (!pdata->mmio_base | ||
| 99 | || pdata->mmio_size < dev_desc->prv_offset + LPSS_CLK_SIZE) | 117 | || pdata->mmio_size < dev_desc->prv_offset + LPSS_CLK_SIZE) |
| 100 | return -ENODATA; | 118 | return -ENODATA; |
| 101 | 119 | ||
| 102 | pdata->clk = clk_register_gate(NULL, dev_name(&adev->dev), | 120 | pdata->clk = clk_register_gate(NULL, dev_name(&adev->dev), |
| 103 | dev_desc->clk_parent, 0, | 121 | clk_data->name, 0, |
| 104 | pdata->mmio_base + dev_desc->prv_offset, | 122 | pdata->mmio_base + dev_desc->prv_offset, |
| 105 | 0, 0, NULL); | 123 | 0, 0, NULL); |
| 106 | if (IS_ERR(pdata->clk)) | 124 | if (IS_ERR(pdata->clk)) |
diff --git a/drivers/acpi/csrt.c b/drivers/acpi/csrt.c deleted file mode 100644 index 5c15a91faf0b..000000000000 --- a/drivers/acpi/csrt.c +++ /dev/null | |||
| @@ -1,159 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Support for Core System Resources Table (CSRT) | ||
| 3 | * | ||
| 4 | * Copyright (C) 2013, Intel Corporation | ||
| 5 | * Authors: Mika Westerberg <mika.westerberg@linux.intel.com> | ||
| 6 | * Andy Shevchenko <andriy.shevchenko@linux.intel.com> | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License version 2 as | ||
| 10 | * published by the Free Software Foundation. | ||
| 11 | */ | ||
| 12 | |||
| 13 | #define pr_fmt(fmt) "ACPI: CSRT: " fmt | ||
| 14 | |||
| 15 | #include <linux/acpi.h> | ||
| 16 | #include <linux/device.h> | ||
| 17 | #include <linux/kernel.h> | ||
| 18 | #include <linux/module.h> | ||
| 19 | #include <linux/platform_device.h> | ||
| 20 | #include <linux/sizes.h> | ||
| 21 | |||
| 22 | ACPI_MODULE_NAME("CSRT"); | ||
| 23 | |||
| 24 | static int __init acpi_csrt_parse_shared_info(struct platform_device *pdev, | ||
| 25 | const struct acpi_csrt_group *grp) | ||
| 26 | { | ||
| 27 | const struct acpi_csrt_shared_info *si; | ||
| 28 | struct resource res[3]; | ||
| 29 | size_t nres; | ||
| 30 | int ret; | ||
| 31 | |||
| 32 | memset(res, 0, sizeof(res)); | ||
| 33 | nres = 0; | ||
| 34 | |||
| 35 | si = (const struct acpi_csrt_shared_info *)&grp[1]; | ||
| 36 | /* | ||
| 37 | * The peripherals that are listed on CSRT typically support only | ||
| 38 | * 32-bit addresses so we only use the low part of MMIO base for | ||
| 39 | * now. | ||
| 40 | */ | ||
| 41 | if (!si->mmio_base_high && si->mmio_base_low) { | ||
| 42 | /* | ||
| 43 | * There is no size of the memory resource in shared_info | ||
| 44 | * so we assume that it is 4k here. | ||
| 45 | */ | ||
| 46 | res[nres].start = si->mmio_base_low; | ||
| 47 | res[nres].end = res[0].start + SZ_4K - 1; | ||
| 48 | res[nres++].flags = IORESOURCE_MEM; | ||
| 49 | } | ||
| 50 | |||
| 51 | if (si->gsi_interrupt) { | ||
| 52 | int irq = acpi_register_gsi(NULL, si->gsi_interrupt, | ||
| 53 | si->interrupt_mode, | ||
| 54 | si->interrupt_polarity); | ||
| 55 | res[nres].start = irq; | ||
| 56 | res[nres].end = irq; | ||
| 57 | res[nres++].flags = IORESOURCE_IRQ; | ||
| 58 | } | ||
| 59 | |||
| 60 | if (si->base_request_line || si->num_handshake_signals) { | ||
| 61 | /* | ||
| 62 | * We pass the driver a DMA resource describing the range | ||
| 63 | * of request lines the device supports. | ||
| 64 | */ | ||
| 65 | res[nres].start = si->base_request_line; | ||
| 66 | res[nres].end = res[nres].start + si->num_handshake_signals - 1; | ||
| 67 | res[nres++].flags = IORESOURCE_DMA; | ||
| 68 | } | ||
| 69 | |||
| 70 | ret = platform_device_add_resources(pdev, res, nres); | ||
| 71 | if (ret) { | ||
| 72 | if (si->gsi_interrupt) | ||
| 73 | acpi_unregister_gsi(si->gsi_interrupt); | ||
| 74 | return ret; | ||
| 75 | } | ||
| 76 | |||
| 77 | return 0; | ||
| 78 | } | ||
| 79 | |||
| 80 | static int __init | ||
| 81 | acpi_csrt_parse_resource_group(const struct acpi_csrt_group *grp) | ||
| 82 | { | ||
| 83 | struct platform_device *pdev; | ||
| 84 | char vendor[5], name[16]; | ||
| 85 | int ret, i; | ||
| 86 | |||
| 87 | vendor[0] = grp->vendor_id; | ||
| 88 | vendor[1] = grp->vendor_id >> 8; | ||
| 89 | vendor[2] = grp->vendor_id >> 16; | ||
| 90 | vendor[3] = grp->vendor_id >> 24; | ||
| 91 | vendor[4] = '\0'; | ||
| 92 | |||
| 93 | if (grp->shared_info_length != sizeof(struct acpi_csrt_shared_info)) | ||
| 94 | return -ENODEV; | ||
| 95 | |||
| 96 | snprintf(name, sizeof(name), "%s%04X", vendor, grp->device_id); | ||
| 97 | pdev = platform_device_alloc(name, PLATFORM_DEVID_AUTO); | ||
| 98 | if (!pdev) | ||
| 99 | return -ENOMEM; | ||
| 100 | |||
| 101 | /* Add resources based on the shared info */ | ||
| 102 | ret = acpi_csrt_parse_shared_info(pdev, grp); | ||
| 103 | if (ret) | ||
| 104 | goto fail; | ||
| 105 | |||
| 106 | ret = platform_device_add(pdev); | ||
| 107 | if (ret) | ||
| 108 | goto fail; | ||
| 109 | |||
| 110 | for (i = 0; i < pdev->num_resources; i++) | ||
| 111 | dev_dbg(&pdev->dev, "%pR\n", &pdev->resource[i]); | ||
| 112 | |||
| 113 | return 0; | ||
| 114 | |||
| 115 | fail: | ||
| 116 | platform_device_put(pdev); | ||
| 117 | return ret; | ||
| 118 | } | ||
| 119 | |||
| 120 | /* | ||
| 121 | * CSRT or Core System Resources Table is a proprietary ACPI table | ||
| 122 | * introduced by Microsoft. This table can contain devices that are not in | ||
| 123 | * the system DSDT table. In particular DMA controllers might be described | ||
| 124 | * here. | ||
| 125 | * | ||
| 126 | * We present these devices as normal platform devices that don't have ACPI | ||
| 127 | * IDs or handle. The platform device name will be something like | ||
| 128 | * <VENDOR><DEVID>.<n>.auto for example: INTL9C06.0.auto. | ||
| 129 | */ | ||
| 130 | void __init acpi_csrt_init(void) | ||
| 131 | { | ||
| 132 | struct acpi_csrt_group *grp, *end; | ||
| 133 | struct acpi_table_csrt *csrt; | ||
| 134 | acpi_status status; | ||
| 135 | int ret; | ||
| 136 | |||
| 137 | status = acpi_get_table(ACPI_SIG_CSRT, 0, | ||
| 138 | (struct acpi_table_header **)&csrt); | ||
| 139 | if (ACPI_FAILURE(status)) { | ||
| 140 | if (status != AE_NOT_FOUND) | ||
| 141 | pr_warn("failed to get the CSRT table\n"); | ||
| 142 | return; | ||
| 143 | } | ||
| 144 | |||
| 145 | pr_debug("parsing CSRT table for devices\n"); | ||
| 146 | |||
| 147 | grp = (struct acpi_csrt_group *)(csrt + 1); | ||
| 148 | end = (struct acpi_csrt_group *)((void *)csrt + csrt->header.length); | ||
| 149 | |||
| 150 | while (grp < end) { | ||
| 151 | ret = acpi_csrt_parse_resource_group(grp); | ||
| 152 | if (ret) { | ||
| 153 | pr_warn("error in parsing resource group: %d\n", ret); | ||
| 154 | return; | ||
| 155 | } | ||
| 156 | |||
| 157 | grp = (struct acpi_csrt_group *)((void *)grp + grp->length); | ||
| 158 | } | ||
| 159 | } | ||
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index 96de787e6104..bc493aa3af19 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c | |||
| @@ -37,68 +37,6 @@ | |||
| 37 | #define _COMPONENT ACPI_POWER_COMPONENT | 37 | #define _COMPONENT ACPI_POWER_COMPONENT |
| 38 | ACPI_MODULE_NAME("device_pm"); | 38 | ACPI_MODULE_NAME("device_pm"); |
| 39 | 39 | ||
| 40 | static DEFINE_MUTEX(acpi_pm_notifier_lock); | ||
| 41 | |||
| 42 | /** | ||
| 43 | * acpi_add_pm_notifier - Register PM notifier for given ACPI device. | ||
| 44 | * @adev: ACPI device to add the notifier for. | ||
| 45 | * @context: Context information to pass to the notifier routine. | ||
| 46 | * | ||
| 47 | * NOTE: @adev need not be a run-wake or wakeup device to be a valid source of | ||
| 48 | * PM wakeup events. For example, wakeup events may be generated for bridges | ||
| 49 | * if one of the devices below the bridge is signaling wakeup, even if the | ||
| 50 | * bridge itself doesn't have a wakeup GPE associated with it. | ||
| 51 | */ | ||
| 52 | acpi_status acpi_add_pm_notifier(struct acpi_device *adev, | ||
| 53 | acpi_notify_handler handler, void *context) | ||
| 54 | { | ||
| 55 | acpi_status status = AE_ALREADY_EXISTS; | ||
| 56 | |||
| 57 | mutex_lock(&acpi_pm_notifier_lock); | ||
| 58 | |||
| 59 | if (adev->wakeup.flags.notifier_present) | ||
| 60 | goto out; | ||
| 61 | |||
| 62 | status = acpi_install_notify_handler(adev->handle, | ||
| 63 | ACPI_SYSTEM_NOTIFY, | ||
| 64 | handler, context); | ||
| 65 | if (ACPI_FAILURE(status)) | ||
| 66 | goto out; | ||
| 67 | |||
| 68 | adev->wakeup.flags.notifier_present = true; | ||
| 69 | |||
| 70 | out: | ||
| 71 | mutex_unlock(&acpi_pm_notifier_lock); | ||
| 72 | return status; | ||
| 73 | } | ||
| 74 | |||
| 75 | /** | ||
| 76 | * acpi_remove_pm_notifier - Unregister PM notifier from given ACPI device. | ||
| 77 | * @adev: ACPI device to remove the notifier from. | ||
| 78 | */ | ||
| 79 | acpi_status acpi_remove_pm_notifier(struct acpi_device *adev, | ||
| 80 | acpi_notify_handler handler) | ||
| 81 | { | ||
| 82 | acpi_status status = AE_BAD_PARAMETER; | ||
| 83 | |||
| 84 | mutex_lock(&acpi_pm_notifier_lock); | ||
| 85 | |||
| 86 | if (!adev->wakeup.flags.notifier_present) | ||
| 87 | goto out; | ||
| 88 | |||
| 89 | status = acpi_remove_notify_handler(adev->handle, | ||
| 90 | ACPI_SYSTEM_NOTIFY, | ||
| 91 | handler); | ||
| 92 | if (ACPI_FAILURE(status)) | ||
| 93 | goto out; | ||
| 94 | |||
| 95 | adev->wakeup.flags.notifier_present = false; | ||
| 96 | |||
| 97 | out: | ||
| 98 | mutex_unlock(&acpi_pm_notifier_lock); | ||
| 99 | return status; | ||
| 100 | } | ||
| 101 | |||
| 102 | /** | 40 | /** |
| 103 | * acpi_power_state_string - String representation of ACPI device power state. | 41 | * acpi_power_state_string - String representation of ACPI device power state. |
| 104 | * @state: ACPI device power state to return the string representation of. | 42 | * @state: ACPI device power state to return the string representation of. |
| @@ -385,6 +323,69 @@ bool acpi_bus_power_manageable(acpi_handle handle) | |||
| 385 | } | 323 | } |
| 386 | EXPORT_SYMBOL(acpi_bus_power_manageable); | 324 | EXPORT_SYMBOL(acpi_bus_power_manageable); |
| 387 | 325 | ||
| 326 | #ifdef CONFIG_PM | ||
| 327 | static DEFINE_MUTEX(acpi_pm_notifier_lock); | ||
| 328 | |||
| 329 | /** | ||
| 330 | * acpi_add_pm_notifier - Register PM notifier for given ACPI device. | ||
| 331 | * @adev: ACPI device to add the notifier for. | ||
| 332 | * @context: Context information to pass to the notifier routine. | ||
| 333 | * | ||
| 334 | * NOTE: @adev need not be a run-wake or wakeup device to be a valid source of | ||
| 335 | * PM wakeup events. For example, wakeup events may be generated for bridges | ||
| 336 | * if one of the devices below the bridge is signaling wakeup, even if the | ||
| 337 | * bridge itself doesn't have a wakeup GPE associated with it. | ||
| 338 | */ | ||
| 339 | acpi_status acpi_add_pm_notifier(struct acpi_device *adev, | ||
| 340 | acpi_notify_handler handler, void *context) | ||
| 341 | { | ||
| 342 | acpi_status status = AE_ALREADY_EXISTS; | ||
| 343 | |||
| 344 | mutex_lock(&acpi_pm_notifier_lock); | ||
| 345 | |||
| 346 | if (adev->wakeup.flags.notifier_present) | ||
| 347 | goto out; | ||
| 348 | |||
| 349 | status = acpi_install_notify_handler(adev->handle, | ||
| 350 | ACPI_SYSTEM_NOTIFY, | ||
| 351 | handler, context); | ||
| 352 | if (ACPI_FAILURE(status)) | ||
| 353 | goto out; | ||
| 354 | |||
| 355 | adev->wakeup.flags.notifier_present = true; | ||
| 356 | |||
| 357 | out: | ||
| 358 | mutex_unlock(&acpi_pm_notifier_lock); | ||
| 359 | return status; | ||
| 360 | } | ||
| 361 | |||
| 362 | /** | ||
| 363 | * acpi_remove_pm_notifier - Unregister PM notifier from given ACPI device. | ||
| 364 | * @adev: ACPI device to remove the notifier from. | ||
| 365 | */ | ||
| 366 | acpi_status acpi_remove_pm_notifier(struct acpi_device *adev, | ||
| 367 | acpi_notify_handler handler) | ||
| 368 | { | ||
| 369 | acpi_status status = AE_BAD_PARAMETER; | ||
| 370 | |||
| 371 | mutex_lock(&acpi_pm_notifier_lock); | ||
| 372 | |||
| 373 | if (!adev->wakeup.flags.notifier_present) | ||
| 374 | goto out; | ||
| 375 | |||
| 376 | status = acpi_remove_notify_handler(adev->handle, | ||
| 377 | ACPI_SYSTEM_NOTIFY, | ||
| 378 | handler); | ||
| 379 | if (ACPI_FAILURE(status)) | ||
| 380 | goto out; | ||
| 381 | |||
| 382 | adev->wakeup.flags.notifier_present = false; | ||
| 383 | |||
| 384 | out: | ||
| 385 | mutex_unlock(&acpi_pm_notifier_lock); | ||
| 386 | return status; | ||
| 387 | } | ||
| 388 | |||
| 388 | bool acpi_bus_can_wakeup(acpi_handle handle) | 389 | bool acpi_bus_can_wakeup(acpi_handle handle) |
| 389 | { | 390 | { |
| 390 | struct acpi_device *device; | 391 | struct acpi_device *device; |
| @@ -1023,3 +1024,4 @@ void acpi_dev_pm_remove_dependent(acpi_handle handle, struct device *depdev) | |||
| 1023 | mutex_unlock(&adev->physical_node_lock); | 1024 | mutex_unlock(&adev->physical_node_lock); |
| 1024 | } | 1025 | } |
| 1025 | EXPORT_SYMBOL_GPL(acpi_dev_pm_remove_dependent); | 1026 | EXPORT_SYMBOL_GPL(acpi_dev_pm_remove_dependent); |
| 1027 | #endif /* CONFIG_PM */ | ||
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index d45b2871d33b..edc00818c803 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
| @@ -223,7 +223,7 @@ static int ec_check_sci_sync(struct acpi_ec *ec, u8 state) | |||
| 223 | static int ec_poll(struct acpi_ec *ec) | 223 | static int ec_poll(struct acpi_ec *ec) |
| 224 | { | 224 | { |
| 225 | unsigned long flags; | 225 | unsigned long flags; |
| 226 | int repeat = 2; /* number of command restarts */ | 226 | int repeat = 5; /* number of command restarts */ |
| 227 | while (repeat--) { | 227 | while (repeat--) { |
| 228 | unsigned long delay = jiffies + | 228 | unsigned long delay = jiffies + |
| 229 | msecs_to_jiffies(ec_delay); | 229 | msecs_to_jiffies(ec_delay); |
| @@ -241,8 +241,6 @@ static int ec_poll(struct acpi_ec *ec) | |||
| 241 | } | 241 | } |
| 242 | advance_transaction(ec, acpi_ec_read_status(ec)); | 242 | advance_transaction(ec, acpi_ec_read_status(ec)); |
| 243 | } while (time_before(jiffies, delay)); | 243 | } while (time_before(jiffies, delay)); |
| 244 | if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) | ||
| 245 | break; | ||
| 246 | pr_debug(PREFIX "controller reset, restart transaction\n"); | 244 | pr_debug(PREFIX "controller reset, restart transaction\n"); |
| 247 | spin_lock_irqsave(&ec->lock, flags); | 245 | spin_lock_irqsave(&ec->lock, flags); |
| 248 | start_transaction(ec); | 246 | start_transaction(ec); |
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index 6f1afd9118c8..297cbf456f86 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h | |||
| @@ -35,7 +35,6 @@ void acpi_pci_link_init(void); | |||
| 35 | void acpi_pci_root_hp_init(void); | 35 | void acpi_pci_root_hp_init(void); |
| 36 | void acpi_platform_init(void); | 36 | void acpi_platform_init(void); |
| 37 | int acpi_sysfs_init(void); | 37 | int acpi_sysfs_init(void); |
| 38 | void acpi_csrt_init(void); | ||
| 39 | #ifdef CONFIG_ACPI_CONTAINER | 38 | #ifdef CONFIG_ACPI_CONTAINER |
| 40 | void acpi_container_init(void); | 39 | void acpi_container_init(void); |
| 41 | #else | 40 | #else |
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 1dd6f6c85874..e427dc516c76 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
| @@ -641,7 +641,9 @@ static void _handle_hotplug_event_root(struct work_struct *work) | |||
| 641 | /* bus enumerate */ | 641 | /* bus enumerate */ |
| 642 | printk(KERN_DEBUG "%s: Bus check notify on %s\n", __func__, | 642 | printk(KERN_DEBUG "%s: Bus check notify on %s\n", __func__, |
| 643 | (char *)buffer.pointer); | 643 | (char *)buffer.pointer); |
| 644 | if (!root) | 644 | if (root) |
| 645 | acpiphp_check_host_bridge(handle); | ||
| 646 | else | ||
| 645 | handle_root_bridge_insertion(handle); | 647 | handle_root_bridge_insertion(handle); |
| 646 | 648 | ||
| 647 | break; | 649 | break; |
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index bec717ffd25f..c266cdc11784 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c | |||
| @@ -95,9 +95,6 @@ static const struct acpi_device_id processor_device_ids[] = { | |||
| 95 | }; | 95 | }; |
| 96 | MODULE_DEVICE_TABLE(acpi, processor_device_ids); | 96 | MODULE_DEVICE_TABLE(acpi, processor_device_ids); |
| 97 | 97 | ||
| 98 | static SIMPLE_DEV_PM_OPS(acpi_processor_pm, | ||
| 99 | acpi_processor_suspend, acpi_processor_resume); | ||
| 100 | |||
| 101 | static struct acpi_driver acpi_processor_driver = { | 98 | static struct acpi_driver acpi_processor_driver = { |
| 102 | .name = "processor", | 99 | .name = "processor", |
| 103 | .class = ACPI_PROCESSOR_CLASS, | 100 | .class = ACPI_PROCESSOR_CLASS, |
| @@ -107,7 +104,6 @@ static struct acpi_driver acpi_processor_driver = { | |||
| 107 | .remove = acpi_processor_remove, | 104 | .remove = acpi_processor_remove, |
| 108 | .notify = acpi_processor_notify, | 105 | .notify = acpi_processor_notify, |
| 109 | }, | 106 | }, |
| 110 | .drv.pm = &acpi_processor_pm, | ||
| 111 | }; | 107 | }; |
| 112 | 108 | ||
| 113 | #define INSTALL_NOTIFY_HANDLER 1 | 109 | #define INSTALL_NOTIFY_HANDLER 1 |
| @@ -934,6 +930,8 @@ static int __init acpi_processor_init(void) | |||
| 934 | if (result < 0) | 930 | if (result < 0) |
| 935 | return result; | 931 | return result; |
| 936 | 932 | ||
| 933 | acpi_processor_syscore_init(); | ||
| 934 | |||
| 937 | acpi_processor_install_hotplug_notify(); | 935 | acpi_processor_install_hotplug_notify(); |
| 938 | 936 | ||
| 939 | acpi_thermal_cpufreq_init(); | 937 | acpi_thermal_cpufreq_init(); |
| @@ -956,6 +954,8 @@ static void __exit acpi_processor_exit(void) | |||
| 956 | 954 | ||
| 957 | acpi_processor_uninstall_hotplug_notify(); | 955 | acpi_processor_uninstall_hotplug_notify(); |
| 958 | 956 | ||
| 957 | acpi_processor_syscore_exit(); | ||
| 958 | |||
| 959 | acpi_bus_unregister_driver(&acpi_processor_driver); | 959 | acpi_bus_unregister_driver(&acpi_processor_driver); |
| 960 | 960 | ||
| 961 | return; | 961 | return; |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index f0df2c9434d2..eb133c77aadb 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
| @@ -34,6 +34,7 @@ | |||
| 34 | #include <linux/sched.h> /* need_resched() */ | 34 | #include <linux/sched.h> /* need_resched() */ |
| 35 | #include <linux/clockchips.h> | 35 | #include <linux/clockchips.h> |
| 36 | #include <linux/cpuidle.h> | 36 | #include <linux/cpuidle.h> |
| 37 | #include <linux/syscore_ops.h> | ||
| 37 | 38 | ||
| 38 | /* | 39 | /* |
| 39 | * Include the apic definitions for x86 to have the APIC timer related defines | 40 | * Include the apic definitions for x86 to have the APIC timer related defines |
| @@ -210,33 +211,41 @@ static void lapic_timer_state_broadcast(struct acpi_processor *pr, | |||
| 210 | 211 | ||
| 211 | #endif | 212 | #endif |
| 212 | 213 | ||
| 214 | #ifdef CONFIG_PM_SLEEP | ||
| 213 | static u32 saved_bm_rld; | 215 | static u32 saved_bm_rld; |
| 214 | 216 | ||
| 215 | static void acpi_idle_bm_rld_save(void) | 217 | int acpi_processor_suspend(void) |
| 216 | { | 218 | { |
| 217 | acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &saved_bm_rld); | 219 | acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &saved_bm_rld); |
| 220 | return 0; | ||
| 218 | } | 221 | } |
| 219 | static void acpi_idle_bm_rld_restore(void) | 222 | |
| 223 | void acpi_processor_resume(void) | ||
| 220 | { | 224 | { |
| 221 | u32 resumed_bm_rld; | 225 | u32 resumed_bm_rld; |
| 222 | 226 | ||
| 223 | acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &resumed_bm_rld); | 227 | acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &resumed_bm_rld); |
| 228 | if (resumed_bm_rld == saved_bm_rld) | ||
| 229 | return; | ||
| 224 | 230 | ||
| 225 | if (resumed_bm_rld != saved_bm_rld) | 231 | acpi_write_bit_register(ACPI_BITREG_BUS_MASTER_RLD, saved_bm_rld); |
| 226 | acpi_write_bit_register(ACPI_BITREG_BUS_MASTER_RLD, saved_bm_rld); | ||
| 227 | } | 232 | } |
| 228 | 233 | ||
| 229 | int acpi_processor_suspend(struct device *dev) | 234 | static struct syscore_ops acpi_processor_syscore_ops = { |
| 235 | .suspend = acpi_processor_suspend, | ||
| 236 | .resume = acpi_processor_resume, | ||
| 237 | }; | ||
| 238 | |||
| 239 | void acpi_processor_syscore_init(void) | ||
| 230 | { | 240 | { |
| 231 | acpi_idle_bm_rld_save(); | 241 | register_syscore_ops(&acpi_processor_syscore_ops); |
| 232 | return 0; | ||
| 233 | } | 242 | } |
| 234 | 243 | ||
| 235 | int acpi_processor_resume(struct device *dev) | 244 | void acpi_processor_syscore_exit(void) |
| 236 | { | 245 | { |
| 237 | acpi_idle_bm_rld_restore(); | 246 | unregister_syscore_ops(&acpi_processor_syscore_ops); |
| 238 | return 0; | ||
| 239 | } | 247 | } |
| 248 | #endif /* CONFIG_PM_SLEEP */ | ||
| 240 | 249 | ||
| 241 | #if defined(CONFIG_X86) | 250 | #if defined(CONFIG_X86) |
| 242 | static void tsc_check_state(int state) | 251 | static void tsc_check_state(int state) |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index fe158fd4f1df..44225cb15f3a 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
| @@ -1785,7 +1785,7 @@ static void acpi_scan_init_hotplug(acpi_handle handle, int type) | |||
| 1785 | acpi_set_pnp_ids(handle, &pnp, type); | 1785 | acpi_set_pnp_ids(handle, &pnp, type); |
| 1786 | 1786 | ||
| 1787 | if (!pnp.type.hardware_id) | 1787 | if (!pnp.type.hardware_id) |
| 1788 | return; | 1788 | goto out; |
| 1789 | 1789 | ||
| 1790 | /* | 1790 | /* |
| 1791 | * This relies on the fact that acpi_install_notify_handler() will not | 1791 | * This relies on the fact that acpi_install_notify_handler() will not |
| @@ -1800,6 +1800,7 @@ static void acpi_scan_init_hotplug(acpi_handle handle, int type) | |||
| 1800 | } | 1800 | } |
| 1801 | } | 1801 | } |
| 1802 | 1802 | ||
| 1803 | out: | ||
| 1803 | acpi_free_pnp_ids(&pnp); | 1804 | acpi_free_pnp_ids(&pnp); |
| 1804 | } | 1805 | } |
| 1805 | 1806 | ||
| @@ -2042,7 +2043,6 @@ int __init acpi_scan_init(void) | |||
| 2042 | acpi_pci_link_init(); | 2043 | acpi_pci_link_init(); |
| 2043 | acpi_platform_init(); | 2044 | acpi_platform_init(); |
| 2044 | acpi_lpss_init(); | 2045 | acpi_lpss_init(); |
| 2045 | acpi_csrt_init(); | ||
| 2046 | acpi_container_init(); | 2046 | acpi_container_init(); |
| 2047 | acpi_memory_hotplug_init(); | 2047 | acpi_memory_hotplug_init(); |
| 2048 | 2048 | ||
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index c3932d0876e0..5b32e15a65ce 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
| @@ -456,6 +456,14 @@ static struct dmi_system_id video_dmi_table[] __initdata = { | |||
| 456 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dm4 Notebook PC"), | 456 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dm4 Notebook PC"), |
| 457 | }, | 457 | }, |
| 458 | }, | 458 | }, |
| 459 | { | ||
| 460 | .callback = video_ignore_initial_backlight, | ||
| 461 | .ident = "HP 1000 Notebook PC", | ||
| 462 | .matches = { | ||
| 463 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), | ||
| 464 | DMI_MATCH(DMI_PRODUCT_NAME, "HP 1000 Notebook PC"), | ||
| 465 | }, | ||
| 466 | }, | ||
| 459 | {} | 467 | {} |
| 460 | }; | 468 | }; |
| 461 | 469 | ||
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index 66f67626f02e..e6bd910bc6ed 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c | |||
| @@ -161,6 +161,14 @@ static struct dmi_system_id video_detect_dmi_table[] = { | |||
| 161 | DMI_MATCH(DMI_PRODUCT_NAME, "UL30VT"), | 161 | DMI_MATCH(DMI_PRODUCT_NAME, "UL30VT"), |
| 162 | }, | 162 | }, |
| 163 | }, | 163 | }, |
| 164 | { | ||
| 165 | .callback = video_detect_force_vendor, | ||
| 166 | .ident = "Asus UL30A", | ||
| 167 | .matches = { | ||
| 168 | DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."), | ||
| 169 | DMI_MATCH(DMI_PRODUCT_NAME, "UL30A"), | ||
| 170 | }, | ||
| 171 | }, | ||
| 164 | { }, | 172 | { }, |
| 165 | }; | 173 | }; |
| 166 | 174 | ||
