diff mbox series

[2/2] mmc: sdhci-acpi: Disable write protect detection on Acer Aspire Switch 10 (SW5-012)

Message ID 20200108093903.57620-3-hdegoede@redhat.com (mailing list archive)
State New, archived
Headers show
Series mmc: sdhci-acpi: Introduce device specific quirks, fix issues on 2 device models | expand

Commit Message

Hans de Goede Jan. 8, 2020, 9:39 a.m. UTC
On the Acer Aspire Switch 10 (SW5-012) microSD slot always reports the card
being write-protected even though microSD cards do not have a write-protect
switch at all.

Add a new SDHCI_ACPI_QUIRK_SD_NO_WRITE_PROTECT quirk which when set sets
the MMC_CAP2_NO_WRITE_PROTECT flag on the controller for the external SD
slot, and add a DMI quirk which enables this new quirk by default on the
Acer SW5-012.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/mmc/host/sdhci-acpi.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff mbox series

Patch

diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
index 9f150c73e958..69485d29b6bc 100644
--- a/drivers/mmc/host/sdhci-acpi.c
+++ b/drivers/mmc/host/sdhci-acpi.c
@@ -78,6 +78,7 @@  struct sdhci_acpi_host {
 
 enum {
 	SDHCI_ACPI_QUIRK_SD_NO_1_8V			= BIT(0),
+	SDHCI_ACPI_QUIRK_SD_NO_WRITE_PROTECT		= BIT(1),
 };
 
 static int quirks = -1;
@@ -671,6 +672,18 @@  static const struct dmi_system_id sdhci_acpi_quirks[] = {
 		},
 		.driver_data = (void *)SDHCI_ACPI_QUIRK_SD_NO_1_8V,
 	},
+	{
+		/*
+		 * The Acer Aspire Switch 10 (SW5-012) microSD slot always
+		 * reports the card being write-protected even though microSD
+		 * cards do not have a write-protect switch at all.
+		 */
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Aspire SW5-012"),
+		},
+		.driver_data = (void *)SDHCI_ACPI_QUIRK_SD_NO_WRITE_PROTECT,
+	},
 	{} /* Terminating entry */
 };
 
@@ -798,6 +811,9 @@  static int sdhci_acpi_probe(struct platform_device *pdev)
 
 		if (quirks & SDHCI_ACPI_QUIRK_SD_NO_1_8V)
 			host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V;
+
+		if (quirks & SDHCI_ACPI_QUIRK_SD_NO_WRITE_PROTECT)
+			host->mmc->caps2 |= MMC_CAP2_NO_WRITE_PROTECT;
 	}
 
 	err = sdhci_setup_host(host);