From patchwork Mon Dec 19 20:10:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Mayer X-Patchwork-Id: 9480703 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BE430601C0 for ; Mon, 19 Dec 2016 20:11:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABF0828471 for ; Mon, 19 Dec 2016 20:11:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0507284EA; Mon, 19 Dec 2016 20:11:08 +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=-6.9 required=2.0 tests=BAYES_00,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 1CF0428471 for ; Mon, 19 Dec 2016 20:11:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755534AbcLSUKt (ORCPT ); Mon, 19 Dec 2016 15:10:49 -0500 Received: from smtp-out-so.shaw.ca ([64.59.136.138]:54258 "EHLO smtp-out-so.shaw.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755190AbcLSUKs (ORCPT ); Mon, 19 Dec 2016 15:10:48 -0500 Received: from triton.mmayer.net ([70.71.160.251]) by shaw.ca with SMTP id J4GkcWMgDrvfEJ4GlckG1l; Mon, 19 Dec 2016 13:10:47 -0700 X-Authority-Analysis: v=2.2 cv=UeUhcOaN c=1 sm=1 tr=0 a=6xzog4CasRozao6qlzTIAw==:117 a=6xzog4CasRozao6qlzTIAw==:17 a=n5n_aSjo0skA:10 a=Q-fNiiVtAAAA:8 a=G-aMlLIYu67mbuG1vAIA:9 a=Fp8MccfUoT0GBdDC_Lng:22 Received: by triton.mmayer.net (Postfix, from userid 501) id 809372E940C9; Mon, 19 Dec 2016 12:10:46 -0800 (PST) From: Markus Mayer To: Viresh Kumar , "Rafael J . Wysocki" Cc: Power Management List , Broadcom Kernel List , Linux Kernel Mailing List , Markus Mayer Subject: [PATCH 2/2] cpufreq: brcmstb-avs-cpufreq: properly retrieve P-state upon suspend Date: Mon, 19 Dec 2016 12:10:28 -0800 Message-Id: <20161219201028.18885-3-code@mmayer.net> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161219201028.18885-1-code@mmayer.net> References: <20161219201028.18885-1-code@mmayer.net> X-CMAE-Envelope: MS4wfGkgCloOZYokWUYCKTkWU2tgNUYwUt4m4OYUwscoQlOkC5IliB72JlskpTOqOXHOKTA8Qe5QdiOC3ek3qrNffCVttpKLu5CN74uFv7agRwlYD00I3UgH icVLA9EzYbELMU1KSVStSwPnpnsmnGiI3FDvXNx7r219yaqzcMHWNSGbYzp6lH4/qOkRM2Bh1+Wuojxqrrl/smEIp0FtVUKWw1FopdimEiXx3Ud8UvZvY0Ll KA0pOodZoR7aBEZJcjdNKpFOCJKh92V3oVa331IiRd9e24k8KY/Q4IJAeAjCBSqRif9ItQX6Dw420B1y1doyM2F4Eoq4th4t/osHANRCpM622hbHFArn5Urk dtq6FHp3f0ebSpoZvArOKNbT7vh9KQ== Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Mayer The AVS GET_PMAP command does return a P-state along with the P-map information. However, that P-state is the initial P-state when the P-map was first downloaded to AVS. It is *not* the current P-state. Therefore, we explicitly retrieve the P-state using the GET_PSTATE command. Signed-off-by: Markus Mayer Acked-by: Viresh Kumar --- drivers/cpufreq/brcmstb-avs-cpufreq.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/brcmstb-avs-cpufreq.c b/drivers/cpufreq/brcmstb-avs-cpufreq.c index 2c6e325..c943606 100644 --- a/drivers/cpufreq/brcmstb-avs-cpufreq.c +++ b/drivers/cpufreq/brcmstb-avs-cpufreq.c @@ -784,8 +784,19 @@ static int brcm_avs_target_index(struct cpufreq_policy *policy, static int brcm_avs_suspend(struct cpufreq_policy *policy) { struct private_data *priv = policy->driver_data; + int ret; + + ret = brcm_avs_get_pmap(priv, &priv->pmap); + if (ret) + return ret; - return brcm_avs_get_pmap(priv, &priv->pmap); + /* + * We can't use the P-state returned by brcm_avs_get_pmap(), since + * that's the initial P-state from when the P-map was downloaded to the + * AVS co-processor, not necessarily the P-state we are running at now. + * So, we get the current P-state explicitly. + */ + return brcm_avs_get_pstate(priv, &priv->pmap.state); } static int brcm_avs_resume(struct cpufreq_policy *policy)