From patchwork Sun Apr 7 20:04:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 787061 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE79E3D988 for ; Sun, 7 Apr 2024 20:05:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712520307; cv=none; b=QesmIP+B3R8mmHyMFpdRSflFWEmTuOAWow8L1CssNXLpx5lRtSLr2Mjeirvd9iIw+P9nbDfr+SCyR+v9Pj9DsqoRh2JIlqDbpZwJPYMrNdSrrPj23De+baTQ5CcdEBixH21A3gaUbosy1dggISYB5inLQdxxkqvbYOH8bPpKIIo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712520307; c=relaxed/simple; bh=hCMJGweq7tU8hlD93B81yze3RHJwnGhyXr4H8YVnHpE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Ijaj2B7zM3NNbPuEKkwWsayJ/Tz5Gnv34yIoWuUzvlRfAWI7oO3JngoSpySz084hGN/A9ilKa4PmvO25yF7lO2y3H4G1D8903Lj2dTP5TKPT1vZqtxITTry2oJEBTCunsYo1fXNzjh9CjOeCDUrAKJ5KC4lTwKZZ+BFgPuSNr2k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=gJXGMiD9; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="gJXGMiD9" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712520304; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=3gzJ7EXt9VdeENWzxJbek4ko1lyMTZTDhIdMsRvzgb0=; b=gJXGMiD9PkBV929F2+UTRc8hvhOWKlFB6HtQmAtFvGbO4iMMWJ8aLlu2kZpjPkRl8d1YlF adflXrSqLpq5yCosh4M44jvIhubrGnv7B0tWX4yF9gRh3LEim8TUt0sGz5a2qQpB+C6SN+ pdBkhERnk5WeQaR9f4QpG2ZhDE+qg24= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-237-KHysgD97NAajQV0jKLuNmQ-1; Sun, 07 Apr 2024 16:04:59 -0400 X-MC-Unique: KHysgD97NAajQV0jKLuNmQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 22C87101150C; Sun, 7 Apr 2024 20:04:59 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.192.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id D3207112132A; Sun, 7 Apr 2024 20:04:57 +0000 (UTC) From: Hans de Goede To: Adrian Hunter , Ulf Hansson , Mika Westerberg , Andy Shevchenko Cc: Hans de Goede , linux-mmc@vger.kernel.org, linux-gpio@vger.kernel.org Subject: [PATCH 1/6] mmc: core: Add mmc_gpiod_set_cd_config() function Date: Sun, 7 Apr 2024 22:04:48 +0200 Message-ID: <20240407200453.40829-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 Some mmc host drivers may need to fixup a card-detection GPIO's config to e.g. enable the GPIO controllers builtin pull-up resistor on devices where the firmware description of the GPIO is broken (e.g. GpioInt with PullNone instead of PullUp in ACPI DSDT). Since this is the exception rather then the rule adding a config parameter to mmc_gpiod_request_cd() seems undesirable, so instead add a new mmc_gpiod_set_cd_config() function. This is simply a wrapper to call gpiod_set_config() on the card-detect GPIO acquired through mmc_gpiod_request_cd(). Signed-off-by: Hans de Goede --- drivers/mmc/core/slot-gpio.c | 20 ++++++++++++++++++++ include/linux/mmc/slot-gpio.h | 1 + 2 files changed, 21 insertions(+) diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c index 39f45c2b6de8..8791656e9e20 100644 --- a/drivers/mmc/core/slot-gpio.c +++ b/drivers/mmc/core/slot-gpio.c @@ -221,6 +221,26 @@ int mmc_gpiod_request_cd(struct mmc_host *host, const char *con_id, } EXPORT_SYMBOL(mmc_gpiod_request_cd); +/** + * mmc_gpiod_set_cd_config - set config for card-detection GPIO + * @host: mmc host + * @config: Generic pinconf config (from pinconf_to_config_packed()) + * + * This can be used by mmc host drivers to fixup a card-detection GPIO's config + * (e.g. set PIN_CONFIG_BIAS_PULL_UP) after acquiring the GPIO descriptor + * through mmc_gpiod_request_cd(). + * + * Returns: + * 0 on success, or a negative errno value on error. + */ +int mmc_gpiod_set_cd_config(struct mmc_host *host, unsigned long config) +{ + struct mmc_gpio *ctx = host->slot.handler_priv; + + return gpiod_set_config(ctx->cd_gpio, config); +} +EXPORT_SYMBOL(mmc_gpiod_set_cd_config); + bool mmc_can_gpio_cd(struct mmc_host *host) { struct mmc_gpio *ctx = host->slot.handler_priv; diff --git a/include/linux/mmc/slot-gpio.h b/include/linux/mmc/slot-gpio.h index 5d3d15e97868..748ab7a88e78 100644 --- a/include/linux/mmc/slot-gpio.h +++ b/include/linux/mmc/slot-gpio.h @@ -19,6 +19,7 @@ void mmc_gpio_set_cd_irq(struct mmc_host *host, int irq); int mmc_gpiod_request_cd(struct mmc_host *host, const char *con_id, unsigned int idx, bool override_active_level, unsigned int debounce); +int mmc_gpiod_set_cd_config(struct mmc_host *host, unsigned long config); int mmc_gpiod_request_ro(struct mmc_host *host, const char *con_id, unsigned int idx, unsigned int debounce); void mmc_gpio_set_cd_isr(struct mmc_host *host, From patchwork Sun Apr 7 20:04:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 786781 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 618F53E47C for ; Sun, 7 Apr 2024 20:05:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712520308; cv=none; b=hNTzfZ8223KTOdH6CuMn8UxtcCNrdVkAcDp+RkrLPHTYt2GoYQItJvH0rXhTFT4LweYqgPEjdZOosOsZu8ZvzV+v50Gfg+tHez6pEEXRn504jbE7npJsMd/Y4fN18FZtQhM6JJ/WQvuW+W2zPfk4wH5iKI/08KbGtNacT7DAAoM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712520308; c=relaxed/simple; bh=upMUJveLAYrZFBF6DFvlvMPvK8XcF4uLJEsPWzW6Muw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ddDwwNcXij3DjV6IkQ41nerhy4qJO0AQnSHUHL3CppPfr7jTqUedWnKqpu2MrUWndJpS5thDdH214bSmOscWAStT+LGOFJFpAHeYygpiaaX6L3vpengN3qFZhN8jVOhUWgtFf5opleWlinOpI89KtKTEXStFueIKxjKWmFI3jjU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=ZIH8eqCg; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ZIH8eqCg" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712520306; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sMoicdiKA9eMl9AI9QS4kybM1TdnA1yFigYV4EpBH24=; b=ZIH8eqCg80q2aos5mHS4aXMi0s9N5A2MhHiBuwPucry/qLYEjNF63pSE5FEuBSoGbMTej5 s/Gk8s10GTu0KMFzyUYocSjzY050TizDEWl6+bnf4mxbXKVodZ8TpRx6qpGinDpsPitvPF ePQO6+7xkaE8N91xg75H/Pt7Ci/UQUQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-608-yPTskxDYP6SxpNrbZ7uZYw-1; Sun, 07 Apr 2024 16:05:01 -0400 X-MC-Unique: yPTskxDYP6SxpNrbZ7uZYw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A34948DEF7C; Sun, 7 Apr 2024 20:05:00 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.192.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 90A7D112132A; Sun, 7 Apr 2024 20:04:59 +0000 (UTC) From: Hans de Goede To: Adrian Hunter , Ulf Hansson , Mika Westerberg , Andy Shevchenko Cc: Hans de Goede , linux-mmc@vger.kernel.org, linux-gpio@vger.kernel.org Subject: [PATCH 2/6] mmc: sdhci-acpi: Sort DMI quirks alphabetically Date: Sun, 7 Apr 2024 22:04:49 +0200 Message-ID: <20240407200453.40829-2-hdegoede@redhat.com> In-Reply-To: <20240407200453.40829-1-hdegoede@redhat.com> References: <20240407200453.40829-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 Sort the DMI quirks alphabetically. Signed-off-by: Hans de Goede --- drivers/mmc/host/sdhci-acpi.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c index acf5fc3ad7e4..d2003d3be6ba 100644 --- a/drivers/mmc/host/sdhci-acpi.c +++ b/drivers/mmc/host/sdhci-acpi.c @@ -719,7 +719,20 @@ static const struct acpi_device_id sdhci_acpi_ids[] = { }; MODULE_DEVICE_TABLE(acpi, sdhci_acpi_ids); +/* Please keep this list sorted alphabetically */ static const struct dmi_system_id sdhci_acpi_quirks[] = { + { + /* + * 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, + }, { /* * The Lenovo Miix 320-10ICR has a bug in the _PS0 method of @@ -734,18 +747,6 @@ 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, - }, { /* * The Toshiba WT8-B's microSD slot always reports the card being From patchwork Sun Apr 7 20:04:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 787060 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 106E43DBA8 for ; Sun, 7 Apr 2024 20:05:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712520308; cv=none; b=H3d2AuDQnITfZ5Nof/UjDUr+3f8pAuLL+Rw1sLl3NiiCL/GM0kwlnL613eYXIVrUlurC/pgLw1bIBBCgC2QlSCtV8bMqZXpKoP6Y/qsIXA8TAxaHKuQ9X+HYcDLll5+4zY+joaCdlKDIPJ0lIUql58/octquZDSnbGOetnGkGyk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712520308; c=relaxed/simple; bh=qpQO6FgTw4O5eGAkk89F0WzAnCKXXhlTtJWGdjRuXck=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OV3rjHTqvgYYj4gv44m1vR4csLJE5Xpw6NKiok8BGoDUWt5XGqjbmsGwwfS8HZ5G7V4a4olqgGxjC7FI5phEDTIr7BbSBdWzmtQZo31i5G53q+VAnhe7Zywrvqh4nstdI/klyyxJUAz76y1OxXWRcqypoo75llD0jJn3I/+fYR0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=JoeiaB+d; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="JoeiaB+d" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712520306; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MZy4eop/gOic+2Q0knfJpw2Vt3sQkPwTALkTkP5fDO4=; b=JoeiaB+dzo+L8q9s3OxoXqPnpuC1PE0ptwBglbbBUasxadlLoiIVgR2ZJ5t6gqrsgKgfeP R3akUKnS3PMmRuBCK6heJ4AZF1mC+d5GcXLGxdDzHpW9EQ+Us2eHrT3DBkHnjTX1MRYubA cLdE8f1IOu8IuJv9w2+yaTDcTav72yE= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-325-NXpV7CnIOzqZV0SACY58CQ-1; Sun, 07 Apr 2024 16:05:02 -0400 X-MC-Unique: NXpV7CnIOzqZV0SACY58CQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E11333C0CEE9; Sun, 7 Apr 2024 20:05:01 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.192.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id D3DE0100077A; Sun, 7 Apr 2024 20:05:00 +0000 (UTC) From: Hans de Goede To: Adrian Hunter , Ulf Hansson , Mika Westerberg , Andy Shevchenko Cc: Hans de Goede , linux-mmc@vger.kernel.org, linux-gpio@vger.kernel.org Subject: [PATCH 3/6] mmc: sdhci-acpi: Fix Lenovo Yoga Tablet 2 Pro 1380 sdcard slot not working Date: Sun, 7 Apr 2024 22:04:50 +0200 Message-ID: <20240407200453.40829-3-hdegoede@redhat.com> In-Reply-To: <20240407200453.40829-1-hdegoede@redhat.com> References: <20240407200453.40829-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 The Lenovo Yoga Tablet 2 Pro 1380 sdcard slot has an active high cd pin and a broken wp pin which always reports the card being write-protected. Add a DMI quirk to address both issues. Signed-off-by: Hans de Goede --- drivers/mmc/host/sdhci-acpi.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c index d2003d3be6ba..c0d77f589deb 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), + DMI_QUIRK_SD_CD_ACTIVE_HIGH = BIT(2), }; static inline void *sdhci_acpi_priv(struct sdhci_acpi_host *c) @@ -747,6 +748,26 @@ static const struct dmi_system_id sdhci_acpi_quirks[] = { }, .driver_data = (void *)DMI_QUIRK_RESET_SD_SIGNAL_VOLT_ON_SUSP, }, + { + /* + * Lenovo Yoga Tablet 2 Pro 1380F/L (13" Android version) this + * has broken WP reporting and an inverted CD signal. + * Note this has more or less the same BIOS as the Lenovo Yoga + * Tablet 2 830F/L or 1050F/L (8" and 10" Android), but unlike + * the 830 / 1050 models which share the same mainboard this + * model has a different mainboard and the inverted CD and + * broken WP are unique to this board. + */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Intel Corp."), + DMI_MATCH(DMI_PRODUCT_NAME, "VALLEYVIEW C0 PLATFORM"), + DMI_MATCH(DMI_BOARD_NAME, "BYT-T FFD8"), + /* Full match so as to NOT match the 830/1050 BIOS */ + DMI_MATCH(DMI_BIOS_VERSION, "BLADE_21.X64.0005.R00.1504101516"), + }, + .driver_data = (void *)(DMI_QUIRK_SD_NO_WRITE_PROTECT | + DMI_QUIRK_SD_CD_ACTIVE_HIGH), + }, { /* * The Toshiba WT8-B's microSD slot always reports the card being @@ -867,6 +888,9 @@ static int sdhci_acpi_probe(struct platform_device *pdev) if (sdhci_acpi_flag(c, SDHCI_ACPI_SD_CD)) { bool v = sdhci_acpi_flag(c, SDHCI_ACPI_SD_CD_OVERRIDE_LEVEL); + if (quirks & DMI_QUIRK_SD_CD_ACTIVE_HIGH) + host->mmc->caps2 |= MMC_CAP2_CD_ACTIVE_HIGH; + err = mmc_gpiod_request_cd(host->mmc, NULL, 0, v, 0); if (err) { if (err == -EPROBE_DEFER) From patchwork Sun Apr 7 20:04:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 786782 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 33BED3D993 for ; Sun, 7 Apr 2024 20:05:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712520308; cv=none; b=r1Zs9RN8H6GsUn2qq1LCiMGR0Ag49LXaREZhmP1996rBSXHNwYxgUNd1oLQFWRJBKRSPF1F7rXqezttu9xrpxOTG1LpK+SlAb/0kD/2Y1AAdevyFWSbK8QhossHxyT2orh/7B0+wIch6w+CKbioPSGq3cSfPcdTJ9Y3Zm8eDFHU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712520308; c=relaxed/simple; bh=UWdlP9A4xBUMKpZnsnnlf89phasUQ7E1xv/QTD+EX8M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rX6u/4Onrs/dC1GlHp6DRo9/MGONmlPxzWjBh4RjXeZoio8S8d9SuGxMskuueIDwGSL7efeSoBpQItB5DaiukgTMRLB9HyBReAG2LOPoxCTU/resD6YkQ6KtG2jl0gLcLT5Jw57l/toJcAze+7Jb0mpPaaPlm4NagZ7RK4E0FiE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=iTXG92GQ; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="iTXG92GQ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712520305; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UpiKXqbWLPjP/NDRVHjpDJdxSVc4DdZOf3OrRONCsyM=; b=iTXG92GQ37HpTPZDEFierqZBV5xaBAd0sq/KlqZL0tmEi3mSuY/I4gtJiVdl81LIN0IXMa hstMoNyNZP4ZN+w4oZZWhkkYubtJFVq95qsbir4qBV9NzCNb7dNRerni+N/urNJb+YEjWb ObHi7+OTaWiAdMmr1FqgUfptMs0FqKU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-678-cCloG6YoNruaRgXDTx-q6w-1; Sun, 07 Apr 2024 16:05:03 -0400 X-MC-Unique: cCloG6YoNruaRgXDTx-q6w-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1432B1887314; Sun, 7 Apr 2024 20:05:03 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.192.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1DF5710060F7; Sun, 7 Apr 2024 20:05:02 +0000 (UTC) From: Hans de Goede To: Adrian Hunter , Ulf Hansson , Mika Westerberg , Andy Shevchenko Cc: Hans de Goede , linux-mmc@vger.kernel.org, linux-gpio@vger.kernel.org Subject: [PATCH 4/6] mmc: sdhci-acpi: Disable UHS/1.8V modes on Lenovo Yoga Tablet 2 series sdcard slot Date: Sun, 7 Apr 2024 22:04:51 +0200 Message-ID: <20240407200453.40829-4-hdegoede@redhat.com> In-Reply-To: <20240407200453.40829-1-hdegoede@redhat.com> References: <20240407200453.40829-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 Unlike all other Bay Trail devices I have (quite a few) the BIOS on the Lenovo Yoga Tablet 2 830 / 1050 and Lenovo Yoga Tablet 2 Pro 1380 (8", 10" and 13") models sets the SDHCI_SUPPORT_DDR50 bit in the sdcard slots' SDHCI controller's Caps_1 register which causes Linux to try and use UHS SDR12 / SDR25 and DDR50 modes on UHS cards. These tablets do have 1.8V signalling implemented in the hw level through the Bay Trail SoC's SD3_1P8EN pin. But trying to use UHS modes leads to lots of errors like these: [ 225.272001] mmc2: Unexpected interrupt 0x04000000. [ 225.272024] mmc2: sdhci: ============ SDHCI REGISTER DUMP =========== [ 225.272034] mmc2: sdhci: Sys addr: 0x0712c400 | Version: 0x0000b502 [ 225.272044] mmc2: sdhci: Blk size: 0x00007200 | Blk cnt: 0x00000007 [ 225.272054] mmc2: sdhci: Argument: 0x00000000 | Trn mode: 0x00000023 [ 225.272064] mmc2: sdhci: Present: 0x01e20002 | Host ctl: 0x00000016 [ 225.272073] mmc2: sdhci: Power: 0x0000000f | Blk gap: 0x00000000 [ 225.272082] mmc2: sdhci: Wake-up: 0x00000000 | Clock: 0x00000107 [ 225.272092] mmc2: sdhci: Timeout: 0x0000000e | Int stat: 0x00000001 [ 225.272101] mmc2: sdhci: Int enab: 0x03ff000b | Sig enab: 0x03ff000b [ 225.272110] mmc2: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000001 [ 225.272119] mmc2: sdhci: Caps: 0x076864b2 | Caps_1: 0x00000004 [ 225.272129] mmc2: sdhci: Cmd: 0x00000c1b | Max curr: 0x00000000 [ 225.272138] mmc2: sdhci: Resp[0]: 0x00000c00 | Resp[1]: 0x00000000 [ 225.272147] mmc2: sdhci: Resp[2]: 0x00000000 | Resp[3]: 0x00000900 [ 225.272155] mmc2: sdhci: Host ctl2: 0x0000000c [ 225.272164] mmc2: sdhci: ADMA Err: 0x00000003 | ADMA Ptr: 0x0712c200 [ 225.272172] mmc2: sdhci: ============================================ Since sdhci_acpi_slot_int_emmc sets SDHCI_QUIRK2_PRESET_VALUE_BROKEN I tried setting that for sdhci_acpi_slot_int_sd too and that does makes things mostly work, but the above error still sometimes happen and regularly access to the card simply freezes for seconds, which are problems which do not happen with the non UHS SDR50 mode. Add a new DMI_QUIRK_SD_NO_1_8_V DMI quirk flag and set that for these tablets to disable sdcard slot UHS modes by setting SDHCI_QUIRK2_NO_1_8_V for the sdcard slot when this quirk is set. Signed-off-by: Hans de Goede --- Note a possible alternative approach would be to simply always set SDHCI_QUIRK2_NO_1_8_V for the sdcard slot on all Bay Trail models but that seems like a bit of a big hammer for a problem only seen on these specific models and maybe there are Bay Trail models out there with working UHS modes for their sdcard slot. --- drivers/mmc/host/sdhci-acpi.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c index c0d77f589deb..233af36d55a9 100644 --- a/drivers/mmc/host/sdhci-acpi.c +++ b/drivers/mmc/host/sdhci-acpi.c @@ -80,7 +80,8 @@ struct sdhci_acpi_host { enum { DMI_QUIRK_RESET_SD_SIGNAL_VOLT_ON_SUSP = BIT(0), DMI_QUIRK_SD_NO_WRITE_PROTECT = BIT(1), - DMI_QUIRK_SD_CD_ACTIVE_HIGH = BIT(2), + DMI_QUIRK_SD_NO_1_8_V = BIT(2), + DMI_QUIRK_SD_CD_ACTIVE_HIGH = BIT(3), }; static inline void *sdhci_acpi_priv(struct sdhci_acpi_host *c) @@ -751,12 +752,15 @@ static const struct dmi_system_id sdhci_acpi_quirks[] = { { /* * Lenovo Yoga Tablet 2 Pro 1380F/L (13" Android version) this - * has broken WP reporting and an inverted CD signal. + * has broken WP reporting, an inverted CD signal and claims + * to support UHS modes but they do not work. * Note this has more or less the same BIOS as the Lenovo Yoga * Tablet 2 830F/L or 1050F/L (8" and 10" Android), but unlike * the 830 / 1050 models which share the same mainboard this * model has a different mainboard and the inverted CD and * broken WP are unique to this board. + * This match for the 13" model MUST come before the 8" + 10" + * match since that one will also match the 13" model! */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "Intel Corp."), @@ -766,7 +770,23 @@ static const struct dmi_system_id sdhci_acpi_quirks[] = { DMI_MATCH(DMI_BIOS_VERSION, "BLADE_21.X64.0005.R00.1504101516"), }, .driver_data = (void *)(DMI_QUIRK_SD_NO_WRITE_PROTECT | - DMI_QUIRK_SD_CD_ACTIVE_HIGH), + DMI_QUIRK_SD_CD_ACTIVE_HIGH | + DMI_QUIRK_SD_NO_1_8_V), + }, + { + /* + * Lenovo Yoga Tablet 2 830F/L or 1050F/L (The 8" and 10" + * Lenovo Yoga Tablet 2 use the same mainboard) These claim + * to support UHS modes but they do not work. + */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Intel Corp."), + DMI_MATCH(DMI_PRODUCT_NAME, "VALLEYVIEW C0 PLATFORM"), + DMI_MATCH(DMI_BOARD_NAME, "BYT-T FFD8"), + /* Partial match on beginning of BIOS version */ + DMI_MATCH(DMI_BIOS_VERSION, "BLADE_21"), + }, + .driver_data = (void *)DMI_QUIRK_SD_NO_1_8_V, }, { /* @@ -904,6 +924,9 @@ static int sdhci_acpi_probe(struct platform_device *pdev) if (quirks & DMI_QUIRK_SD_NO_WRITE_PROTECT) host->mmc->caps2 |= MMC_CAP2_NO_WRITE_PROTECT; + + if (quirks & DMI_QUIRK_SD_NO_1_8_V) + host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V; } err = sdhci_setup_host(host); From patchwork Sun Apr 7 20:04:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 786780 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B5F03DB8C for ; Sun, 7 Apr 2024 20:05:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712520312; cv=none; b=KTPm9l2J4h2s1QjxYlmefK2djcHDiwa99nvNF6SIUbqXUril/5w3ewxOnNaGf4vUoVOr20tqpdcP6nnhwhXxZwdcW5vdeXPlG1bSIA/hlKqhf3fV0kiGb34Q0epUuXju0GqDd4MMrp4XAyQ35QgWIQQK2TSlfgs+g19Z8/KMJo8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712520312; c=relaxed/simple; bh=BkPfyh+/R/SAT/Dw3qhoPfUOKrJzhfKfc9c377XZyUg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gS1XtcAekTztWBe5p57gH8/KjeC0grpm5ezDMTajy5oGqhtIqBs4C8RykEyuH013hwUqFpsFU2PsogyvgXKXGNjQGHY1aAbpx8i5AuUMVfLhz2UXFgaMCx2jxYSxlBJAqaY4kpEClWH3DCEPshrIK26bR8gkH8l7BzGJnm+Q8DQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=BSvJtoGL; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="BSvJtoGL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712520308; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=++mJnVutmsBGOslhKKCtNNUogGbPipdKZBdIb1Fk3GU=; b=BSvJtoGLSEXue5kFqNvNg5x8ewYRuyDCrGeewZvbc3oDI+JAMXs68an5ewlau5C3KNsKyf T4iIdDoC0G0J5jXaVhIhlNy1TlysuXdcOsJo6RCWVrvcitRBqnCQ6RTBg39qLLAzrjux2k 0LGMc6+IjHbL0MbtYefZ91B++Ty1dbI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-287-KMMAlvNSN5KWR5Os3IfTQQ-1; Sun, 07 Apr 2024 16:05:04 -0400 X-MC-Unique: KMMAlvNSN5KWR5Os3IfTQQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 57BBC10113D3; Sun, 7 Apr 2024 20:05:04 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.192.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 61783112132A; Sun, 7 Apr 2024 20:05:03 +0000 (UTC) From: Hans de Goede To: Adrian Hunter , Ulf Hansson , Mika Westerberg , Andy Shevchenko Cc: Hans de Goede , linux-mmc@vger.kernel.org, linux-gpio@vger.kernel.org Subject: [PATCH 5/6] mmc: sdhci-acpi: Disable write protect detection on Toshiba WT10-A Date: Sun, 7 Apr 2024 22:04:52 +0200 Message-ID: <20240407200453.40829-5-hdegoede@redhat.com> In-Reply-To: <20240407200453.40829-1-hdegoede@redhat.com> References: <20240407200453.40829-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 On the Toshiba WT10-A the microSD slot always reports the card being write-protected, just like on the Toshiba WT8-B. Add a DMI quirk to work around this. Signed-off-by: Hans de Goede --- drivers/mmc/host/sdhci-acpi.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c index 233af36d55a9..ff45114bf886 100644 --- a/drivers/mmc/host/sdhci-acpi.c +++ b/drivers/mmc/host/sdhci-acpi.c @@ -799,6 +799,17 @@ static const struct dmi_system_id sdhci_acpi_quirks[] = { }, .driver_data = (void *)DMI_QUIRK_SD_NO_WRITE_PROTECT, }, + { + /* + * The Toshiba WT10-A's microSD slot always reports the card being + * write-protected. + */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), + DMI_MATCH(DMI_PRODUCT_NAME, "TOSHIBA WT10-A"), + }, + .driver_data = (void *)DMI_QUIRK_SD_NO_WRITE_PROTECT, + }, {} /* Terminating entry */ }; From patchwork Sun Apr 7 20:04:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 787059 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF1FF3D993 for ; Sun, 7 Apr 2024 20:05:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712520312; cv=none; b=FHuBMlzmgooM5BL2qdnnRV+exMykkC4dtup//O06o3jSkHmEIYusybmrucoeUrIKOYfKZMBd2mXOsbdal4FhiYt1V1ZBtVad67ZyIkxFW8P8ywr0RoTvneXxkL6BoSmJf9SBZLBafW3q4kLfrcyLg8vROI9xBydtXv+c3crBSLY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712520312; c=relaxed/simple; bh=OgvWH5rFLRMp9/Lp7+rzSqG9q7V8SUbiEUtnbLeyu+Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=he0CP/0a2bv3vBgE9+wI1Ncy9mFfI9gv9QQlCHANXmM9hXgBlBhRUUHeKML9nJ/8aC0gL0I4JFNlv5U3gP9LAw1Y9FSWU7jyeksA7ICB7Q2Mz0QJLP77TucYtgouzmYi2wDEvDnpnEsgSSh5JvNXs4MBsC9yHumImyp1v+dOmSk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=dVOssdUo; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="dVOssdUo" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712520310; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3et/5FeyB/tFG1WRdy6xpIUU4iRwCxKWl6S6XWDRmVs=; b=dVOssdUo7t3ZZ1KUnrK1bUpLQQ/kvLHah5EjGG0/YZM0loYPHDGvJwXWJo+4/kfgvPtFRl xjayEoMVC3Zuys2lh1OyJxs1c6X5nJYuiY5LXJG0sXSFiwhtYDDCtQkTcmQjeMdFpbFUSs MGUZREqSEiVBTYA+dao3+pTNLhwEA5I= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-481-vwPz7Y89M-CRz7H9CGMZzg-1; Sun, 07 Apr 2024 16:05:06 -0400 X-MC-Unique: vwPz7Y89M-CRz7H9CGMZzg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B75BC1C031A4; Sun, 7 Apr 2024 20:05:05 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.192.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 883C4100077A; Sun, 7 Apr 2024 20:05:04 +0000 (UTC) From: Hans de Goede To: Adrian Hunter , Ulf Hansson , Mika Westerberg , Andy Shevchenko Cc: Hans de Goede , linux-mmc@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Nuno_S=C3=A1?= Subject: [PATCH 6/6] mmc: sdhci-acpi: Add quirk to enable pull-up on the card-detect GPIO on Asus T100TA Date: Sun, 7 Apr 2024 22:04:53 +0200 Message-ID: <20240407200453.40829-6-hdegoede@redhat.com> In-Reply-To: <20240407200453.40829-1-hdegoede@redhat.com> References: <20240407200453.40829-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 The card-detect GPIO for the microSD slot on Asus T100TA / T100TAM models stopped working under Linux after commit 6fd03f024828 ("gpiolib: acpi: support bias pull disable"). The GPIO in question is connected to a mechanical switch in the slot which shorts the pin to GND when a card is inserted. The GPIO pin correctly gets configured with a 20K pull-up by the BIOS, but there is a bug in the DSDT where the GpioInt for the card-detect is configured with a NoPull setting: GpioInt (Edge, ActiveBoth, SharedAndWake, PullNone, 0x2710, "\\_SB.GPO0", 0x00, ResourceConsumer, , ) { // Pin list 0x0026 } Linux now actually honors the PullNone setting and disables the 20K pull-up configured by the BIOS. Add a new DMI_QUIRK_SD_CD_ENABLE_PULL_UP quirk which when set calls mmc_gpiod_set_cd_config() to re-enable the pull-up and set this for the Asus T100TA models to fix this. Cc: Nuno Sá Fixes: 6fd03f024828 ("gpiolib: acpi: support bias pull disable") Signed-off-by: Hans de Goede --- drivers/mmc/host/sdhci-acpi.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c index ff45114bf886..2450617e99f0 100644 --- a/drivers/mmc/host/sdhci-acpi.c +++ b/drivers/mmc/host/sdhci-acpi.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -82,6 +83,7 @@ enum { DMI_QUIRK_SD_NO_WRITE_PROTECT = BIT(1), DMI_QUIRK_SD_NO_1_8_V = BIT(2), DMI_QUIRK_SD_CD_ACTIVE_HIGH = BIT(3), + DMI_QUIRK_SD_CD_ENABLE_PULL_UP = BIT(4), }; static inline void *sdhci_acpi_priv(struct sdhci_acpi_host *c) @@ -735,6 +737,14 @@ static const struct dmi_system_id sdhci_acpi_quirks[] = { }, .driver_data = (void *)DMI_QUIRK_SD_NO_WRITE_PROTECT, }, + { + /* Asus T100TA, needs pull-up for cd but DSDT GpioInt has NoPull set */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "T100TA"), + }, + .driver_data = (void *)DMI_QUIRK_SD_CD_ENABLE_PULL_UP, + }, { /* * The Lenovo Miix 320-10ICR has a bug in the _PS0 method of @@ -928,7 +938,9 @@ static int sdhci_acpi_probe(struct platform_device *pdev) goto err_free; dev_warn(dev, "failed to setup card detect gpio\n"); c->use_runtime_pm = false; - } + } else if (quirks & DMI_QUIRK_SD_CD_ENABLE_PULL_UP) + mmc_gpiod_set_cd_config(host->mmc, + PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_UP, 20000)); if (quirks & DMI_QUIRK_RESET_SD_SIGNAL_VOLT_ON_SUSP) c->reset_signal_volt_on_suspend = true;