diff mbox series

[v2,6/7] mmc: sdhci-acpi: Remove special handling for GPD win/pocket devices

Message ID 20211122170536.7725-7-hdegoede@redhat.com (mailing list archive)
State New, archived
Headers show
Series ACPI: acpi_device_override_status() changes | expand

Commit Message

Hans de Goede Nov. 22, 2021, 5:05 p.m. UTC
Remove the special sdhci_acpi_no_fixup_child_power() helper which was
added to avoid triggering an ACPI tables bug on the GPD win/pocket
devices.

The ACPI child-device triggering this bug has now been added to the
acpi_device_override_status() quirk table, so that its status
field is set to all 0 (instead of the wrong return value from the _STA
ACPI method). This removes the need for the special handling in
the sdhci-acpi code.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v2:
- No changes in v2 of this patch-series
---
 drivers/mmc/host/sdhci-acpi.c | 61 ++---------------------------------
 1 file changed, 3 insertions(+), 58 deletions(-)

Comments

Adrian Hunter Nov. 24, 2021, 3:16 p.m. UTC | #1
On 22/11/2021 19:05, Hans de Goede wrote:
> Remove the special sdhci_acpi_no_fixup_child_power() helper which was
> added to avoid triggering an ACPI tables bug on the GPD win/pocket
> devices.
> 
> The ACPI child-device triggering this bug has now been added to the
> acpi_device_override_status() quirk table, so that its status
> field is set to all 0 (instead of the wrong return value from the _STA
> ACPI method). This removes the need for the special handling in
> the sdhci-acpi code.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

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

> ---
> Changes in v2:
> - No changes in v2 of this patch-series
> ---
>  drivers/mmc/host/sdhci-acpi.c | 61 ++---------------------------------
>  1 file changed, 3 insertions(+), 58 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
> index f1ef0d28b0dd..1461aae13c19 100644
> --- a/drivers/mmc/host/sdhci-acpi.c
> +++ b/drivers/mmc/host/sdhci-acpi.c
> @@ -34,7 +34,6 @@
>  #include <asm/cpu_device_id.h>
>  #include <asm/intel-family.h>
>  #include <asm/iosf_mbi.h>
> -#include <linux/pci.h>
>  #endif
>  
>  #include "sdhci.h"
> @@ -250,16 +249,6 @@ static bool sdhci_acpi_byt(void)
>  	return x86_match_cpu(byt);
>  }
>  
> -static bool sdhci_acpi_cht(void)
> -{
> -	static const struct x86_cpu_id cht[] = {
> -		X86_MATCH_INTEL_FAM6_MODEL(ATOM_AIRMONT, NULL),
> -		{}
> -	};
> -
> -	return x86_match_cpu(cht);
> -}
> -
>  #define BYT_IOSF_SCCEP			0x63
>  #define BYT_IOSF_OCP_NETCTRL0		0x1078
>  #define BYT_IOSF_OCP_TIMEOUT_BASE	GENMASK(10, 8)
> @@ -304,43 +293,6 @@ static bool sdhci_acpi_byt_defer(struct device *dev)
>  	return false;
>  }
>  
> -static bool sdhci_acpi_cht_pci_wifi(unsigned int vendor, unsigned int device,
> -				    unsigned int slot, unsigned int parent_slot)
> -{
> -	struct pci_dev *dev, *parent, *from = NULL;
> -
> -	while (1) {
> -		dev = pci_get_device(vendor, device, from);
> -		pci_dev_put(from);
> -		if (!dev)
> -			break;
> -		parent = pci_upstream_bridge(dev);
> -		if (ACPI_COMPANION(&dev->dev) && PCI_SLOT(dev->devfn) == slot &&
> -		    parent && PCI_SLOT(parent->devfn) == parent_slot &&
> -		    !pci_upstream_bridge(parent)) {
> -			pci_dev_put(dev);
> -			return true;
> -		}
> -		from = dev;
> -	}
> -
> -	return false;
> -}
> -
> -/*
> - * GPDwin uses PCI wifi which conflicts with SDIO's use of
> - * acpi_device_fix_up_power() on child device nodes. Identifying GPDwin is
> - * problematic, but since SDIO is only used for wifi, the presence of the PCI
> - * wifi card in the expected slot with an ACPI companion node, is used to
> - * indicate that acpi_device_fix_up_power() should be avoided.
> - */
> -static inline bool sdhci_acpi_no_fixup_child_power(struct acpi_device *adev)
> -{
> -	return sdhci_acpi_cht() &&
> -	       acpi_dev_hid_uid_match(adev, "80860F14", "2") &&
> -	       sdhci_acpi_cht_pci_wifi(0x14e4, 0x43ec, 0, 28);
> -}
> -
>  #else
>  
>  static inline void sdhci_acpi_byt_setting(struct device *dev)
> @@ -352,11 +304,6 @@ static inline bool sdhci_acpi_byt_defer(struct device *dev)
>  	return false;
>  }
>  
> -static inline bool sdhci_acpi_no_fixup_child_power(struct acpi_device *adev)
> -{
> -	return false;
> -}
> -
>  #endif
>  
>  static int bxt_get_cd(struct mmc_host *mmc)
> @@ -861,11 +808,9 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
>  
>  	/* Power on the SDHCI controller and its children */
>  	acpi_device_fix_up_power(device);
> -	if (!sdhci_acpi_no_fixup_child_power(device)) {
> -		list_for_each_entry(child, &device->children, node)
> -			if (child->status.present && child->status.enabled)
> -				acpi_device_fix_up_power(child);
> -	}
> +	list_for_each_entry(child, &device->children, node)
> +		if (child->status.present && child->status.enabled)
> +			acpi_device_fix_up_power(child);
>  
>  	if (sdhci_acpi_byt_defer(dev))
>  		return -EPROBE_DEFER;
>
diff mbox series

Patch

diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
index f1ef0d28b0dd..1461aae13c19 100644
--- a/drivers/mmc/host/sdhci-acpi.c
+++ b/drivers/mmc/host/sdhci-acpi.c
@@ -34,7 +34,6 @@ 
 #include <asm/cpu_device_id.h>
 #include <asm/intel-family.h>
 #include <asm/iosf_mbi.h>
-#include <linux/pci.h>
 #endif
 
 #include "sdhci.h"
@@ -250,16 +249,6 @@  static bool sdhci_acpi_byt(void)
 	return x86_match_cpu(byt);
 }
 
-static bool sdhci_acpi_cht(void)
-{
-	static const struct x86_cpu_id cht[] = {
-		X86_MATCH_INTEL_FAM6_MODEL(ATOM_AIRMONT, NULL),
-		{}
-	};
-
-	return x86_match_cpu(cht);
-}
-
 #define BYT_IOSF_SCCEP			0x63
 #define BYT_IOSF_OCP_NETCTRL0		0x1078
 #define BYT_IOSF_OCP_TIMEOUT_BASE	GENMASK(10, 8)
@@ -304,43 +293,6 @@  static bool sdhci_acpi_byt_defer(struct device *dev)
 	return false;
 }
 
-static bool sdhci_acpi_cht_pci_wifi(unsigned int vendor, unsigned int device,
-				    unsigned int slot, unsigned int parent_slot)
-{
-	struct pci_dev *dev, *parent, *from = NULL;
-
-	while (1) {
-		dev = pci_get_device(vendor, device, from);
-		pci_dev_put(from);
-		if (!dev)
-			break;
-		parent = pci_upstream_bridge(dev);
-		if (ACPI_COMPANION(&dev->dev) && PCI_SLOT(dev->devfn) == slot &&
-		    parent && PCI_SLOT(parent->devfn) == parent_slot &&
-		    !pci_upstream_bridge(parent)) {
-			pci_dev_put(dev);
-			return true;
-		}
-		from = dev;
-	}
-
-	return false;
-}
-
-/*
- * GPDwin uses PCI wifi which conflicts with SDIO's use of
- * acpi_device_fix_up_power() on child device nodes. Identifying GPDwin is
- * problematic, but since SDIO is only used for wifi, the presence of the PCI
- * wifi card in the expected slot with an ACPI companion node, is used to
- * indicate that acpi_device_fix_up_power() should be avoided.
- */
-static inline bool sdhci_acpi_no_fixup_child_power(struct acpi_device *adev)
-{
-	return sdhci_acpi_cht() &&
-	       acpi_dev_hid_uid_match(adev, "80860F14", "2") &&
-	       sdhci_acpi_cht_pci_wifi(0x14e4, 0x43ec, 0, 28);
-}
-
 #else
 
 static inline void sdhci_acpi_byt_setting(struct device *dev)
@@ -352,11 +304,6 @@  static inline bool sdhci_acpi_byt_defer(struct device *dev)
 	return false;
 }
 
-static inline bool sdhci_acpi_no_fixup_child_power(struct acpi_device *adev)
-{
-	return false;
-}
-
 #endif
 
 static int bxt_get_cd(struct mmc_host *mmc)
@@ -861,11 +808,9 @@  static int sdhci_acpi_probe(struct platform_device *pdev)
 
 	/* Power on the SDHCI controller and its children */
 	acpi_device_fix_up_power(device);
-	if (!sdhci_acpi_no_fixup_child_power(device)) {
-		list_for_each_entry(child, &device->children, node)
-			if (child->status.present && child->status.enabled)
-				acpi_device_fix_up_power(child);
-	}
+	list_for_each_entry(child, &device->children, node)
+		if (child->status.present && child->status.enabled)
+			acpi_device_fix_up_power(child);
 
 	if (sdhci_acpi_byt_defer(dev))
 		return -EPROBE_DEFER;