From patchwork Sun Dec 27 06:21:57 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: 7922991 Return-Path: X-Original-To: patchwork-linux-mediatek@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id F0618BEEE5 for ; Sun, 27 Dec 2015 06:23:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 245EC202F0 for ; Sun, 27 Dec 2015 06:23:07 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5747D202E6 for ; Sun, 27 Dec 2015 06:23:06 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aD4jR-0004Et-Rx; Sun, 27 Dec 2015 06:23:05 +0000 Received: from mail-pf0-x236.google.com ([2607:f8b0:400e:c00::236]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aD4iy-00046e-0F for linux-mediatek@lists.infradead.org; Sun, 27 Dec 2015 06:22:37 +0000 Received: by mail-pf0-x236.google.com with SMTP id q63so61714378pfb.0 for ; Sat, 26 Dec 2015 22:22:15 -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; bh=cUy2OR0Tjr4J+74ytebBlbQHqFFXe3w4fLqIks7uBwM=; b=ZW3JpFyR6OaByMV2OOo9pA+nYozK/ek2fZ4Hl+Im3jM89aB2CSjH6BugElUGCHFhox tWFX3tyoBSWHlgyuh0LHU/JffmGjXF6xwQmxjq1tJNz0snJyfn1Bfw0Lty91F/RuZ0Uk BI6+T+ugxfN3SSuQG/Mx6TgO1KDwxL8LRuz3s= 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=cUy2OR0Tjr4J+74ytebBlbQHqFFXe3w4fLqIks7uBwM=; b=nLLggB7S4Yxh9rUkOzAMwWNylzSEh1/wZQxwEsyZLyLxjurHS/FV7pqqRCy3VJPyyf fTiMjAkbRSIxaIwLJV9eybPd577TRuVHWeyLv+o1EHf4sIgvQgYnr0YH7naRePIIB92X zoqsK2OXSq6/HE6GCqIl5hN59fE+GHWpQCuvygoDyBFkRmS58jeNPqIjhb/xqeaYY13X OcMJkRon1aRKYik3W+aZ9hujLIjOMinFzKpjw3ayU5rfOJ9zBJxV5WSxfWjjQr6M2NhJ /0s8yTGs4SWkIbz+eqjlzM0OJ0G8QDKm5fAhWWASh68Dx03MKHwwUKEVoYoND02KQm7U 5VCw== X-Gm-Message-State: ALoCoQkOdi2AhbohML8cE64S+X5fKvK3YP9qHrZ4jqCYTJ0d84H7/x4vB3OFnFSEsjO2L0Z8g2AQgoho8s+gH/oTDUEJam4GKQ== X-Received: by 10.98.14.85 with SMTP id w82mr7987177pfi.131.1451197335372; Sat, 26 Dec 2015 22:22:15 -0800 (PST) Received: from localhost.localdomain ([124.219.30.17]) by smtp.googlemail.com with ESMTPSA id tu9sm73508609pac.0.2015.12.26.22.22.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 26 Dec 2015 22:22:14 -0800 (PST) From: Pi-Cheng Chen To: Viresh Kumar , Matthias Brugger Subject: [PATCH v2 2/3] cpufreq: mt8173: migrate to use operating-points-v2 bindings Date: Sun, 27 Dec 2015 14:21:57 +0800 Message-Id: <1451197318-12418-3-git-send-email-pi-cheng.chen@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1451197318-12418-1-git-send-email-pi-cheng.chen@linaro.org> References: <1451197318-12418-1-git-send-email-pi-cheng.chen@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151226_222236_338194_34545D1D X-CRM114-Status: GOOD ( 12.16 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, Michael Turquette , linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Viresh Kumar --- drivers/cpufreq/mt8173-cpufreq.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/cpufreq/mt8173-cpufreq.c b/drivers/cpufreq/mt8173-cpufreq.c index fd601b9..1efba34 100644 --- a/drivers/cpufreq/mt8173-cpufreq.c +++ b/drivers/cpufreq/mt8173-cpufreq.c @@ -390,7 +390,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 +429,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 +458,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)