From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lee Jones Subject: Re: [RFC 1/2] mfd: qcom-rpm: Expose sleep state resources to clients Date: Wed, 12 Nov 2014 09:52:00 +0000 Message-ID: <20141112095200.GD24004@x1> References: <1415659966-16200-1-git-send-email-bjorn.andersson@sonymobile.com> <1415659966-16200-2-git-send-email-bjorn.andersson@sonymobile.com> <20141111120457.GZ24004@x1> <20141111183319.GD16980@sonymobile.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Received: from mail-ig0-f169.google.com ([209.85.213.169]:38448 "EHLO mail-ig0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752187AbaKLJwG (ORCPT ); Wed, 12 Nov 2014 04:52:06 -0500 Received: by mail-ig0-f169.google.com with SMTP id hn18so2676491igb.2 for ; Wed, 12 Nov 2014 01:52:05 -0800 (PST) Content-Disposition: inline In-Reply-To: <20141111183319.GD16980@sonymobile.com> Sender: linux-arm-msm-owner@vger.kernel.org List-Id: linux-arm-msm@vger.kernel.org To: Bjorn Andersson Cc: Stephen Boyd , David Collins , Lina Iyer , Mark Brown , "linux-arm-kernel@lists.infradead.org" , "linux-arm-msm@vger.kernel.org" On Tue, 11 Nov 2014, Bjorn Andersson wrote: > On Tue 11 Nov 04:04 PST 2014, Lee Jones wrote: >=20 > > On Mon, 10 Nov 2014, Bjorn Andersson wrote: > >=20 > > > Resources exposed from the RPM have an "active state" that is use= d during > > > normal operations and a "sleep state" that is used for HW assiste= d sleep > > > modes. Expose this in the api to let client drivers set the "slee= p > > > state" as well. > >=20 > > I assume you have users lined up which will request a sleeping stat= e? > >=20 >=20 > All users of this interface (regulators, clocks and bus scaling) will= have to > be able to specify this. >=20 > [..] > > > @@ -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)); > > > } > > > =20 > > > - writel_relaxed(RPM_ACTIVE_STATE, > > > - RPM_CTRL_REG(rpm, RPM_REQUEST_CONTEXT)); > > > + writel_relaxed(BIT(state), RPM_CTRL_REG(rpm, RPM_REQUEST_CONTEX= T)); > >=20 > > How are the state bits organised? > >=20 >=20 > BIT(0) is active mode, BIT(1) is sleep mode, as specified below. I co= uld add > some sanity checking here if you would like to. I'm just double checking that you know what that means. BIT(0) =3D=3D b01 BIT(1) =3D=3D b10 It seems strange to represent a single boolean state over 2 bits. Also, what happens if b11 or b00 occurs? > [..] > > > diff --git a/include/linux/mfd/qcom_rpm.h b/include/linux/mfd/qco= m_rpm.h > > > index a60798d..f0e70b2 100644 > > > --- a/include/linux/mfd/qcom_rpm.h > > > +++ b/include/linux/mfd/qcom_rpm.h > > > +#define RPM_ACTIVE_STATE 0 > > > +#define RPM_SLEEP_STATE 1 >=20 > Regards, > Bjorn --=20 Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org =E2=94=82 Open source software for ARM SoCs =46ollow Linaro: Facebook | Twitter | Blog From mboxrd@z Thu Jan 1 00:00:00 1970 From: lee.jones@linaro.org (Lee Jones) Date: Wed, 12 Nov 2014 09:52:00 +0000 Subject: [RFC 1/2] mfd: qcom-rpm: Expose sleep state resources to clients In-Reply-To: <20141111183319.GD16980@sonymobile.com> References: <1415659966-16200-1-git-send-email-bjorn.andersson@sonymobile.com> <1415659966-16200-2-git-send-email-bjorn.andersson@sonymobile.com> <20141111120457.GZ24004@x1> <20141111183319.GD16980@sonymobile.com> Message-ID: <20141112095200.GD24004@x1> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org 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: > > > > > 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. > > > > I assume you have users lined up which will request a sleeping state? > > > > All users of this interface (regulators, clocks and bus scaling) will have to > be able to specify this. > > [..] > > > @@ -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)); > > > > 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? > [..] > > > 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 > > > +#define RPM_ACTIVE_STATE 0 > > > +#define RPM_SLEEP_STATE 1 > > Regards, > Bjorn -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog