From: Kaiwei Liu <kaiwei.liu@unisoc.com>
To: Vinod Koul <vkoul@kernel.org>, Orson Zhai <orsonzhai@gmail.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Chunyan Zhang <zhang.lyra@gmail.com>
Cc: <dmaengine@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
kaiwei liu <liukaiwei086@gmail.com>,
Wenming Wu <wenming.wu@unisoc.com>
Subject: [PATCH 5/5] dma: add relative interface to support deep sleep
Date: Mon, 7 Aug 2023 13:20:56 +0800 [thread overview]
Message-ID: <20230807052056.2963-1-kaiwei.liu@unisoc.com> (raw)
The DMA doesn't support deep sleep before, here add
relative interface in deep sleep framework.
Signed-off-by: Kaiwei Liu <kaiwei.liu@unisoc.com>
---
drivers/dma/sprd-dma.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c
index 41d427df5098..b1dbbc5f4e70 100644
--- a/drivers/dma/sprd-dma.c
+++ b/drivers/dma/sprd-dma.c
@@ -1339,10 +1339,30 @@ static int __maybe_unused sprd_dma_runtime_resume(struct device *dev)
return ret;
}
+static int sprd_dma_suspend_noirq(struct device *dev)
+{
+ if ((pm_runtime_status_suspended(dev)) ||
+ (atomic_read(&(dev->power.usage_count)) > 1))
+ return 0;
+
+ return sprd_dma_runtime_suspend(dev);
+}
+
+static int sprd_dma_resume_early(struct device *dev)
+{
+ if ((pm_runtime_status_suspended(dev)) ||
+ (atomic_read(&(dev->power.usage_count)) > 1))
+ return 0;
+
+ return sprd_dma_runtime_resume(dev);
+}
+
static const struct dev_pm_ops sprd_dma_pm_ops = {
SET_RUNTIME_PM_OPS(sprd_dma_runtime_suspend,
sprd_dma_runtime_resume,
NULL)
+ SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(sprd_dma_suspend_noirq,
+ sprd_dma_resume_early)
};
static struct platform_driver sprd_dma_driver = {
--
2.17.1
reply other threads:[~2023-08-07 5:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230807052056.2963-1-kaiwei.liu@unisoc.com \
--to=kaiwei.liu@unisoc.com \
--cc=baolin.wang@linux.alibaba.com \
--cc=dmaengine@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liukaiwei086@gmail.com \
--cc=orsonzhai@gmail.com \
--cc=vkoul@kernel.org \
--cc=wenming.wu@unisoc.com \
--cc=zhang.lyra@gmail.com \
/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
all inboxes | Powered by JetHome®