Skip to contentSkip to conversation

sdhci: pci: Fix up power if device has ACPI companion

PATCH Applied Andy Shevchenko 3 participants 3 messages Jul 24, 2017 – Jul 27, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sdhci: pci: Fix up power if device has ACPI companion

Fix up a power state in case PCI device has an ACPI companion.

Do it only for Intel Merrifield for now.

This is almost copy'n'paste of part of sdhci_acpi_probe() and might be split out to a helper function in the future.

---
 drivers/mmc/host/sdhci-pci-core.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/mmc/host/sdhci-pci-core.c +20 -0
index e1721ac37919..2c853cfa8389 100644
@@ -730,6 +730,24 @@ static const struct sdhci_pci_fixes sdhci_intel_byt_sd = {
 #define INTEL_MRFLD_SD		2
 #define INTEL_MRFLD_SDIO	3
 
+#ifdef CONFIG_ACPI
+static void intel_mrfld_mmc_fix_up_power_slot(struct sdhci_pci_slot *slot)
+{
+	struct acpi_device *device, *child;
+
+	device = ACPI_COMPANION(&slot->chip->pdev->dev);
+	if (!device)
+		return;
+
+	acpi_device_fix_up_power(device);
+	list_for_each_entry(child, &device->children, node)
+		if (child->status.present && child->status.enabled)
+			acpi_device_fix_up_power(child);
+}
+#else
+static inline void intel_mrfld_mmc_fix_up_power_slot(struct sdhci_pci_slot *slot) {}
+#endif
+
 static int intel_mrfld_mmc_probe_slot(struct sdhci_pci_slot *slot)
 {
 	unsigned int func = PCI_FUNC(slot->chip->pdev->devfn);
@@ -751,6 +769,8 @@ static int intel_mrfld_mmc_probe_slot(struct sdhci_pci_slot *slot)
 	default:
 		return -ENODEV;
 	}
+
+	intel_mrfld_mmc_fix_up_power_slot(slot);
 	return 0;
 }
 
Signature · 1 line
2.13.2
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Andy Shevchenko

Fix up a power state in case PCI device has an ACPI companion.

Do it only for Intel Merrifield for now.

This is almost copy'n'paste of part of sdhci_acpi_probe() and might be split out to a helper function in the future.

---

Quoted 42 lines
 drivers/mmc/host/sdhci-pci-core.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/mmc/host/sdhci-pci-core.c +20 -0
index e1721ac37919..2c853cfa8389 100644
@@ -730,6 +730,24 @@ static const struct sdhci_pci_fixes sdhci_intel_byt_sd = {
 #define INTEL_MRFLD_SD		2
 #define INTEL_MRFLD_SDIO	3
 
+#ifdef CONFIG_ACPI
+static void intel_mrfld_mmc_fix_up_power_slot(struct sdhci_pci_slot *slot)
+{
+	struct acpi_device *device, *child;
+
+	device = ACPI_COMPANION(&slot->chip->pdev->dev);
+	if (!device)
+		return;
+
+	acpi_device_fix_up_power(device);
+	list_for_each_entry(child, &device->children, node)
+		if (child->status.present && child->status.enabled)
+			acpi_device_fix_up_power(child);
+}
+#else
+static inline void intel_mrfld_mmc_fix_up_power_slot(struct sdhci_pci_slot *slot) {}
+#endif
+
 static int intel_mrfld_mmc_probe_slot(struct sdhci_pci_slot *slot)
 {
 	unsigned int func = PCI_FUNC(slot->chip->pdev->devfn);
@@ -751,6 +769,8 @@ static int intel_mrfld_mmc_probe_slot(struct sdhci_pci_slot *slot)
 	default:
 		return -ENODEV;
 	}
+
+	intel_mrfld_mmc_fix_up_power_slot(slot);
 	return 0;
 }
 
Applied
#2 lore raw
In reply to Andy Shevchenko
Quoted 8 lines · Andy Shevchenko

Fix up a power state in case PCI device has an ACPI companion.

Do it only for Intel Merrifield for now.

This is almost copy'n'paste of part of sdhci_acpi_probe() and might be split out to a helper function in the future.

Thanks, applied for next!

Kind regards
Uffe

Quoted 45 lines
---
 drivers/mmc/host/sdhci-pci-core.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/mmc/host/sdhci-pci-core.c +20 -1
index e1721ac37919..2c853cfa8389 100644
@@ -730,6 +730,24 @@ static const struct sdhci_pci_fixes sdhci_intel_byt_sd = {
 #define INTEL_MRFLD_SD         2
 #define INTEL_MRFLD_SDIO       3
 
+#ifdef CONFIG_ACPI
+static void intel_mrfld_mmc_fix_up_power_slot(struct sdhci_pci_slot *slot)
+{
+       struct acpi_device *device, *child;
+
+       device = ACPI_COMPANION(&slot->chip->pdev->dev);
+       if (!device)
+               return;
+
+       acpi_device_fix_up_power(device);
+       list_for_each_entry(child, &device->children, node)
+               if (child->status.present && child->status.enabled)
+                       acpi_device_fix_up_power(child);
+}
+#else
+static inline void intel_mrfld_mmc_fix_up_power_slot(struct sdhci_pci_slot *slot) {}
+#endif
+
 static int intel_mrfld_mmc_probe_slot(struct sdhci_pci_slot *slot)
 {
        unsigned int func = PCI_FUNC(slot->chip->pdev->devfn);
@@ -751,6 +769,8 @@ static int intel_mrfld_mmc_probe_slot(struct sdhci_pci_slot *slot)
        default:
                return -ENODEV;
        }
+
+       intel_mrfld_mmc_fix_up_power_slot(slot);
        return 0;
 }
 
--

2.13.2