From patchwork Mon Feb 26 05:08:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 10241231 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 2E64E60208 for ; Mon, 26 Feb 2018 05:09:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F9C1292DF for ; Mon, 26 Feb 2018 05:09:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1435E297C3; Mon, 26 Feb 2018 05:09:34 +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.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 97055292DF for ; Mon, 26 Feb 2018 05:09:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750749AbeBZFJc (ORCPT ); Mon, 26 Feb 2018 00:09:32 -0500 Received: from mail-pl0-f66.google.com ([209.85.160.66]:46061 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751319AbeBZFJb (ORCPT ); Mon, 26 Feb 2018 00:09:31 -0500 Received: by mail-pl0-f66.google.com with SMTP id v9-v6so6653041plp.12 for ; Sun, 25 Feb 2018 21:09:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=IRF+MQeOVHlhVJTzFnx7uJZGfQIq/OPPymBcGDWrVbE=; b=CukAmvO0P+SPlYQuAhjiPOPaQucmS2cN0yJ2yKJ9D7HIbRHLIBfM7irQQyHZlyYWTh RGe6D7fYnS7Gor/ANena3e+7ssWA2wc0oWKz6TKrbSolmKfW8YaGCnmSyWuztSYp1lcF gnP+NJskhL27yvV7ELjreEIYpBo5qKN78wHOo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=IRF+MQeOVHlhVJTzFnx7uJZGfQIq/OPPymBcGDWrVbE=; b=q1WrKbwtZ7ugQb+DK8nZV9bBW9oTkz0eTolQMk1yuE/8jUiJc1gl6PQuvQT0YBNgLW kh6jCmUCUTK7jLNLa5SH+hcsoT4AS5RbDtS0rvE3PJZO7/TlC+d/xDUlRsn9xS2+/fut X9fBcGafxO0rnPspo75qjSVzBxf21EepA9Bc3CsKmD6zrSsNiZLLZvqfMMKLO8JUbxbq gEQ2xXRwVfPW8EEp8ElBvdgenUEUPriRQ3nG4Xqc1ElxR1/eOa47zlA7jnnBOdjHmW8h JkLrGMANWQZcR0xO2oDI/C2xlauRq1DJ1g4/lEKVSc1FKToFImDem1PPAucgdBI/dexQ BXEQ== X-Gm-Message-State: APf1xPBKW24MPYeOfFaQOVxBK9jd9tAFoRhTjxS2ob+Hn5UlqQsKNb09 l8kcta6p5MAYO2nbwssGJLQo5n4PJoc= X-Google-Smtp-Source: AH8x224ObiLEL+cJ5DbWb9+JZX5JrjqKTeb4GghkxYpTY9xTGlfYiGtXNVLWkV7l9l2xYS6m/bdx2g== X-Received: by 2002:a17:902:44:: with SMTP id 62-v6mr9183436pla.193.1519621771430; Sun, 25 Feb 2018 21:09:31 -0800 (PST) Received: from localhost ([122.172.92.38]) by smtp.gmail.com with ESMTPSA id g77sm16925960pfk.135.2018.02.25.21.09.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Feb 2018 21:09:30 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot Subject: [PATCH 01/27] cpufreq: imx6q: Find max freq from frequency table itself Date: Mon, 26 Feb 2018 10:38:44 +0530 Message-Id: X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: 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 This is a preparatory commit to make policy->suspend_freq independent of validation of the cpufreq table, as a later commit would update cpufreq_generic_init() to not validate the cpufreq table any longer. The driver already assumes the order in which the frequency table is sorted and we can get the max frequency easily. Signed-off-by: Viresh Kumar --- drivers/cpufreq/imx6q-cpufreq.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index ff67859948b3..83cf631fc9bc 100644 --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c @@ -52,6 +52,7 @@ static struct clk_bulk_data clks[] = { static struct device *cpu_dev; static bool free_opp; static struct cpufreq_frequency_table *freq_table; +static unsigned int max_freq; static unsigned int transition_latency; static u32 *imx6_soc_volt; @@ -196,7 +197,7 @@ static int imx6q_cpufreq_init(struct cpufreq_policy *policy) policy->clk = clks[ARM].clk; ret = cpufreq_generic_init(policy, freq_table, transition_latency); - policy->suspend_freq = policy->max; + policy->suspend_freq = max_freq; return ret; } @@ -437,12 +438,12 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) * freq_table initialised from OPP is therefore sorted in the * same order. */ + max_freq = freq_table[--num].frequency; opp = dev_pm_opp_find_freq_exact(cpu_dev, freq_table[0].frequency * 1000, true); min_volt = dev_pm_opp_get_voltage(opp); dev_pm_opp_put(opp); - opp = dev_pm_opp_find_freq_exact(cpu_dev, - freq_table[--num].frequency * 1000, true); + opp = dev_pm_opp_find_freq_exact(cpu_dev, max_freq * 1000, true); max_volt = dev_pm_opp_get_voltage(opp); dev_pm_opp_put(opp);