From patchwork Mon Jun 15 11:57:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 6608791 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8B83CC0020 for ; Mon, 15 Jun 2015 12:05:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ADA1720525 for ; Mon, 15 Jun 2015 12:05:14 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2510420523 for ; Mon, 15 Jun 2015 12:05:09 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z4T5X-0004yg-PX; Mon, 15 Jun 2015 12:02:03 +0000 Received: from mail-pd0-f175.google.com ([209.85.192.175]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z4T2I-0001YV-N2 for linux-arm-kernel@lists.infradead.org; Mon, 15 Jun 2015 11:58:43 +0000 Received: by pdjm12 with SMTP id m12so71449753pdj.3 for ; Mon, 15 Jun 2015 04:58:25 -0700 (PDT) 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=0MgyqzCeonYvqoLM4O8b3s0BtcjKEvSRkuEZKTvIF0o=; b=moGS/6Wj+mIJcFCbbqa8DMeU0cf4unDOY3BMn0ILmDNlGL0uXqiQukJdNikd+xjQRz EjIvC8cJj08sS8OoTQaaDYX5smdj0SKhyv7MGCMLH1hZoiObgnCwPEjFP11rsxynMlFw ZVBaPBVF6/GZLkgvAhXsDkKUy6l5O3GiLACzAT0+vqcTMiqNcgjwbZQlOpO6MlODNsR3 tRBYU2IlmEdbxMNC0IgsiLZ6JRYMEdvXE7ajlcqkhXfqKefj/Uk2lZFHHpXmy8B1CuNc z5MLC0EwXpZp7+P/dFbI7KbGW1NxdcOnJ9qg/KVblIkhwIfeK2zfDDXrZQdjtdtYAaTO OoyA== X-Gm-Message-State: ALoCoQlkLv4/8o2+voiYQuaq39+Kfkul1Dmx8+Mb2GfZZe6e+y2bslCU40Y70NXO09rtO7bg6T79 X-Received: by 10.68.246.1 with SMTP id xs1mr47528898pbc.53.1434369505551; Mon, 15 Jun 2015 04:58:25 -0700 (PDT) Received: from localhost ([122.167.70.98]) by mx.google.com with ESMTPSA id ve1sm12029500pbc.52.2015.06.15.04.58.24 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 15 Jun 2015 04:58:24 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , rob.herring@linaro.org, nm@ti.com Subject: [PATCH 08/10] OPP: Add support for opp-suspend Date: Mon, 15 Jun 2015 17:27:34 +0530 Message-Id: <6a4a0da974d5944a111af6f0b57bcba63a91fe40.1434369079.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.4.0 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150615_045842_835315_FB3A1E36 X-CRM114-Status: GOOD ( 13.71 ) X-Spam-Score: -0.7 (/) Cc: thomas.petazzoni@free-electrons.com, kesavan.abhilash@gmail.com, linaro-kernel@lists.linaro.org, ta.omasab@gmail.com, khilman@linaro.org, linux-pm@vger.kernel.org, viswanath.puttagunta@linaro.org, Viresh Kumar , santosh.shilimkar@oracle.com, sboyd@codeaurora.org, broonie@kernel.org, mike.turquette@linaro.org, Sudeep.Holla@arm.com, arnd.bergmann@linaro.org, linux-arm-kernel@lists.infradead.org, l.stach@pengutronix.de X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP With "operating-points-v2" bindings, its possible to specify the OPP to which the device must be switched, before suspending. This patch adds support for getting that information. Signed-off-by: Viresh Kumar --- drivers/base/power/opp.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c index 6b554e417b1f..0022453e4b60 100644 --- a/drivers/base/power/opp.c +++ b/drivers/base/power/opp.c @@ -137,6 +137,7 @@ struct device_opp { struct device_node *np; unsigned long clock_latency_ns_max; bool shared_opp; + struct dev_pm_opp *suspend_opp; }; /* @@ -1218,6 +1219,8 @@ static int _of_init_opp_table_v2(struct device *dev, goto put_opp_np; if (!ret) { + const phandle *handle; + if (!dev_opp) { dev_opp = _find_device_opp(dev); if (WARN_ON(!dev_opp)) @@ -1227,6 +1230,25 @@ static int _of_init_opp_table_v2(struct device *dev, dev_opp->np = opp_np; if (of_get_property(opp_np, "opp-shared", NULL)) dev_opp->shared_opp = true; + + /* OPP to select on device suspend */ + handle = of_get_property(opp_np, "opp-suspend", NULL); + if (handle) { + struct device_node *suspend_opp_np; + struct dev_pm_opp *opp; + + suspend_opp_np = of_find_node_by_phandle(be32_to_cpup(handle)); + + list_for_each_entry_rcu(opp, &dev_opp->opp_list, node) + if (opp->np == suspend_opp_np) { + dev_opp->suspend_opp = opp; + break; + } + + if (!dev_opp->suspend_opp) + dev_err(dev, "%s: Invalid opp-suspend\n", + __func__); + } } else { of_free_opp_table(dev); }