From patchwork Mon Apr 9 11:43:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 133033 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp168479ljb; Mon, 9 Apr 2018 04:44:44 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/aEg80ioRwNFcKqAb4DT1J9ZmdPlpjFIpy6BiUD8vzxTKwC0BcOnobswV1Ws+rsMGcLubj X-Received: by 2002:a17:902:2e:: with SMTP id 43-v6mr38237189pla.282.1523274284310; Mon, 09 Apr 2018 04:44:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523274284; cv=none; d=google.com; s=arc-20160816; b=CG8SCGYTH8i4S4JvrAWLSp1UpyyM9CYE1ui9Q+UUNdM+zhUufcjpP0EILscbzBADIb Sc0e49DMPlObgX60H3TTJrIUoq4yAIRDBKcA0OBZ5aeI/FX1tX4F2qYCFAQMoub78cQy CrYk3K+ugfSbi4fgzaHVx5f6mj4AQ25DKSSWIuXB15k+WnBgRObJ0IlaoIdz1NXoWGGx M+Wv+dcqfjA7JsoaVVX+GEJgN7AU0mWSD96bE+PHolb0eRwcWyCOYIOiJMhZZh9tpONA GxdBwOTxsCN8sKmG9OQRBMQIKbycOH8Osb3h4KTJYdFDSG7CmspYMZ0pNRGk3wurxCSm BXeA== 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=9wDc+0pse7OWTpuIPhm3Ig06uxmHSKdgmTinQq1SoDI=; b=ccsd6NgwfEfPl78qjVssih1ywjFZx9Gi0hl5EXLd/8cD77vxCdVls9UEdUYSAAcRMu IYWZWdAy+9/HhteJTRwcFuoDaa4P7pphBup6otU23cKWc88Sp7zrMVnRwP1w1sbjvTTZ kgR5xzin/6p6XUnqZgoe6Sn9V8HSg8LaSsi28bDmedWa3Q6oK1xfpm8H8E+eEQdQ5a51 s0KH9FeUldDfAdX7dMY5kH1oGgzpy/8KHuvg0Zev7/GYaCE4je0aaSTM21tQh7uFtBfD w7B/WLMp3OowkFGsH3qbqVzPGA9/W6xp5qS35bRR7smo3pzgIOMZl25wOzENBS9UE2Da IxBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DfpsJRN7; 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 n11-v6si153720pls.422.2018.04.09.04.44.43; Mon, 09 Apr 2018 04:44:44 -0700 (PDT) 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=DfpsJRN7; 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 S1752262AbeDILol (ORCPT + 11 others); Mon, 9 Apr 2018 07:44:41 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:35518 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752240AbeDILoj (ORCPT ); Mon, 9 Apr 2018 07:44:39 -0400 Received: by mail-pl0-f67.google.com with SMTP id 61-v6so4959542plb.2 for ; Mon, 09 Apr 2018 04:44:39 -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 :in-reply-to:references; bh=9wDc+0pse7OWTpuIPhm3Ig06uxmHSKdgmTinQq1SoDI=; b=DfpsJRN7Fnt3CZ01FZs5EcbZmk0ZXaq6OwsVlvg+JQyVhBwVAHyAuF3ReKf0py33bz TYEbijTwvMl81OJNq4Nk272PE3cKeP7TWFcuRHk7IZa61/y7TTVdFqzWgbNrRB0QnrfR dpwBZEIy2i2qI0jiLQbEU1N7VR6QGoeVGNPb0= 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=9wDc+0pse7OWTpuIPhm3Ig06uxmHSKdgmTinQq1SoDI=; b=JcZxXyGxqSNUVs7h9WRa8AlYJWQ6rn6QUXhN/zKLog6TssGloU6UZXHaizPjPwL9BM 4f2EvJF3Km9mYkTWHLvADnfzJkX5kORkcMcbJypzEQ3f+1AecB3HHGCD3vKJ5LwT6lRH XawbbLhfV/XaJda7TOvPkUZOL209s0UMQv5PEDho2E6S1pRv1GgTsdQeCMqYpn7oQKlP /AT+FCmTcL18N1K949rULsNjUOgeTuGQC1XE4ob+7OOAoBGjlipYjLHb3v16zQeM8C6g uCXP9LHog5MUMKAtndbbobxbVBobuVQW+lW1D/OiLU9MPuzsik6yiakU7EZgOztevp/X C6xA== X-Gm-Message-State: AElRT7FyBAbHXrSMxkw4PDjH3sawOwZZ4XymNr0T57vbUKG7AcGMUGdK npBgQT7AtMPqLFWSiYpCxDatnYARoDg= X-Received: by 2002:a17:902:3084:: with SMTP id v4-v6mr39008494plb.262.1523274279175; Mon, 09 Apr 2018 04:44:39 -0700 (PDT) Received: from localhost ([122.171.228.188]) by smtp.gmail.com with ESMTPSA id j10sm894544pfj.1.2018.04.09.04.44.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Apr 2018 04:44:38 -0700 (PDT) From: Viresh Kumar To: Ulf Hansson , Stephen Boyd , Viresh Kumar , Nishanth Menon Cc: Viresh Kumar , Rajendra Nayak , Vincent Guittot , linux-pm@vger.kernel.org Subject: [PATCH V2 10/11] PM / OPP: Get performance state using genpd helper Date: Mon, 9 Apr 2018 17:13:50 +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 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 Reviewed-by: Ulf Hansson --- drivers/opp/core.c | 3 --- drivers/opp/of.c | 20 +++++++++++++++++++- 2 files changed, 19 insertions(+), 4 deletions(-) -- 2.15.0.194.g9af6a3dea062 diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 416f54ba7a26..e4ec30ee1493 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1056,9 +1056,6 @@ int _opp_add(struct device *dev, struct dev_pm_opp *new_opp, } } - 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 de41e68b780f..5de9ec47c6bd 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -329,6 +330,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_opp_to_performance_state(dev, np); + ret = opp_parse_supplies(new_opp, dev, opp_table); if (ret) goto free_opp; @@ -379,7 +382,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) { @@ -413,6 +417,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;