linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: bjorn.andersson@sonymobile.com (Bjorn Andersson)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC 1/2] mfd: qcom-rpm: Expose sleep state resources to clients
Date: Mon, 10 Nov 2014 14:52:45 -0800	[thread overview]
Message-ID: <1415659966-16200-2-git-send-email-bjorn.andersson@sonymobile.com> (raw)
In-Reply-To: <1415659966-16200-1-git-send-email-bjorn.andersson@sonymobile.com>

Resources exposed from the RPM have an "active state" that is used during
normal operations and a "sleep state" that is used for HW assisted sleep
modes. Expose this in the api to let client drivers set the "sleep
state" as well.

Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
---
 drivers/mfd/qcom_rpm.c                 |    9 +++++----
 drivers/regulator/qcom_rpm-regulator.c |    1 +
 include/linux/mfd/qcom_rpm.h           |    5 ++++-
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/qcom_rpm.c b/drivers/mfd/qcom_rpm.c
index 0dd7a6fe..f696328 100644
--- a/drivers/mfd/qcom_rpm.c
+++ b/drivers/mfd/qcom_rpm.c
@@ -67,7 +67,6 @@ struct qcom_rpm {
 #define RPM_ACK_SELECTOR	23
 #define RPM_SELECT_SIZE		7
 
-#define RPM_ACTIVE_STATE	BIT(0)
 #define RPM_NOTIFICATION	BIT(30)
 #define RPM_REJECTED		BIT(31)
 
@@ -332,7 +331,10 @@ static const struct of_device_id qcom_rpm_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, qcom_rpm_of_match);
 
-int qcom_rpm_write(struct qcom_rpm *rpm, int resource, u32 *buf, size_t count)
+int qcom_rpm_write(struct qcom_rpm *rpm,
+		   int state,
+		   int resource,
+		   u32 *buf, size_t count)
 {
 	const struct qcom_rpm_resource *res;
 	const struct qcom_rpm_data *data = rpm->data;
@@ -359,8 +361,7 @@ int qcom_rpm_write(struct qcom_rpm *rpm, int resource, u32 *buf, size_t count)
 			       RPM_CTRL_REG(rpm, RPM_REQ_SELECT + i));
 	}
 
-	writel_relaxed(RPM_ACTIVE_STATE,
-		       RPM_CTRL_REG(rpm, RPM_REQUEST_CONTEXT));
+	writel_relaxed(BIT(state), RPM_CTRL_REG(rpm, RPM_REQUEST_CONTEXT));
 
 	reinit_completion(&rpm->ack);
 	regmap_write(rpm->ipc_regmap, rpm->ipc_offset, BIT(rpm->ipc_bit));
diff --git a/drivers/regulator/qcom_rpm-regulator.c b/drivers/regulator/qcom_rpm-regulator.c
index b55cd5b..4fc1c7e 100644
--- a/drivers/regulator/qcom_rpm-regulator.c
+++ b/drivers/regulator/qcom_rpm-regulator.c
@@ -198,6 +198,7 @@ static int rpm_reg_write(struct qcom_rpm_reg *vreg,
 	vreg->val[req->word] |= value << req->shift;
 
 	return qcom_rpm_write(vreg->rpm,
+			      RPM_ACTIVE_STATE,
 			      vreg->resource,
 			      vreg->val,
 			      vreg->parts->request_len);
diff --git a/include/linux/mfd/qcom_rpm.h b/include/linux/mfd/qcom_rpm.h
index a60798d..f0e70b2 100644
--- a/include/linux/mfd/qcom_rpm.h
+++ b/include/linux/mfd/qcom_rpm.h
@@ -5,6 +5,9 @@
 
 struct qcom_rpm;
 
-int qcom_rpm_write(struct qcom_rpm *rpm, int resource, u32 *buf, size_t count);
+#define RPM_ACTIVE_STATE	0
+#define RPM_SLEEP_STATE		1
+
+int qcom_rpm_write(struct qcom_rpm *rpm, int state, int resource, u32 *buf, size_t count);
 
 #endif
-- 
1.7.9.5

  reply	other threads:[~2014-11-10 22:52 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-10 22:52 [RFC 0/2] Qualcomm RPM sleep states Bjorn Andersson
2014-11-10 22:52 ` Bjorn Andersson [this message]
2014-11-11 12:04   ` [RFC 1/2] mfd: qcom-rpm: Expose sleep state resources to clients Lee Jones
2014-11-11 18:33     ` Bjorn Andersson
2014-11-12  9:52       ` Lee Jones
2014-11-12 14:45         ` Lina Iyer
2014-11-12 19:23           ` Bjorn Andersson
2014-11-19 18:06             ` Lina Iyer
2014-11-12 19:55         ` Bjorn Andersson
2014-11-10 22:52 ` [RFC 2/2] regulator: qcom-rpm: Implement RPM assisted disable Bjorn Andersson
2014-11-11  9:11   ` Andreas Färber
2014-11-11 18:34     ` Bjorn Andersson
2014-11-11 11:59   ` Lee Jones
2014-11-11 18:39     ` Bjorn Andersson
2014-11-11 14:21   ` Javier Martinez Canillas
2014-11-11 19:23     ` Bjorn Andersson
2014-11-21 23:10 ` [RFC 0/2] Qualcomm RPM sleep states Stephen Boyd
2014-11-21 23:27   ` Mark Brown
2014-11-21 23:43     ` Stephen Boyd
2014-11-21 23:54       ` Mark Brown
2014-11-22  0:03         ` Stephen Boyd
2014-11-22  0:16         ` Bjorn Andersson
2014-11-24 18:16       ` Mark Brown
2014-11-24 21:19         ` Stephen Boyd
2014-11-25 20:44           ` Mark Brown
2014-11-26  1:02             ` Stephen Boyd
2014-11-26 13:40               ` Mark Brown
2014-11-27  1:51                 ` Stephen Boyd
2014-11-27 18:56                   ` Mark Brown
2014-11-26 23:34             ` Bjorn Andersson
2014-11-27 19:02               ` Mark Brown
2014-11-27 19:42                 ` Bjorn Andersson
2014-11-28 20:16                   ` Mark Brown
2014-12-04 21:15                     ` Stephen Boyd
2014-12-08 18:06                       ` Bjorn Andersson
2014-12-08 19:39                         ` Mark Brown
2014-12-08 20:55                           ` Bjorn Andersson
2014-12-09 18:16                             ` Mark Brown
2014-12-09 19:25                               ` Bjorn Andersson
2014-12-09 20:28                                 ` Mark Brown
2014-12-11 22:36                                   ` Bjorn Andersson
2014-12-15 18:04                                     ` Mark Brown
2014-12-16  6:05                                       ` Bjorn Andersson
2014-12-26 17:09                                         ` Mark Brown
2014-12-29 21:54                                           ` Bjorn Andersson
2014-12-30 16:43                                             ` Mark Brown
2014-11-24 17:02   ` Bjorn Andersson
2014-11-24 21:19     ` Stephen Boyd
2014-11-24 21:59       ` Bjorn Andersson
2014-11-25  0:02         ` Stephen Boyd
2014-11-26 22:49           ` Bjorn Andersson

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=1415659966-16200-2-git-send-email-bjorn.andersson@sonymobile.com \
    --to=bjorn.andersson@sonymobile.com \
    --cc=linux-arm-kernel@lists.infradead.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).