diff mbox

[v1] sdhci: pci: Fix up power if device has ACPI companion

Message ID 20170724150750.12217-1-andriy.shevchenko@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andy Shevchenko July 24, 2017, 3:07 p.m. UTC
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.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/mmc/host/sdhci-pci-core.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Comments

Adrian Hunter July 25, 2017, 7:12 a.m. UTC | #1
On 24/07/17 18:07, Andy Shevchenko wrote:
> 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.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

>  drivers/mmc/host/sdhci-pci-core.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
> index e1721ac37919..2c853cfa8389 100644
> --- a/drivers/mmc/host/sdhci-pci-core.c
> +++ b/drivers/mmc/host/sdhci-pci-core.c
> @@ -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;
>  }
>  
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ulf Hansson July 27, 2017, 2:49 p.m. UTC | #2
On 24 July 2017 at 17:07, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> 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.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Thanks, applied for next!

Kind regards
Uffe

> ---
>  drivers/mmc/host/sdhci-pci-core.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
> index e1721ac37919..2c853cfa8389 100644
> --- a/drivers/mmc/host/sdhci-pci-core.c
> +++ b/drivers/mmc/host/sdhci-pci-core.c
> @@ -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
>
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
index e1721ac37919..2c853cfa8389 100644
--- a/drivers/mmc/host/sdhci-pci-core.c
+++ b/drivers/mmc/host/sdhci-pci-core.c
@@ -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;
 }