diff mbox series

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

Message ID 20200316184753.393458-2-hdegoede@redhat.com (mailing list archive)
State New, archived
Headers show
Series [v3,1/2] mmc: sdhci-acpi: Switch signal voltage back to 3.3V on suspend on external microSD on Lenovo Miix 320 | expand

Commit Message

Hans de Goede March 16, 2020, 6:47 p.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 DMI_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 table entry which selects this quirk for the
Acer SW5-012.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v2:
- Drop the module option to allow overridig the quirks
---
 drivers/mmc/host/sdhci-acpi.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Adrian Hunter March 17, 2020, 7:42 a.m. UTC | #1
On 16/03/20 8:47 pm, Hans de Goede wrote:
> 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 DMI_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 table entry which selects this quirk for the
> Acer SW5-012.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

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

> ---
> Changes in v2:
> - Drop the module option to allow overridig the quirks
> ---
>  drivers/mmc/host/sdhci-acpi.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
> index b4c1b2367066..2a2173d953f5 100644
> --- a/drivers/mmc/host/sdhci-acpi.c
> +++ b/drivers/mmc/host/sdhci-acpi.c
> @@ -80,6 +80,7 @@ struct sdhci_acpi_host {
>  
>  enum {
>  	DMI_QUIRK_RESET_SD_SIGNAL_VOLT_ON_SUSP			= BIT(0),
> +	DMI_QUIRK_SD_NO_WRITE_PROTECT				= BIT(1),
>  };
>  
>  static inline void *sdhci_acpi_priv(struct sdhci_acpi_host *c)
> @@ -671,6 +672,18 @@ static const struct dmi_system_id sdhci_acpi_quirks[] = {
>  		},
>  		.driver_data = (void *)DMI_QUIRK_RESET_SD_SIGNAL_VOLT_ON_SUSP,
>  	},
> +	{
> +		/*
> +		 * 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 *)DMI_QUIRK_SD_NO_WRITE_PROTECT,
> +	},
>  	{} /* Terminating entry */
>  };
>  
> @@ -795,6 +808,9 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
>  
>  		if (quirks & DMI_QUIRK_RESET_SD_SIGNAL_VOLT_ON_SUSP)
>  			c->reset_signal_volt_on_suspend = true;
> +
> +		if (quirks & DMI_QUIRK_SD_NO_WRITE_PROTECT)
> +			host->mmc->caps2 |= MMC_CAP2_NO_WRITE_PROTECT;
>  	}
>  
>  	err = sdhci_setup_host(host);
>
Ulf Hansson March 17, 2020, 11:58 a.m. UTC | #2
On Mon, 16 Mar 2020 at 19:48, Hans de Goede <hdegoede@redhat.com> wrote:
>
> 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 DMI_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 table entry which selects this quirk for the
> Acer SW5-012.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Applied for fixes and by adding a stable tag, thanks!

Kind regards
Uffe


> ---
> Changes in v2:
> - Drop the module option to allow overridig the quirks
> ---
>  drivers/mmc/host/sdhci-acpi.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
> index b4c1b2367066..2a2173d953f5 100644
> --- a/drivers/mmc/host/sdhci-acpi.c
> +++ b/drivers/mmc/host/sdhci-acpi.c
> @@ -80,6 +80,7 @@ struct sdhci_acpi_host {
>
>  enum {
>         DMI_QUIRK_RESET_SD_SIGNAL_VOLT_ON_SUSP                  = BIT(0),
> +       DMI_QUIRK_SD_NO_WRITE_PROTECT                           = BIT(1),
>  };
>
>  static inline void *sdhci_acpi_priv(struct sdhci_acpi_host *c)
> @@ -671,6 +672,18 @@ static const struct dmi_system_id sdhci_acpi_quirks[] = {
>                 },
>                 .driver_data = (void *)DMI_QUIRK_RESET_SD_SIGNAL_VOLT_ON_SUSP,
>         },
> +       {
> +               /*
> +                * 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 *)DMI_QUIRK_SD_NO_WRITE_PROTECT,
> +       },
>         {} /* Terminating entry */
>  };
>
> @@ -795,6 +808,9 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
>
>                 if (quirks & DMI_QUIRK_RESET_SD_SIGNAL_VOLT_ON_SUSP)
>                         c->reset_signal_volt_on_suspend = true;
> +
> +               if (quirks & DMI_QUIRK_SD_NO_WRITE_PROTECT)
> +                       host->mmc->caps2 |= MMC_CAP2_NO_WRITE_PROTECT;
>         }
>
>         err = sdhci_setup_host(host);
> --
> 2.25.1
>
diff mbox series

Patch

diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
index b4c1b2367066..2a2173d953f5 100644
--- a/drivers/mmc/host/sdhci-acpi.c
+++ b/drivers/mmc/host/sdhci-acpi.c
@@ -80,6 +80,7 @@  struct sdhci_acpi_host {
 
 enum {
 	DMI_QUIRK_RESET_SD_SIGNAL_VOLT_ON_SUSP			= BIT(0),
+	DMI_QUIRK_SD_NO_WRITE_PROTECT				= BIT(1),
 };
 
 static inline void *sdhci_acpi_priv(struct sdhci_acpi_host *c)
@@ -671,6 +672,18 @@  static const struct dmi_system_id sdhci_acpi_quirks[] = {
 		},
 		.driver_data = (void *)DMI_QUIRK_RESET_SD_SIGNAL_VOLT_ON_SUSP,
 	},
+	{
+		/*
+		 * 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 *)DMI_QUIRK_SD_NO_WRITE_PROTECT,
+	},
 	{} /* Terminating entry */
 };
 
@@ -795,6 +808,9 @@  static int sdhci_acpi_probe(struct platform_device *pdev)
 
 		if (quirks & DMI_QUIRK_RESET_SD_SIGNAL_VOLT_ON_SUSP)
 			c->reset_signal_volt_on_suspend = true;
+
+		if (quirks & DMI_QUIRK_SD_NO_WRITE_PROTECT)
+			host->mmc->caps2 |= MMC_CAP2_NO_WRITE_PROTECT;
 	}
 
 	err = sdhci_setup_host(host);