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: 49855 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 169D5205DE for ; Mon, 15 Jun 2015 11:58:31 +0000 (UTC) Received: by lbcak1 with SMTP id ak1sf25002650lbc.2 for ; Mon, 15 Jun 2015 04:58:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=Bt/QjSIwbyd4B7nvw6ksh7wcb9Osx2k6JdxcyBkvbmc=; b=FjGKl2ocZDCyiEs+P4ESJ4hClG5Gu8aEyfM2ZpjCOtVEQtIFWhORBqBohSapvOSNOU 3BOD7uQheSc4fA+7vMbmt8esRQ3Mlik45tjoHp2bgu3XNzvDuhwV7C1Tm811Xe+VjNVD rPYyplyDMfezq+Hij0uiyMGUuQSeynT6s356CYoWVFnaCBRIERHwPEW7GeYnjouJA0mj yI3UQJcmqc89Tq98+ScRATC9sZpI7jB3VTxALoIlA69qtUCg2Bw+alhcOXXplwgzWNua muOY/RbsnJ1nstnUclyLyEnIoZrKlXMDu5i05fddtltJYi60jcYBdvhOZcT+UUUwRpDp 0lJQ== X-Gm-Message-State: ALoCoQkkwJ/jE9qL4FoPgkWuT+x5+gTUQlrjAW/pLVptk+kKKxdWtWIju37aipl1Yt+6k1osPE+Y X-Received: by 10.194.142.205 with SMTP id ry13mr29542625wjb.2.1434369510030; Mon, 15 Jun 2015 04:58:30 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.116.7 with SMTP id js7ls811707lab.34.gmail; Mon, 15 Jun 2015 04:58:29 -0700 (PDT) X-Received: by 10.152.7.7 with SMTP id f7mr27106812laa.106.1434369509845; Mon, 15 Jun 2015 04:58:29 -0700 (PDT) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id j5si10300324laf.127.2015.06.15.04.58.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jun 2015 04:58:29 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by labko7 with SMTP id ko7so56195490lab.2 for ; Mon, 15 Jun 2015 04:58:29 -0700 (PDT) X-Received: by 10.112.97.194 with SMTP id ec2mr26808903lbb.88.1434369509605; Mon, 15 Jun 2015 04:58:29 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1363719lbb; Mon, 15 Jun 2015 04:58:28 -0700 (PDT) X-Received: by 10.70.39.103 with SMTP id o7mr47587998pdk.122.1434369507846; Mon, 15 Jun 2015 04:58:27 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gu10si258184pbc.26.2015.06.15.04.58.27; Mon, 15 Jun 2015 04:58:27 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754031AbbFOL60 (ORCPT + 11 others); Mon, 15 Jun 2015 07:58:26 -0400 Received: from mail-pd0-f172.google.com ([209.85.192.172]:33016 "EHLO mail-pd0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753933AbbFOL6Z (ORCPT ); Mon, 15 Jun 2015 07:58:25 -0400 Received: by pdjn11 with SMTP id n11so71617518pdj.0 for ; Mon, 15 Jun 2015 04:58:25 -0700 (PDT) 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 Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, arnd.bergmann@linaro.org, broonie@kernel.org, mike.turquette@linaro.org, sboyd@codeaurora.org, Sudeep.Holla@arm.com, viswanath.puttagunta@linaro.org, l.stach@pengutronix.de, thomas.petazzoni@free-electrons.com, linux-arm-kernel@lists.infradead.org, ta.omasab@gmail.com, kesavan.abhilash@gmail.com, khilman@linaro.org, santosh.shilimkar@oracle.com, Viresh Kumar 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: Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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); }