From patchwork Fri Dec 22 07:26:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 122632 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1909256qgn; Thu, 21 Dec 2017 23:31:02 -0800 (PST) X-Google-Smtp-Source: ACJfBot7WWIGombv3J+Bj/goSnMWPRF5t9tS1Uvx/zYrDpjIB42cNrH05fEdIF2q6JfO1q2UO+Fx X-Received: by 10.99.3.9 with SMTP id 9mr11822205pgd.10.1513927862227; Thu, 21 Dec 2017 23:31:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513927862; cv=none; d=google.com; s=arc-20160816; b=ZCGfgmvEjm3WprykAIe+MzoK/hncjVKoG2Bg7gCEhhaTkjYyhOvAoVQ4kEjCHVs/3x Q/2fZSwbccJGHhAyAKPjFYK1LKIAOs93wbaJozDptxFDH21pVnuw7CvSv/0dPod/Xry4 90c/Kj+oVfFXCCJiEYLeYnxT+cjrE3iE4454kxIyRHEUri215zyHA2kW4AfmWq82se3q gaOSW6h8xhyMI3PCIkRl7u5eSq44ONHVhxFqfqx1XxBvDciZq9CGmtwGURsUL050ZDD4 bxuiHw5Qzenim5/6WzgkZ05rtuyApZhYqVolfOcz4hMo0CMQHY22GZFKv8FMKZTVdpvZ ay9A== 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=4Z6/NG1kC9DAbVHgekL+MiFyHMChJedsVTshilvGh0I=; b=xisBNEshUQZmCLyzHrrIcUPfO9+o4Gez2uTPlzjDKa4i6W/UYmwdvNvu1EZ/vEa7J2 Q+CasNxGxz4ZVwhF5MH2fYTHO5ukl6ufJG6Gn2EDXRLZWkqF2NiVn+xW1ZJ+LikXtJBS oZiOKPGKgwnybeSc06/3zH4p7D4LJofxxkfypDypF2TnQ9adqiqOKofpZ5iNUseUyaiY uq47aqyqDIkoGm4EgKSpvwFI125cF6OBsVK/eA1DWAXR6HPHxiTVgP90CTMKn8S+08ot Y9xRgoe0WjtrXAI7mD0PUEgLwF7P2ChaKDdOZOWTjS54xc5hpp6nMmK09f84YmY9gIco mvBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gLwKFvGV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 g9si14699661pgr.775.2017.12.21.23.31.01; Thu, 21 Dec 2017 23:31:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=gLwKFvGV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1755928AbdLVHa6 (ORCPT + 28 others); Fri, 22 Dec 2017 02:30:58 -0500 Received: from mail-pl0-f68.google.com ([209.85.160.68]:42050 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755862AbdLVHaw (ORCPT ); Fri, 22 Dec 2017 02:30:52 -0500 Received: by mail-pl0-f68.google.com with SMTP id bd8so12474506plb.9 for ; Thu, 21 Dec 2017 23:30:51 -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=4Z6/NG1kC9DAbVHgekL+MiFyHMChJedsVTshilvGh0I=; b=gLwKFvGVHIu14Wq73qS0ZbdAJjxXAfN5bACBzgR2sCAjldcRasQ2KYvn2xzughR/rZ uzYbYvKsdcvOK2imgEjh0cN5UkBdirp8goqtUoMPojKc1ygScYDuiq7ANvF3rpNGYZwf DsKAX7WHmrHhm02zvDVzZDqEe7P9kp4i16zoo= 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=4Z6/NG1kC9DAbVHgekL+MiFyHMChJedsVTshilvGh0I=; b=fpA6cnr6AEGbECWNYJCNN7K3fBjpLS8gj1lJsYOxx0IOm0xwyUIkihPE9xNGITVxPe eAGdjj8SR8e4HoVjQHuzMltSroz7HrD82ssuT0DBy3+GKV7jLVdGDUjiqpJIKmhfbBzA Mi/tid/EI7jtMs5FkoFYHB8hlHtiGkzi3eIOY7NBULp5pPaxDnGSLGM46CWBKhGIaNmp uhMQjZ45FkxN7XKJ923J5vNstUAOMEwO853U8zeFPdqPpahqmS+jrdHZRISJzGpv53Gy CYLBDnsX32v9wYFuCa59Jgm+cr6tMu5bsjXNP7KalEgm5CWuw4cXh+bsM4jKqP2mKCfu 0NBg== X-Gm-Message-State: AKGB3mKW7GlGMpgDCo9VR8Q8lOQu5SbvfspdEThbOKo2UptjW4lp03EF 15wzSs3NaPrggTBpbBGJ3aXJFg== X-Received: by 10.84.195.36 with SMTP id i33mr13502575pld.189.1513927851512; Thu, 21 Dec 2017 23:30:51 -0800 (PST) Received: from localhost ([122.172.139.116]) by smtp.gmail.com with ESMTPSA id k14sm23172599pgt.48.2017.12.21.23.30.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Dec 2017 23:30:50 -0800 (PST) From: Viresh Kumar To: ulf.hansson@linaro.org, Kevin Hilman , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , Rafael Wysocki , linux-pm@vger.kernel.org, Vincent Guittot , robh+dt@kernel.org, rnayak@codeaurora.org, sudeep.holla@arm.com, linux-kernel@vger.kernel.org Subject: [PATCH 6/7] PM / OPP: Get performance state using genpd helper Date: Fri, 22 Dec 2017 12:56:30 +0530 Message-Id: X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The genpd core provides an API now to retrieve the performance state from DT, use that instead of the ->get_pstate() callback. Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 3 --- drivers/opp/of.c | 20 +++++++++++++++++++- 2 files changed, 19 insertions(+), 4 deletions(-) -- 2.15.0.194.g9af6a3dea062 Reviewed-by: Ulf Hansson diff --git a/drivers/opp/core.c b/drivers/opp/core.c index bfcad8983fd1..6194219fb95f 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1034,9 +1034,6 @@ int _opp_add(struct device *dev, struct dev_pm_opp *new_opp, return ret; } - if (opp_table->get_pstate) - new_opp->pstate = opp_table->get_pstate(dev, new_opp->rate); - list_add(&new_opp->node, head); mutex_unlock(&opp_table->lock); diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 2d1bb348ae73..21265af55117 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -321,6 +322,8 @@ static int _opp_add_static_v2(struct opp_table *opp_table, struct device *dev, if (!of_property_read_u32(np, "clock-latency-ns", &val)) new_opp->clock_latency_ns = val; + new_opp->pstate = of_dev_pm_genpd_get_performance_state(dev, np); + ret = opp_parse_supplies(new_opp, dev, opp_table); if (ret) goto free_opp; @@ -371,7 +374,8 @@ static int _of_add_opp_table_v2(struct device *dev, struct device_node *opp_np) { struct device_node *np; struct opp_table *opp_table; - int ret = 0, count = 0; + int ret = 0, count = 0, pstate_count = 0; + struct dev_pm_opp *opp; opp_table = _managed_opp(opp_np); if (opp_table) { @@ -405,6 +409,20 @@ static int _of_add_opp_table_v2(struct device *dev, struct device_node *opp_np) goto put_opp_table; } + list_for_each_entry(opp, &opp_table->opp_list, node) + pstate_count += !!opp->pstate; + + /* Either all or none of the nodes shall have performance state set */ + if (pstate_count && pstate_count != count) { + dev_err(dev, "Not all nodes have performance state set (%d: %d)\n", + count, pstate_count); + ret = -ENOENT; + goto put_opp_table; + } + + if (pstate_count) + opp_table->genpd_performance_state = true; + opp_table->np = opp_np; if (of_property_read_bool(opp_np, "opp-shared")) opp_table->shared_opp = OPP_TABLE_ACCESS_SHARED;