From patchwork Mon May 13 10:20:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sibi Sankar X-Patchwork-Id: 10940663 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E0E1514DB for ; Mon, 13 May 2019 10:21:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D28BE26E79 for ; Mon, 13 May 2019 10:21:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D0C652787C; Mon, 13 May 2019 10:21:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE443274A3 for ; Mon, 13 May 2019 10:21:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728852AbfEMKUm (ORCPT ); Mon, 13 May 2019 06:20:42 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:55850 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727690AbfEMKUm (ORCPT ); Mon, 13 May 2019 06:20:42 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 485E060C72; Mon, 13 May 2019 10:20:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1557742841; bh=9qbE9DNsT7sHR+XIxHoeAAs2S5N1haUdw3Jt612GZno=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=duspvJgLY6ATJbIzQz8rkrrAXzgIar+9cWfyNhcFuzMVsHfko64V6JZbz47QhQLDP mBVWr2Mfrj+Uv7ElZxVmIr8GWmAboZmnIp6qYW7miGGU7MZShzGncDctNG/mSSAmeZ wVp6/TpGrFYhAPRhAik1IE2sND+RkSc9dNqWEGBs= Received: from blr-ubuntu-87.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: sibis@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 9532E60ACA; Mon, 13 May 2019 10:20:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1557742840; bh=9qbE9DNsT7sHR+XIxHoeAAs2S5N1haUdw3Jt612GZno=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YronulV9I4I0iQfXZGtNt4yyrD6vRlbWSVhE72Ry85twC9vCqzoE59jPstJfFfqKx SvXVTOwmU4oREFh/aMx4x5owCwOIKU4qQCpQ5ScqaGqYMG14S2vmgHLZ5hNyJcHVNi dcFLMPdyhUEQEsW7SKOIMfkCA4F8yp+0ymx+c044= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 9532E60ACA 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=sibis@codeaurora.org From: Sibi Sankar To: bjorn.andersson@linaro.org, robh+dt@kernel.org, agross@kernel.org Cc: david.brown@linaro.org, mark.rutland@arm.com, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, rnayak@codeaurora.org, marc.w.gonzalez@free.fr, Sibi Sankar Subject: [PATCH v4 2/9] soc: qcom: rpmpd: Add support to set rpmpd state to max Date: Mon, 13 May 2019 15:50:08 +0530 Message-Id: <20190513102015.26551-3-sibis@codeaurora.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190513102015.26551-1-sibis@codeaurora.org> References: <20190513102015.26551-1-sibis@codeaurora.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP rpmpd max state varies across SoCs and SoC families, add support in the driver to make it SoC/SoC family specific Signed-off-by: Sibi Sankar --- drivers/soc/qcom/rpmpd.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/soc/qcom/rpmpd.c b/drivers/soc/qcom/rpmpd.c index 235d01870dd8..94015ece40e9 100644 --- a/drivers/soc/qcom/rpmpd.c +++ b/drivers/soc/qcom/rpmpd.c @@ -25,7 +25,7 @@ #define KEY_ENABLE 0x6e657773 /* swen */ #define KEY_FLOOR_CORNER 0x636676 /* vfc */ -#define MAX_RPMPD_STATE 6 +#define MAX_8996_RPMPD_STATE 6 #define DEFINE_RPMPD_CORNER_SMPA(_platform, _name, _active, r_id) \ static struct rpmpd _platform##_##_active; \ @@ -83,12 +83,14 @@ struct rpmpd { const int res_type; const int res_id; struct qcom_smd_rpm *rpm; + unsigned int max_state; __le32 key; }; struct rpmpd_desc { struct rpmpd **rpmpds; size_t num_pds; + unsigned int max_state; }; static DEFINE_MUTEX(rpmpd_lock); @@ -114,6 +116,7 @@ static struct rpmpd *msm8996_rpmpds[] = { static const struct rpmpd_desc msm8996_desc = { .rpmpds = msm8996_rpmpds, .num_pds = ARRAY_SIZE(msm8996_rpmpds), + .max_state = MAX_8996_RPMPD_STATE, }; static const struct of_device_id rpmpd_match_table[] = { @@ -225,8 +228,8 @@ static int rpmpd_set_performance(struct generic_pm_domain *domain, int ret = 0; struct rpmpd *pd = domain_to_rpmpd(domain); - if (state > MAX_RPMPD_STATE) - state = MAX_RPMPD_STATE; + if (state > pd->max_state) + state = pd->max_state; mutex_lock(&rpmpd_lock); @@ -287,6 +290,7 @@ static int rpmpd_probe(struct platform_device *pdev) } rpmpds[i]->rpm = rpm; + rpmpds[i]->max_state = desc->max_state; 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;