Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7560372ybi; Tue, 9 Jul 2019 00:21:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqx4Ftjm9G1rISSJbMmKfOiR6Xjvq1rDjeLPuvGvej9sKX9RKn57t+xRXpjVVosQPoLcVjLN X-Received: by 2002:a17:90a:36a7:: with SMTP id t36mr30526050pjb.34.1562656863958; Tue, 09 Jul 2019 00:21:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562656863; cv=none; d=google.com; s=arc-20160816; b=Qp03GG4ZgdgW5XS3YHg5ZbRG7MziN4apFaemBcRWUxJlkMhQKzdu3/Ri4zNimRfCT3 siEo0U2KOgKAAH9LMQi3UgL2b8oAQBHRgLThTUpL6GwESer969XQ1jHOf8Dq+qNph943 zab/1P2lfdrVbzu9XlgqX5rBs7PmbtdEr/nc9f/vL+S3bF+HU2gNpOwmWUuN741X6T+4 IY0+jmFQYE0mr39borTw1/N7GkMvQRReWTWTwAY0/r8nnPqx+JUey5gJEKAZxmeF0+vw 0LVWg3Q+fOwnr/3Us67QpLDiB9+a14tpa9WBmm8/0bQWwnJcffl+X7n8rBwGnNC5Syw1 wWzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=GA0qltBaq4etkAOKLrkSoaIR61BS2JLkVNXEkntZJus=; b=JlGA5/Q7O945EZxMjQd8tj50prkrksgvjJnrgysxsNBCnpZWfyXONw/0KKMaZXn8JV Zr0WbYPw8pc1yaxt5uu6uZYUXRpuXnMBjzBOwlM+b3KUIMPWmW7RTLEh8W7njVA6BE9O LuE9QeyzluUKirpsMwNUa3WtRtwAQokHMy8X1dUT/2ourd3qkT0omFdt/JgjFy1mLd2l LnSiDgRMqcoaGmlUQ5h8gER9V+qL222oFJcKH8AKrjnBFmqD/O5vGnttRSiqxCJ2pKud p7ZqACiHGqu48atm0/NdvofcZG/jcEj9J2AGGSMlDXx2Ce/z7r8da5lhCWbrkIafc7M8 YMLQ== ARC-Authentication-Results: i=1; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n22si23045386pgj.474.2019.07.09.00.20.48; Tue, 09 Jul 2019 00:21:03 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726030AbfGIHUX (ORCPT + 99 others); Tue, 9 Jul 2019 03:20:23 -0400 Received: from inva021.nxp.com ([92.121.34.21]:43942 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725886AbfGIHUX (ORCPT ); Tue, 9 Jul 2019 03:20:23 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id D6373200D6A; Tue, 9 Jul 2019 09:20:20 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 86FA9200D69; Tue, 9 Jul 2019 09:20:08 +0200 (CEST) Received: from titan.ap.freescale.net (TITAN.ap.freescale.net [10.192.208.233]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id DBFDE402D3; Tue, 9 Jul 2019 15:19:54 +0800 (SGT) From: Anson.Huang@nxp.com To: robh+dt@kernel.org, mark.rutland@arm.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, vireshk@kernel.org, nm@ti.com, sboyd@kernel.org, leonard.crestez@nxp.com, aisheng.dong@nxp.com, daniel.baluta@nxp.com, ping.bai@nxp.com, l.stach@pengutronix.de, abel.vesa@nxp.com, ccaione@baylibre.com, angus@akkea.ca, andrew.smirnov@gmail.com, agx@sigxcpu.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: Linux-imx@nxp.com Subject: [PATCH 1/3] opp: of: Support multiple suspend OPPs defined in DT Date: Tue, 9 Jul 2019 15:10:54 +0800 Message-Id: <20190709071056.26361-1-Anson.Huang@nxp.com> X-Mailer: git-send-email 2.9.5 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anson Huang With property "opp-supported-hw" introduced, the OPP table in DT could be a large OPP table and ONLY a subset of OPPs are available, based on the version of the hardware running on. That introduces restriction of using "opp-suspend" property to define the suspend OPP, as we are NOT sure if the OPP containing "opp-suspend" property is available for the hardware running on, and the of opp core does NOT allow multiple suspend OPPs defined in DT OPP table. To eliminate this restrition, make of opp core allow multiple suspend OPPs defined in DT, and pick the OPP with highest rate and with "opp-suspend" property present to be suspend OPP, it can speed up the suspend/resume process. Signed-off-by: Anson Huang --- drivers/opp/of.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/opp/of.c b/drivers/opp/of.c index b313aca..7e8ec6c 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -617,9 +617,12 @@ static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table, /* OPP to select on device suspend */ if (of_property_read_bool(np, "opp-suspend")) { if (opp_table->suspend_opp) { - dev_warn(dev, "%s: Multiple suspend OPPs found (%lu %lu)\n", - __func__, opp_table->suspend_opp->rate, - new_opp->rate); + /* Pick the OPP with higher rate as suspend OPP */ + if (new_opp->rate > opp_table->suspend_opp->rate) { + opp_table->suspend_opp->suspend = false; + new_opp->suspend = true; + opp_table->suspend_opp = new_opp; + } } else { new_opp->suspend = true; opp_table->suspend_opp = new_opp; -- 2.7.4