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: 129527 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp3230108lja; Sun, 25 Feb 2018 21:09:33 -0800 (PST) X-Google-Smtp-Source: AH8x225trfIJFewiLe2H8UO+Xn1ykTMg9VDbeQBcGGYQX5ZSu0w4dAQ7+6OaomATsflLOyRyU+yA X-Received: by 10.98.47.65 with SMTP id v62mr9214905pfv.152.1519621773799; Sun, 25 Feb 2018 21:09:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519621773; cv=none; d=google.com; s=arc-20160816; b=U/CGlFNIJU6za01KR7X7BCsUoBex1AQJwiAIpBsWmd4QMalsW5ise1jCb0yXOz+wWe k1AyXT91k56pDOA0yMV+Akfqb0tYi38N9H0LhHFGH2E27cUd8vIzdkVJuoc6AnEVwdRq QAVGEr2RNssKfDJqz+gIHS4egl0Gu9fPzfsNJCJmYS9Ot4+VMJOli5bgKPWHlCAHf+HD 2f6iPkIO37IySmcVDC8HaCAdhjzlwsnRGzHpdPUEN4tm9GVf9pXOWbvL1tybSZLk6gcF OBLB6mfy2ZjMG7SDQHUuGogoVtbj+a3DrVsA+K6Q/oOFwW2WLQ/U4jOaeNx+GPq8+mRm sgDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=IRF+MQeOVHlhVJTzFnx7uJZGfQIq/OPPymBcGDWrVbE=; b=FFEP+20th3RDjwmy40lDVhgR7RPxGojSEykTOTgRfZUtSo769v6QFCkpY/gqqTzy50 H8oy+IxTONpNJdHQgjD4yPPtnJgoVJTz5Uo3QomaBWbDss133FJNuDZHztk1qaq358iD Lr4v4fF50ZZvxM7O3hfGe273FjTOAE6G/nL2GD/qbzjCCBf1ZkGSIlIKd2Kkvv2hxEtO 3ABjpEANK6eVWSXHWyVW8E6X5lC4AL0WiipyArbsyRSgcqcIwB52EYqAYdfdaQCd/Adh G7qHXcbdEkilwkMBQiVHJ54N7PJGkxcZXrlsyczAD11kl8ALtChF35FJosuTtlJd2IzE 8Mjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CukAmvO0; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h32-v6si6199354pld.217.2018.02.25.21.09.33; Sun, 25 Feb 2018 21:09:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CukAmvO0; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750749AbeBZFJc (ORCPT + 11 others); 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-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 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(-) -- 2.15.0.194.g9af6a3dea062 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);