From patchwork Fri Jun 29 06:19:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 140498 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp450746ljj; Thu, 28 Jun 2018 23:20:06 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLy9zxv5Nw0XdgY8LRvqcviG9fbAtRdAUzwaJ9UTE0xHZMiq3fKI56I+irJFUZwipFuKMrp X-Received: by 2002:a17:902:28c8:: with SMTP id f66-v6mr13637932plb.60.1530253206541; Thu, 28 Jun 2018 23:20:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530253206; cv=none; d=google.com; s=arc-20160816; b=wgcLko7ybbZEzaPhOohGQwt31/LzjBfjv7SD9QAA4Yc7dyAn8VKoaC7KPkwAciwe46 R8MLmKear+YZ7jV35w778r/N8o/N2JRQtVzapumt6nKNXepQZlMhUqRto0Seqcn27qIo L2g/Eafy+poDjM3iRI4QLWpqG9KYYTESyTlthpASHEfFSkjkoaJRBmTCQMgjvWZgYMrh QYTzTbM0u4VTT/6j6HKLipyxFWuJ3+Vj5hyrffYyXo2DCbpdT3/OV2mw22VVkZlkSq6/ QIIlvXvaQlWedRukZQWTrGV8rZtJiJ9S/V/HbMlEWXHMbsHjavTwI0MxtisZsDMeHDKA nW+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=TBfHkYuERDOrgM/8wx6qu440hJJWlqeZST2ftQHE0NY=; b=LbuM4tXyZlUKCfK7XwsGEjWR6lku19UkCNSB0DKl8CDol3tkaxVKAZKLDptBie1pCo Pglhj8ESVCcQ+z0vBVM+pHueNypDAyQtNAQ0GxadHOv4QvbGSOmFOUGmZMFrP06YtVst 9aigant6y+g/Gtpr3XZ4FlaecjNT/Re/2IhuALBOYshtufbzFHF/afskhDG9xb8YcXUo QQd+1jXbBY4tK3wv2xFSQaBLd5Yi5+23abaF2ehgRj4RWFuFdRfrVK6V6h7o3dzydJZm 8vnWrryqMmVdk1f1wD3tIWxm2iPW3zpD+Y1q55bly3DQ7VEehkrWkJuwMCTNPsncm74T bbUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="GrmyM/NR"; 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 f35-v6si8318665plh.193.2018.06.28.23.20.06; Thu, 28 Jun 2018 23:20:06 -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; dkim=pass header.i=@linaro.org header.s=google header.b="GrmyM/NR"; 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 S1754538AbeF2GUE (ORCPT + 31 others); Fri, 29 Jun 2018 02:20:04 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:34047 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754277AbeF2GT7 (ORCPT ); Fri, 29 Jun 2018 02:19:59 -0400 Received: by mail-pl0-f66.google.com with SMTP id z9-v6so3963217plo.1 for ; Thu, 28 Jun 2018 23:19:59 -0700 (PDT) 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; bh=TBfHkYuERDOrgM/8wx6qu440hJJWlqeZST2ftQHE0NY=; b=GrmyM/NRDYQ9bL4gWJgXLdVEkbbXgAn2xakHyTqNBOpjvh30V/pJ4AA94WiLpyZhSO s5cyjtWInVfScgIQgd6q6MgR90xxspGGoJM9YsomdwJVqJnXqr9Eenf7FHb6gpZcKXLX I4HMO5zfDFj6EFw670u3zFwYnD5z1YZFA9ECg= 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; bh=TBfHkYuERDOrgM/8wx6qu440hJJWlqeZST2ftQHE0NY=; b=AChiRaMiNksBLSgQR5SmKY7c090xzd4q6JqqFBH4tsmnfpqG7oqIYHg3GU/QU5jxvM aeTLNrkqK1euSDHS5LkJxTgaZ3JfOM1ybUC0pFajXHCYcJKZ9IeaDY5vunro5CqkSi1x adN/UexwhmGyOGrNzIk0CcgOalXuqGYKWlif5fdarINWbIffdTtqb9NJljl5loMS2A6h 9q/4xxDUpSDSq4dde/QleSDTWuIhCOHOdKZjF20Sh00R26QfzhwmBJJ32xQMAzi/XCkO uD/RZG0r0s79O8Bcv4bNQntIAaN7IvVti+8rAD3XNJ3f6CeO30hnMsiEIDm9Hg94HmOa +Geg== X-Gm-Message-State: APt69E0DpoNe4hQLqQYK6dbvo1jgPfWAVwCiilPJ01ZZsWz3ms9tJWPr kkQwv0aDaumuOR1ysv3LxDHECA== X-Received: by 2002:a17:902:e101:: with SMTP id cc1-v6mr13432682plb.96.1530253199322; Thu, 28 Jun 2018 23:19:59 -0700 (PDT) Received: from localhost ([122.172.117.17]) by smtp.gmail.com with ESMTPSA id m134-v6sm7561188pga.20.2018.06.28.23.19.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jun 2018 23:19:58 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , ulf.hansson@linaro.org, Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rajendra Nayak , linux-kernel@vger.kernel.org Subject: [PATCH 01/10] OPP: Parse OPP table's DT properties from _of_init_opp_table() Date: Fri, 29 Jun 2018 11:49:31 +0530 Message-Id: <415e586b2dedcc6f97ee07a76bd54124c4b7e8bb.1530252803.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.18.0.rc1.242.g61856ae69a2c In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Parse the DT properties present in the OPP table from _of_init_opp_table(), which is a dedicated routine of DT parsing. Minor relocation of helpers was required for this. Signed-off-by: Viresh Kumar --- drivers/opp/of.c | 77 +++++++++++++++++++++++++++++------------------- 1 file changed, 47 insertions(+), 30 deletions(-) -- 2.18.0.rc1.242.g61856ae69a2c diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 7af0ddec936b..44a6b81fd228 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -23,6 +23,24 @@ #include "opp.h" +/* + * Returns opp descriptor node for a device node, caller must + * do of_node_put(). + */ +static struct device_node *_opp_of_get_opp_desc_node(struct device_node *np, + int index) +{ + /* "operating-points-v2" can be an array for power domain providers */ + return of_parse_phandle(np, "operating-points-v2", index); +} + +/* Returns opp descriptor node for a device, caller must do of_node_put() */ +struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev) +{ + return _opp_of_get_opp_desc_node(dev->of_node, 0); +} +EXPORT_SYMBOL_GPL(dev_pm_opp_of_get_opp_desc_node); + static struct opp_table *_managed_opp(const struct device_node *np) { struct opp_table *opp_table, *managed_table = NULL; @@ -54,22 +72,35 @@ static struct opp_table *_managed_opp(const struct device_node *np) void _of_init_opp_table(struct opp_table *opp_table, struct device *dev) { - struct device_node *np; + struct device_node *np, *opp_np; + u32 val; /* * Only required for backward compatibility with v1 bindings, but isn't * harmful for other cases. And so we do it unconditionally. */ np = of_node_get(dev->of_node); - if (np) { - u32 val; - - if (!of_property_read_u32(np, "clock-latency", &val)) - opp_table->clock_latency_ns_max = val; - of_property_read_u32(np, "voltage-tolerance", - &opp_table->voltage_tolerance_v1); - of_node_put(np); - } + if (!np) + return; + + if (!of_property_read_u32(np, "clock-latency", &val)) + opp_table->clock_latency_ns_max = val; + of_property_read_u32(np, "voltage-tolerance", + &opp_table->voltage_tolerance_v1); + + /* Get OPP table node */ + opp_np = _opp_of_get_opp_desc_node(np, 0); + of_node_put(np); + + if (!opp_np) + return; + + if (of_property_read_bool(opp_np, "opp-shared")) + opp_table->shared_opp = OPP_TABLE_ACCESS_SHARED; + else + opp_table->shared_opp = OPP_TABLE_ACCESS_EXCLUSIVE; + + of_node_put(opp_np); } static bool _opp_is_supported(struct device *dev, struct opp_table *opp_table, @@ -249,22 +280,6 @@ void dev_pm_opp_of_remove_table(struct device *dev) } EXPORT_SYMBOL_GPL(dev_pm_opp_of_remove_table); -/* Returns opp descriptor node for a device node, caller must - * do of_node_put() */ -static struct device_node *_opp_of_get_opp_desc_node(struct device_node *np, - int index) -{ - /* "operating-points-v2" can be an array for power domain providers */ - return of_parse_phandle(np, "operating-points-v2", index); -} - -/* Returns opp descriptor node for a device, caller must do of_node_put() */ -struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev) -{ - return _opp_of_get_opp_desc_node(dev->of_node, 0); -} -EXPORT_SYMBOL_GPL(dev_pm_opp_of_get_opp_desc_node); - /** * _opp_add_static_v2() - Allocate static OPPs (As per 'v2' DT bindings) * @opp_table: OPP table @@ -431,11 +446,13 @@ static int _of_add_opp_table_v2(struct device *dev, struct device_node *opp_np) if (pstate_count) opp_table->genpd_performance_state = true; + /* + * This is used by _managed_opp() to find OPP tables that are fully + * initialized by other devices sharing clock/voltage rails with current + * device. And so we can't set this from _of_init_opp_table() as tables + * aren't fully initialized at that point. + */ opp_table->np = opp_np; - if (of_property_read_bool(opp_np, "opp-shared")) - opp_table->shared_opp = OPP_TABLE_ACCESS_SHARED; - else - opp_table->shared_opp = OPP_TABLE_ACCESS_EXCLUSIVE; put_opp_table: dev_pm_opp_put_opp_table(opp_table); From patchwork Fri Jun 29 06:19:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 140507 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp453213ljj; Thu, 28 Jun 2018 23:22:29 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdb3tsLAl9Dx9HFOZjTCUDlOYXcty8dg/BtdYbwqN3HiL1tI/CIo++ft0bL0eyI8+FZOWlE X-Received: by 2002:aa7:8058:: with SMTP id y24-v6mr13131299pfm.148.1530253349396; Thu, 28 Jun 2018 23:22:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530253349; cv=none; d=google.com; s=arc-20160816; b=MpdA9RImH+tZTm9kDPrxPTZQ0uOUB4kyWb+sVHbYgkpX/8QgQsfizsWOhDiXUHj85R d4AvxINZsxfHTM+G2Z2acj91qyNPgGWBtM/ibO8X+AqWPPUxE4H26Tx7PkBmSiDqil4I AE5mBL81edVmajFsh98MUkhc0CSGtfFAmDlrTz+A126njqOw/V7ydnMUtaWdSYQ69P03 NupvANo3QDAIPCfuYGGVLG9drxdeqYmjnBjuCUzFynPw8tvMSbq7w2hH+nAkPo1SoBKu BAGksXmReL44QbzCa25iP2ZnDsQbDxMafQURcC0n62pnz6nGIruKxkcE31YYTrMoUFOM KbNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=S4eygS426BABBAsQSIESeCrT2oWeYHdrfhnghVokkWA=; b=rBZ8vjqqPRcx6Nn9NpNojN4/QpoDx2jEa2uf2cxsWr0u5kY8vloa0EcjaEP3Zf8tL2 KNw9KnYCf3GI69G1bWhC+8tSiLZfl0b38HooqY5Xv7mWFdkoxAJcUboeqQhGhC7vDxmG DUM6l6Q8IFJheuGz3Mc8mNt9GQdfyUbFmpyUX7QPHJP+SIVJJxHPTpdriwcRzQniNi6x YTw3LMvumtgHiGUwjZScrjDzcnQNZt06aDjj8qybVZhkz/ENvqDEV9Pdrg6oz3UGbwYj ZQIh6WXUVOvvMEsgYZWAxqLolQx/rDbrxbJnWgIVjRfeHISogPki00R97maH6ezx9yhR FdAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V932m0Q4; 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 l4-v6si8183357plt.497.2018.06.28.23.22.29; Thu, 28 Jun 2018 23:22:29 -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; dkim=pass header.i=@linaro.org header.s=google header.b=V932m0Q4; 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 S933943AbeF2GW1 (ORCPT + 31 others); Fri, 29 Jun 2018 02:22:27 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:44873 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754342AbeF2GUC (ORCPT ); Fri, 29 Jun 2018 02:20:02 -0400 Received: by mail-pg0-f68.google.com with SMTP id b10-v6so3534217pgq.11 for ; Thu, 28 Jun 2018 23:20:02 -0700 (PDT) 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; bh=S4eygS426BABBAsQSIESeCrT2oWeYHdrfhnghVokkWA=; b=V932m0Q4haBm2tcIysbJW8MMYcBwvDbEly/TZrjjyBjgxbCR/0s8FngAI1amd5iNcF kaGlaSEQfikQ1kkQNKteNjVo/goaM7pF0x2yFJVDsGWz1acsHfeAVyGmnPSjfPsBxSP9 WgVksM6E5lXD40dnxxXwhqU4Dg76rfUALkwZw= 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; bh=S4eygS426BABBAsQSIESeCrT2oWeYHdrfhnghVokkWA=; b=SqCjNYkpK2wt7M2ooRZn39ML8WlIV/FSpWJAu9ooszkpbCVhkALzNuuiZxnsqp9d3V BoYJp4PyKgEZLWgvobawEoUVNidWij/1KnbXn3elsYQWubtMkGzwX78UuFNZYGApxre9 3QOs8DFiBMQgluYiRklOnsx1gBYdSRevoB34DUAT1nszIAqgY37RKFtPiY5lnHHk2i5L y/0z553fj39uYCDtn+h33U93DnxxOoN+rs3HBVialklcoga2mkAm/I0ND+Jlyxg6zaQH 3h6qWqzmAFucoNjgLDrUt2OoVlfQePPVIkYQOWkEu6q/jW/eHkEM2AS+Q1aw/L1TsDsS rgog== X-Gm-Message-State: APt69E3PiKWP/99gxCitgEGpLBjNuD9y/SqwKFeyMKCXSKHqzW1BnPQ8 HHIpbXwfBmeUXPLsQ/THCw+SKw== X-Received: by 2002:a62:1f8c:: with SMTP id l12-v6mr4414317pfj.143.1530253202061; Thu, 28 Jun 2018 23:20:02 -0700 (PDT) Received: from localhost ([122.172.117.17]) by smtp.gmail.com with ESMTPSA id f7-v6sm1976454pfj.101.2018.06.28.23.20.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jun 2018 23:20:01 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , ulf.hansson@linaro.org, Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rajendra Nayak , linux-kernel@vger.kernel.org Subject: [PATCH 02/10] OPP: Identify and mark genpd OPP tables Date: Fri, 29 Jun 2018 11:49:32 +0530 Message-Id: X-Mailer: git-send-email 2.18.0.rc1.242.g61856ae69a2c In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We need to handle genpd OPP tables differently, this is already the case at one location and will be extended going forward. Add another field to the OPP table to check if the table belongs to a genpd or not. Signed-off-by: Viresh Kumar --- drivers/opp/of.c | 6 ++++-- drivers/opp/opp.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) -- 2.18.0.rc1.242.g61856ae69a2c diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 44a6b81fd228..218b8997d817 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -88,6 +88,9 @@ void _of_init_opp_table(struct opp_table *opp_table, struct device *dev) of_property_read_u32(np, "voltage-tolerance", &opp_table->voltage_tolerance_v1); + if (of_find_property(np, "#power-domain-cells", NULL)) + opp_table->is_genpd = true; + /* Get OPP table node */ opp_np = _opp_of_get_opp_desc_node(np, 0); of_node_put(np); @@ -314,8 +317,7 @@ static int _opp_add_static_v2(struct opp_table *opp_table, struct device *dev, ret = of_property_read_u64(np, "opp-hz", &rate); if (ret < 0) { /* "opp-hz" is optional for devices like power domains. */ - if (!of_find_property(dev->of_node, "#power-domain-cells", - NULL)) { + if (!opp_table->is_genpd) { dev_err(dev, "%s: opp-hz not found\n", __func__); goto free_opp; } diff --git a/drivers/opp/opp.h b/drivers/opp/opp.h index 7c540fd063b2..3cd3b7b167b5 100644 --- a/drivers/opp/opp.h +++ b/drivers/opp/opp.h @@ -138,6 +138,7 @@ enum opp_table_access { * @regulators: Supply regulators * @regulator_count: Number of power supply regulators * @genpd_performance_state: Device's power domain support performance state. + * @is_genpd: Marks if the OPP table belongs to a genpd. * @set_opp: Platform specific set_opp callback * @set_opp_data: Data to be passed to set_opp callback * @dentry: debugfs dentry pointer of the real device directory (not links). @@ -174,6 +175,7 @@ struct opp_table { struct regulator **regulators; unsigned int regulator_count; bool genpd_performance_state; + bool is_genpd; int (*set_opp)(struct dev_pm_set_opp_data *data); struct dev_pm_set_opp_data *set_opp_data; From patchwork Fri Jun 29 06:19:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 140499 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp450810ljj; Thu, 28 Jun 2018 23:20:10 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ5Jq6IGuAEy13WwOgTodNdH+NL5NmLTaKIIwG3+9RTQyCCthZBfeVe2Ah3o3byQBBR7xp4 X-Received: by 2002:a63:7558:: with SMTP id f24-v6mr11686638pgn.314.1530253209997; Thu, 28 Jun 2018 23:20:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530253209; cv=none; d=google.com; s=arc-20160816; b=rsAzco2Sz1Qf5HLY7QP5B7+alXs3XmfN86q8U7ZX/q+ho0+ZjzsTvIV7Dx/eqveNwp daah49CAwQ4KP5NKmb0kj9tqwIb0RaY751rJYsYpm+kkiWe4y9dvXQjVK0PE06neSts7 BzWwfzYN4lAXDW+/vQK+BiiJenlxJNXXnndy7SX0gmGOpcEOkVLiLlzH4G+UHBWDcH3n C5tvxnHyRSdMeGV/LDXUTnUVzTBp08U6idbOqkxh7Grhxq/Qf7hyXdD00UUC3+8w7bLg Mcov2MeNFQ5l7YWuN4V5EgD63yeuNcMBAXVE+I0bonpyU7t7gMNa0FPQtW3981pWphrO suGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=b7P0x4OPyLm2pT3XAYOXCOfkFYVojybdEOu/Rewxw1o=; b=GeZuFvCJnOVPchBi7pm2FH3V7ji5/7XNgKx/2aoOeB8LKL3nbqRwy+ikyS0AgUdCKg hG2VVi/ybqJoGDEdIe9yV1zyh+fEV830c63n4Xe8rtobCjS6waiCJwRwB4DK0eXefyVf uh+BkmqxDo42OI3QI62xMJPeqn26vxMQloK4kDIhSBl3lpr7TQgIs6RAQ6w/YPlKBMpZ Qn0XNBfIir4k0uYy1Z3d6q84YlcNvCYycASKiSv/Nv+6ZgDi6E5MQjP139Bi3iRjg9Cv aGS7QtQnPVT/0+8s4RGKjy5tkoStjE2z5h0cjEVhV7xrSogjM2N393w5P+SB1QrPtsvF i7QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ce8hkccx; 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 f35-v6si8318665plh.193.2018.06.28.23.20.09; Thu, 28 Jun 2018 23:20:09 -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; dkim=pass header.i=@linaro.org header.s=google header.b=ce8hkccx; 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 S1754572AbeF2GUH (ORCPT + 31 others); Fri, 29 Jun 2018 02:20:07 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:36694 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754309AbeF2GUF (ORCPT ); Fri, 29 Jun 2018 02:20:05 -0400 Received: by mail-pg0-f65.google.com with SMTP id m19-v6so6452pgv.3 for ; Thu, 28 Jun 2018 23:20:05 -0700 (PDT) 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; bh=b7P0x4OPyLm2pT3XAYOXCOfkFYVojybdEOu/Rewxw1o=; b=ce8hkccx/nIS0ZS90LwxVOBNjolNhOA05dHPgxThIzEHOBiW3Z3b9ii11t2m2Rqyq/ wq1QWsKE1uJbXbi5LNfH/jAHF2/NM9imAvtMgvej3PQOAhveciiIoxpF5dXshpa4cndY mObrjyJmc3dTH7dROZqnrZWrN2Fyb/n58l/yQ= 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; bh=b7P0x4OPyLm2pT3XAYOXCOfkFYVojybdEOu/Rewxw1o=; b=K/7dqebYCAgy07HzTnfPU8KMroWr5JerSVS97WiCVhcOj3r4Pus9cvaBHmKmdM5HLh 3D91jZfxQ/vBiayW+oPk955cMAgW9y/Ray48mawjjcFZrrB5mHe+96J4y/JFZ4XqauxL thNh7SIRgR9ej0tM8fhZhH6WPEXnmDbPUCeC2XEZ/M5sDeb4zhs79gQReGcJ/vY/uNc3 +XWZ/It4DoM3hoHT3zQPz7jU6e9EBOh3bai2HYJ0hOUNylfSIxKTOWRmZ1+0C2VTY00u lU90Cc3wOW43T+dNV22sAcUA/nsMP1Wp3oHf+05no42wrIqGNWCbu/N0ZIbGgcZm18T5 2b9A== X-Gm-Message-State: APt69E0cpbG8iX1VAXeKHMDVDp2PMXnUB0nLOqp8cerQxPArqb7uDj1h mRSvERLKA5YfBenifL+cH4X/LiMPo6w= X-Received: by 2002:aa7:808f:: with SMTP id v15-v6mr13221389pff.38.1530253204809; Thu, 28 Jun 2018 23:20:04 -0700 (PDT) Received: from localhost ([122.172.117.17]) by smtp.gmail.com with ESMTPSA id m7-v6sm13232046pgr.5.2018.06.28.23.20.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jun 2018 23:20:04 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , ulf.hansson@linaro.org, Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rajendra Nayak , linux-kernel@vger.kernel.org Subject: [PATCH 03/10] OPP: Separate out custom OPP handler specific code Date: Fri, 29 Jun 2018 11:49:33 +0530 Message-Id: <152adbb18a6d7129327a0f320cf8c60e5434dead.1530252803.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.18.0.rc1.242.g61856ae69a2c In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Create a separate routine to take care of custom set_opp() handler specific stuff. Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 67 +++++++++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 27 deletions(-) -- 2.18.0.rc1.242.g61856ae69a2c diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 31ff03dbeb83..c0c657fdbf33 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -630,6 +630,34 @@ static int _generic_set_opp_regulator(const struct opp_table *opp_table, return ret; } +static int _set_opp_custom(const struct opp_table *opp_table, + struct device *dev, unsigned long old_freq, + unsigned long freq, + struct dev_pm_opp_supply *old_supply, + struct dev_pm_opp_supply *new_supply) +{ + struct dev_pm_set_opp_data *data; + int size; + + data = opp_table->set_opp_data; + data->regulators = opp_table->regulators; + data->regulator_count = opp_table->regulator_count; + data->clk = opp_table->clk; + data->dev = dev; + + data->old_opp.rate = old_freq; + size = sizeof(*old_supply) * opp_table->regulator_count; + if (IS_ERR(old_supply)) + memset(data->old_opp.supplies, 0, size); + else + memcpy(data->old_opp.supplies, old_supply, size); + + data->new_opp.rate = freq; + memcpy(data->new_opp.supplies, new_supply, size); + + return opp_table->set_opp(data); +} + /** * dev_pm_opp_set_rate() - Configure new OPP based on frequency * @dev: device for which we do this operation @@ -644,7 +672,7 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) unsigned long freq, old_freq; struct dev_pm_opp *old_opp, *opp; struct clk *clk; - int ret, size; + int ret; if (unlikely(!target_freq)) { dev_err(dev, "%s: Invalid target frequency %lu\n", __func__, @@ -697,8 +725,17 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) dev_dbg(dev, "%s: switching OPP: %lu Hz --> %lu Hz\n", __func__, old_freq, freq); - /* Only frequency scaling */ - if (!opp_table->regulators) { + if (opp_table->set_opp) { + ret = _set_opp_custom(opp_table, dev, old_freq, freq, + IS_ERR(old_opp) ? NULL : old_opp->supplies, + opp->supplies); + } else if (opp_table->regulators) { + ret = _generic_set_opp_regulator(opp_table, dev, old_freq, freq, + IS_ERR(old_opp) ? NULL : old_opp->supplies, + opp->supplies); + } else { + /* Only frequency scaling */ + /* * We don't support devices with both regulator and * domain performance-state for now. @@ -709,30 +746,6 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) opp->pstate); else ret = _generic_set_opp_clk_only(dev, clk, old_freq, freq); - } else if (!opp_table->set_opp) { - ret = _generic_set_opp_regulator(opp_table, dev, old_freq, freq, - IS_ERR(old_opp) ? NULL : old_opp->supplies, - opp->supplies); - } else { - struct dev_pm_set_opp_data *data; - - data = opp_table->set_opp_data; - data->regulators = opp_table->regulators; - data->regulator_count = opp_table->regulator_count; - data->clk = clk; - data->dev = dev; - - data->old_opp.rate = old_freq; - size = sizeof(*opp->supplies) * opp_table->regulator_count; - if (IS_ERR(old_opp)) - memset(data->old_opp.supplies, 0, size); - else - memcpy(data->old_opp.supplies, old_opp->supplies, size); - - data->new_opp.rate = freq; - memcpy(data->new_opp.supplies, opp->supplies, size); - - ret = opp_table->set_opp(data); } dev_pm_opp_put(opp); From patchwork Fri Jun 29 06:19:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 140500 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp450912ljj; Thu, 28 Jun 2018 23:20:15 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc0JU4OTUoj9QlNrr9F9+Tla7vnuHzlbgV5yxAOPUsDdC0IQLO8UNqitc88qh/3P3ivQbe+ X-Received: by 2002:a62:c918:: with SMTP id k24-v6mr13120171pfg.160.1530253215710; Thu, 28 Jun 2018 23:20:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530253215; cv=none; d=google.com; s=arc-20160816; b=sXHy/tN1MM9Q4KboRQtXSqUUFMcUkk0BrBVqF1Kl92smvwIjAlkRlHhX0zg5I+hZlK jFJmw0O8l1+XZA04uZg/fL85raiztx4OcUiKcTgbTYO1oYWWrmGrhPeZ0T57jUZSvs5z Ph26mKpLssu4gtPtVEPbFxuZCSjc3/iRTTBiuLdQYe2BLoaopPWn6SxZjOy7VjkZraOr DUryUFnHw53YDOpjV8O/+fKDI6OvxCmEIdPQ7uXUxgM667maaFcmG2hmzPnzxQ6tuWD0 TSSpEfZm7SOzW9vGvoSz0mJOZUVNrj4vqo41eY88t6waE44352z62+grCh9U6WmySrUN 2aiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=8ZM+uZPd8Ym3pQOe6pOL3GJlnsslpoljPMAp53e4UWo=; b=bkBKp9xUTVO3+kxTeVqwCz/GKDTgu9Qaf5V/6QuDl3qa1plBNe5Q0glC58f5aXDhIr TsoeVCR2jBZxORH/RsRrXZpquTE3Tz7EcLbVWWdIDldOpbwadL7ofaaYRFENUsdVCWkh sKncwIOb7HHccic8XsuDUCGk+OTXUxNqTMVJbQsQF6SUDlpv3PZXr709T1gzmGWPUTZr r5WYk11FIUhF6sxMLNXI0A25i3AMnVrY3oHFX7+QAL3fnPBQ/jVyFiB3Hniw4jXRx9Gl T11RRZydKLM3JHutUQM55c/sl+9tMqmTpUbI1/tZApG2tVfRseP3XlJ+1C8TBAneNEnQ 9eSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="E/K/Bfc5"; 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 f35-v6si8318665plh.193.2018.06.28.23.20.15; Thu, 28 Jun 2018 23:20:15 -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; dkim=pass header.i=@linaro.org header.s=google header.b="E/K/Bfc5"; 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 S1754721AbeF2GUM (ORCPT + 31 others); Fri, 29 Jun 2018 02:20:12 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:42151 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754309AbeF2GUI (ORCPT ); Fri, 29 Jun 2018 02:20:08 -0400 Received: by mail-pl0-f68.google.com with SMTP id y15-v6so2084245pll.9 for ; Thu, 28 Jun 2018 23:20:08 -0700 (PDT) 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; bh=8ZM+uZPd8Ym3pQOe6pOL3GJlnsslpoljPMAp53e4UWo=; b=E/K/Bfc58WsPRsVPdtRUpuKj5af2XXijVbChI8wWM6Ve7j4yEbTlSQUmxAlCnbnzh6 uOE/KC38oQgZomN6G+iLXF5xJMvsdOF+aI9HiGmEbIuofD0uWp+Bi7g8tUTUEeZSjuVg xgva+EZoXV5Hw/DtuLnMhsVD4+YxVBpokyAiQ= 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; bh=8ZM+uZPd8Ym3pQOe6pOL3GJlnsslpoljPMAp53e4UWo=; b=T48J+MlQxk5o7wDTJB135jzCXJEHInS6TTj2OxKLnQSsyEDPslVRbqq/nzqykxwUMr oBy2SyNZ/wzQcfzcW0s8rSMjGSZzQMJNYhje9peRKUg44/aTBeAxdbf5QqiptS9JI4HG 7Aejkir3WXrJJAi5vcrA9vEjx0SIc0uTYyI5ZBU1VIXgvXLQtbuyUqNeb31P3vEUGpbB 5vFDrg5S1A27+EqMAztOScpFuzXWBm621rd+3AmlY6VlYVF+J0Z0bKwbin8TSkQxzIAy iXHME+osZfRwWk82tPgrLWoHRz6HthitXBzBEuuDH8TAbd9LA3/j+u21ZxnsqxMuoNMO WocQ== X-Gm-Message-State: APt69E3UKewPJ1++OHdHQNgOVlRneaeL05FSulqVpckyJmxZ6QPKLJ9j wx6LcRHgBkC3yMQSMUrWwOnIRw== X-Received: by 2002:a17:902:342:: with SMTP id 60-v6mr13596219pld.311.1530253207686; Thu, 28 Jun 2018 23:20:07 -0700 (PDT) Received: from localhost ([122.172.117.17]) by smtp.gmail.com with ESMTPSA id u21-v6sm7386537pfi.30.2018.06.28.23.20.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jun 2018 23:20:07 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , ulf.hansson@linaro.org, Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rajendra Nayak , linux-kernel@vger.kernel.org Subject: [PATCH 04/10] OPP: Populate required opp tables from "required-opps" property Date: Fri, 29 Jun 2018 11:49:34 +0530 Message-Id: X-Mailer: git-send-email 2.18.0.rc1.242.g61856ae69a2c In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The current implementation works only for the case where a single phandle is present in the "required-opps" property, while DT allows multiple phandles to be present there. This patch adds new infrastructure to parse all the phandles present in "required-opps" property and save pointers of the required OPP's OPP tables. These will be used by later commits. Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 2 + drivers/opp/of.c | 138 +++++++++++++++++++++++++++++++++++++++++++++ drivers/opp/opp.h | 8 +++ 3 files changed, 148 insertions(+) -- 2.18.0.rc1.242.g61856ae69a2c diff --git a/drivers/opp/core.c b/drivers/opp/core.c index c0c657fdbf33..22c927c5e4ea 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -863,6 +863,8 @@ static void _opp_table_kref_release(struct kref *kref) struct opp_table *opp_table = container_of(kref, struct opp_table, kref); struct opp_device *opp_dev; + _of_clear_opp_table(opp_table); + /* Release clk */ if (!IS_ERR(opp_table->clk)) clk_put(opp_table->clk); diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 218b8997d817..b639195a1e3d 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -70,6 +70,138 @@ static struct opp_table *_managed_opp(const struct device_node *np) return managed_table; } +static struct device_node *of_parse_required_opp(struct device_node *np, + int index) +{ + struct device_node *required_np; + + required_np = of_parse_phandle(np, "required-opps", index); + if (unlikely(!required_np)) { + pr_err("%s: Unable to parse required-opps: %pOF, index: %d\n", + __func__, np, index); + } + + return required_np; +} + +/* The caller must call dev_pm_opp_put_opp_table() after the table is used */ +static struct opp_table *_get_required_opp_table(struct device_node *np) +{ + struct opp_table *opp_table, *required_opp_table = NULL; + struct dev_pm_opp *opp; + + lockdep_assert_held(&opp_table_lock); + + list_for_each_entry(opp_table, &opp_tables, node) { + mutex_lock(&opp_table->lock); + + list_for_each_entry(opp, &opp_table->opp_list, node) { + if (opp->np == np) { + /* Found required OPP table */ + if (opp_table->is_genpd) { + required_opp_table = opp_table; + break; + } + + /* + * We only support OPP of genpd's in the + * "required-opps" for now, as we don't know how + * to do DVFS for any other use cases. Error out + * if the required OPP doesn't belong to a + * genpd. + */ + pr_err("%s: required-opp doesn't belong to genpd: %pOF\n", + __func__, opp->np); + break; + } + } + + mutex_unlock(&opp_table->lock); + + if (!required_opp_table) + continue; + + _get_opp_table_kref(required_opp_table); + + return required_opp_table; + } + + return ERR_PTR(-ENODEV); +} + +/* Free resources previously acquired by _opp_table_alloc_required_tables() */ +static void _opp_table_free_required_tables(struct opp_table *opp_table) +{ + struct opp_table **required_opp_tables = opp_table->required_opp_tables; + int i; + + if (!required_opp_tables) + return; + + for (i = 0; i < opp_table->required_opp_count; i++) { + if (IS_ERR_OR_NULL(required_opp_tables[i])) + break; + + dev_pm_opp_put_opp_table(required_opp_tables[i]); + } + + kfree(required_opp_tables); + + opp_table->required_opp_count = 0; + opp_table->required_opp_tables = NULL; +} + +/* + * Populate all devices and opp tables which are part of "required-opps" list. + * Checking only the first OPP node should be enough. + */ +static void _opp_table_alloc_required_tables(struct opp_table *opp_table, + struct device *dev, + struct device_node *opp_np) +{ + struct opp_table **required_opp_tables; + struct device_node *required_np, *np; + int count, i; + + /* Traversing the first OPP node is all we need */ + np = of_get_next_available_child(opp_np, NULL); + if (!np) { + dev_err(dev, "Empty OPP table\n"); + return; + } + + count = of_count_phandle_with_args(np, "required-opps", NULL); + if (!count) + goto put_np; + + required_opp_tables = kcalloc(count, sizeof(*required_opp_tables), + GFP_KERNEL); + if (!required_opp_tables) + goto put_np; + + opp_table->required_opp_tables = required_opp_tables; + opp_table->required_opp_count = count; + + for (i = 0; i < count; i++) { + required_np = of_parse_required_opp(np, i); + if (!required_np) + goto free_required_tables; + + required_opp_tables[i] = _get_required_opp_table(required_np); + of_node_put(required_np); + + if (IS_ERR(required_opp_tables[i])) + goto free_required_tables; + } + + goto put_np; + +free_required_tables: + _opp_table_free_required_tables(opp_table); +put_np: + of_node_put(np); +} + void _of_init_opp_table(struct opp_table *opp_table, struct device *dev) { struct device_node *np, *opp_np; @@ -103,9 +235,15 @@ void _of_init_opp_table(struct opp_table *opp_table, struct device *dev) else opp_table->shared_opp = OPP_TABLE_ACCESS_EXCLUSIVE; + _opp_table_alloc_required_tables(opp_table, dev, opp_np); of_node_put(opp_np); } +void _of_clear_opp_table(struct opp_table *opp_table) +{ + _opp_table_free_required_tables(opp_table); +} + static bool _opp_is_supported(struct device *dev, struct opp_table *opp_table, struct device_node *np) { diff --git a/drivers/opp/opp.h b/drivers/opp/opp.h index 3cd3b7b167b5..fea70c71cc99 100644 --- a/drivers/opp/opp.h +++ b/drivers/opp/opp.h @@ -131,6 +131,9 @@ enum opp_table_access { * @clock_latency_ns_max: Max clock latency in nanoseconds. * @shared_opp: OPP is shared between multiple devices. * @suspend_opp: Pointer to OPP to be used during device suspend. + * @required_opp_tables: List of device OPP tables that are required by OPPs in + * this table. + * @required_opp_count: Number of required devices. * @supported_hw: Array of version number to support. * @supported_hw_count: Number of elements in supported_hw array. * @prop_name: A name to postfix to many DT properties, while parsing them. @@ -168,6 +171,9 @@ struct opp_table { enum opp_table_access shared_opp; struct dev_pm_opp *suspend_opp; + struct opp_table **required_opp_tables; + unsigned int required_opp_count; + unsigned int *supported_hw; unsigned int supported_hw_count; const char *prop_name; @@ -203,8 +209,10 @@ struct opp_table *_add_opp_table(struct device *dev); #ifdef CONFIG_OF void _of_init_opp_table(struct opp_table *opp_table, struct device *dev); +void _of_clear_opp_table(struct opp_table *opp_table); #else static inline void _of_init_opp_table(struct opp_table *opp_table, struct device *dev) {} +static inline void _of_clear_opp_table(struct opp_table *opp_table) {} #endif #ifdef CONFIG_DEBUG_FS From patchwork Fri Jun 29 06:19:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 140506 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp452237ljj; Thu, 28 Jun 2018 23:21:32 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf5feFwpdTFvRG3JIIO3Iu3/AiD9SN6oAtuUNPfTAcVZDvSiZEio8I+r7vC5EcSizoLgy+5 X-Received: by 2002:a62:403:: with SMTP id 3-v6mr13042240pfe.28.1530253292360; Thu, 28 Jun 2018 23:21:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530253292; cv=none; d=google.com; s=arc-20160816; b=jPOu0qJpbne3KC2rBbx6sWXIEaImHnczb2/oER8Wamx1CrpL5tC3pKHC1Fs8ntDz55 aE3+rWKDNbEbGng8bPUmrG74Rkupc0KKSMdhw3YSbJSL8Oudrhca76coNIkz6LDL7Zfo UBVmTktzOeX0o2twAEEHDVZ23kOt1wQjIt/eJijyUtTHAj9bfq8we/FvaMM+yBVrROMq oNBYFk62arU+RiBsG70IXKAiZcQpi8EnkK0jekfBIOIr0h10GJTlxu2m98BQK40b9So2 MAWKNdEr3/dgb8rSmZllIISy9bkWDwNmcwTJ090kPojWpBDQSJmOpFqm5twOl5XVJIoC KMIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=7p1A7z4Vn09G1lmhenJN0/W2ncsp/nbi2IYjY6GsVLM=; b=N6uRut1xxcTHqtxC558W+mnVK2qKP4+aRbRJe6q4IakoPtMnKnZoyJFiK29BbLsmSh 0UDPPCjqsKCRc7scuMhfSsDEuCnn2bdohwtw6oKIi+zrEjcDI41kSpFCWmGN1JisxAJ2 kkzmd5WaqqaZ3DAbov3tV9ReMRCVQBedaMMQ8N1VQPBT/3uj2HO4b6mEGHY5r3485qMK /+GInniRfnGSX5Dfu3vU5DG4PPtndwQd0zgk065ZTRLjrn+6Hl54VUj3jAaZRtOevSUe zPaMetAcSSzNZwgonLFT/qLMdvGArGuNrMp1/mYKiTXIAZ6yscoK2N2W1ROe0v3+z+WG JzNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MLNvcr1d; 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 c192-v6si7452375pfg.347.2018.06.28.23.21.32; Thu, 28 Jun 2018 23:21:32 -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; dkim=pass header.i=@linaro.org header.s=google header.b=MLNvcr1d; 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 S933738AbeF2GVa (ORCPT + 31 others); Fri, 29 Jun 2018 02:21:30 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:43833 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754613AbeF2GUL (ORCPT ); Fri, 29 Jun 2018 02:20:11 -0400 Received: by mail-pf0-f193.google.com with SMTP id y8-v6so3733863pfm.10 for ; Thu, 28 Jun 2018 23:20:11 -0700 (PDT) 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; bh=7p1A7z4Vn09G1lmhenJN0/W2ncsp/nbi2IYjY6GsVLM=; b=MLNvcr1dbLaC1xg5sPo6raj7cUKfARaHDwI5BrybEhHJxPiW1A1GC9tkT/cukUbsd/ 89yYLlRA1u9emJXgkAwfQaSoNy0SzaLfPS3AmRFPHXRBWJiSSy+2iVJL8ZyfMIoOXe2S iS7F8UFWJbZr2N57FRkhQxCpJFmB1K+wJd8OI= 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; bh=7p1A7z4Vn09G1lmhenJN0/W2ncsp/nbi2IYjY6GsVLM=; b=GbQdu/tASYK4Y/Z2WG7XHBEk0IZ8N16UGN9CnUdzu4ZmNooFw3mqlwesrEK5yJDbIy AQo/OvgVqWtc43GKlgHrMjiCf/k/sd5U0Z9CzZ1s5ZrYM2U2kqa6tl5x+ryb/o/jDYMm y32F7dIKElBunHn5JyCYTg7wiwtImBIM9JlI8Olpk1m2PRWL4LpDRRIBIqkFuQjSKoJI eXsA3SOXsCZYWoyChAsDnHIIRml9RN5J0B/O4/ckOq3+ZakGN1YfxZdeWiu/jKtHwEvd tfurAHXHlJs7zFtmVHhmmw0PyewPpT16ziwRh+gt0yWY7x9NTO5U8y/65uj71BzQAR8F SLyQ== X-Gm-Message-State: APt69E2tPLQhTW95HR03e9mQv5lTZdxnfPrI/5mZ+7Xcr9IS2Ouhf9Fe AJgqC060Az0UDZxP5j07vz61qQ== X-Received: by 2002:a65:62cd:: with SMTP id m13-v6mr11430291pgv.280.1530253210643; Thu, 28 Jun 2018 23:20:10 -0700 (PDT) Received: from localhost ([122.172.117.17]) by smtp.gmail.com with ESMTPSA id y81-v6sm21434600pfd.178.2018.06.28.23.20.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jun 2018 23:20:10 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , ulf.hansson@linaro.org, Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rajendra Nayak , linux-kernel@vger.kernel.org Subject: [PATCH 05/10] OPP: Populate OPPs from "required-opps" property Date: Fri, 29 Jun 2018 11:49:35 +0530 Message-Id: X-Mailer: git-send-email 2.18.0.rc1.242.g61856ae69a2c In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org An earlier commit populated the OPP tables from the "required-opps" property, this commit populates the individual OPPs. This is repeated for each OPP in the OPP table and these populated OPPs will be used by later commits. Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 1 + drivers/opp/of.c | 93 +++++++++++++++++++++++++++++++++++++++++++++- drivers/opp/opp.h | 6 +++ 3 files changed, 98 insertions(+), 2 deletions(-) -- 2.18.0.rc1.242.g61856ae69a2c diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 22c927c5e4ea..acc34c238fd6 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -906,6 +906,7 @@ static void _opp_kref_release(struct kref *kref) * frequency/voltage list. */ blocking_notifier_call_chain(&opp_table->head, OPP_EVENT_REMOVE, opp); + _of_opp_free_required_opps(opp_table, opp); opp_debug_remove_one(opp); list_del(&opp->node); kfree(opp); diff --git a/drivers/opp/of.c b/drivers/opp/of.c index b639195a1e3d..ffefccfdbc26 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -244,6 +244,89 @@ void _of_clear_opp_table(struct opp_table *opp_table) _opp_table_free_required_tables(opp_table); } +/* + * Release all resources previously acquired with a call to + * _of_opp_alloc_required_opps(). + */ +void _of_opp_free_required_opps(struct opp_table *opp_table, + struct dev_pm_opp *opp) +{ + struct dev_pm_opp **required_opps = opp->required_opps; + int i, count = opp_table->required_opp_count; + + if (!count) + return; + + for (i = 0; i < count; i++) { + if (!required_opps[i]) + break; + + /* Put the reference back */ + dev_pm_opp_put(required_opps[i]); + } + + kfree(required_opps); + opp->required_opps = NULL; +} + +/* Populate all required OPPs which are part of "required-opps" list */ +static int _of_opp_alloc_required_opps(struct opp_table *opp_table, + struct dev_pm_opp *opp) +{ + struct dev_pm_opp *temp_opp, **required_opps; + struct opp_table *temp_table; + struct device_node *np; + int i, ret, count = opp_table->required_opp_count; + + if (!count) + return 0; + + required_opps = kcalloc(count, sizeof(*required_opps), GFP_KERNEL); + if (!required_opps) + return -ENOMEM; + + opp->required_opps = required_opps; + + for (i = 0; i < count; i++) { + temp_table = opp_table->required_opp_tables[i]; + + np = of_parse_phandle(opp->np, "required-opps", i); + if (unlikely(!np)) { + pr_err("%s: Unable to parse required-opps: %pOF (%d)\n", + __func__, opp->np, i); + ret = -ENODEV; + goto free_required_opps; + } + + mutex_lock(&temp_table->lock); + + list_for_each_entry(temp_opp, &temp_table->opp_list, node) { + if (temp_opp->np == np) { + /* Take a reference to the OPP */ + dev_pm_opp_get(temp_opp); + required_opps[i] = temp_opp; + break; + } + } + + mutex_unlock(&temp_table->lock); + + if (!required_opps[i]) { + pr_err("%s: Unable to find required OPP node: %pOF (%d)\n", + __func__, opp->np, i); + ret = -ENODEV; + goto free_required_opps; + } + } + + return 0; + +free_required_opps: + _of_opp_free_required_opps(opp_table, opp); + + return ret; +} + static bool _opp_is_supported(struct device *dev, struct opp_table *opp_table, struct device_node *np) { @@ -482,6 +565,10 @@ static int _opp_add_static_v2(struct opp_table *opp_table, struct device *dev, new_opp->dynamic = false; new_opp->available = true; + ret = _of_opp_alloc_required_opps(opp_table, new_opp); + if (ret) + goto free_opp; + if (!of_property_read_u32(np, "clock-latency-ns", &val)) new_opp->clock_latency_ns = val; @@ -489,14 +576,14 @@ static int _opp_add_static_v2(struct opp_table *opp_table, struct device *dev, ret = opp_parse_supplies(new_opp, dev, opp_table); if (ret) - goto free_opp; + goto free_required_opps; ret = _opp_add(dev, new_opp, opp_table, rate_not_available); if (ret) { /* Don't return error for duplicate OPPs */ if (ret == -EBUSY) ret = 0; - goto free_opp; + goto free_required_opps; } /* OPP to select on device suspend */ @@ -526,6 +613,8 @@ static int _opp_add_static_v2(struct opp_table *opp_table, struct device *dev, blocking_notifier_call_chain(&opp_table->head, OPP_EVENT_ADD, new_opp); return 0; +free_required_opps: + _of_opp_free_required_opps(opp_table, new_opp); free_opp: _opp_free(new_opp); diff --git a/drivers/opp/opp.h b/drivers/opp/opp.h index fea70c71cc99..9efdc3e4840c 100644 --- a/drivers/opp/opp.h +++ b/drivers/opp/opp.h @@ -63,6 +63,7 @@ extern struct list_head opp_tables; * @supplies: Power supplies voltage/current values * @clock_latency_ns: Latency (in nanoseconds) of switching to this OPP's * frequency from any other OPP's frequency. + * @required_opps: List of OPPs that are required by this OPP. * @opp_table: points back to the opp_table struct this opp belongs to * @np: OPP's device node. * @dentry: debugfs dentry pointer (per opp) @@ -84,6 +85,7 @@ struct dev_pm_opp { unsigned long clock_latency_ns; + struct dev_pm_opp **required_opps; struct opp_table *opp_table; struct device_node *np; @@ -210,9 +212,13 @@ struct opp_table *_add_opp_table(struct device *dev); #ifdef CONFIG_OF void _of_init_opp_table(struct opp_table *opp_table, struct device *dev); void _of_clear_opp_table(struct opp_table *opp_table); +void _of_opp_free_required_opps(struct opp_table *opp_table, + struct dev_pm_opp *opp); #else static inline void _of_init_opp_table(struct opp_table *opp_table, struct device *dev) {} static inline void _of_clear_opp_table(struct opp_table *opp_table) {} +static inline void _of_opp_free_required_opps(struct opp_table *opp_table, + struct dev_pm_opp *opp) {} #endif #ifdef CONFIG_DEBUG_FS From patchwork Fri Jun 29 06:19:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 140501 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp450999ljj; Thu, 28 Jun 2018 23:20:21 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfj8YqIc1wzMngcCG5FV6iJuVaFesYtrw9V8Z2rlGU/f64TKv/kcAAVU3hVp/FyyohJeznb X-Received: by 2002:a62:39cd:: with SMTP id u74-v6mr13219891pfj.95.1530253221153; Thu, 28 Jun 2018 23:20:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530253221; cv=none; d=google.com; s=arc-20160816; b=EbxKaX+PPx4gPQ3wswQUuYogZoa2Rgq3bGNEUF3pBWI0+cokPYbCKBN/wrNs2aE71y nY5gmpfE0y6trBbWkxeYz9OazkLMPzEi2S/M0rOXR8Kw6JzaXgsfBcWH26G/fgwry5oz n7Eqy89qqDaY9UimrH3LPxXpZp2AFJ+KDAfMTwzlZCSvpfoLpc7EOjXAbChQYtA8FKXJ BbrbHPfwS2BZkwab+So1BxMzjid0WPsMPUWZRuofIe7u2uvCvKuQmlLe/EDEIlxIl0f1 NcucKm+Ou3wTSm9PUdmmzThN5n7dAjAyHKn31UqbfAxbjC2+ldS3Za4GxUUlzSYgoP2Z DXpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=1AfuWlMOVWU1Vhlp0o/mTCtZRMnjimj2uS0MvsxSa7A=; b=vyrIJE+AjS+pibXHDnDxJ1Kd8aUxnJoCt+jaswe7Zeg5+FjKF3KU0tZBBSFYutRnd1 /UmvjK67rP+WMTL3JpenFgEThLcxWd8BlashdzR9qQ4LuNbkVL58umPD3CM5NVkq2+sQ 6mSWUosqlcmrfzDF9d0VZrUqYjhkb0ZXr1+aubNFVwHmSrGo+VRBP8mhUnNsDqfBJNCY gDgGqipDj6qywCBdag+RofONm/T0Y/Kq3vSEqGZrdk4iuhq6yDcv2ynSBJCVvaF+jlR6 BPzu802Fd1Sk9d5Yc6MwqRO3kh33DteinVPOjkAT5XmIcQ5F/sW0lij3szBrrEjGEGfV zyog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Kp828VCD; 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 f35-v6si8318665plh.193.2018.06.28.23.20.20; Thu, 28 Jun 2018 23:20:21 -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; dkim=pass header.i=@linaro.org header.s=google header.b=Kp828VCD; 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 S1754805AbeF2GUS (ORCPT + 31 others); Fri, 29 Jun 2018 02:20:18 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:39879 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754588AbeF2GUO (ORCPT ); Fri, 29 Jun 2018 02:20:14 -0400 Received: by mail-pl0-f66.google.com with SMTP id s24-v6so3958848plq.6 for ; Thu, 28 Jun 2018 23:20:14 -0700 (PDT) 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; bh=1AfuWlMOVWU1Vhlp0o/mTCtZRMnjimj2uS0MvsxSa7A=; b=Kp828VCDMiy5+Qwo7n9aaeY72R7ikkaQv2SAoEzU6Zj6hqvNhflClNUi0zR5e8KQZn 4a10pqF7P19/HI7tX8LwIs/ssdiQxB6EfFCWAJ+4u6ueJnZCFRhLFJPp6QOFUPgNKlNs 65cf4MF3XDQ57wz7YwqTBpNFKqOmAMfpLxoJs= 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; bh=1AfuWlMOVWU1Vhlp0o/mTCtZRMnjimj2uS0MvsxSa7A=; b=bWGivOiRMsxfvXKuJWbmHfNneGNXbreB/xFEeXv9P4sJvbBgxSwmBvTfIIaN61X9Qr SnUEh++DDXP35jUvXO0bPXVTyie07urUHAhT1qO8l5ocFREQjhXxzpWlsIYYRqHeCYQD Upk6Zgijh/bMzOyjlhQ5GFQ34sFdpgODbhxya0ILao7btmwYa9jplw5cgVraHqiWu9Py z0Y+yPqEmf+bWbsp0eQ0Nn4UF5TRIplFBlJAu25xLn07e9X65UhIiV6BVqSkIaSrHE1j 07XTbbQUPawQuN2fmnxEoL2/fl69PTH7GPxew84FTGu/msGpmnYmpBFecPDlJFDXrkAz wR+w== X-Gm-Message-State: APt69E1Bj23qQI4kcuO09hivFUhSaHQzQxUokt3NRYeuYD2XoreHOIsL gAsSr8uavBljLQ/pJCvQpzcSrA== X-Received: by 2002:a17:902:1007:: with SMTP id b7-v6mr13335305pla.277.1530253213695; Thu, 28 Jun 2018 23:20:13 -0700 (PDT) Received: from localhost ([122.172.117.17]) by smtp.gmail.com with ESMTPSA id m5-v6sm12709679pgn.45.2018.06.28.23.20.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jun 2018 23:20:13 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , ulf.hansson@linaro.org, Kevin Hilman , Pavel Machek , Len Brown , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rajendra Nayak , linux-kernel@vger.kernel.org Subject: [PATCH 06/10] OPP: Add dev_pm_opp_{set|put}_required_device() helper Date: Fri, 29 Jun 2018 11:49:36 +0530 Message-Id: <282ac8092650c95595c84213dc87a4bf6b278da8.1530252803.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.18.0.rc1.242.g61856ae69a2c In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Multiple generic power domains for a device are supported with the help of virtual devices, which are created for each device-genpd pair. These are the device structures which are attached to the power domain and are required by the OPP core to set the performance state of the genpd. The helpers added by this commit are required to be called once for each genpd of a device. These are required only if multiple domains are present for a device, otherwise the actual device structure will be used instead by the OPP core. This commit also updates the genpd core to automatically call the new helper to set the required devices with the OPP layer, whenever the virtual devices are created for multiple genpd. The prototype of __genpd_dev_pm_attach() is slightly updated for this. Signed-off-by: Viresh Kumar --- drivers/base/power/domain.c | 31 ++++++++++++++--- drivers/opp/core.c | 69 +++++++++++++++++++++++++++++++++++++ drivers/opp/of.c | 12 +++++++ drivers/opp/opp.h | 2 ++ include/linux/pm_opp.h | 8 +++++ 5 files changed, 118 insertions(+), 4 deletions(-) -- 2.18.0.rc1.242.g61856ae69a2c diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index c298de8a8308..e9c85c96580c 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2219,8 +2219,14 @@ static void genpd_dev_pm_detach(struct device *dev, bool power_off) genpd_queue_power_off_work(pd); /* Unregister the device if it was created by genpd. */ - if (dev->bus == &genpd_bus_type) + if (dev->bus == &genpd_bus_type) { + struct opp_table *opp_table = dev_get_drvdata(dev); + + if (opp_table) + dev_pm_opp_put_required_device(opp_table, dev); + device_unregister(dev); + } } static void genpd_dev_pm_sync(struct device *dev) @@ -2235,7 +2241,8 @@ static void genpd_dev_pm_sync(struct device *dev) } static int __genpd_dev_pm_attach(struct device *dev, struct device_node *np, - unsigned int index) + unsigned int index, + struct generic_pm_domain **pd_ptr) { struct of_phandle_args pd_args; struct generic_pm_domain *pd; @@ -2277,6 +2284,8 @@ static int __genpd_dev_pm_attach(struct device *dev, struct device_node *np, if (ret) genpd_remove_device(pd, dev); + else if (pd_ptr) + *pd_ptr = pd; return ret ? -EPROBE_DEFER : 1; } @@ -2307,7 +2316,7 @@ int genpd_dev_pm_attach(struct device *dev) "#power-domain-cells") != 1) return 0; - return __genpd_dev_pm_attach(dev, dev->of_node, 0); + return __genpd_dev_pm_attach(dev, dev->of_node, 0, NULL); } EXPORT_SYMBOL_GPL(genpd_dev_pm_attach); @@ -2330,6 +2339,7 @@ EXPORT_SYMBOL_GPL(genpd_dev_pm_attach); struct device *genpd_dev_pm_attach_by_id(struct device *dev, unsigned int index) { + struct generic_pm_domain *pd; struct device *genpd_dev; int num_domains; int ret; @@ -2359,12 +2369,25 @@ struct device *genpd_dev_pm_attach_by_id(struct device *dev, } /* Try to attach the device to the PM domain at the specified index. */ - ret = __genpd_dev_pm_attach(genpd_dev, dev->of_node, index); + ret = __genpd_dev_pm_attach(genpd_dev, dev->of_node, index, &pd); if (ret < 1) { device_unregister(genpd_dev); return ret ? ERR_PTR(ret) : NULL; } + if (pd->set_performance_state) { + struct opp_table *opp_table; + + opp_table = dev_pm_opp_set_required_device(dev, genpd_dev, + index); + if (IS_ERR(opp_table)) { + genpd_dev_pm_detach(genpd_dev, true); + return ERR_CAST(opp_table); + } + + dev_set_drvdata(genpd_dev, opp_table); + } + pm_runtime_set_active(genpd_dev); pm_runtime_enable(genpd_dev); diff --git a/drivers/opp/core.c b/drivers/opp/core.c index acc34c238fd6..3a2f08c56c4e 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1532,6 +1532,75 @@ void dev_pm_opp_unregister_set_opp_helper(struct opp_table *opp_table) } EXPORT_SYMBOL_GPL(dev_pm_opp_unregister_set_opp_helper); +/** + * dev_pm_opp_set_required_device - Set required device for an index + * @dev: Device for which the required device is getting set. + * @required_dev: required device. + * @index: index for which the required device is getting added. + * + * Multiple generic power domains for a device are supported with the help of + * virtual devices, which are created for each dev-genpd pair. These are the + * device structures which are attached to the power domain and are required by + * the OPP core to set the performance state of the genpd. + * + * This helper needs to be called once for each genpd of a device, but only if + * multiple domains are present for a device. Otherwise the original device + * structure will be used instead by the OPP core. + */ +struct opp_table *dev_pm_opp_set_required_device(struct device *dev, + struct device *required_dev, + int index) +{ + struct opp_table *opp_table; + + opp_table = dev_pm_opp_get_opp_table(dev); + if (!opp_table) + return ERR_PTR(-ENOMEM); + + /* Make sure there are no concurrent readers while updating opp_table */ + WARN_ON(!list_empty(&opp_table->opp_list)); + + if (unlikely(!opp_table->required_devices || + index >= opp_table->required_opp_count || + opp_table->required_devices[index])) { + dev_err(dev, "Invalid request to set required device\n"); + dev_pm_opp_put_opp_table(opp_table); + return ERR_PTR(-EINVAL); + } + + opp_table->required_devices[index] = required_dev; + + return opp_table; +} + +/** + * dev_pm_opp_put_required_device() - Releases resources blocked for required device. + * @opp_table: OPP table returned by dev_pm_opp_set_required_device(). + * @required_dev: required device. + * + * This releases the resource previously acquired with a call to + * dev_pm_opp_set_required_device(). + */ +void dev_pm_opp_put_required_device(struct opp_table *opp_table, + struct device *required_dev) +{ + int i; + + /* Make sure there are no concurrent readers while updating opp_table */ + WARN_ON(!list_empty(&opp_table->opp_list)); + + for (i = 0; i < opp_table->required_opp_count; i++) { + if (opp_table->required_devices[i] != required_dev) + continue; + + opp_table->required_devices[i] = NULL; + dev_pm_opp_put_opp_table(opp_table); + return; + } + + dev_err(required_dev, "Failed to find required device entry\n"); +} + /** * dev_pm_opp_add() - Add an OPP table from a table definitions * @dev: device for which we do this operation diff --git a/drivers/opp/of.c b/drivers/opp/of.c index ffefccfdbc26..20baba090c17 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -133,6 +133,7 @@ static struct opp_table *_get_required_opp_table(struct device_node *np) static void _opp_table_free_required_tables(struct opp_table *opp_table) { struct opp_table **required_opp_tables = opp_table->required_opp_tables; + struct device **required_devices = opp_table->required_devices; int i; if (!required_opp_tables) @@ -146,8 +147,10 @@ static void _opp_table_free_required_tables(struct opp_table *opp_table) } kfree(required_opp_tables); + kfree(required_devices); opp_table->required_opp_count = 0; + opp_table->required_devices = NULL; opp_table->required_opp_tables = NULL; } @@ -159,6 +162,7 @@ static void _opp_table_alloc_required_tables(struct opp_table *opp_table, struct device *dev, struct device_node *opp_np) { + struct device **required_devices = NULL; struct opp_table **required_opp_tables; struct device_node *required_np, *np; int count, i; @@ -174,11 +178,19 @@ static void _opp_table_alloc_required_tables(struct opp_table *opp_table, if (!count) goto put_np; + if (count > 1) { + required_devices = kcalloc(count, sizeof(*required_devices), + GFP_KERNEL); + if (!required_devices) + goto put_np; + } + required_opp_tables = kcalloc(count, sizeof(*required_opp_tables), GFP_KERNEL); if (!required_opp_tables) goto put_np; + opp_table->required_devices = required_devices; opp_table->required_opp_tables = required_opp_tables; opp_table->required_opp_count = count; diff --git a/drivers/opp/opp.h b/drivers/opp/opp.h index 9efdc3e4840c..857a7f5e66d0 100644 --- a/drivers/opp/opp.h +++ b/drivers/opp/opp.h @@ -133,6 +133,7 @@ enum opp_table_access { * @clock_latency_ns_max: Max clock latency in nanoseconds. * @shared_opp: OPP is shared between multiple devices. * @suspend_opp: Pointer to OPP to be used during device suspend. + * @required_devices: List of virtual devices for multiple genpd support. * @required_opp_tables: List of device OPP tables that are required by OPPs in * this table. * @required_opp_count: Number of required devices. @@ -173,6 +174,7 @@ struct opp_table { enum opp_table_access shared_opp; struct dev_pm_opp *suspend_opp; + struct device **required_devices; struct opp_table **required_opp_tables; unsigned int required_opp_count; diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 099b31960dec..ffdb4a78edec 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -125,6 +125,8 @@ struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char * name); void dev_pm_opp_put_clkname(struct opp_table *opp_table); struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev, int (*set_opp)(struct dev_pm_set_opp_data *data)); void dev_pm_opp_unregister_set_opp_helper(struct opp_table *opp_table); +struct opp_table *dev_pm_opp_set_required_device(struct device *dev, struct device *required_dev, int index); +void dev_pm_opp_put_required_device(struct opp_table *opp_table, struct device *required_device); int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq); int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev, const struct cpumask *cpumask); int dev_pm_opp_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask); @@ -266,6 +268,12 @@ static inline struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const static inline void dev_pm_opp_put_clkname(struct opp_table *opp_table) {} +static inline struct opp_table *dev_pm_opp_set_required_device(struct device *dev, struct device *required_dev, int index) +{ + return ERR_PTR(-ENOTSUPP); +} + +static inline void dev_pm_opp_put_required_device(struct opp_table *opp_table, struct device *required_device) {} static inline int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) { return -ENOTSUPP; From patchwork Fri Jun 29 06:19:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 140502 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp451063ljj; Thu, 28 Jun 2018 23:20:24 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ4hE5xi4ElUxRlJoslfRG6uSj856YpL3GChKi6jAKbaHegNu+XOMDeaGYOEY7lyn55jmgm X-Received: by 2002:a63:8e41:: with SMTP id k62-v6mr11238215pge.187.1530253224367; Thu, 28 Jun 2018 23:20:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530253224; cv=none; d=google.com; s=arc-20160816; b=g+3teVUR/d7Q2UxHllyqzcdBNbhVPm8av/MtbZFQggkied0ZgWnmk8Y7Pe8gt4AVrB JyNUfkxjVJWxKpE5hJNP9shEg2T1/2TYZ6XD/PqES4UjOKP1+qVBiwjl2bcv3WQLwKwq cpkugzyJUHZhVDll0IB6W6TJvGQEtZgldaFqD6Jv6uc4SpQsRJ+U9NAlJQbr+XZcWxjC Zvp1GLndTD6amYWw6Uko0/maKIl+EH1wrf10cHtltZEw1AhfRF5D8TsOP/oFQbcAkFwW vcbiKk7AVvkFclbwFuy6fGX/2+rC0exbGKNg4+Pjd7dfpULuz1PNaCpufXSrh7KCmwY8 W26w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=RAkNTVnfjx0sqCftYi4+z+jIgEfTOT4ZKqT/BTZR498=; b=hsZKC3EKcY2IRx8ocA2ZsQGE0iNzobUaAiUZahSmMXEtXDv2uMtdu8Xea2g2Og5xSM YXDoF+SSy3sXtQJDzvJSyQMdVwjy9w6JjsGgmqj9Kvfb3mpOZJw9E6Mua5YMqoLCj46J UPWk5iauyfPwXXEUdXonTRxcb9vVDtLZABgUNad6t9hpa+Bq/Dfi9rk0UAlYYnhu9TeZ 7qbbK5Z2nUQzDM4ur3JAsrw9dOfgRgqQ3IaQRY6CoCBabuUxSL+xY2H9Sqb+gKgedvQV 8+/zI9NMunVOi/aiqZK2qdiSCrN30jn4A8CicOmwAFaB+gUCO+xCsF5v3a198S0y0j4V YfSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RzsQYkaa; 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 f35-v6si8318665plh.193.2018.06.28.23.20.24; Thu, 28 Jun 2018 23:20:24 -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; dkim=pass header.i=@linaro.org header.s=google header.b=RzsQYkaa; 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 S1754881AbeF2GUX (ORCPT + 31 others); Fri, 29 Jun 2018 02:20:23 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:39412 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754807AbeF2GUT (ORCPT ); Fri, 29 Jun 2018 02:20:19 -0400 Received: by mail-pg0-f67.google.com with SMTP id n2-v6so3539234pgq.6 for ; Thu, 28 Jun 2018 23:20:19 -0700 (PDT) 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; bh=RAkNTVnfjx0sqCftYi4+z+jIgEfTOT4ZKqT/BTZR498=; b=RzsQYkaa5Ud3Um+ACh+T3R/P5TjDavehXqIMPJMbvBeqd7Q4vEoJz/cpT4ouf1NzZZ PujeTGYs/ahUsf/4zJGKoRGvqnxUkznbte7ebuXTR8RSAoeDCt7XC9E1+C3P6SVxzyB8 wl/SMkY5KPAkYgvfgpk3KY9fnr78OXb/m+3bY= 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; bh=RAkNTVnfjx0sqCftYi4+z+jIgEfTOT4ZKqT/BTZR498=; b=fj9uojrqM8lhw55Zknpz070OhXXmpFC9MCeWRTJcCmEMl9Ud8NylYa48M4Xl+6kWV3 YurlT1V3UAI8aLUoofvWdM3SgSyxtjafLg8ZAfGM6PalTM/FY6jRqZnhNY/XbQ4MwsMp n5aBUElDetZipHmwvXlYlMo/3W2PpeDR05rL4ekjyiKGduRH96KI++89DFLbn9ZtRwfv XQLiJOMiap2bhMK57gVNTEyvK9h5OTvmySMqx171AZVQIaD1+e1Men4iz69MfJ9lKM/f sqjB5d1aVBtRJb+ZCS/CaMVM5olQNYvxLY8HhxHzZnEF23wnqO/xiio8kV7AAPyhBv2p dwnw== X-Gm-Message-State: APt69E2s214zX8M9VAPxd+y7WQWiD85DSf8oW3qQUdPrJOC1yNBpn/ph enzZADO71bsEn3SwpcRkcK/wdw== X-Received: by 2002:a62:2605:: with SMTP id m5-v6mr13178654pfm.223.1530253219211; Thu, 28 Jun 2018 23:20:19 -0700 (PDT) Received: from localhost ([122.172.117.17]) by smtp.gmail.com with ESMTPSA id i89-v6sm4730250pfi.170.2018.06.28.23.20.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jun 2018 23:20:18 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , ulf.hansson@linaro.org, Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rajendra Nayak , linux-kernel@vger.kernel.org Subject: [PATCH 08/10] OPP: Configure all required OPPs Date: Fri, 29 Jun 2018 11:49:38 +0530 Message-Id: X-Mailer: git-send-email 2.18.0.rc1.242.g61856ae69a2c In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that all the infrastructure is in place to support multiple required OPPs, lets switch over to using it. A new internal routine _set_required_opps() takes care of updating performance state for all the required OPPs. With this the performance state updates are supported even when the end device needs to configure regulators as well, that wasn't the case earlier. The pstates were earlier stored in the end device's OPP structures, that also changes now as those values are stored in the genpd's OPP structures. And so we switch over to using genpd_opp_to_performance_state() instead of of_genpd_opp_to_performance_state() to get performance state for the genpd OPPs. The routine _generic_set_opp_domain() is not required anymore and is removed. On errors we don't try to recover by reverting to old settings as things are really complex now and the calls here should never really fail unless there is a bug. There is no point increasing the complexity, for code which will never be executed. Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 99 ++++++++++++++++++++++++---------------------- drivers/opp/of.c | 5 ++- 2 files changed, 54 insertions(+), 50 deletions(-) -- 2.18.0.rc1.242.g61856ae69a2c diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 3a2f08c56c4e..6b3410ded1ca 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -543,44 +543,6 @@ _generic_set_opp_clk_only(struct device *dev, struct clk *clk, return ret; } -static inline int -_generic_set_opp_domain(struct device *dev, struct clk *clk, - unsigned long old_freq, unsigned long freq, - unsigned int old_pstate, unsigned int new_pstate) -{ - int ret; - - /* Scaling up? Scale domain performance state before frequency */ - if (freq > old_freq) { - ret = dev_pm_genpd_set_performance_state(dev, new_pstate); - if (ret) - return ret; - } - - ret = _generic_set_opp_clk_only(dev, clk, old_freq, freq); - if (ret) - goto restore_domain_state; - - /* Scaling down? Scale domain performance state after frequency */ - if (freq < old_freq) { - ret = dev_pm_genpd_set_performance_state(dev, new_pstate); - if (ret) - goto restore_freq; - } - - return 0; - -restore_freq: - if (_generic_set_opp_clk_only(dev, clk, freq, old_freq)) - dev_err(dev, "%s: failed to restore old-freq (%lu Hz)\n", - __func__, old_freq); -restore_domain_state: - if (freq > old_freq) - dev_pm_genpd_set_performance_state(dev, old_pstate); - - return ret; -} - static int _generic_set_opp_regulator(const struct opp_table *opp_table, struct device *dev, unsigned long old_freq, @@ -658,6 +620,42 @@ static int _set_opp_custom(const struct opp_table *opp_table, return opp_table->set_opp(data); } +/* This is only called for PM domain for now */ +static int _set_required_opps(struct device *dev, + const struct opp_table *opp_table, + struct dev_pm_opp *opp) +{ + struct opp_table **required_opp_tables = opp_table->required_opp_tables; + struct device **required_devices = opp_table->required_devices; + struct device *required_dev = dev; + unsigned int pstate; + int i, ret; + + if (!required_opp_tables) + return 0; + + for (i = 0; i < opp_table->required_opp_count; i++) { + pstate = opp->required_opps[i]->pstate; + + if (required_devices) { + required_dev = required_devices[i]; + if (!required_dev) { + dev_err(dev, "Missing OPP required device\n"); + return -ENODEV; + } + } + + ret = dev_pm_genpd_set_performance_state(required_dev, pstate); + if (ret) { + dev_err(dev, "Failed to set performance rate of %s: %d (%d)\n", + dev_name(required_dev), pstate, ret); + return ret; + } + } + + return 0; +} + /** * dev_pm_opp_set_rate() - Configure new OPP based on frequency * @dev: device for which we do this operation @@ -725,6 +723,13 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) dev_dbg(dev, "%s: switching OPP: %lu Hz --> %lu Hz\n", __func__, old_freq, freq); + /* Scaling up? Configure required OPPs before frequency */ + if (freq > old_freq) { + ret = _set_required_opps(dev, opp_table, opp); + if (ret) + goto put_opp; + } + if (opp_table->set_opp) { ret = _set_opp_custom(opp_table, dev, old_freq, freq, IS_ERR(old_opp) ? NULL : old_opp->supplies, @@ -735,19 +740,17 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) opp->supplies); } else { /* Only frequency scaling */ + ret = _generic_set_opp_clk_only(dev, clk, old_freq, freq); + } - /* - * We don't support devices with both regulator and - * domain performance-state for now. - */ - if (opp_table->genpd_performance_state) - ret = _generic_set_opp_domain(dev, clk, old_freq, freq, - IS_ERR(old_opp) ? 0 : old_opp->pstate, - opp->pstate); - else - ret = _generic_set_opp_clk_only(dev, clk, old_freq, freq); + /* Scaling down? Configure required OPPs after frequency */ + if (!ret && freq < old_freq) { + ret = _set_required_opps(dev, opp_table, opp); + if (ret) + dev_err(dev, "Failed to set required opps: %d\n", ret); } +put_opp: dev_pm_opp_put(opp); put_old_opp: if (!IS_ERR(old_opp)) diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 20baba090c17..e1e4a58dd748 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -584,12 +584,13 @@ static int _opp_add_static_v2(struct opp_table *opp_table, struct device *dev, if (!of_property_read_u32(np, "clock-latency-ns", &val)) new_opp->clock_latency_ns = val; - new_opp->pstate = of_genpd_opp_to_performance_state(dev, np); - ret = opp_parse_supplies(new_opp, dev, opp_table); if (ret) goto free_required_opps; + if (opp_table->is_genpd) + new_opp->pstate = genpd_opp_to_performance_state(dev, new_opp); + ret = _opp_add(dev, new_opp, opp_table, rate_not_available); if (ret) { /* Don't return error for duplicate OPPs */ From patchwork Fri Jun 29 06:19:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 140503 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp451152ljj; Thu, 28 Jun 2018 23:20:29 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe6eGvifHF9z8kLrsQyUQEDBWz7ofchIDx2SaRmcKJMfm6oPJKNVJxt4pBkflua6AUP4ARQ X-Received: by 2002:a63:b00f:: with SMTP id h15-v6mr11100887pgf.442.1530253229775; Thu, 28 Jun 2018 23:20:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530253229; cv=none; d=google.com; s=arc-20160816; b=AOBLLwmL0hXQt/w8JWnoWd22eQ24mmPtBqPwjwzgK5JpawcX417AvhEgGEENmBoQ83 tzQ/AgSYMPOwcLKJ1jxmQ5t/NtpGJ4r7ujb3lAzsc8Qr9r8fUW/CBECPA0Xp0Xo+Wckj pYJcyJWMDrQiAmBqeZKYSkmuVyo1HYf9VVPneN9j93Huy7jBQAI/m38zKwtSmDXUkYuo CJJab4p2IDoUb/0uLqGW4gra6Sts6zfB7FBmlKFfIGsoD7kXrOb0iWqLUrdnEiz0yhWG vVLbZALIXmXioeLk4+hNuP3ZR5/JE9ykeve2CjUB4xuFRa3+OKslA95HjkbuYFCj/ioR a4Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=7HdC+3C2V6gtOSdBSxnueYDMAQcAswZVENc9D7squtE=; b=A2mphTL5smsDq2hnoCsU3Ai7bxdtqjmGKfoBpcvq7vEmKeJJiWAhTgqnrK/q1L+wIY lLPbfgak4PZhNCZSHeLpY2R7Mzun8TJMrNaME1hE0tQR+bSkqwUSxxo9U1ABB1KkbsSg SQUbJ5pUsORzU/uO/POK+ViIr6OiFqoJ2XLmzf3xCsAxqF8uOGcMkRnV2L9gaIYQfjWs vpwNHukxNXHCeBo00owxFDivw33S3ufqn1C8qnENcXAywyrGRDZJtphW0pYauYgNRXuB KWn570e2NEf/480W3xGGMcXZjGVmMOnpoygdqPDqdN3n0zRpD7fEzRAV2NJpH/VEtJF9 j7Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y6Cb3Gb4; 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 f35-v6si8318665plh.193.2018.06.28.23.20.29; Thu, 28 Jun 2018 23:20:29 -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; dkim=pass header.i=@linaro.org header.s=google header.b=Y6Cb3Gb4; 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 S1754945AbeF2GU1 (ORCPT + 31 others); Fri, 29 Jun 2018 02:20:27 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:46470 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754851AbeF2GUW (ORCPT ); Fri, 29 Jun 2018 02:20:22 -0400 Received: by mail-pg0-f66.google.com with SMTP id q14-v6so3529486pgt.13 for ; Thu, 28 Jun 2018 23:20:22 -0700 (PDT) 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; bh=7HdC+3C2V6gtOSdBSxnueYDMAQcAswZVENc9D7squtE=; b=Y6Cb3Gb4VgKHPO+6QwCV45OlfZFgaw+QL/dC1wzweOv7qT+CfDUmWotTJvkUHV4PeF SRJ3vU2M7gUSzZYy+Vf6XuW3Xn8Q/fTLOEg7IUsAOmhVl6XO4EqJWgAjDPHnMuGHtlre cXoYhht82zk4Yzos5w8wqjBAgKfGfuMSaOykY= 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; bh=7HdC+3C2V6gtOSdBSxnueYDMAQcAswZVENc9D7squtE=; b=AwSL4rjGw2UEyYhWkEIvBE287xO7qXFhCf+aqxqnOpKuvqT/QknJbZskWYubXFafrd Makkrk9l8Bv3Pe8MpPf3z93nYltCiW3K8F4Luk6DfJu4m0NksVHOuD9nv+ALe0i34XBN /MS70h3AsIb6hAODh11vYEMoB8yPtUTo+raj6Hhm9W6UgXU6MkAI5Bu/h/0jvYQqZlKj 0PMLRX6GB3Gwm/x+8IUudIZWm9F2KkgLetR6yHsUT0yiHkqhGIG1l4v2Z/P08AV39R1Y 8YdsdQWSQetKZIzSuxSJKLZP9asLK0R8ZR/Y8+3PZcBlBFgPFeShjTYEPW3lVopqdYNL p/mA== X-Gm-Message-State: APt69E2uswJWwV6L2gvX6igB7NCNTmd7vkrYQF4eK7j8+MNxngRTjQNk RE8A6ocUmj9coCJGpYvFOs4HFw== X-Received: by 2002:a65:4841:: with SMTP id i1-v6mr11249431pgs.75.1530253222241; Thu, 28 Jun 2018 23:20:22 -0700 (PDT) Received: from localhost ([122.172.117.17]) by smtp.gmail.com with ESMTPSA id f7-v6sm1980230pfj.101.2018.06.28.23.20.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jun 2018 23:20:21 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , ulf.hansson@linaro.org, Kevin Hilman , Len Brown , Pavel Machek , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rajendra Nayak , linux-kernel@vger.kernel.org Subject: [PATCH 09/10] OPP: Rename and relocate of_genpd_opp_to_performance_state() Date: Fri, 29 Jun 2018 11:49:39 +0530 Message-Id: <9dddd2b291fcdf8eee7d95ca4346d9b3e4228e43.1530252803.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.18.0.rc1.242.g61856ae69a2c In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The OPP core already has the performance state values for each of the genpd's OPPs and there is no need to call the genpd callback again to get the performance state for the case where the end device doesn't have an OPP table and has the "required-opps" property directly in its node. This commit renames of_get_required_opp_performance_state() as of_get_required_opp_performance_state() and moves it to the OPP core, as it is all about OPP stuff now. Signed-off-by: Viresh Kumar --- drivers/base/power/domain.c | 48 ------------------------------------ drivers/opp/of.c | 49 +++++++++++++++++++++++++++++++++++++ include/linux/pm_domain.h | 9 ------- include/linux/pm_opp.h | 5 ++++ 4 files changed, 54 insertions(+), 57 deletions(-) -- 2.18.0.rc1.242.g61856ae69a2c diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 15ffac081b0e..4b6acaac6ab9 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2544,54 +2544,6 @@ unsigned int genpd_opp_to_performance_state(struct device *genpd_dev, } EXPORT_SYMBOL_GPL(genpd_opp_to_performance_state); -/** - * of_genpd_opp_to_performance_state- Gets performance state of device's - * power domain corresponding to a DT node's "required-opps" property. - * - * @dev: Device for which the performance-state needs to be found. - * @np: DT node where the "required-opps" property is present. This can be - * the device node itself (if it doesn't have an OPP table) or a node - * within the OPP table of a device (if device has an OPP table). - * - * Returns performance state corresponding to the "required-opps" property of - * a DT node. This calls platform specific genpd->opp_to_performance_state() - * callback to translate power domain OPP to performance state. - * - * Returns performance state on success and 0 on failure. - */ -unsigned int of_genpd_opp_to_performance_state(struct device *dev, - struct device_node *np) -{ - struct generic_pm_domain *genpd; - struct dev_pm_opp *opp; - int state = 0; - - genpd = dev_to_genpd(dev); - if (IS_ERR(genpd)) - return 0; - - if (unlikely(!genpd->set_performance_state)) - return 0; - - genpd_lock(genpd); - - opp = of_dev_pm_opp_find_required_opp(&genpd->dev, np); - if (IS_ERR(opp)) { - dev_err(dev, "Failed to find required OPP: %ld\n", - PTR_ERR(opp)); - goto unlock; - } - - state = genpd->opp_to_performance_state(genpd, opp); - dev_pm_opp_put(opp); - -unlock: - genpd_unlock(genpd); - - return state; -} -EXPORT_SYMBOL_GPL(of_genpd_opp_to_performance_state); - static int __init genpd_bus_init(void) { return bus_register(&genpd_bus_type); diff --git a/drivers/opp/of.c b/drivers/opp/of.c index e1e4a58dd748..80fdeab4364a 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -964,6 +964,55 @@ int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, } EXPORT_SYMBOL_GPL(dev_pm_opp_of_get_sharing_cpus); +/** + * of_get_required_opp_performance_state() - Search for required OPP and return its performance state. + * @np: Node that contains the "required-opps" property. + * @index: Index of the phandle to parse. + * + * Returns the performance state of the OPP pointed out by the "required-opps" + * property at @index in @np. + * + * Return: Positive performance state on success, otherwise 0 on errors. + */ +unsigned int of_get_required_opp_performance_state(struct device_node *np, + int index) +{ + struct dev_pm_opp *opp; + struct device_node *required_np; + struct opp_table *opp_table; + unsigned int pstate = 0; + + required_np = of_parse_required_opp(np, index); + if (!required_np) + return -ENODEV; + + opp_table = _get_required_opp_table(required_np); + if (IS_ERR(opp_table)) { + pr_err("%s: Failed to find required OPP table %pOF: %ld\n", + __func__, np, PTR_ERR(opp_table)); + goto put_required_np; + } + + mutex_lock(&opp_table->lock); + + list_for_each_entry(opp, &opp_table->opp_list, node) { + if (opp->np == required_np) { + pstate = opp->pstate; + break; + } + } + + mutex_unlock(&opp_table->lock); + + dev_pm_opp_put_opp_table(opp_table); + +put_required_np: + of_node_put(required_np); + + return pstate; +} +EXPORT_SYMBOL_GPL(of_get_required_opp_performance_state); + /** * of_dev_pm_opp_find_required_opp() - Search for required OPP. * @dev: The device whose OPP node is referenced by the 'np' DT node. diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index b3c5f1eaf16c..685f982d56e4 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -235,8 +235,6 @@ int of_genpd_parse_idle_states(struct device_node *dn, struct genpd_power_state **states, int *n); unsigned int genpd_opp_to_performance_state(struct device *genpd_dev, struct dev_pm_opp *opp); -unsigned int of_genpd_opp_to_performance_state(struct device *dev, - struct device_node *np); int genpd_dev_pm_attach(struct device *dev); struct device *genpd_dev_pm_attach_by_id(struct device *dev, @@ -280,13 +278,6 @@ genpd_opp_to_performance_state(struct device *genpd_dev, struct dev_pm_opp *opp) return 0; } -static inline unsigned int -of_genpd_opp_to_performance_state(struct device *dev, - struct device_node *np) -{ - return 0; -} - static inline int genpd_dev_pm_attach(struct device *dev) { return 0; diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index ffdb4a78edec..6d6b1febe068 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -309,6 +309,7 @@ int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpuma struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev); struct dev_pm_opp *of_dev_pm_opp_find_required_opp(struct device *dev, struct device_node *np); struct device_node *dev_pm_opp_get_of_node(struct dev_pm_opp *opp); +unsigned int of_get_required_opp_performance_state(struct device_node *np, int index); #else static inline int dev_pm_opp_of_add_table(struct device *dev) { @@ -351,6 +352,10 @@ static inline struct device_node *dev_pm_opp_get_of_node(struct dev_pm_opp *opp) { return NULL; } +static inline unsigned int of_get_required_opp_performance_state(struct device_node *np, int index) +{ + return 0; +} #endif #endif /* __LINUX_OPP_H__ */ From patchwork Fri Jun 29 06:19:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 140504 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp451342ljj; Thu, 28 Jun 2018 23:20:39 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdNYjOM9eyBRWJvdN7InIZI8Nj+VLA00ImnlB2FKsBWEFHFnYFXvjCsL5jY5FDqStFOQeh0 X-Received: by 2002:a62:51c4:: with SMTP id f187-v6mr13239297pfb.88.1530253239582; Thu, 28 Jun 2018 23:20:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530253239; cv=none; d=google.com; s=arc-20160816; b=YpIyWjFFZiofg8esU3MtcOmjYRgkGi0XFupfTbsEuWQDtg01NOb0AJpNmBhl2fL1VL 1csiKEdbJjpGkeAzrMAscTc9GwNw26Fxpp4H3TXriv5xH76mYWoZ/ycNxI0fqOBmBd42 sJbzuSJlxdM6OKb2rxtaT1cYdR/SaeYzvo9deT8Z5ZVsNoDFOMFpI06xYLLqC8ANt1bp eULGnVqzPad7D/ipd48Jb9L77OyGe0BKN00G+izMka5+pzfzslssHOldXZFQ0XuUaVmv MeXYeKfa+MS+bA4YufZdQVQ3YtBPu9k1cgBCCG8zhK47pBnVZN8BmaMz81awmG6/GjnD jNpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=EkwPwO0lER5EARerditu2y59jlVuf9fgSDG7a5KSRuc=; b=S1egXAexrlBlpKiBw7CczeumLn0vTjtmAUuWV0ld5CTAEA5TFoZm/XP1Y8T0e43cXh HjVRW6kBysDIM0psZzVopsdZ5Sq/ZEoafhMCpt8s3QtFkHaxMFcgvhldmmcG55QOT2Mt jz9XMiK4l7PBTCXTuUddmQSSfdfafZegQ6CbTzCvMXWmoo2H/yG7Fmef88eWR0rEoed9 73FyJdEtrCrs6F2SDT7pfDmUug/J+R+QEXow9pMJngUsrnm3aG83yiB/dIDICP+BAU+b ENeAUpuz+uTq9hJ2FMYQpZuugB3KQmq1K1vfLbMs9Qt9C5mDOo/pbrEKCW1TzBPisL9f jACA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JyTGrJWG; 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 f35-v6si8318665plh.193.2018.06.28.23.20.39; Thu, 28 Jun 2018 23:20:39 -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; dkim=pass header.i=@linaro.org header.s=google header.b=JyTGrJWG; 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 S933617AbeF2GUi (ORCPT + 31 others); Fri, 29 Jun 2018 02:20:38 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:45596 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754883AbeF2GUZ (ORCPT ); Fri, 29 Jun 2018 02:20:25 -0400 Received: by mail-pl0-f66.google.com with SMTP id bi1-v6so3956329plb.12 for ; Thu, 28 Jun 2018 23:20:25 -0700 (PDT) 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; bh=EkwPwO0lER5EARerditu2y59jlVuf9fgSDG7a5KSRuc=; b=JyTGrJWG0kjcQ/TxaLHFrKvcTPh6fGRmY/j4pIYClJJhp8Nwh0xRdDT/tkod4z0JHu sZ00GEMH0J/E/eBo1Afx3CR5fK4flgM8wBPWXW43eWOhuTYQ6i7FtG2iL/zZF21dIRpK VWgHRdds3k1iZnv0fkYAviFjrcRsAUG0STxcM= 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; bh=EkwPwO0lER5EARerditu2y59jlVuf9fgSDG7a5KSRuc=; b=GVallkmC2SThd0vnXF2zw77p0OHSczvvjLPn5OlUm2z9NoaTscLRzl/s0dtkKTydRL JK5SPp/R2PEBDaIkA8ulDfJ0g3gN7PLWjszJlPfJ5CnT/5lMCqggX/y9FedZ8qGp9Cgf ntgN0AA3eE46GvriN0E59F94zBPZCISD1ptylcf4fTuyUmzrGJKnyYaBbGuEX5smrVil yGGy7yoDuRnQQi4ZAdOC8iXg5rKJc7X7VmXbgKilUDm+5EtYMRN+7GBGyq2pCqAHhEEY O7xbkBfkHPv41iDX6Yna8OG45TWfsbzp+oXtGT3xWuYc1F/paZ7NY4uQOe0sKv+adcw5 gsWQ== X-Gm-Message-State: APt69E1l2dptQZ2F3gECUOlH2iTq7uRevKTGmMrH8ehAD5qJAZe6ZZG/ Ro/A9fzJOp6VbLYR+mkS/JInAg== X-Received: by 2002:a17:902:b612:: with SMTP id b18-v6mr8759553pls.131.1530253225134; Thu, 28 Jun 2018 23:20:25 -0700 (PDT) Received: from localhost ([122.172.117.17]) by smtp.gmail.com with ESMTPSA id g136-v6sm143660pfb.23.2018.06.28.23.20.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jun 2018 23:20:24 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , ulf.hansson@linaro.org, Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rajendra Nayak , linux-kernel@vger.kernel.org Subject: [PATCH 10/10] OPP: Remove of_dev_pm_opp_find_required_opp() Date: Fri, 29 Jun 2018 11:49:40 +0530 Message-Id: X-Mailer: git-send-email 2.18.0.rc1.242.g61856ae69a2c In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This isn't used anymore, remove it. Signed-off-by: Viresh Kumar --- drivers/opp/of.c | 54 ------------------------------------------ include/linux/pm_opp.h | 5 ---- 2 files changed, 59 deletions(-) -- 2.18.0.rc1.242.g61856ae69a2c diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 80fdeab4364a..722b3142f4c6 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -1013,60 +1013,6 @@ unsigned int of_get_required_opp_performance_state(struct device_node *np, } EXPORT_SYMBOL_GPL(of_get_required_opp_performance_state); -/** - * of_dev_pm_opp_find_required_opp() - Search for required OPP. - * @dev: The device whose OPP node is referenced by the 'np' DT node. - * @np: Node that contains the "required-opps" property. - * - * Returns the OPP of the device 'dev', whose phandle is present in the "np" - * node. Although the "required-opps" property supports having multiple - * phandles, this helper routine only parses the very first phandle in the list. - * - * Return: Matching opp, else returns ERR_PTR in case of error and should be - * handled using IS_ERR. - * - * The callers are required to call dev_pm_opp_put() for the returned OPP after - * use. - */ -struct dev_pm_opp *of_dev_pm_opp_find_required_opp(struct device *dev, - struct device_node *np) -{ - struct dev_pm_opp *temp_opp, *opp = ERR_PTR(-ENODEV); - struct device_node *required_np; - struct opp_table *opp_table; - - opp_table = _find_opp_table(dev); - if (IS_ERR(opp_table)) - return ERR_CAST(opp_table); - - required_np = of_parse_phandle(np, "required-opps", 0); - if (unlikely(!required_np)) { - dev_err(dev, "Unable to parse required-opps\n"); - goto put_opp_table; - } - - mutex_lock(&opp_table->lock); - - list_for_each_entry(temp_opp, &opp_table->opp_list, node) { - if (temp_opp->available && temp_opp->np == required_np) { - opp = temp_opp; - - /* Increment the reference count of OPP */ - dev_pm_opp_get(opp); - break; - } - } - - mutex_unlock(&opp_table->lock); - - of_node_put(required_np); -put_opp_table: - dev_pm_opp_put_opp_table(opp_table); - - return opp; -} -EXPORT_SYMBOL_GPL(of_dev_pm_opp_find_required_opp); - /** * dev_pm_opp_get_of_node() - Gets the DT node corresponding to an opp * @opp: opp for which DT node has to be returned for diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 6d6b1febe068..fadf6d1bdef5 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -307,7 +307,6 @@ int dev_pm_opp_of_cpumask_add_table(const struct cpumask *cpumask); void dev_pm_opp_of_cpumask_remove_table(const struct cpumask *cpumask); int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask); struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev); -struct dev_pm_opp *of_dev_pm_opp_find_required_opp(struct device *dev, struct device_node *np); struct device_node *dev_pm_opp_get_of_node(struct dev_pm_opp *opp); unsigned int of_get_required_opp_performance_state(struct device_node *np, int index); #else @@ -344,10 +343,6 @@ static inline struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device return NULL; } -static inline struct dev_pm_opp *of_dev_pm_opp_find_required_opp(struct device *dev, struct device_node *np) -{ - return NULL; -} static inline struct device_node *dev_pm_opp_get_of_node(struct dev_pm_opp *opp) { return NULL;