public inbox for linux-arm-kernel@lists.infradead.org 
 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: Wed, 12 Nov 2014 11:23:43 -0800	[thread overview]
Message-ID: <20141112192342.GA19703@sonymobile.com> (raw)
In-Reply-To: <20141112144508.GD45276@linaro.org>

On Wed 12 Nov 06:45 PST 2014, Lina Iyer wrote:

> On Wed, Nov 12 2014 at 02:52 -0700, Lee Jones wrote:
> >On Tue, 11 Nov 2014, Bjorn Andersson wrote:
> >
> >> On Tue 11 Nov 04:04 PST 2014, Lee Jones wrote:
> >>
> >> > On Mon, 10 Nov 2014, Bjorn Andersson wrote:
> >> >
> 
> > > > +	writel_relaxed(BIT(state), RPM_CTRL_REG(rpm, RPM_REQUEST_CONTEXT));
> >> >
> >> > How are the state bits organised?
> >> >
> >>
> >> BIT(0) is active mode, BIT(1) is sleep mode, as specified below. I could add
> >> some sanity checking here if you would like to.
> >
> >I'm just double checking that you know what that means.
> >
> >BIT(0) == b01
> >BIT(1) == b10
> >
> >It seems strange to represent a single boolean state over 2 bits.
> >
> >Also, what happens if b11 or b00 occurs?
> >
> Lee is correct, it should be 0 for Active and 1 for Sleep set. 
> 

In the caf msm-3.4 tree the regulator core will call e.g. vreg_set_voltage()
that will call vreg_set(), that will call msm_rpm_set(MSM_RPM_CTX_SET_0,...).
That comes from the following:

enum {
	MSM_RPM_CTX_SET_0,
	MSM_RPM_CTX_SET_SLEEP,
	MSM_RPM_CTX_SET_COUNT,

	MSM_RPM_CTX_NOTIFICATION = 30,
	MSM_RPM_CTX_REJECTED = 31,
};

So there's your 0 and 1.

msm_rpm_set() calls msm_rpm_set_common() that calls msm_rpm_set_exclusive()
that contains these two statements:

        uint32_t ctx_mask = msm_rpm_get_ctx_mask(ctx);
	...
	msm_rpm_write(MSM_RPM_PAGE_CTRL, target_ctrl(MSM_RPM_CTRL_REQ_CTX_0), ctx_mask);

And we have:

static inline uint32_t msm_rpm_get_ctx_mask(unsigned int ctx)
{
	return 1UL << ctx;
}

So, as far as I can see it should be BIT(state) here. But there's a lot of code
and a lot of indirections here and I've been tricked by it before, so please
let me know if I got something wrong on the way.

Regards,
Bjorn

  reply	other threads:[~2014-11-12 19:23 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 ` [RFC 1/2] mfd: qcom-rpm: Expose sleep state resources to clients Bjorn Andersson
2014-11-11 12:04   ` 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 [this message]
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=20141112192342.GA19703@sonymobile.com \
    --to=bjorn.andersson@sonymobile$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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