From patchwork Mon Nov 10 22:52:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 5269851 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E3BAEC11AC for ; Mon, 10 Nov 2014 22:55:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 14C502012F for ; Mon, 10 Nov 2014 22:55:10 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2B35C2011D for ; Mon, 10 Nov 2014 22:55:09 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XnxpN-0007lL-PI; Mon, 10 Nov 2014 22:52:53 +0000 Received: from seldrel01.sonyericsson.com ([212.209.106.2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XnxpF-0007it-FF for linux-arm-kernel@lists.infradead.org; Mon, 10 Nov 2014 22:52:46 +0000 From: Bjorn Andersson To: Stephen Boyd , David Collins , Lina Iyer , Mark Brown Subject: [RFC 1/2] mfd: qcom-rpm: Expose sleep state resources to clients Date: Mon, 10 Nov 2014 14:52:45 -0800 Message-ID: <1415659966-16200-2-git-send-email-bjorn.andersson@sonymobile.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1415659966-16200-1-git-send-email-bjorn.andersson@sonymobile.com> References: <1415659966-16200-1-git-send-email-bjorn.andersson@sonymobile.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141110_145245_780995_EEC59699 X-CRM114-Status: GOOD ( 10.96 ) X-Spam-Score: -5.0 (-----) Cc: linux-arm-msm@vger.kernel.org, Lee Jones , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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