From patchwork Sat Dec 5 08:53:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "pi-cheng.chen" X-Patchwork-Id: 57738 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp71878lbb; Sat, 5 Dec 2015 00:53:19 -0800 (PST) X-Received: by 10.98.70.19 with SMTP id t19mr28289209pfa.50.1449305597938; Sat, 05 Dec 2015 00:53:17 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ra6si25488827pab.90.2015.12.05.00.53.17; Sat, 05 Dec 2015 00:53:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-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 devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro-org.20150623.gappssmtp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753173AbbLEIxR (ORCPT + 6 others); Sat, 5 Dec 2015 03:53:17 -0500 Received: from mail-pa0-f54.google.com ([209.85.220.54]:35485 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752898AbbLEIxQ (ORCPT ); Sat, 5 Dec 2015 03:53:16 -0500 Received: by pacej9 with SMTP id ej9so98913595pac.2 for ; Sat, 05 Dec 2015 00:53:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zhWp/tot1GcJjppaNmpgPwYzP9F8FLqhdriREWOBRn0=; b=lU7u6BkEbeMU2hezz4CFUQV82UTLpLILS/hpnSGjCzaEb+tEWTjqdjHYi4c+biyTi9 tZLcAoZdkY1OEBb74+Ph/zgOip4nHFPwSTK1EQ0dzbwZM4eZbORPXAEVdCRLPswBjwIv qHCaJt5FiQkfqxyFGf1hr5ZS2OheSj+yjW8fjMnnbYGnFsKRsOq5sPsr7ThK8NJeTqmW DglierDVHeeLTue9xKNoZ8OTl6e9BuJOQEcFrVafxVHexqmDHWKjI5tUYkYK+jyJBxki 2hrqddeDe96UaAJlAnpCRwv+VOo6MA8bXu+Sb+ZV9ME0mRd7hhCMm/24zR86cq8oE20V MVuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zhWp/tot1GcJjppaNmpgPwYzP9F8FLqhdriREWOBRn0=; b=EJANTV77jeTBRrN6phB0szCETC7OateGD9UHnJMqXKkZqSGliHR4sT82a5qLzTeL8S 1sn6QF8YiA1NftucvxtCO84N5HISCmv9pg0S96W/2Y+JZGSKl+py64Eeqcsm8BU8hS3x IrhtQHMYRc/AxymHqhapgu7BVzSMjM3EvNu175MKxn/R/t24z314Gw5kLS/WTLaDrw4S TiRwdY+e3DoaLCeyS/YGMBmSC9xgwAShwutv2rczDfU+7eFbwNfSahx0zG6hXwcBXb7r ZET7C/5TZ1mel/NYs/bl6qYjV1kCwuGhbnRI8OxCXaONtpRWx8toBesdUVTm7A48NDXo E2lQ== X-Gm-Message-State: ALoCoQny5DS2rJ04vejfkNjtGdRsCfQ2J0ghZPdAR8VRxzTUDmZmF7ZHaNqYMvkJGAOKiF71aky6 X-Received: by 10.66.227.102 with SMTP id rz6mr27787601pac.4.1449305595514; Sat, 05 Dec 2015 00:53:15 -0800 (PST) Received: from localhost.localdomain ([124.219.30.17]) by smtp.googlemail.com with ESMTPSA id r20sm21782704pfa.93.2015.12.05.00.53.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 05 Dec 2015 00:53:15 -0800 (PST) From: Pi-Cheng Chen To: Viresh Kumar , Matthias Brugger Cc: Michael Turquette , Daniel Kurtz , linux-mediatek@lists.infradead.org, linaro-kernel@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 1/2] cpufreq: mt8173: migrate to use operating-points-v2 bindings Date: Sat, 5 Dec 2015 16:53:03 +0800 Message-Id: <1449305584-414-2-git-send-email-pi-cheng.chen@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1449305584-414-1-git-send-email-pi-cheng.chen@linaro.org> References: <1449305584-414-1-git-send-email-pi-cheng.chen@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Modify mt8173-cpufreq driver to get OPP-sharing information and set up OPP table provided by operating-points-v2 bindings. Signed-off-by: Pi-Cheng Chen --- This patch is based on the series[1] which fixes some issues of mt8173-cpufreq driver. [1] http://thread.gmane.org/gmane.linux.power-management.general/68692 --- drivers/cpufreq/mt8173-cpufreq.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/cpufreq/mt8173-cpufreq.c b/drivers/cpufreq/mt8173-cpufreq.c index 257bcb9..17e9cad 100644 --- a/drivers/cpufreq/mt8173-cpufreq.c +++ b/drivers/cpufreq/mt8173-cpufreq.c @@ -344,6 +344,9 @@ static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu) unsigned long rate; int ret; + /* Mark the first owner of this CPU DVFS domain information */ + cpumask_set_cpu(cpu, &info->cpus); + cpu_dev = get_cpu_device(cpu); if (!cpu_dev) { pr_err("failed to get cpu%d device\n", cpu); @@ -390,7 +393,15 @@ static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu) /* Both presence and absence of sram regulator are valid cases. */ sram_reg = regulator_get_exclusive(cpu_dev, "sram"); - ret = dev_pm_opp_of_add_table(cpu_dev); + /* Get OPP-sharing information from "operating-points-v2" bindings */ + ret = dev_pm_opp_of_get_sharing_cpus(cpu_dev, &info->cpus); + if (ret) { + pr_err("failed to get OPP-sharing information for cpu%d\n", + cpu); + goto out_free_resources; + } + + ret = dev_pm_opp_of_cpumask_add_table(&info->cpus); if (ret) { pr_warn("no OPP table for cpu%d\n", cpu); goto out_free_resources; @@ -421,13 +432,10 @@ static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu) */ info->need_voltage_tracking = !IS_ERR(sram_reg); - /* CPUs in the same cluster share a clock and power domain. */ - cpumask_copy(&info->cpus, &cpu_topology[cpu].core_sibling); - return 0; out_free_opp_table: - dev_pm_opp_of_remove_table(cpu_dev); + dev_pm_opp_of_cpumask_remove_table(&info->cpus); out_free_resources: if (!IS_ERR(proc_reg)) @@ -453,7 +461,7 @@ static void mtk_cpu_dvfs_info_release(struct mtk_cpu_dvfs_info *info) if (!IS_ERR(info->inter_clk)) clk_put(info->inter_clk); - dev_pm_opp_of_remove_table(info->cpu_dev); + dev_pm_opp_of_cpumask_remove_table(&info->cpus); } static int mtk_cpufreq_init(struct cpufreq_policy *policy)