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: 787099 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 7E4823D971 for ; Sun, 7 Apr 2024 20:05:02 +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=1712520304; cv=none; b=q5hFUK1HviJMw2jE2vwjIugvyRvz+6cdf5YmREQ/u18t2/nrCRA1bvNsvldNwy4xzKlwfxuf1bTpy97+Xxu+GyMaxXEx61/1mRIclkEat23U/C7YrOlcOJylNo+KiaYptqk3nc9qYU2KqNd8GLMM+79xyvvotZ9wjxxiNAY/I28= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712520304; c=relaxed/simple; bh=hCMJGweq7tU8hlD93B81yze3RHJwnGhyXr4H8YVnHpE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=FzlCfulpvEu3jwqFDTgF/JBNyqRU0Ypx2Rpvo4GtSpWgJFiQMIg6SgDUIgGRQLMZKYJtxueI056bsKJ9/77oA/3wayRCdtjBLQE7Lj+euYZCvMVxOXwuGb/S88BTya0ZPgIRjnJfTZfxUOHH7jPE8cD+Amnb2YONZ+POEwa49q8= 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=ATAnZjfM; 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="ATAnZjfM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712520301; 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=ATAnZjfMq7Y3UdZ0O4hwerBMqeQzTH7m2U254w94U5zr0p+41DO3KRiKJoMTJBw9vIogIA RXZiNZ4oU8+H0ArXSOaNMq6FFTTWNQV5iROo5UDPuD/tuhWdYo5305+resPyehulBQoQDJ b2poXWadC03lwSSnTR1EjKOHqy420bk= 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-mmc@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: 786789 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 A9F823D971 for ; Sun, 7 Apr 2024 20:05:04 +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=1712520306; cv=none; b=KJVi7IDWF+OFxfuVZvFYgXw34TYhGwIM9QiMP0xRLMnXZ9f4wjTITBfos9r6txMogrAtK7oNUYDz4OmFLir7++ECoctEMS1bXT1lmNr/QO42X1UtV2X6/MwxTfSeXwl6ScPAdpJBe0DT3JLIdiM7TPCy5Pq3oXBzS8sayRUL9JI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712520306; c=relaxed/simple; bh=upMUJveLAYrZFBF6DFvlvMPvK8XcF4uLJEsPWzW6Muw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kKEqBpTIUMjSaa+Ufg9lS0Cimq+vQQWksjfvjs7sO9NmishyhzxtHV90Xk3XFsSh4Gljw4MB1yz2pPlvAk/cDfMjjCJPdBrvigr4kk5LT/jMNT1Ux77VqhkoxUWRLXP4IjfPKamZIPyukA+JAMexQuC1aSmCvI6kf42f9yX0RVs= 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=D+n7tuoR; 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="D+n7tuoR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712520303; 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=D+n7tuoRB1jcR+IQiXe3CQ/N/FO2VM9wUsNrb0v5u2y2AICQ00bHGS5EB5tBQSkBtZa6Ro vbn4uJudaZhiYTL2XElVUikMaFsO8CaAxJEknMFbrP8i0GYZB6LmGcXnsX280uWhmVLbvo Ckb+I7COfX2P3Mh5bj0vnCuf2woZ1xE= 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-mmc@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: 787098 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 107143E46D 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-mmc@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: 787097 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 BD9ED3D993 for ; Sun, 7 Apr 2024 20:05:08 +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=1712520310; cv=none; b=azJ4ZRs44pNiaXIiQF8cMY0bq3hdgQM50SEewR/CRH34d+8hDx30KW5kBrafk1G41ev8dSYwNaHYZj78ny10AGad/rXjbQh8uYqntdQGSELZxgURQI2tWjnlvMX02pR34gBGyR6A03PrKzIUXPihdFQOOq42NwtbeC8S6VLwaVY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712520310; c=relaxed/simple; bh=UWdlP9A4xBUMKpZnsnnlf89phasUQ7E1xv/QTD+EX8M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GvNjgqUZmNsj8UHi6UmPeajF/Q61O5jVBk5sCXWTn0NORNWSyEZsrddqUXXC0DrtGty2ltIZHrhTC1A/FGcZ3eI998RAZdcB3Px4x/nMvf/jZ+vMxCIfNVkw1t9c7WTFHmo8SlkgWjYN1FAK2vwfwzZEDvTX6cZQxdhvWhx/xR8= 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=X/wrgzHc; 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="X/wrgzHc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712520307; 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=X/wrgzHc0V5EMj82KE03cpPxA6hsz3TOXivJx393qJM7y+Z80d4DsN0JhnW1fPOCJ+LcSC pLosmWJ0BOBjIeflViKopc29ph3GFxa3v9+Hv+nL8uo9ztFJ3NEK0aMZnOrpOMCQOOsw1u Y2nKnLZmxf27YI/Hl5v99MH00mXex2A= 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-mmc@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: 786788 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 6254E3D569 for ; Sun, 7 Apr 2024 20:05:08 +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=1712520309; cv=none; b=TSZsF3Qxrqk4k7HF9x7gZXsjAQIeF6bOugXEPJ8Sndba6HUEmjwItXIzBlOcqjHdkaOIHELo9mevaB/EPKVCgD0tQg8teqUoBlOlrSIGjTegTHGLlNh857dFsFnBO3I+otIUTZbZbZ/sRjQU4AC+9ZPQzRRHCzRGLo0Jaq7V1/o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712520309; c=relaxed/simple; bh=BkPfyh+/R/SAT/Dw3qhoPfUOKrJzhfKfc9c377XZyUg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Vwj70+zykjVK0fxQujM/hz+dK2Z4F41ik6mYjX8Ad10mTHAV1bztqBu++FERaU/HXP0z/Hg4C9evil825hA4Ti/mxtinmhsducUs5XzRcCqjAdfFcn8JG/TAho8LKVKZfne1uXXlOads8H9f8Z6TGx/R8+ykgWzz6Xp2GaQVfJo= 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=a41Kbowh; 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="a41Kbowh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712520307; 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=a41KbowhYY9125BgfRhJMfyAOvRHtkPr1OPGyP+51GJSWg3ZuH+xIGAB1pvlhi09zunXHA BNHliYOiji4vPekVtU9KFyGJ6AiaJSLaT7MWypQcl8eLPtMbBwMmlHtHoZrHY87EfJYpR6 mau1Ci/xPFGpX0UWWm8Nnlks1p8cz+M= 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-mmc@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: 786787 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 EDAD23DB86 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-mmc@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;