void-packages/srcpkgs/pinebookpro-kernel/patches/0004-mmc-core-pwrseq_simple-disable-mmc-power-on-shutdown.patch
2020-12-03 17:49:48 -03:00

64 lines
2.1 KiB
Diff

From 43f1e05b9b660d3d4763ebc406ef5ea667ba64f9 Mon Sep 17 00:00:00 2001
From: Tobias Schramm <t.schramm@manjaro.org>
Date: Thu, 28 May 2020 14:16:52 +0200
Subject: [PATCH 4/8] mmc: core: pwrseq_simple: disable mmc power on shutdown
Fix for Broadcom SDIO WiFi modules. They misbehave if reinitialized
without a power cycle.
Signed-off-by: Tobias Schramm <t.schramm@manjaro.org>
---
drivers/mmc/core/pwrseq_simple.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c
index ea4d3670560e..38fe7e29aba6 100644
--- a/drivers/mmc/core/pwrseq_simple.c
+++ b/drivers/mmc/core/pwrseq_simple.c
@@ -80,10 +80,8 @@ static void mmc_pwrseq_simple_post_power_on(struct mmc_host *host)
msleep(pwrseq->post_power_on_delay_ms);
}
-static void mmc_pwrseq_simple_power_off(struct mmc_host *host)
+static void __mmc_pwrseq_simple_power_off(struct mmc_pwrseq_simple *pwrseq)
{
- struct mmc_pwrseq_simple *pwrseq = to_pwrseq_simple(host->pwrseq);
-
mmc_pwrseq_simple_set_gpios_value(pwrseq, 1);
if (pwrseq->power_off_delay_us)
@@ -96,6 +94,12 @@ static void mmc_pwrseq_simple_power_off(struct mmc_host *host)
}
}
+static void mmc_pwrseq_simple_power_off(struct mmc_host *host)
+{
+ struct mmc_pwrseq_simple *pwrseq = to_pwrseq_simple(host->pwrseq);
+ __mmc_pwrseq_simple_power_off(pwrseq);
+}
+
static const struct mmc_pwrseq_ops mmc_pwrseq_simple_ops = {
.pre_power_on = mmc_pwrseq_simple_pre_power_on,
.post_power_on = mmc_pwrseq_simple_post_power_on,
@@ -151,9 +155,18 @@ static int mmc_pwrseq_simple_remove(struct platform_device *pdev)
return 0;
}
+static void mmc_pwrseq_simple_shutdown(struct platform_device *pdev)
+{
+ struct mmc_pwrseq_simple *pwrseq = platform_get_drvdata(pdev);
+
+ dev_info(&pdev->dev, "Turning off mmc\n");
+ __mmc_pwrseq_simple_power_off(pwrseq);
+}
+
static struct platform_driver mmc_pwrseq_simple_driver = {
.probe = mmc_pwrseq_simple_probe,
.remove = mmc_pwrseq_simple_remove,
+ .shutdown = mmc_pwrseq_simple_shutdown,
.driver = {
.name = "pwrseq_simple",
.of_match_table = mmc_pwrseq_simple_of_match,
--
2.28.0