Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3283733imm; Fri, 25 May 2018 03:03:53 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr5bU9/o76UnOET/f3PyIoJt6ZA6VtgzELs/XZxcv4A8OsM66Kp/wancso80JmePV63iPCd X-Received: by 2002:a17:902:b786:: with SMTP id e6-v6mr1966707pls.260.1527242632943; Fri, 25 May 2018 03:03:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527242632; cv=none; d=google.com; s=arc-20160816; b=bYxSS0GOe3GY7A/Sojfdm+EIVmUAVPQjNPEGZNyY73hWFh614nparWElc8LCKAhBx1 vL50mGB+ToNLnh07IpJTs2Ha1NPfgDM0soApIF/41UNGU1YcbgTJW3OlA7Mw8YCWMGdA bTgq7CCX5tbRlU+AuQc+z1uV70xV9vZf8WEgIuhtvBGENoYDYZf/tSi/w9QsjYzFT5R4 dbCbfvycAiKWby7uhIotQSXGupqQU+WVknkXLlGzZhGOLhyBLYjET9+/ly5sc7a6NcD+ caiiw70sW+qcHBxHRhloo2kO9A+8NWYDKzhzv288cAtFrB4pgDMbX8GxvDikfWvs61jK ugDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=ok9BqiyEKBb47ruAn6x2Ux8rw41M8u9aW3/zoINdTy0=; b=pRdahm2TSMY0WoTFTjU5AcKnJlZinY2a/g0QjR+Cz51dFgnVCiDSnA3aPfrs61/rKO 5xTbfIyMBPiiSrRbA/5VdBcxjdOkA86C6mKtCwAvP+impjxHYxwdTjdaN9psqdJ4NREk b7bKf2iLXFnEzGk9KzjJrcjBH9x7NMKENFxbMTGWL/VPxBs1QQtQQP0t3yArAhK32F1b cD1fVgWqCc1h99t4v638cw1gQ/kDP1CLOiyOtSidMx3RwK/DbjXR8sr7G8M/JDrPC2CA M+14czNEisTzoMpZsXu5nwTYOu5/wdmLokOE9XMyH38QEo6s2mab3R9rD65yf2Xsae0p kyQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=UOKG1Kjs; dkim=pass header.i=@codeaurora.org header.s=default header.b=UOKG1Kjs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x3-v6si6537763plr.307.2018.05.25.03.03.33; Fri, 25 May 2018 03:03:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=UOKG1Kjs; dkim=pass header.i=@codeaurora.org header.s=default header.b=UOKG1Kjs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966005AbeEYKCz (ORCPT + 99 others); Fri, 25 May 2018 06:02:55 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:45930 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965681AbeEYKBo (ORCPT ); Fri, 25 May 2018 06:01:44 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id E63A260D81; Fri, 25 May 2018 10:01:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1527242503; bh=iGQoHjUv9JNLKdZdlRkEypx5IS0LKWnoOG9LWg11LK4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UOKG1KjsCWOmfICD4AksI2X96yHXbJbzKBO0B3Ew2ttn5rPuPtelhk9ZVkKAp70kz E6sq7nAChNqeKALei9ZYDePTC1p2Qt59YRXfN9eaPSX7j9pFUx1oYhAfl2V/j+7Ve4 VTgA5TWfI3jccSv0IzGppSisI17jbiCBUjI+bMRM= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from blr-ubuntu-173.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.18.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: rnayak@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id D7D1F610D6; Fri, 25 May 2018 10:01:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1527242503; bh=iGQoHjUv9JNLKdZdlRkEypx5IS0LKWnoOG9LWg11LK4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UOKG1KjsCWOmfICD4AksI2X96yHXbJbzKBO0B3Ew2ttn5rPuPtelhk9ZVkKAp70kz E6sq7nAChNqeKALei9ZYDePTC1p2Qt59YRXfN9eaPSX7j9pFUx1oYhAfl2V/j+7Ve4 VTgA5TWfI3jccSv0IzGppSisI17jbiCBUjI+bMRM= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org D7D1F610D6 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=rnayak@codeaurora.org From: Rajendra Nayak To: viresh.kumar@linaro.org, sboyd@kernel.org, andy.gross@linaro.org, ulf.hansson@linaro.org Cc: devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, collinsd@codeaurora.org, Rajendra Nayak Subject: [PATCH v2 3/6] soc: qcom: rpmpd: Add support for get/set performance state Date: Fri, 25 May 2018 15:31:18 +0530 Message-Id: <20180525100121.28214-4-rnayak@codeaurora.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180525100121.28214-1-rnayak@codeaurora.org> References: <20180525100121.28214-1-rnayak@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support for the .set_performace_state() and .opp_to_performance_state() callbacks in the rpmpd driver. Signed-off-by: Rajendra Nayak Signed-off-by: Viresh Kumar --- drivers/soc/qcom/rpmpd.c | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/drivers/soc/qcom/rpmpd.c b/drivers/soc/qcom/rpmpd.c index df6427d43414..ff3d910f388c 100644 --- a/drivers/soc/qcom/rpmpd.c +++ b/drivers/soc/qcom/rpmpd.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -29,6 +30,8 @@ #define KEY_ENABLE 0x6e657773 /* swen */ #define KEY_FLOOR_CORNER 0x636676 /* vfc */ +#define MAX_RPMPD_STATE 6 + #define DEFINE_RPMPD_CORN_SMPA(_platform, _name, _active, r_id) \ static struct rpmpd _platform##_##_active; \ static struct rpmpd _platform##_##_name = { \ @@ -222,6 +225,47 @@ static int rpmpd_power_off(struct generic_pm_domain *domain) return ret; } +static int rpmpd_set_performance(struct generic_pm_domain *domain, + unsigned int state) +{ + int ret = 0; + struct rpmpd *pd = domain_to_rpmpd(domain); + + mutex_lock(&rpmpd_lock); + + if (state > MAX_RPMPD_STATE) + goto out; + + pd->corner = state; + + if (!pd->enabled && (pd->key != KEY_FLOOR_CORNER)) + goto out; + + ret = rpmpd_aggregate_corner(pd); + +out: + mutex_unlock(&rpmpd_lock); + + return ret; +} + +static unsigned int rpmpd_get_performance(struct generic_pm_domain *genpd, + struct dev_pm_opp *opp) +{ + struct device_node *np; + unsigned int corner = 0; + + np = dev_pm_opp_get_of_node(opp); + if (of_property_read_u32(np, "qcom,level", &corner)) { + pr_err("%s: missing 'qcom,level' property\n", __func__); + return 0; + } + + of_node_put(np); + + return corner; +} + static int rpmpd_probe(struct platform_device *pdev) { int i; @@ -259,6 +303,8 @@ static int rpmpd_probe(struct platform_device *pdev) rpmpds[i]->rpm = rpm; rpmpds[i]->pd.power_off = rpmpd_power_off; rpmpds[i]->pd.power_on = rpmpd_power_on; + rpmpds[i]->pd.set_performance_state = rpmpd_set_performance; + rpmpds[i]->pd.opp_to_performance_state = rpmpd_get_performance; pm_genpd_init(&rpmpds[i]->pd, NULL, true); data->domains[i] = &rpmpds[i]->pd; -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation