From: "Raju P.L.S.S.S.N" <rplsssn@codeaurora.org>
To: andy.gross@linaro.org, david.brown@linaro.org,
linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org
Cc: rnayak@codeaurora.org, bjorn.andersson@linaro.org,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
sboyd@kernel.org, evgreen@chromium.org, dianders@chromium.org,
mka@chromium.org, ilina@codeaurora.org,
"Raju P.L.S.S.S.N" <rplsssn@codeaurora.org>
Subject: [PATCH RFC 4/5] drivers: qcom: rpmh-pdc-timer: Add power management ops
Date: Fri, 21 Dec 2018 17:29:45 +0530 [thread overview]
Message-ID: <20181221115946.10095-5-rplsssn@codeaurora.org> (raw)
In-Reply-To: <20181221115946.10095-1-rplsssn@codeaurora.org>
Add suspend power management ops so that the PDC timer is programmed
to highest match value when system is suspended.
Signed-off-by: Raju P.L.S.S.S.N <rplsssn@codeaurora.org>
---
drivers/soc/qcom/Kconfig | 2 +-
drivers/soc/qcom/rpmh-pdc-timer.c | 24 ++++++++++++++++++++++++
2 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig
index d04724ea5490..c6ef41a06c97 100644
--- a/drivers/soc/qcom/Kconfig
+++ b/drivers/soc/qcom/Kconfig
@@ -105,7 +105,7 @@ config QCOM_RPMH
config QCOM_RPMH_PDC_TIMER
bool "Qualcomm PDC Timer for RPM-Hardened based SoCs"
- depends on CPU_PM
+ depends on CPU_PM && PM_SLEEP
help
Support for QCOM platform next wakeup timer programming when
application processor enters SoC level deepest low power mode.
diff --git a/drivers/soc/qcom/rpmh-pdc-timer.c b/drivers/soc/qcom/rpmh-pdc-timer.c
index 108ea4a2df89..ebb643924a3e 100644
--- a/drivers/soc/qcom/rpmh-pdc-timer.c
+++ b/drivers/soc/qcom/rpmh-pdc-timer.c
@@ -23,6 +23,7 @@ static resource_size_t cmd0_data_offset;
static resource_size_t cmd1_data_offset;
static uint64_t pdc_wakeup = ~0ULL;
static raw_spinlock_t pdc_wakeup_lock;
+static int suspended;
/* convert micro sec to ticks or clock cycles
*
@@ -102,6 +103,9 @@ static int cpu_pm_notifier(struct notifier_block *b,
{
uint64_t cpu_next_wakeup;
+ if (suspended)
+ return NOTIFY_DONE;
+
switch (cmd) {
case CPU_PM_ENTER:
cpu_next_wakeup = get_next_wakeup_cycles(smp_processor_id());
@@ -130,6 +134,25 @@ static struct notifier_block cpu_pm_notifier_block = {
.priority = -1, /* Should be last in the order of notifications */
};
+static int pdc_timer_suspend(struct device *dev)
+{
+ suspended = true;
+ raw_spin_lock(&pdc_wakeup_lock);
+ pdc_wakeup = ~0ULL;
+ setup_pdc_wakeup_timer(pdc_wakeup);
+ raw_spin_unlock(&pdc_wakeup_lock);
+ return 0;
+}
+
+static int pdc_timer_resume(struct device *dev)
+{
+ suspended = false;
+ return 0;
+}
+static const struct dev_pm_ops pdc_timer_dev_pm_ops = {
+ SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(pdc_timer_suspend, pdc_timer_resume)
+};
+
static int pdc_timer_probe(struct platform_device *pdev)
{
struct device *pdc_timer_dev = &pdev->dev;
@@ -176,6 +199,7 @@ static struct platform_driver pdc_timer_driver = {
.driver = {
.name = KBUILD_MODNAME,
.of_match_table = pdc_timer_drv_match,
+ .pm = &pdc_timer_dev_pm_ops,
},
};
builtin_platform_driver(pdc_timer_driver);
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of the Code Aurora Forum, hosted by The Linux Foundation.
next prev parent reply other threads:[~2018-12-21 11:59 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-21 11:59 [PATCH RFC 0/5] Add support for PDC timer for wake-ups Raju P.L.S.S.S.N
2018-12-21 11:59 ` [PATCH RFC 1/5] drivers: qcom: rpmh-rsc: Add regmap for RSC controller Raju P.L.S.S.S.N
2018-12-21 11:59 ` [PATCH RFC 2/5] drivers: qcom: rpmh-pdc-timer: add PDC timer support for RPMH based SoCs Raju P.L.S.S.S.N
2018-12-21 11:59 ` [PATCH RFC 3/5] dt-bindings: Add PDC timer bindings for Qualcomm SoCs Raju P.L.S.S.S.N
2018-12-22 7:39 ` Stephen Boyd
2018-12-26 9:44 ` Raju P L S S S N
2018-12-28 21:38 ` Stephen Boyd
2019-01-03 12:22 ` Raju P L S S S N
2019-01-03 21:19 ` Stephen Boyd
2019-01-07 16:17 ` Raju P L S S S N
2019-01-09 5:34 ` Raju P L S S S N
2019-01-09 17:46 ` Stephen Boyd
2019-01-10 16:58 ` Raju P L S S S N
2019-01-10 21:27 ` Stephen Boyd
2018-12-21 11:59 ` Raju P.L.S.S.S.N [this message]
2018-12-21 11:59 ` [PATCH RFC 5/5] arm64: dts: msm: add PDC timer for apps_rsc for SDM845 Raju P.L.S.S.S.N
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=20181221115946.10095-5-rplsssn@codeaurora.org \
--to=rplsssn@codeaurora.org \
--cc=andy.gross@linaro.org \
--cc=bjorn.andersson@linaro.org \
--cc=david.brown@linaro.org \
--cc=dianders@chromium.org \
--cc=evgreen@chromium.org \
--cc=ilina@codeaurora.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-soc@vger.kernel.org \
--cc=mka@chromium.org \
--cc=rnayak@codeaurora.org \
--cc=sboyd@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;
as well as URLs for NNTP newsgroup(s).