blob: a45ed39d062c1d7a73d557cd3c62e326fbf61652 [file] [log] [blame]
Adrian Hunterc4e05032012-11-23 21:17:34 +01001/*
2 * Secure Digital Host Controller Interface ACPI driver.
3 *
4 * Copyright (c) 2012, Intel Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20
21#include <linux/init.h>
22#include <linux/export.h>
23#include <linux/module.h>
24#include <linux/device.h>
25#include <linux/platform_device.h>
26#include <linux/ioport.h>
27#include <linux/io.h>
28#include <linux/dma-mapping.h>
29#include <linux/compiler.h>
30#include <linux/stddef.h>
31#include <linux/bitops.h>
32#include <linux/types.h>
33#include <linux/err.h>
34#include <linux/interrupt.h>
35#include <linux/acpi.h>
36#include <linux/pm.h>
37#include <linux/pm_runtime.h>
Adrian Hunterb04fa062013-06-13 11:50:27 +030038#include <linux/delay.h>
Adrian Hunterc4e05032012-11-23 21:17:34 +010039
40#include <linux/mmc/host.h>
41#include <linux/mmc/pm.h>
Adrian Hunter4fd44092014-03-10 15:02:42 +020042#include <linux/mmc/slot-gpio.h>
Adrian Hunterc4e05032012-11-23 21:17:34 +010043#include <linux/mmc/sdhci.h>
44
45#include "sdhci.h"
46
47enum {
Adrian Hunter4fd44092014-03-10 15:02:42 +020048 SDHCI_ACPI_SD_CD = BIT(0),
49 SDHCI_ACPI_RUNTIME_PM = BIT(1),
50 SDHCI_ACPI_SD_CD_OVERRIDE_LEVEL = BIT(2),
Adrian Hunterc4e05032012-11-23 21:17:34 +010051};
52
53struct sdhci_acpi_chip {
54 const struct sdhci_ops *ops;
55 unsigned int quirks;
56 unsigned int quirks2;
57 unsigned long caps;
58 unsigned int caps2;
59 mmc_pm_flag_t pm_caps;
60};
61
62struct sdhci_acpi_slot {
63 const struct sdhci_acpi_chip *chip;
64 unsigned int quirks;
65 unsigned int quirks2;
66 unsigned long caps;
67 unsigned int caps2;
68 mmc_pm_flag_t pm_caps;
69 unsigned int flags;
Adrian Hunter7dafca82014-10-06 15:23:06 +030070 int (*probe_slot)(struct platform_device *, const char *, const char *);
Gao, Yunpeng578b36b2014-09-01 11:35:40 +080071 int (*remove_slot)(struct platform_device *);
Adrian Hunterc4e05032012-11-23 21:17:34 +010072};
73
74struct sdhci_acpi_host {
75 struct sdhci_host *host;
76 const struct sdhci_acpi_slot *slot;
77 struct platform_device *pdev;
78 bool use_runtime_pm;
Adrian Hunter4f64f842014-11-04 12:42:47 +020079 bool dma_setup;
Adrian Hunterc4e05032012-11-23 21:17:34 +010080};
81
82static inline bool sdhci_acpi_flag(struct sdhci_acpi_host *c, unsigned int flag)
83{
84 return c->slot && (c->slot->flags & flag);
85}
86
87static int sdhci_acpi_enable_dma(struct sdhci_host *host)
88{
Adrian Hunter4f64f842014-11-04 12:42:47 +020089 struct sdhci_acpi_host *c = sdhci_priv(host);
90 struct device *dev = &c->pdev->dev;
91 int err = -1;
92
93 if (c->dma_setup)
94 return 0;
95
96 if (host->flags & SDHCI_USE_64_BIT_DMA) {
97 if (host->quirks2 & SDHCI_QUIRK2_BROKEN_64_BIT_DMA) {
98 host->flags &= ~SDHCI_USE_64_BIT_DMA;
99 } else {
100 err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
101 if (err)
102 dev_warn(dev, "Failed to set 64-bit DMA mask\n");
103 }
104 }
105
106 if (err)
107 err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
108
109 c->dma_setup = !err;
110
111 return err;
Adrian Hunterc4e05032012-11-23 21:17:34 +0100112}
113
Adrian Hunterb04fa062013-06-13 11:50:27 +0300114static void sdhci_acpi_int_hw_reset(struct sdhci_host *host)
115{
116 u8 reg;
117
118 reg = sdhci_readb(host, SDHCI_POWER_CONTROL);
119 reg |= 0x10;
120 sdhci_writeb(host, reg, SDHCI_POWER_CONTROL);
121 /* For eMMC, minimum is 1us but give it 9us for good measure */
122 udelay(9);
123 reg &= ~0x10;
124 sdhci_writeb(host, reg, SDHCI_POWER_CONTROL);
125 /* For eMMC, minimum is 200us but give it 300us for good measure */
126 usleep_range(300, 1000);
127}
128
Adrian Hunterc4e05032012-11-23 21:17:34 +0100129static const struct sdhci_ops sdhci_acpi_ops_dflt = {
Russell King17710592014-04-25 12:58:55 +0100130 .set_clock = sdhci_set_clock,
Adrian Hunterc4e05032012-11-23 21:17:34 +0100131 .enable_dma = sdhci_acpi_enable_dma,
Russell King2317f562014-04-25 12:57:07 +0100132 .set_bus_width = sdhci_set_bus_width,
Russell King03231f92014-04-25 12:57:12 +0100133 .reset = sdhci_reset,
Russell King96d7b782014-04-25 12:59:26 +0100134 .set_uhs_signaling = sdhci_set_uhs_signaling,
Adrian Hunterc4e05032012-11-23 21:17:34 +0100135};
136
Adrian Hunterb04fa062013-06-13 11:50:27 +0300137static const struct sdhci_ops sdhci_acpi_ops_int = {
Russell King17710592014-04-25 12:58:55 +0100138 .set_clock = sdhci_set_clock,
Adrian Hunterb04fa062013-06-13 11:50:27 +0300139 .enable_dma = sdhci_acpi_enable_dma,
Russell King2317f562014-04-25 12:57:07 +0100140 .set_bus_width = sdhci_set_bus_width,
Russell King03231f92014-04-25 12:57:12 +0100141 .reset = sdhci_reset,
Russell King96d7b782014-04-25 12:59:26 +0100142 .set_uhs_signaling = sdhci_set_uhs_signaling,
Adrian Hunterb04fa062013-06-13 11:50:27 +0300143 .hw_reset = sdhci_acpi_int_hw_reset,
144};
145
146static const struct sdhci_acpi_chip sdhci_acpi_chip_int = {
147 .ops = &sdhci_acpi_ops_int,
148};
149
Adrian Hunter7dafca82014-10-06 15:23:06 +0300150static int sdhci_acpi_emmc_probe_slot(struct platform_device *pdev,
151 const char *hid, const char *uid)
Gao, Yunpeng578b36b2014-09-01 11:35:40 +0800152{
153 struct sdhci_acpi_host *c = platform_get_drvdata(pdev);
154 struct sdhci_host *host;
155
156 if (!c || !c->host)
157 return 0;
158
159 host = c->host;
160
Andy Shevchenko94203042015-01-12 19:37:25 +0200161 /* Platform specific code during emmc probe slot goes here */
Gao, Yunpeng578b36b2014-09-01 11:35:40 +0800162
Adrian Hunter80243792014-10-06 15:23:07 +0300163 if (hid && uid && !strcmp(hid, "80860F14") && !strcmp(uid, "1") &&
164 sdhci_readl(host, SDHCI_CAPABILITIES) == 0x446cc8b2 &&
165 sdhci_readl(host, SDHCI_CAPABILITIES_1) == 0x00000807)
166 host->timeout_clk = 1000; /* 1000 kHz i.e. 1 MHz */
167
Gao, Yunpeng578b36b2014-09-01 11:35:40 +0800168 return 0;
169}
170
Adrian Hunter7dafca82014-10-06 15:23:06 +0300171static int sdhci_acpi_sdio_probe_slot(struct platform_device *pdev,
172 const char *hid, const char *uid)
Gao, Yunpeng578b36b2014-09-01 11:35:40 +0800173{
174 struct sdhci_acpi_host *c = platform_get_drvdata(pdev);
175 struct sdhci_host *host;
176
177 if (!c || !c->host)
178 return 0;
179
180 host = c->host;
181
Andy Shevchenko94203042015-01-12 19:37:25 +0200182 /* Platform specific code during sdio probe slot goes here */
Gao, Yunpeng578b36b2014-09-01 11:35:40 +0800183
184 return 0;
185}
186
Adrian Hunter7dafca82014-10-06 15:23:06 +0300187static int sdhci_acpi_sd_probe_slot(struct platform_device *pdev,
188 const char *hid, const char *uid)
Gao, Yunpeng578b36b2014-09-01 11:35:40 +0800189{
190 struct sdhci_acpi_host *c = platform_get_drvdata(pdev);
191 struct sdhci_host *host;
192
193 if (!c || !c->host || !c->slot)
194 return 0;
195
196 host = c->host;
197
Andy Shevchenko94203042015-01-12 19:37:25 +0200198 /* Platform specific code during sd probe slot goes here */
Gao, Yunpeng578b36b2014-09-01 11:35:40 +0800199
200 return 0;
201}
202
Adrian Hunter07a58882013-04-26 11:27:22 +0300203static const struct sdhci_acpi_slot sdhci_acpi_slot_int_emmc = {
Adrian Hunterb04fa062013-06-13 11:50:27 +0300204 .chip = &sdhci_acpi_chip_int,
Maurice Petallof25c3372014-07-08 19:11:01 +0800205 .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE |
Adrian Hunter9d65cb82014-12-01 15:51:19 +0200206 MMC_CAP_HW_RESET | MMC_CAP_1_8V_DDR |
207 MMC_CAP_BUS_WIDTH_TEST | MMC_CAP_WAIT_WHILE_BUSY,
Adrian Hunter07a58882013-04-26 11:27:22 +0300208 .caps2 = MMC_CAP2_HC_ERASE_SZ,
209 .flags = SDHCI_ACPI_RUNTIME_PM,
Adrian Huntere1f56332014-12-01 15:51:17 +0200210 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
Adrian Hunter934e31b2014-09-24 10:27:28 +0300211 .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN | SDHCI_QUIRK2_STOP_WITH_TC,
Gao, Yunpeng578b36b2014-09-01 11:35:40 +0800212 .probe_slot = sdhci_acpi_emmc_probe_slot,
Adrian Hunter07a58882013-04-26 11:27:22 +0300213};
214
Adrian Huntere5571392012-12-10 21:18:48 +0100215static const struct sdhci_acpi_slot sdhci_acpi_slot_int_sdio = {
Adrian Huntere1f56332014-12-01 15:51:17 +0200216 .quirks = SDHCI_QUIRK_BROKEN_CARD_DETECTION |
217 SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
Adrian Huntere5571392012-12-10 21:18:48 +0100218 .quirks2 = SDHCI_QUIRK2_HOST_OFF_CARD_ON,
Adrian Hunter9d65cb82014-12-01 15:51:19 +0200219 .caps = MMC_CAP_NONREMOVABLE | MMC_CAP_POWER_OFF_CARD |
220 MMC_CAP_BUS_WIDTH_TEST | MMC_CAP_WAIT_WHILE_BUSY,
Adrian Huntere5571392012-12-10 21:18:48 +0100221 .flags = SDHCI_ACPI_RUNTIME_PM,
222 .pm_caps = MMC_PM_KEEP_POWER,
Gao, Yunpeng578b36b2014-09-01 11:35:40 +0800223 .probe_slot = sdhci_acpi_sdio_probe_slot,
Adrian Huntere5571392012-12-10 21:18:48 +0100224};
225
Adrian Hunter07a58882013-04-26 11:27:22 +0300226static const struct sdhci_acpi_slot sdhci_acpi_slot_int_sd = {
Adrian Hunter4fd44092014-03-10 15:02:42 +0200227 .flags = SDHCI_ACPI_SD_CD | SDHCI_ACPI_SD_CD_OVERRIDE_LEVEL |
228 SDHCI_ACPI_RUNTIME_PM,
Adrian Huntere1f56332014-12-01 15:51:17 +0200229 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
Adrian Hunter934e31b2014-09-24 10:27:28 +0300230 .quirks2 = SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON |
231 SDHCI_QUIRK2_STOP_WITH_TC,
Adrian Hunter9d65cb82014-12-01 15:51:19 +0200232 .caps = MMC_CAP_BUS_WIDTH_TEST | MMC_CAP_WAIT_WHILE_BUSY,
Gao, Yunpeng578b36b2014-09-01 11:35:40 +0800233 .probe_slot = sdhci_acpi_sd_probe_slot,
Adrian Hunter07a58882013-04-26 11:27:22 +0300234};
235
236struct sdhci_acpi_uid_slot {
237 const char *hid;
238 const char *uid;
239 const struct sdhci_acpi_slot *slot;
240};
241
242static const struct sdhci_acpi_uid_slot sdhci_acpi_uids[] = {
243 { "80860F14" , "1" , &sdhci_acpi_slot_int_emmc },
244 { "80860F14" , "3" , &sdhci_acpi_slot_int_sd },
Adrian Hunteraad95dc2014-03-10 15:02:43 +0200245 { "80860F16" , NULL, &sdhci_acpi_slot_int_sd },
Adrian Hunter07a58882013-04-26 11:27:22 +0300246 { "INT33BB" , "2" , &sdhci_acpi_slot_int_sdio },
Adrian Hunter7147eaf2014-09-24 10:27:29 +0300247 { "INT33BB" , "3" , &sdhci_acpi_slot_int_sd },
Adrian Hunter07a58882013-04-26 11:27:22 +0300248 { "INT33C6" , NULL, &sdhci_acpi_slot_int_sdio },
Mika Westerberg07c001c2013-11-12 12:01:33 +0200249 { "INT3436" , NULL, &sdhci_acpi_slot_int_sdio },
Adrian Hunterd0ed8e62015-01-05 14:47:57 +0200250 { "INT344D" , NULL, &sdhci_acpi_slot_int_sdio },
Adrian Hunter07a58882013-04-26 11:27:22 +0300251 { "PNP0D40" },
252 { },
253};
254
Adrian Hunterc4e05032012-11-23 21:17:34 +0100255static const struct acpi_device_id sdhci_acpi_ids[] = {
Adrian Hunter07a58882013-04-26 11:27:22 +0300256 { "80860F14" },
Adrian Hunteraad95dc2014-03-10 15:02:43 +0200257 { "80860F16" },
Adrian Hunter07a58882013-04-26 11:27:22 +0300258 { "INT33BB" },
259 { "INT33C6" },
Mika Westerberg07c001c2013-11-12 12:01:33 +0200260 { "INT3436" },
Adrian Hunterd0ed8e62015-01-05 14:47:57 +0200261 { "INT344D" },
Adrian Hunter07a58882013-04-26 11:27:22 +0300262 { "PNP0D40" },
Adrian Hunterc4e05032012-11-23 21:17:34 +0100263 { },
264};
265MODULE_DEVICE_TABLE(acpi, sdhci_acpi_ids);
266
Adrian Hunter3db35252014-10-06 15:23:05 +0300267static const struct sdhci_acpi_slot *sdhci_acpi_get_slot(const char *hid,
268 const char *uid)
Adrian Hunterc4e05032012-11-23 21:17:34 +0100269{
Adrian Hunter07a58882013-04-26 11:27:22 +0300270 const struct sdhci_acpi_uid_slot *u;
Adrian Hunterc4e05032012-11-23 21:17:34 +0100271
Adrian Hunter07a58882013-04-26 11:27:22 +0300272 for (u = sdhci_acpi_uids; u->hid; u++) {
273 if (strcmp(u->hid, hid))
274 continue;
275 if (!u->uid)
276 return u->slot;
277 if (uid && !strcmp(u->uid, uid))
278 return u->slot;
279 }
Adrian Hunterc4e05032012-11-23 21:17:34 +0100280 return NULL;
281}
282
Greg Kroah-Hartman4e608e42012-12-21 15:05:47 -0800283static int sdhci_acpi_probe(struct platform_device *pdev)
Adrian Hunterc4e05032012-11-23 21:17:34 +0100284{
285 struct device *dev = &pdev->dev;
286 acpi_handle handle = ACPI_HANDLE(dev);
287 struct acpi_device *device;
288 struct sdhci_acpi_host *c;
289 struct sdhci_host *host;
290 struct resource *iomem;
291 resource_size_t len;
292 const char *hid;
Adrian Hunter3db35252014-10-06 15:23:05 +0300293 const char *uid;
Mika Westerberg87875652014-01-08 12:40:55 +0200294 int err;
Adrian Hunterc4e05032012-11-23 21:17:34 +0100295
296 if (acpi_bus_get_device(handle, &device))
297 return -ENODEV;
298
299 if (acpi_bus_get_status(device) || !device->status.present)
300 return -ENODEV;
301
302 hid = acpi_device_hid(device);
Adrian Hunter3db35252014-10-06 15:23:05 +0300303 uid = device->pnp.unique_id;
Adrian Hunterc4e05032012-11-23 21:17:34 +0100304
305 iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
306 if (!iomem)
307 return -ENOMEM;
308
309 len = resource_size(iomem);
310 if (len < 0x100)
311 dev_err(dev, "Invalid iomem size!\n");
312
313 if (!devm_request_mem_region(dev, iomem->start, len, dev_name(dev)))
314 return -ENOMEM;
315
316 host = sdhci_alloc_host(dev, sizeof(struct sdhci_acpi_host));
317 if (IS_ERR(host))
318 return PTR_ERR(host);
319
320 c = sdhci_priv(host);
321 c->host = host;
Adrian Hunter3db35252014-10-06 15:23:05 +0300322 c->slot = sdhci_acpi_get_slot(hid, uid);
Adrian Hunterc4e05032012-11-23 21:17:34 +0100323 c->pdev = pdev;
324 c->use_runtime_pm = sdhci_acpi_flag(c, SDHCI_ACPI_RUNTIME_PM);
325
326 platform_set_drvdata(pdev, c);
327
328 host->hw_name = "ACPI";
329 host->ops = &sdhci_acpi_ops_dflt;
330 host->irq = platform_get_irq(pdev, 0);
331
332 host->ioaddr = devm_ioremap_nocache(dev, iomem->start,
333 resource_size(iomem));
334 if (host->ioaddr == NULL) {
335 err = -ENOMEM;
336 goto err_free;
337 }
338
Adrian Hunterc4e05032012-11-23 21:17:34 +0100339 if (c->slot) {
Gao, Yunpeng578b36b2014-09-01 11:35:40 +0800340 if (c->slot->probe_slot) {
Adrian Hunter7dafca82014-10-06 15:23:06 +0300341 err = c->slot->probe_slot(pdev, hid, uid);
Gao, Yunpeng578b36b2014-09-01 11:35:40 +0800342 if (err)
343 goto err_free;
344 }
Adrian Hunterc4e05032012-11-23 21:17:34 +0100345 if (c->slot->chip) {
346 host->ops = c->slot->chip->ops;
347 host->quirks |= c->slot->chip->quirks;
348 host->quirks2 |= c->slot->chip->quirks2;
349 host->mmc->caps |= c->slot->chip->caps;
350 host->mmc->caps2 |= c->slot->chip->caps2;
351 host->mmc->pm_caps |= c->slot->chip->pm_caps;
352 }
353 host->quirks |= c->slot->quirks;
354 host->quirks2 |= c->slot->quirks2;
355 host->mmc->caps |= c->slot->caps;
356 host->mmc->caps2 |= c->slot->caps2;
357 host->mmc->pm_caps |= c->slot->pm_caps;
358 }
359
Adrian Hunter0d3e3352013-04-04 16:41:06 +0300360 host->mmc->caps2 |= MMC_CAP2_NO_PRESCAN_POWERUP;
361
Adrian Hunter4fd44092014-03-10 15:02:42 +0200362 if (sdhci_acpi_flag(c, SDHCI_ACPI_SD_CD)) {
363 bool v = sdhci_acpi_flag(c, SDHCI_ACPI_SD_CD_OVERRIDE_LEVEL);
364
Linus Walleij89168b42014-10-02 09:08:46 +0200365 if (mmc_gpiod_request_cd(host->mmc, NULL, 0, v, 0, NULL)) {
Adrian Hunter4fd44092014-03-10 15:02:42 +0200366 dev_warn(dev, "failed to setup card detect gpio\n");
367 c->use_runtime_pm = false;
368 }
369 }
370
Adrian Hunterc4e05032012-11-23 21:17:34 +0100371 err = sdhci_add_host(host);
372 if (err)
373 goto err_free;
374
375 if (c->use_runtime_pm) {
Adrian Hunter1d1ff452013-04-26 11:27:21 +0300376 pm_runtime_set_active(dev);
Adrian Hunterc4e05032012-11-23 21:17:34 +0100377 pm_suspend_ignore_children(dev, 1);
378 pm_runtime_set_autosuspend_delay(dev, 50);
379 pm_runtime_use_autosuspend(dev);
380 pm_runtime_enable(dev);
381 }
382
383 return 0;
384
385err_free:
Adrian Hunterc4e05032012-11-23 21:17:34 +0100386 sdhci_free_host(c->host);
387 return err;
388}
389
Greg Kroah-Hartman4e608e42012-12-21 15:05:47 -0800390static int sdhci_acpi_remove(struct platform_device *pdev)
Adrian Hunterc4e05032012-11-23 21:17:34 +0100391{
392 struct sdhci_acpi_host *c = platform_get_drvdata(pdev);
393 struct device *dev = &pdev->dev;
394 int dead;
395
396 if (c->use_runtime_pm) {
397 pm_runtime_get_sync(dev);
398 pm_runtime_disable(dev);
399 pm_runtime_put_noidle(dev);
400 }
401
Gao, Yunpeng578b36b2014-09-01 11:35:40 +0800402 if (c->slot && c->slot->remove_slot)
403 c->slot->remove_slot(pdev);
404
Adrian Hunterc4e05032012-11-23 21:17:34 +0100405 dead = (sdhci_readl(c->host, SDHCI_INT_STATUS) == ~0);
406 sdhci_remove_host(c->host, dead);
Adrian Hunterc4e05032012-11-23 21:17:34 +0100407 sdhci_free_host(c->host);
408
409 return 0;
410}
411
412#ifdef CONFIG_PM_SLEEP
413
414static int sdhci_acpi_suspend(struct device *dev)
415{
416 struct sdhci_acpi_host *c = dev_get_drvdata(dev);
417
418 return sdhci_suspend_host(c->host);
419}
420
421static int sdhci_acpi_resume(struct device *dev)
422{
423 struct sdhci_acpi_host *c = dev_get_drvdata(dev);
424
425 return sdhci_resume_host(c->host);
426}
427
428#else
429
430#define sdhci_acpi_suspend NULL
431#define sdhci_acpi_resume NULL
432
433#endif
434
Rafael J. Wysocki162d6f92014-12-05 03:05:33 +0100435#ifdef CONFIG_PM
Adrian Hunterc4e05032012-11-23 21:17:34 +0100436
437static int sdhci_acpi_runtime_suspend(struct device *dev)
438{
439 struct sdhci_acpi_host *c = dev_get_drvdata(dev);
440
441 return sdhci_runtime_suspend_host(c->host);
442}
443
444static int sdhci_acpi_runtime_resume(struct device *dev)
445{
446 struct sdhci_acpi_host *c = dev_get_drvdata(dev);
447
448 return sdhci_runtime_resume_host(c->host);
449}
450
Adrian Hunterc4e05032012-11-23 21:17:34 +0100451#endif
452
453static const struct dev_pm_ops sdhci_acpi_pm_ops = {
454 .suspend = sdhci_acpi_suspend,
455 .resume = sdhci_acpi_resume,
Peter Griffin1d75f742014-08-12 17:14:29 +0100456 SET_RUNTIME_PM_OPS(sdhci_acpi_runtime_suspend,
Ulf Hansson9b449e92015-01-02 14:47:00 +0100457 sdhci_acpi_runtime_resume, NULL)
Adrian Hunterc4e05032012-11-23 21:17:34 +0100458};
459
460static struct platform_driver sdhci_acpi_driver = {
461 .driver = {
462 .name = "sdhci-acpi",
Adrian Hunterc4e05032012-11-23 21:17:34 +0100463 .acpi_match_table = sdhci_acpi_ids,
464 .pm = &sdhci_acpi_pm_ops,
465 },
466 .probe = sdhci_acpi_probe,
Greg Kroah-Hartman4e608e42012-12-21 15:05:47 -0800467 .remove = sdhci_acpi_remove,
Adrian Hunterc4e05032012-11-23 21:17:34 +0100468};
469
470module_platform_driver(sdhci_acpi_driver);
471
472MODULE_DESCRIPTION("Secure Digital Host Controller Interface ACPI driver");
473MODULE_AUTHOR("Adrian Hunter");
474MODULE_LICENSE("GPL v2");