diff options
| -rw-r--r-- | drivers/mmc/core/sdio_bus.c | 20 | ||||
| -rw-r--r-- | drivers/mmc/host/sdhci-pci.c | 1 | ||||
| -rw-r--r-- | include/linux/mmc/host.h | 2 |
3 files changed, 22 insertions, 1 deletions
diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c index 5e57048e2c1d..8d6bb1821834 100644 --- a/drivers/mmc/core/sdio_bus.c +++ b/drivers/mmc/core/sdio_bus.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <linux/export.h> | 16 | #include <linux/export.h> |
| 17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
| 18 | #include <linux/pm_runtime.h> | 18 | #include <linux/pm_runtime.h> |
| 19 | #include <linux/acpi.h> | ||
| 19 | 20 | ||
| 20 | #include <linux/mmc/card.h> | 21 | #include <linux/mmc/card.h> |
| 21 | #include <linux/mmc/host.h> | 22 | #include <linux/mmc/host.h> |
| @@ -299,6 +300,19 @@ struct sdio_func *sdio_alloc_func(struct mmc_card *card) | |||
| 299 | return func; | 300 | return func; |
| 300 | } | 301 | } |
| 301 | 302 | ||
| 303 | #ifdef CONFIG_ACPI | ||
| 304 | static void sdio_acpi_set_handle(struct sdio_func *func) | ||
| 305 | { | ||
| 306 | struct mmc_host *host = func->card->host; | ||
| 307 | u64 addr = (host->slotno << 16) | func->num; | ||
| 308 | |||
| 309 | ACPI_HANDLE_SET(&func->dev, | ||
| 310 | acpi_get_child(ACPI_HANDLE(host->parent), addr)); | ||
| 311 | } | ||
| 312 | #else | ||
| 313 | static inline void sdio_acpi_set_handle(struct sdio_func *func) {} | ||
| 314 | #endif | ||
| 315 | |||
| 302 | /* | 316 | /* |
| 303 | * Register a new SDIO function with the driver model. | 317 | * Register a new SDIO function with the driver model. |
| 304 | */ | 318 | */ |
| @@ -308,9 +322,12 @@ int sdio_add_func(struct sdio_func *func) | |||
| 308 | 322 | ||
| 309 | dev_set_name(&func->dev, "%s:%d", mmc_card_id(func->card), func->num); | 323 | dev_set_name(&func->dev, "%s:%d", mmc_card_id(func->card), func->num); |
| 310 | 324 | ||
| 325 | sdio_acpi_set_handle(func); | ||
| 311 | ret = device_add(&func->dev); | 326 | ret = device_add(&func->dev); |
| 312 | if (ret == 0) | 327 | if (ret == 0) { |
| 313 | sdio_func_set_present(func); | 328 | sdio_func_set_present(func); |
| 329 | acpi_dev_pm_attach(&func->dev, false); | ||
| 330 | } | ||
| 314 | 331 | ||
| 315 | return ret; | 332 | return ret; |
| 316 | } | 333 | } |
| @@ -326,6 +343,7 @@ void sdio_remove_func(struct sdio_func *func) | |||
| 326 | if (!sdio_func_present(func)) | 343 | if (!sdio_func_present(func)) |
| 327 | return; | 344 | return; |
| 328 | 345 | ||
| 346 | acpi_dev_pm_detach(&func->dev, false); | ||
| 329 | device_del(&func->dev); | 347 | device_del(&func->dev); |
| 330 | put_device(&func->dev); | 348 | put_device(&func->dev); |
| 331 | } | 349 | } |
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c index c7ccf3034dad..3dee22d098e9 100644 --- a/drivers/mmc/host/sdhci-pci.c +++ b/drivers/mmc/host/sdhci-pci.c | |||
| @@ -1279,6 +1279,7 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot( | |||
| 1279 | } | 1279 | } |
| 1280 | 1280 | ||
| 1281 | host->mmc->pm_caps = MMC_PM_KEEP_POWER | MMC_PM_WAKE_SDIO_IRQ; | 1281 | host->mmc->pm_caps = MMC_PM_KEEP_POWER | MMC_PM_WAKE_SDIO_IRQ; |
| 1282 | host->mmc->slotno = slotno; | ||
| 1282 | 1283 | ||
| 1283 | ret = sdhci_add_host(host); | 1284 | ret = sdhci_add_host(host); |
| 1284 | if (ret) | 1285 | if (ret) |
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index d6f20cc6415e..17d714801e94 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h | |||
| @@ -361,6 +361,8 @@ struct mmc_host { | |||
| 361 | 361 | ||
| 362 | unsigned int actual_clock; /* Actual HC clock rate */ | 362 | unsigned int actual_clock; /* Actual HC clock rate */ |
| 363 | 363 | ||
| 364 | unsigned int slotno; /* used for sdio acpi binding */ | ||
| 365 | |||
| 364 | unsigned long private[0] ____cacheline_aligned; | 366 | unsigned long private[0] ____cacheline_aligned; |
| 365 | }; | 367 | }; |
| 366 | 368 | ||
