From patchwork Wed Dec 12 10:57:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 153569 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1679399ljp; Wed, 12 Dec 2018 02:57:53 -0800 (PST) X-Google-Smtp-Source: AFSGD/XuZyq2AJoHPif17DeKAeAWIZIVlLC5dsl7vaOgupnWSaCe0kltoJ9HkhW9yeDOxYj1ARjE X-Received: by 2002:a62:938f:: with SMTP id r15mr19652607pfk.27.1544612273508; Wed, 12 Dec 2018 02:57:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544612273; cv=none; d=google.com; s=arc-20160816; b=seF0H8vrkyz7m9WHvwZm3lOKvpETh14Qus9/LPHk2WnCxfpzJJsyW4z8U5d5WsnmFv 8pWsJZQ9tNw7PUuf4QuP8mJrG0k5uwIdzuwWD5VwdQGB5qcZg1V3L2bLcmIAis4amMtg qkAE6lLfoUMkhV891WRnHkfvh2JC+YO0R5bCXuEggpp/jcumVDI94f6STR898bUKoLeM Dglw0SsqKsr0I4nTptJotk9LRaMQuJWgaEXORPzdRg4QKoIVRuFYmGvHf3R3qKKRHNj0 /f0/lzzRoDoCP8EhEjUEv1dEvmwJA17Qk/vW6/SV2mdmkk5iNH/mLfugSNPBQpGRm7bA og7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=a5kLi4xuwk7dpMQcurWuHvhYASg5acLmavueiEtTxTk=; b=VGyD6m1Qv0iO0X5AEHFwJZ0E6vuKhtclAopGpNwwnss69Rt8veEbENhLb5TfhPA5V6 jgXgNPKjlv20KmSfHLqxOOp4/KCUb3QrVjV7CoFTYFW/TJKCLfbf/4CCzdHy3ZYhSb92 9mKrgMBfJCYm98kmf4Rr0VHFEmTaTZDyZbAB7woUmADnprx7tLm03iihvk90k+rTH2Xi QTL/l1U0rK7loGuNsHfETIgbGaLKhndlEpEQ4TPl48ujBcG66RZGIIoK1juo+4mCrYwf 3qdeFxNkv7QxrNY3b/tjNlj6ADYMPGucgt67hliiD1/IKwYsTROzHlk3AJbPShbMv15e t4Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fEnLiF31; 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 b4si14042153pgk.350.2018.12.12.02.57.53; Wed, 12 Dec 2018 02:57:53 -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=fEnLiF31; 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 S1727266AbeLLK5v (ORCPT + 31 others); Wed, 12 Dec 2018 05:57:51 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:45287 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726842AbeLLK5u (ORCPT ); Wed, 12 Dec 2018 05:57:50 -0500 Received: by mail-pl1-f196.google.com with SMTP id a14so8434817plm.12 for ; Wed, 12 Dec 2018 02:57:50 -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 :mime-version:content-transfer-encoding; bh=a5kLi4xuwk7dpMQcurWuHvhYASg5acLmavueiEtTxTk=; b=fEnLiF31ENthjSEay6GYdC4yQO4wtTnRTh0ZrBobbwmNGml2sASHWOMsN43O5t4bQ0 FU/o2D4z0RGFUZozFNk2gIMWbECLMXgRaO9jK6mCiQhW4Jyfd10gVeVKx8gKe8jrniBe UBnsXVP5+R19EZ9szMeWR3kw5gJiWfEx86Gco= 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=a5kLi4xuwk7dpMQcurWuHvhYASg5acLmavueiEtTxTk=; b=f8jiR3gThGxVEr77mn/uWGGv416VS0L54yTOmApoykw+PSqN6HzU3izfgFMK1ZO8gp SCuCBtAiXxxH3bA6+nbzUqXBU2kg4jsiA1FyXrYamYNdS/7/c1YIHXdUIAh3NhMySbun Yn0Yny+RFDBQ2WNBdIyTi/N9FJmmVutcGhaISkE1MJPqiOotFfwyb1H4TcnBzJ9pb5on 3bg/r60b53PYKiFobAtqLbWwOXVfErGSMIU17NCKceC2I8NnqsyB14sVS8bQgSbFZ/L3 uqQzozgkDGGZyR5yJousPo0OrooI28mS2r8MVG9swzNlPjYqGSpvdRNjh/pNZ2QYTOLd jXKQ== X-Gm-Message-State: AA+aEWY367WYhqTttxPi2GiAsV8GvHU8QJaPWql5hvWJhWiFb2YjzY2K dDYSJ3dvuXZFbgsyf+mY/J79WQ== X-Received: by 2002:a17:902:1682:: with SMTP id h2mr19339386plh.243.1544612269932; Wed, 12 Dec 2018 02:57:49 -0800 (PST) Received: from localhost ([122.172.23.29]) by smtp.gmail.com with ESMTPSA id u8sm23413177pfl.16.2018.12.12.02.57.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 02:57:49 -0800 (PST) From: Viresh Kumar To: ulf.hansson@linaro.org, Rafael Wysocki , Kevin Hilman , Pavel Machek , Len Brown Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Stephen Boyd , Nishanth Menon , rnayak@codeaurora.org, niklas.cassel@linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH V3 1/6] PM / Domains: Make genpd performance states orthogonal to the idlestates Date: Wed, 12 Dec 2018 16:27:24 +0530 Message-Id: <48a7fc66faec9ac5c157b0cadcdaeb07bfe78781.1544611890.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.19.1.568.g152ad8e3369a In-Reply-To: References: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ulf Hansson It's quite questionable whether genpd internally should care about if the corresponding PM domain for a device is powered on, as to allow setting a new performance state for it. The assumptions creates an unnecessary limitation at this point, for both consumers and providers, but more importantly it also makes the code more complicated. Therefore, let's simplify the code to allow setting a performance state, by invoking the ->set_performance_state() callback, no matter whether the PM domain is powered on or off. Do note, this change means genpd providers needs to restore the performance state themselves during power on, via the ->power_on() callback. Moreover, they may also need to check that the PM domain is powered on, from their ->set_performance_state() callback, before deciding to update the state. Tested-by: Rajendra Nayak Acked-by: Viresh Kumar Signed-off-by: Ulf Hansson Signed-off-by: Viresh Kumar --- drivers/base/power/domain.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) -- 2.19.1.568.g152ad8e3369a diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 8e554e6a82a2..4a4e39d12354 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -311,12 +311,10 @@ int dev_pm_genpd_set_performance_state(struct device *dev, unsigned int state) */ update_state: - if (genpd_status_on(genpd)) { - ret = genpd->set_performance_state(genpd, state); - if (ret) { - gpd_data->performance_state = prev; - goto unlock; - } + ret = genpd->set_performance_state(genpd, state); + if (ret) { + gpd_data->performance_state = prev; + goto unlock; } genpd->performance_state = state; @@ -347,15 +345,6 @@ static int _genpd_power_on(struct generic_pm_domain *genpd, bool timed) return ret; elapsed_ns = ktime_to_ns(ktime_sub(ktime_get(), time_start)); - - if (unlikely(genpd->set_performance_state)) { - ret = genpd->set_performance_state(genpd, genpd->performance_state); - if (ret) { - pr_warn("%s: Failed to set performance state %d (%d)\n", - genpd->name, genpd->performance_state, ret); - } - } - if (elapsed_ns <= genpd->states[state_idx].power_on_latency_ns) return ret;