From patchwork Wed Mar 13 09:00:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 10850803 X-Patchwork-Delegate: viresh.linux@gmail.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C34761390 for ; Wed, 13 Mar 2019 09:00:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AFD0528C1D for ; Wed, 13 Mar 2019 09:00:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A400729A12; Wed, 13 Mar 2019 09:00:29 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable 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 4BF8028E46 for ; Wed, 13 Mar 2019 09:00:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727349AbfCMJA2 (ORCPT ); Wed, 13 Mar 2019 05:00:28 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:37049 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726814AbfCMJAZ (ORCPT ); Wed, 13 Mar 2019 05:00:25 -0400 Received: by mail-lj1-f194.google.com with SMTP id a17so813369ljd.4 for ; Wed, 13 Mar 2019 02:00:24 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=lRuCf454mnzXB+DyjyFfFPdMgMq/C5zdWzQg4oC5VkU=; b=inRvYdF2URJMHy6DjIr+GhGLMU3P1FzqcqtEDRK4JChuFpTLPGpOXtV+RO7/5dckAL jpeGejyWeb/QXvr0zUbCfzv5imaWuFE8wlhpWlFxqC8uX5ShsK5sWeKiHgO8TEXRm1kj mqT+DHt8hKej3THaZPN8rbwK1rMZYmYkyAGrcCnAMoqRxxNnJykTIdVW1fQYmKs7gZln +R0hIrYLWqWlsKlY0LeNuBvvrVJQKFJR6/+GH7XKRikBbsWDbg1AqOKFIRinz1/qSmVm WCvKsymK5Mv7aT4QBueq3B5eBZpjEXka9bfjlOqe7cbZPc4fU+Dto10G8lkRcRDJdQtd 6YGg== 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:mime-version:content-transfer-encoding; bh=lRuCf454mnzXB+DyjyFfFPdMgMq/C5zdWzQg4oC5VkU=; b=kJc9avm0HiYQ8Jz0FIxIdTfCOhC9Ng/zaeCbJZOt1rM2MuQ6EIuLIbloxaIcvXSTHI Nn9l6VdUfHhJxF4gu0Wp/agjYMCZScRrvKsLEQrYa3qPRfeyNEB7LLbsFV6fPYG43o4C CbxMb2XV7GsHYTZQogYQU0RE5yxa22m5o5vZ7htmfbzwGZ2j0qc0XpEqwUQseCGucrur Ps+NGr0Spa1woAQbI0oQkDzrXakDiUDWox22w0id05ZBxhTlNUszB1wHztuDc/bBt/F0 bEX19Ru9dmKCvonbQDLbSj+xEQfJXO4mZ991OhZGjNh9dT4b9YSXfIJKWn8Y+icGbCZk x46A== X-Gm-Message-State: APjAAAW2q1B6/6H9XmmaQELxFPG0cXSLgFKB1Dh/mbpQG2DyzZQvrT80 V2CiZNGgtDt/jfGr6k6OP3IcXw== X-Google-Smtp-Source: APXvYqy+0kI5lN5r3CDxfcKdZ5X2ac9IRFzw80Mxsj4mGpyXAGd5SfKIalXwYLiag6G79eZLggdkjA== X-Received: by 2002:a2e:8585:: with SMTP id b5mr22362278lji.125.1552467623334; Wed, 13 Mar 2019 02:00:23 -0700 (PDT) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id u15sm1701986lja.73.2019.03.13.02.00.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 13 Mar 2019 02:00:22 -0700 (PDT) From: Georgi Djakov To: vireshk@kernel.org, sboyd@kernel.org, nm@ti.com, robh+dt@kernel.org, mark.rutland@arm.com, rjw@rjwysocki.net Cc: jcrouse@codeaurora.org, vincent.guittot@linaro.org, bjorn.andersson@linaro.org, amit.kucheria@linaro.org, seansw@qti.qualcomm.com, daidavid1@codeaurora.org, evgreen@chromium.org, sibis@codeaurora.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, georgi.djakov@linaro.org Subject: [PATCH 4/4] cpufreq: dt: Add support for interconnect bandwidth scaling Date: Wed, 13 Mar 2019 11:00:10 +0200 Message-Id: <20190313090010.20534-5-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190313090010.20534-1-georgi.djakov@linaro.org> References: <20190313090010.20534-1-georgi.djakov@linaro.org> MIME-Version: 1.0 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 In addition to clocks and regulators, some devices can scale the bandwidth of their on-chip interconnect - for example between CPU and DDR memory. Add support for that, so that platforms which support it can make use of it. Signed-off-by: Georgi Djakov --- drivers/cpufreq/cpufreq-dt.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index e58bfcb1169e..30fed0fc266d 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -100,6 +101,7 @@ static int resources_available(void) struct device *cpu_dev; struct regulator *cpu_reg; struct clk *cpu_clk; + struct icc_path *cpu_path; int ret = 0; const char *name; @@ -126,6 +128,19 @@ static int resources_available(void) clk_put(cpu_clk); + cpu_path = of_icc_get(cpu_dev, NULL); + ret = PTR_ERR_OR_ZERO(cpu_path); + if (ret) { + if (ret == -EPROBE_DEFER) + dev_dbg(cpu_dev, "defer icc path: %d\n", ret); + else + dev_err(cpu_dev, "failed to get icc path: %d\n", ret); + + return ret; + } + + icc_put(cpu_path); + name = find_supply_name(cpu_dev); /* Platform doesn't require regulator */ if (!name) @@ -205,10 +220,18 @@ static int cpufreq_init(struct cpufreq_policy *policy) } } + opp_table = dev_pm_opp_set_path(cpu_dev, NULL); + if (IS_ERR(opp_table)) { + ret = PTR_ERR(opp_table); + dev_err(cpu_dev, "Failed to set interconnect path for cpu%d: %d\n", + policy->cpu, ret); + goto out_put_regulator; + } + priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (!priv) { ret = -ENOMEM; - goto out_put_regulator; + goto out_put_path; } priv->reg_name = name; @@ -288,6 +311,8 @@ static int cpufreq_init(struct cpufreq_policy *policy) if (priv->have_static_opps) dev_pm_opp_of_cpumask_remove_table(policy->cpus); kfree(priv); +out_put_path: + dev_pm_opp_put_path(opp_table); out_put_regulator: if (name) dev_pm_opp_put_regulators(opp_table);