From patchwork Wed May 16 03:49:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Mayer X-Patchwork-Id: 10402491 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 0A1B2601F9 for ; Wed, 16 May 2018 03:58:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2B84200E7 for ; Wed, 16 May 2018 03:58:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D316920243; Wed, 16 May 2018 03:58:10 +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.9 required=2.0 tests=BAYES_00, 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 2CDC6200E7 for ; Wed, 16 May 2018 03:58:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751402AbeEPD6J (ORCPT ); Tue, 15 May 2018 23:58:09 -0400 Received: from smtp-out-no.shaw.ca ([64.59.134.12]:59308 "EHLO smtp-out-no.shaw.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750810AbeEPD6I (ORCPT ); Tue, 15 May 2018 23:58:08 -0400 X-Greylist: delayed 488 seconds by postgrey-1.27 at vger.kernel.org; Tue, 15 May 2018 23:58:08 EDT Received: from tethys.mmayer.net ([96.48.174.102]) by shaw.ca with ESMTP id InRtfFcyiuYopInRufMw8p; Tue, 15 May 2018 21:50:00 -0600 X-Authority-Analysis: v=2.3 cv=GopsBH9C c=1 sm=1 tr=0 a=IfKG9KDHjPrX0SZ8gMoyrg==:117 a=IfKG9KDHjPrX0SZ8gMoyrg==:17 a=VUJBJC2UJ8kA:10 a=Q-fNiiVtAAAA:8 a=ZXcZxKTucvakvfwa_LUA:9 a=Fp8MccfUoT0GBdDC_Lng:22 Received: by tethys.mmayer.net (Postfix, from userid 501) id 921D886FE01; Tue, 15 May 2018 20:49:56 -0700 (PDT) From: Markus Mayer To: Viresh Kumar , "Rafael J. Wysocki" , Brian Norris , Gregory Fong , Florian Fainelli Cc: Markus Mayer , Broadcom Kernel List , Power Management List , ARM Kernel List , Linux Kernel Mailing List Subject: [PATCH] cpufreq: brcmstb-avs-cpufreq: sort frequencies in ascending order Date: Tue, 15 May 2018 20:49:54 -0700 Message-Id: <20180516034954.56475-1-code@mmayer.net> X-Mailer: git-send-email 2.17.0 X-CMAE-Envelope: MS4wfG6fOW7KYdyKbEc2Hickmobu1EcrsiqBlHjAhFPBoNw6e+cswZFtzW3T8QI/OPdHIOTjQAEVfpyO4iXQdKQAY+hEwA7rlbsYttam+/es3nSFU2TFbtoJ 7EHrnJw4xC8awPCL2fYgBhcyJnJwamff6Hg4aiZ82UAaryrU3ae5NFy+4PJ+OboIEEdvecWoOMPLRpOQcNecQzpeIeEt21UcWXaagS5Pt4AqvDfz63rueVrr /Lo950FJ7m9atg2I0jLzS8QATD0Ri/q6GijEZmspijukBaOeS4kwe1oQJONV8y+FVXl+6XjgQURfI+DQVXuqrPqLv0or7C7LwgZrEwKdLSwO5MwA3R1PdJbY dkdqOvqGZ+f/IgADtJGUv+gJKnM8FWkP9PNR473QGCHh017uNUf4naYp1nNvhARmeQWKglvJvcHSjJil8lwUrG48pb9XlSuxPIknXGIckKJQkUolxpbdAJTY dSdnhG+aYVTDo+AVY6Ex0eS+dgpwlnFLsiyKKpqrVBI+EuGd8VIsTjc6gYI= 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 Most CPUfreq drivers (at least on ARM) seem to be sorting the available frequencies from lowest to highest. To match this behaviour, we reverse the sorting order in brcmstb-avs-cpufreq, so it is now also lowest to highest. Signed-off-by: Markus Mayer --- drivers/cpufreq/brcmstb-avs-cpufreq.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/cpufreq/brcmstb-avs-cpufreq.c b/drivers/cpufreq/brcmstb-avs-cpufreq.c index b07559b9ed99..7dac3205d3eb 100644 --- a/drivers/cpufreq/brcmstb-avs-cpufreq.c +++ b/drivers/cpufreq/brcmstb-avs-cpufreq.c @@ -403,7 +403,7 @@ brcm_avs_get_freq_table(struct device *dev, struct private_data *priv) { struct cpufreq_frequency_table *table; unsigned int pstate; - int i, ret; + int p, i, ret; /* Remember P-state for later */ ret = brcm_avs_get_pstate(priv, &pstate); @@ -415,12 +415,13 @@ brcm_avs_get_freq_table(struct device *dev, struct private_data *priv) if (!table) return ERR_PTR(-ENOMEM); - for (i = AVS_PSTATE_P0; i <= AVS_PSTATE_MAX; i++) { - ret = brcm_avs_set_pstate(priv, i); + for (p = AVS_PSTATE_MAX, i = 0; p >= 0; p--, i++) { + ret = brcm_avs_set_pstate(priv, p); if (ret) return ERR_PTR(ret); table[i].frequency = brcm_avs_get_frequency(priv->base); - table[i].driver_data = i; + /* Store the corresponding P-state with each frequency */ + table[i].driver_data = p; } table[i].frequency = CPUFREQ_TABLE_END;