Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1465271imm; Tue, 15 May 2018 20:58:40 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrLWzkRdFVd0KohO8cKW6XSdutGwypGFJ7knSuIoAHTtcG+dyUhk2Po8djLVy5rancEr+r4 X-Received: by 2002:a17:902:7406:: with SMTP id g6-v6mr16600613pll.237.1526443120154; Tue, 15 May 2018 20:58:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526443120; cv=none; d=google.com; s=arc-20160816; b=By/1R8ELwvlK/G2Nm+T6a2KULZfCbEz/xLft+fSsWYyl3utjfiRm6ZVh4GWbYYyH2c E3DjHTR2Dmn7rGShqNS3oaz7mllcnbNlXkQX37Kkwr3N+W4evjpdtrAKdf6L4j0JvFc5 JNI97HdsDJCgmx3Q03owuiotcip0gHyio9NedPY+UZgG0NAsJdmlp1M2Cyx5AsQ5aNds KByrSkdJBJwj0mcYQ/N1L973+G6NdoItknES6aIilC5LoCGyANrtTnpxq5dezN3gL9Oj 2VGTsyxtWm98paNxDnkV+hh15pZSNZV78NyV02HzQ1Yqbh8pMygR40TuU3Ay8vECwmX1 l9BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=ZEHPU1Pmr55Gy/SdTaw2u4E0Klc3so239y9e8iuVTWg=; b=ns5pyXx/zJnW8lQxmtYRwm4Y+nhrIGw9vZREkU47x7fn1Mwq0PQ4PARJVsj3kE/4DI 6TcIMyzPtwZOnCyrFg/C10hoUEd/xmaBxvDiYMIsb4Mfcf9KR9iAx5Kwtd03s0ElV84D 3rtxYBw3/3mjAgmbQ3amUKdkyQh5y5Sohjma35/nlGvA9V5K5kMEzRdMDHoBKWcI9LwN OjhIT4sOMy2xWwyNNY2sMlRtTACbsNzVEMjiqE/FQga7t4tGMkryiBFpYe2DNIMB3vqq f4LfVtCIQ0bCQHSzy400C1xYfBPE0c9aqBQoJnvEoRlNJRYxbq2fdBydlOnm3JpkekCY MIDg== ARC-Authentication-Results: i=1; mx.google.com; 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 g17-v6si1540778plo.355.2018.05.15.20.58.20; Tue, 15 May 2018 20:58:40 -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; 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 S1752026AbeEPD6J (ORCPT + 99 others); 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.7.4