aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2011-10-17 03:52:44 -0400
committerChris Ball <cjb@laptop.org>2011-10-26 16:32:25 -0400
commitc43fd7746698a10aa6435d62ec28f977dd6246cc (patch)
tree4fc569113696afc238429dea6a13ae8f8ab1cda7 /drivers/mmc
parente840ce134ba5c617af97a2adbedefb0a9c0bb5a7 (diff)
mmc: sdhci-pci: add flag for devices that can support runtime PM
Only allow runtime PM for devices that specifically indicate that they support it. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/sdhci-pci.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
index f49b184308c0..d833d9c2f7e3 100644
--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -47,6 +47,7 @@ struct sdhci_pci_slot;
47 47
48struct sdhci_pci_fixes { 48struct sdhci_pci_fixes {
49 unsigned int quirks; 49 unsigned int quirks;
50 bool allow_runtime_pm;
50 51
51 int (*probe) (struct sdhci_pci_chip *); 52 int (*probe) (struct sdhci_pci_chip *);
52 53
@@ -72,6 +73,7 @@ struct sdhci_pci_chip {
72 struct pci_dev *pdev; 73 struct pci_dev *pdev;
73 74
74 unsigned int quirks; 75 unsigned int quirks;
76 bool allow_runtime_pm;
75 const struct sdhci_pci_fixes *fixes; 77 const struct sdhci_pci_fixes *fixes;
76 78
77 int num_slots; /* Slots on controller */ 79 int num_slots; /* Slots on controller */
@@ -305,16 +307,19 @@ static const struct sdhci_pci_fixes sdhci_intel_mrst_hc1_hc2 = {
305 307
306static const struct sdhci_pci_fixes sdhci_intel_mfd_sd = { 308static const struct sdhci_pci_fixes sdhci_intel_mfd_sd = {
307 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC, 309 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
310 .allow_runtime_pm = true,
308 .probe_slot = mfd_sd_probe_slot, 311 .probe_slot = mfd_sd_probe_slot,
309 .remove_slot = mfd_sd_remove_slot, 312 .remove_slot = mfd_sd_remove_slot,
310}; 313};
311 314
312static const struct sdhci_pci_fixes sdhci_intel_mfd_sdio = { 315static const struct sdhci_pci_fixes sdhci_intel_mfd_sdio = {
313 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC, 316 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
317 .allow_runtime_pm = true,
314}; 318};
315 319
316static const struct sdhci_pci_fixes sdhci_intel_mfd_emmc = { 320static const struct sdhci_pci_fixes sdhci_intel_mfd_emmc = {
317 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC, 321 .quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,
322 .allow_runtime_pm = true,
318 .probe_slot = mfd_emmc_probe_slot, 323 .probe_slot = mfd_emmc_probe_slot,
319 .remove_slot = mfd_emmc_remove_slot, 324 .remove_slot = mfd_emmc_remove_slot,
320}; 325};
@@ -1355,8 +1360,10 @@ static int __devinit sdhci_pci_probe(struct pci_dev *pdev,
1355 1360
1356 chip->pdev = pdev; 1361 chip->pdev = pdev;
1357 chip->fixes = (const struct sdhci_pci_fixes *)ent->driver_data; 1362 chip->fixes = (const struct sdhci_pci_fixes *)ent->driver_data;
1358 if (chip->fixes) 1363 if (chip->fixes) {
1359 chip->quirks = chip->fixes->quirks; 1364 chip->quirks = chip->fixes->quirks;
1365 chip->allow_runtime_pm = chip->fixes->allow_runtime_pm;
1366 }
1360 chip->num_slots = slots; 1367 chip->num_slots = slots;
1361 1368
1362 pci_set_drvdata(pdev, chip); 1369 pci_set_drvdata(pdev, chip);
@@ -1381,7 +1388,8 @@ static int __devinit sdhci_pci_probe(struct pci_dev *pdev,
1381 chip->slots[i] = slot; 1388 chip->slots[i] = slot;
1382 } 1389 }
1383 1390
1384 sdhci_pci_runtime_pm_allow(&pdev->dev); 1391 if (chip->allow_runtime_pm)
1392 sdhci_pci_runtime_pm_allow(&pdev->dev);
1385 1393
1386 return 0; 1394 return 0;
1387 1395
@@ -1399,11 +1407,12 @@ static void __devexit sdhci_pci_remove(struct pci_dev *pdev)
1399 int i; 1407 int i;
1400 struct sdhci_pci_chip *chip; 1408 struct sdhci_pci_chip *chip;
1401 1409
1402 sdhci_pci_runtime_pm_forbid(&pdev->dev);
1403
1404 chip = pci_get_drvdata(pdev); 1410 chip = pci_get_drvdata(pdev);
1405 1411
1406 if (chip) { 1412 if (chip) {
1413 if (chip->allow_runtime_pm)
1414 sdhci_pci_runtime_pm_forbid(&pdev->dev);
1415
1407 for (i = 0; i < chip->num_slots; i++) 1416 for (i = 0; i < chip->num_slots; i++)
1408 sdhci_pci_remove_slot(chip->slots[i]); 1417 sdhci_pci_remove_slot(chip->slots[i]);
1409 1418