From: Stefan Wahren <wahrenst@gmx.net>
To: Russell King <linux@armlinux.org.uk>,
Florian Fainelli <florian.fainelli@broadcom.com>,
Ray Jui <rjui@broadcom.com>,
Scott Branden <sbranden@broadcom.com>,
Vinod Koul <vkoul@kernel.org>,
Ulf Hansson <ulf.hansson@linaro.org>,
Minas Harutyunyan <hminas@synopsys.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Lukas Wunner <lukas@wunner.de>,
Peter Robinson <pbrobinson@gmail.com>,
linux-arm-kernel@lists.infradead.org,
kernel-list@raspberrypi.com,
bcm-kernel-feedback-list@broadcom.com, dmaengine@vger.kernel.org,
linux-mmc@vger.kernel.org, linux-usb@vger.kernel.org,
Stefan Wahren <wahrenst@gmx.net>
Subject: [PATCH 5/9] mmc: bcm2835: add suspend/resume pm support
Date: Thu, 24 Oct 2024 22:18:33 +0200 [thread overview]
Message-ID: <20241024201837.79927-6-wahrenst@gmx.net> (raw)
In-Reply-To: <20241024201837.79927-1-wahrenst@gmx.net>
Add a minimalistic suspend/resume PM support.
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
drivers/mmc/host/bcm2835.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c
index 107666b7c1c8..17c327b7b5cc 100644
--- a/drivers/mmc/host/bcm2835.c
+++ b/drivers/mmc/host/bcm2835.c
@@ -1343,6 +1343,30 @@ static int bcm2835_add_host(struct bcm2835_host *host)
return 0;
}
+static int bcm2835_suspend(struct device *dev)
+{
+ struct bcm2835_host *host = dev_get_drvdata(dev);
+
+ if (!host->data_complete) {
+ dev_warn(dev, "Suspend is prevented\n");
+ return -EBUSY;
+ }
+
+ clk_disable_unprepare(host->clk);
+
+ return 0;
+}
+
+static int bcm2835_resume(struct device *dev)
+{
+ struct bcm2835_host *host = dev_get_drvdata(dev);
+
+ return clk_prepare_enable(host->clk);
+}
+
+static DEFINE_SIMPLE_DEV_PM_OPS(bcm2835_pm_ops, bcm2835_suspend,
+ bcm2835_resume);
+
static int bcm2835_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -1471,6 +1495,7 @@ static struct platform_driver bcm2835_driver = {
.name = "sdhost-bcm2835",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
.of_match_table = bcm2835_match,
+ .pm = pm_ptr(&bcm2835_pm_ops),
},
};
module_platform_driver(bcm2835_driver);
--
2.34.1
next prev parent reply other threads:[~2024-10-24 20:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-24 20:18 [PATCH V4 0/9] ARM: bcm2835: Implement initial S2Idle for Raspberry Pi Stefan Wahren
2024-10-24 20:18 ` [PATCH 1/9] Revert "usb: dwc2: Skip clock gating on Broadcom SoCs" Stefan Wahren
2024-10-24 20:18 ` [PATCH 2/9] dmaengine: bcm2835-dma: add suspend/resume pm support Stefan Wahren
2024-10-24 20:18 ` [PATCH 3/9] mmc: bcm2835: Fix type of current clock speed Stefan Wahren
2024-10-24 20:18 ` [PATCH 4/9] mmc: bcm2835: Introduce proper clock handling Stefan Wahren
2024-10-24 20:18 ` Stefan Wahren [this message]
2024-10-24 20:18 ` [PATCH 6/9] usb: dwc2: gadget: Introduce register restore flags Stefan Wahren
2024-10-24 20:18 ` [PATCH 7/9] usb: dwc2: Refactor backup/restore of registers Stefan Wahren
2024-10-24 20:18 ` [PATCH 8/9] usb: dwc2: Implement recovery after PM domain off Stefan Wahren
2024-10-24 20:18 ` [PATCH 9/9] ARM: bcm2835_defconfig: Enable SUSPEND Stefan Wahren
2024-10-24 20:21 ` [PATCH V4 0/9] ARM: bcm2835: Implement initial S2Idle for Raspberry Pi Stefan Wahren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241024201837.79927-6-wahrenst@gmx.net \
--to=wahrenst@gmx.net \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=dmaengine@vger.kernel.org \
--cc=florian.fainelli@broadcom.com \
--cc=gregkh@linuxfoundation.org \
--cc=hminas@synopsys.com \
--cc=kernel-list@raspberrypi.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=lukas@wunner.de \
--cc=pbrobinson@gmail.com \
--cc=rjui@broadcom.com \
--cc=sbranden@broadcom.com \
--cc=ulf.hansson@linaro.org \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox