diff options
Diffstat (limited to 'drivers/acpi/acpi_lpss.c')
-rw-r--r-- | drivers/acpi/acpi_lpss.c | 39 |
1 files changed, 10 insertions, 29 deletions
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index dfd1b8095dad..02e835f3cf8a 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * ACPI support for Intel Lynxpoint LPSS. | 2 | * ACPI support for Intel Lynxpoint LPSS. |
3 | * | 3 | * |
4 | * Copyright (C) 2013, 2014, Intel Corporation | 4 | * Copyright (C) 2013, Intel Corporation |
5 | * Authors: Mika Westerberg <mika.westerberg@linux.intel.com> | 5 | * Authors: Mika Westerberg <mika.westerberg@linux.intel.com> |
6 | * Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 6 | * Rafael J. Wysocki <rafael.j.wysocki@intel.com> |
7 | * | 7 | * |
@@ -60,8 +60,6 @@ ACPI_MODULE_NAME("acpi_lpss"); | |||
60 | #define LPSS_CLK_DIVIDER BIT(2) | 60 | #define LPSS_CLK_DIVIDER BIT(2) |
61 | #define LPSS_LTR BIT(3) | 61 | #define LPSS_LTR BIT(3) |
62 | #define LPSS_SAVE_CTX BIT(4) | 62 | #define LPSS_SAVE_CTX BIT(4) |
63 | #define LPSS_DEV_PROXY BIT(5) | ||
64 | #define LPSS_PROXY_REQ BIT(6) | ||
65 | 63 | ||
66 | struct lpss_private_data; | 64 | struct lpss_private_data; |
67 | 65 | ||
@@ -72,10 +70,8 @@ struct lpss_device_desc { | |||
72 | void (*setup)(struct lpss_private_data *pdata); | 70 | void (*setup)(struct lpss_private_data *pdata); |
73 | }; | 71 | }; |
74 | 72 | ||
75 | static struct device *proxy_device; | ||
76 | |||
77 | static struct lpss_device_desc lpss_dma_desc = { | 73 | static struct lpss_device_desc lpss_dma_desc = { |
78 | .flags = LPSS_CLK | LPSS_PROXY_REQ, | 74 | .flags = LPSS_CLK, |
79 | }; | 75 | }; |
80 | 76 | ||
81 | struct lpss_private_data { | 77 | struct lpss_private_data { |
@@ -129,7 +125,7 @@ static struct lpss_device_desc lpt_dev_desc = { | |||
129 | }; | 125 | }; |
130 | 126 | ||
131 | static struct lpss_device_desc lpt_i2c_dev_desc = { | 127 | static struct lpss_device_desc lpt_i2c_dev_desc = { |
132 | .flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_LTR, | 128 | .flags = LPSS_CLK | LPSS_LTR, |
133 | .prv_offset = 0x800, | 129 | .prv_offset = 0x800, |
134 | }; | 130 | }; |
135 | 131 | ||
@@ -150,24 +146,22 @@ static struct lpss_device_desc byt_pwm_dev_desc = { | |||
150 | }; | 146 | }; |
151 | 147 | ||
152 | static struct lpss_device_desc byt_uart_dev_desc = { | 148 | static struct lpss_device_desc byt_uart_dev_desc = { |
153 | .flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_SAVE_CTX | | 149 | .flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_SAVE_CTX, |
154 | LPSS_DEV_PROXY, | ||
155 | .prv_offset = 0x800, | 150 | .prv_offset = 0x800, |
156 | .setup = lpss_uart_setup, | 151 | .setup = lpss_uart_setup, |
157 | }; | 152 | }; |
158 | 153 | ||
159 | static struct lpss_device_desc byt_spi_dev_desc = { | 154 | static struct lpss_device_desc byt_spi_dev_desc = { |
160 | .flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_SAVE_CTX | | 155 | .flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_SAVE_CTX, |
161 | LPSS_DEV_PROXY, | ||
162 | .prv_offset = 0x400, | 156 | .prv_offset = 0x400, |
163 | }; | 157 | }; |
164 | 158 | ||
165 | static struct lpss_device_desc byt_sdio_dev_desc = { | 159 | static struct lpss_device_desc byt_sdio_dev_desc = { |
166 | .flags = LPSS_CLK | LPSS_DEV_PROXY, | 160 | .flags = LPSS_CLK, |
167 | }; | 161 | }; |
168 | 162 | ||
169 | static struct lpss_device_desc byt_i2c_dev_desc = { | 163 | static struct lpss_device_desc byt_i2c_dev_desc = { |
170 | .flags = LPSS_CLK | LPSS_SAVE_CTX | LPSS_DEV_PROXY, | 164 | .flags = LPSS_CLK | LPSS_SAVE_CTX, |
171 | .prv_offset = 0x800, | 165 | .prv_offset = 0x800, |
172 | .setup = byt_i2c_setup, | 166 | .setup = byt_i2c_setup, |
173 | }; | 167 | }; |
@@ -340,6 +334,8 @@ static int acpi_lpss_create_device(struct acpi_device *adev, | |||
340 | pdata->mmio_size = resource_size(rentry->res); | 334 | pdata->mmio_size = resource_size(rentry->res); |
341 | pdata->mmio_base = ioremap(rentry->res->start, | 335 | pdata->mmio_base = ioremap(rentry->res->start, |
342 | pdata->mmio_size); | 336 | pdata->mmio_size); |
337 | if (!pdata->mmio_base) | ||
338 | goto err_out; | ||
343 | break; | 339 | break; |
344 | } | 340 | } |
345 | 341 | ||
@@ -374,8 +370,6 @@ static int acpi_lpss_create_device(struct acpi_device *adev, | |||
374 | adev->driver_data = pdata; | 370 | adev->driver_data = pdata; |
375 | pdev = acpi_create_platform_device(adev); | 371 | pdev = acpi_create_platform_device(adev); |
376 | if (!IS_ERR_OR_NULL(pdev)) { | 372 | if (!IS_ERR_OR_NULL(pdev)) { |
377 | if (!proxy_device && dev_desc->flags & LPSS_DEV_PROXY) | ||
378 | proxy_device = &pdev->dev; | ||
379 | return 1; | 373 | return 1; |
380 | } | 374 | } |
381 | 375 | ||
@@ -600,14 +594,7 @@ static int acpi_lpss_runtime_suspend(struct device *dev) | |||
600 | if (pdata->dev_desc->flags & LPSS_SAVE_CTX) | 594 | if (pdata->dev_desc->flags & LPSS_SAVE_CTX) |
601 | acpi_lpss_save_ctx(dev, pdata); | 595 | acpi_lpss_save_ctx(dev, pdata); |
602 | 596 | ||
603 | ret = acpi_dev_runtime_suspend(dev); | 597 | return acpi_dev_runtime_suspend(dev); |
604 | if (ret) | ||
605 | return ret; | ||
606 | |||
607 | if (pdata->dev_desc->flags & LPSS_PROXY_REQ && proxy_device) | ||
608 | return pm_runtime_put_sync_suspend(proxy_device); | ||
609 | |||
610 | return 0; | ||
611 | } | 598 | } |
612 | 599 | ||
613 | static int acpi_lpss_runtime_resume(struct device *dev) | 600 | static int acpi_lpss_runtime_resume(struct device *dev) |
@@ -615,12 +602,6 @@ static int acpi_lpss_runtime_resume(struct device *dev) | |||
615 | struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); | 602 | struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); |
616 | int ret; | 603 | int ret; |
617 | 604 | ||
618 | if (pdata->dev_desc->flags & LPSS_PROXY_REQ && proxy_device) { | ||
619 | ret = pm_runtime_get_sync(proxy_device); | ||
620 | if (ret) | ||
621 | return ret; | ||
622 | } | ||
623 | |||
624 | ret = acpi_dev_runtime_resume(dev); | 605 | ret = acpi_dev_runtime_resume(dev); |
625 | if (ret) | 606 | if (ret) |
626 | return ret; | 607 | return ret; |