From patchwork Fri Dec 14 10:15:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 153804 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1881690ljp; Fri, 14 Dec 2018 02:15:46 -0800 (PST) X-Google-Smtp-Source: AFSGD/WJHPPt/+ZArnILRNQIBvZEW04PKAf7XrE7LYGgR1EOawP4EEqi5yeqGeiRIhoy6SkZxk8w X-Received: by 2002:a63:2b01:: with SMTP id r1mr2144361pgr.432.1544782545895; Fri, 14 Dec 2018 02:15:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544782545; cv=none; d=google.com; s=arc-20160816; b=wNHxwiKpgKrCrYxlCQLtmSoRcNu3/FloWTbMNHuj/qKISOipqA4vZ3+zH/HoTcXtqa RRLdYG4mjooyXUuSD88Jywog2j7Jom/FI8ltdtyogu2Zh+tWg0EoSsFwHCnD/IkD6Nql MKe6W5BUaDIyzu7lcvxGOejkbZ+7EC+jV6eifYQ9ry9rJpp1tJbHGg9itpKxro/MDnkx bcr2FCNQgCvvFeJr0A3hfFdSnMfIu7H8aDX0rHZ85AfCB2zBwF8EbK2KQElzzrim/6Oa rSs+fWc7zxjsSVzocXdmp0VWyfZSOkV7qVFKQDks9B1CBDDpW0oIver+NHUbhV+YSaIO 5vGQ== 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=NQQ8+qTBYTN7MwFFezSvMdLptkcV2B586qQZHdT6CL1d3vA5gJwSfTyo4WLuOBt8Ja ipqeWLhFx6yg6j7IaxDtqxdc4+hH7mrK2zRIbp0F/EuspEiWihWpMCdgUk+/IP/hJYjy zZH2uiWJeW22wYAUDpVh/z45Wo/EPXlq0TkZob/pt3j3RoCjEEW4HRcd1yuV+ZdOGxBS cff5UQpglnS7B1ZYgzYIS1aMkUVefhmCnvusdQ/gDfX6WuxTNaDUtd8YDHhdiYhcRyWM +lc7S8LzsmhqqJrb6WviuctLxlSgS8NxpIImIQlrSb8sqxuAbXDn6UKZ7t/rcuDHAYfZ B3Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HQrMDzUq; 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 z4si3660084pgl.16.2018.12.14.02.15.45; Fri, 14 Dec 2018 02:15:45 -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=HQrMDzUq; 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 S1729486AbeLNKPo (ORCPT + 31 others); Fri, 14 Dec 2018 05:15:44 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:35170 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728829AbeLNKPm (ORCPT ); Fri, 14 Dec 2018 05:15:42 -0500 Received: by mail-pl1-f195.google.com with SMTP id p8so2541962plo.2 for ; Fri, 14 Dec 2018 02:15:42 -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=HQrMDzUqh3MUYQIsDHDucLjzhFpViI0N/rtfVw4d1bhzFgHCKawj+qxQCgLU/kTnPM Iagdiv7rUyhq4WsM3jCFOcO4FGkEdyRWtKoUXL9p/Fvq7f2PLGQSqdoe+w3qAOJpvduE bEKyAoYUWI8pFOLmUCpZZV/d87yuWc6Izqo4Q= 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=A+fEVWNOIrBHR2c9eyNO1XyNQV9Hgg/YDZpcQHQZh+wLTaqGN+y2aLuoCoeJbBKqHI Uddvtiu88wbEQIk/VH9OarH7MkilO1ZYnPLdUSPsDpRL4w2dluPUhU2ezntqx1lpz7yh ufvwbVtMPN9kIF6/ZbrQuv00kbdHisywMAA98s0P+k79uFhBSRhCPJk0A68zYQb6benG px8Bx/UO1fb5uJNgilFrTMRprgz8ES0kMtwIP2zQ8NLGOheP7Vz+gltITMmaTCVvBxOW BpXPivsnbpCwf1WLSg8VEXsrSPc5Ul+HsDWmBqbJOJAwlb9ZPi17wvV9bn9w3bQUO9H0 K0vQ== X-Gm-Message-State: AA+aEWYhXWbG+0GHipVqSUsFBVNRKxASODC5utlKE3H2qa0DBVkYKg++ piBGkegfi3Yvo2+CZigeaRH11A== X-Received: by 2002:a17:902:bb98:: with SMTP id m24mr2237750pls.71.1544782541779; Fri, 14 Dec 2018 02:15:41 -0800 (PST) Received: from localhost ([122.172.23.29]) by smtp.gmail.com with ESMTPSA id p24sm6290090pfk.155.2018.12.14.02.15.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Dec 2018 02:15:41 -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 V4 1/7] PM / Domains: Make genpd performance states orthogonal to the idlestates Date: Fri, 14 Dec 2018 15:45:27 +0530 Message-Id: <48a7fc66faec9ac5c157b0cadcdaeb07bfe78781.1544782279.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;