From patchwork Thu Jan 28 08:20:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 60690 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp333531lbb; Thu, 28 Jan 2016 00:26:45 -0800 (PST) X-Received: by 10.66.193.195 with SMTP id hq3mr2768606pac.38.1453969604212; Thu, 28 Jan 2016 00:26:44 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h9si15377543pat.144.2016.01.28.00.26.43; Thu, 28 Jan 2016 00:26:44 -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; 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; dkim=pass header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966515AbcA1I0i (ORCPT + 30 others); Thu, 28 Jan 2016 03:26:38 -0500 Received: from mail-pf0-f177.google.com ([209.85.192.177]:35870 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965103AbcA1IVG (ORCPT ); Thu, 28 Jan 2016 03:21:06 -0500 Received: by mail-pf0-f177.google.com with SMTP id n128so19730735pfn.3 for ; Thu, 28 Jan 2016 00:21:05 -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=d8Zs/9UZ+UpIAUw+G0JcGpHU7vwaTYW1oltPwBonFGo=; b=L/dBtpwQRiLOkEquXYwKB8ABNCfBx/LZ8qAiM1kWGbAYke9boI0hGQnQiPDLt4kNAZ o66Ge1QnSIsRs7ZahXrDV1w1pV+eNaF5cMMWFQDGeTmCCiMARh24rpdB0a5zhT1VVPHP R48dc+r0tJXMBH0SErLC0wRAXhurNu4gsLm0k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=d8Zs/9UZ+UpIAUw+G0JcGpHU7vwaTYW1oltPwBonFGo=; b=HHq3nv0caH9ZMNQOxfXlwkhdiCCkWFJPPFtHC7yi3ieDZ44FgVGBNU31/W6q6rZxiY WwASIIpkPiNrTUGF5SD/s7pfejV/CvX21DnhyP/NI1XaohheO15csyBOTt2PD6xJjvEk yj17EGsMJyPfDCXCT2rIViJNMOF9/xg18F6JX/7Wzb3fF4MoSuYY8iTR5gjhKuvErkUn 4j8eCq7ujwK0nG4jg1lVoPUUYGb7dVgQbE036CDYjDCijpv7mwrV/SXvruPN9t5+mXSt ggLlKY6W/Ik5fyibhDXgzFwi5ddxYDWaTrnDsTEhs6rPEHsATJaoqsdhrlpZ9RApbf7f qbXw== X-Gm-Message-State: AG10YOQw52/sbGmpkPZu6cJolnuV6zZvcd0TFO3sbhFhQ31YyljfccmO9w6GI069V0VBsYpE X-Received: by 10.98.76.80 with SMTP id z77mr2646472pfa.121.1453969265505; Thu, 28 Jan 2016 00:21:05 -0800 (PST) Received: from localhost ([122.171.121.234]) by smtp.gmail.com with ESMTPSA id w22sm14173710pfa.79.2016.01.28.00.21.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jan 2016 00:21:04 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, Stephen Boyd , nm@ti.com, Viresh Kumar , Greg Kroah-Hartman , Len Brown , linux-kernel@vger.kernel.org (open list), Pavel Machek , Viresh Kumar Subject: [PATCH V2 04/16] PM / OPP: Introduce dev_pm_opp_get_max_transition_latency() Date: Thu, 28 Jan 2016 13:50:33 +0530 Message-Id: X-Mailer: git-send-email 2.7.0.79.gdc08a19 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 In few use cases (like: cpufreq), it is desired to get the maximum latency for changing OPPs. Add support for that. Signed-off-by: Viresh Kumar Reviewed-by: Stephen Boyd --- drivers/base/power/opp/core.c | 17 +++++++++++++++++ include/linux/pm_opp.h | 6 ++++++ 2 files changed, 23 insertions(+) -- 2.7.0.79.gdc08a19 diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c index ffe2406af882..b0f5c72f0fc3 100644 --- a/drivers/base/power/opp/core.c +++ b/drivers/base/power/opp/core.c @@ -290,6 +290,23 @@ unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev) EXPORT_SYMBOL_GPL(dev_pm_opp_get_max_volt_latency); /** + * dev_pm_opp_get_max_transition_latency() - Get max transition latency in + * nanoseconds + * @dev: device for which we do this operation + * + * Return: This function returns the max transition latency, in nanoseconds, to + * switch from one OPP to other. + * + * Locking: This function takes rcu_read_lock(). + */ +unsigned long dev_pm_opp_get_max_transition_latency(struct device *dev) +{ + return dev_pm_opp_get_max_volt_latency(dev) + + dev_pm_opp_get_max_clock_latency(dev); +} +EXPORT_SYMBOL_GPL(dev_pm_opp_get_max_transition_latency); + +/** * dev_pm_opp_get_suspend_opp() - Get suspend opp * @dev: device for which we do this operation * diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 5daa43058ac1..59da3d9e11ea 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -35,6 +35,7 @@ bool dev_pm_opp_is_turbo(struct dev_pm_opp *opp); int dev_pm_opp_get_opp_count(struct device *dev); unsigned long dev_pm_opp_get_max_clock_latency(struct device *dev); unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev); +unsigned long dev_pm_opp_get_max_transition_latency(struct device *dev); struct dev_pm_opp *dev_pm_opp_get_suspend_opp(struct device *dev); struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev, @@ -94,6 +95,11 @@ static inline unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev) return 0; } +static inline unsigned long dev_pm_opp_get_max_transition_latency(struct device *dev) +{ + return 0; +} + static inline struct dev_pm_opp *dev_pm_opp_get_suspend_opp(struct device *dev) { return NULL;