From patchwork Thu Oct 25 05:52: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: 149513 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp913513ljp; Wed, 24 Oct 2018 22:53:28 -0700 (PDT) X-Google-Smtp-Source: AJdET5cHZbd2VU0NRyWb2sG5uePS6IHsReXVeNTzehUJSLkdxJnQ1lTodW+aHW1Z2G47fyBWNG90 X-Received: by 2002:a63:2356:: with SMTP id u22-v6mr209879pgm.122.1540446808430; Wed, 24 Oct 2018 22:53:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540446808; cv=none; d=google.com; s=arc-20160816; b=ozmH6qvyZQOXdTTLAYBmBe7c28xPUBgv3M7sXX0yuY7nFP4X+HovXOYVC+uEGAgjB5 9+fg31MnyUICy6xCqb0/czEdEZ/GBtIgv4j+cyeXy7ozBvDQ7B6eISvsXMTQrQ+7EZqN 3bRAEDEN0NZ0xi7rVJl1K1WBPRZWcW91bz2hEZXIDsoJ1d2P32HVbNNv9uBkJb7gtXdY eZM3a7Br7HJ5g9yFUAnjKtdwjpyFEz3x1KWcEqNmCC+j80beb2ukhqBadub86dWlgIEo IbKMS7Oe8WTcTMvPBYVQm4K0wUY3C8pXeFiQ4PDCpQoSFEWTawjzRiN1vB81jVAdwHbx gb8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=avYgO8zmRu0z6skuS/KZQ7OfLu1Dauo/53ZC7TuTX1M=; b=S6E+0hfYFkWDUlcQw5fD618BHpobyCdp8382vzmiu0HCZFqGLL9MtKEERwI/H+4nZB rEidHqaQIMrFYQjxAWDMa3IurWrJZ2+zPxcZ8ZKSvobANJ2876E7BmCmVaeKKgStSTk5 eAfRXOjXHu31WUd2PqQlp4t6wlTnQoMUZehjXCvJte+TydS6gfDoCcSFqYvDFQruCxaE GwxUeErj9z+1BUGBlnXJfewRUWHvQvh0APA51iH68GPJB88AbhwtGA5PxTwxjQyCVDJ1 rNJ45dv7HNo94jDOBSuv/WjcyYOrYOz7uxbdERly53PtUqGAx+1uk4DWmNN08dYSvZlr KpnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="WK2e5x/w"; 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 e11-v6si4692177pff.272.2018.10.24.22.53.28; Wed, 24 Oct 2018 22:53:28 -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="WK2e5x/w"; 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 S1727338AbeJYOYa (ORCPT + 32 others); Thu, 25 Oct 2018 10:24:30 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:39836 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726652AbeJYOY3 (ORCPT ); Thu, 25 Oct 2018 10:24:29 -0400 Received: by mail-pg1-f195.google.com with SMTP id r9-v6so3480155pgv.6 for ; Wed, 24 Oct 2018 22:53: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 :mime-version:content-transfer-encoding; bh=avYgO8zmRu0z6skuS/KZQ7OfLu1Dauo/53ZC7TuTX1M=; b=WK2e5x/wn+DwVaY2TkDftoOK6YXeok4Q7tIFiLxlLuvd4DXc5H9FTxJA28BuoHtlSI WHYPTDWP68I50uP3WuV8h5sRuYyZJK4TO1yGIsapNDahoRUMbEvGsUJ6AJL5q2dgSJmz 74tmhRxNd0MJO+2aWquQlgnXhHG4O3WCE1CGQ= 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:mime-version:content-transfer-encoding; bh=avYgO8zmRu0z6skuS/KZQ7OfLu1Dauo/53ZC7TuTX1M=; b=BJQ1QpYigETqvIeKh4KOb4d7qtf/Mlnq3IYpWLnZzngYG4fpamN+iPtfY8k709NOWl yXKJziGc7MtaXF0tkmBukpoZNvtUouIbIEq1HR+B43gaLwzDDX82OITaQRIaxjQ3X73v 2L2X7VBOqANP4hOOeqtMl9aAgng5PEIGeJtrMUag4fkqQfEqokDKqqbKJkZaQHL3jZNZ 8RyUOD83+JlXktrqUP2wT9Vlfi0dIXP/sOLMuHP52qVeJ/JK6H31Dury8g1EykdoqBB1 uPPS2h4M99VKppOdQm2g3rGmGvQNRihndpZILVpNKKWQDvxOicyeGpYj2RECAgJlarJP JGXw== X-Gm-Message-State: AGRZ1gITTahgV+SJfO5FcAGuaS9+w4rgNVevVkhts2JiI8RUYay9VTqI vX+MirfHSVf4guuLg7l9+p2+0w== X-Received: by 2002:a63:194a:: with SMTP id 10-v6mr211043pgz.192.1540446798805; Wed, 24 Oct 2018 22:53:18 -0700 (PDT) Received: from localhost ([122.172.217.9]) by smtp.gmail.com with ESMTPSA id o75-v6sm14923493pfg.0.2018.10.24.22.53.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Oct 2018 22:53:18 -0700 (PDT) From: Viresh Kumar To: ulf.hansson@linaro.org, "Rafael J. Wysocki" , Kevin Hilman , Pavel Machek , Len Brown Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Stephen Boyd , Nishanth Menon , niklas.cassel@linaro.org, rnayak@codeaurora.org, linux-kernel@vger.kernel.org Subject: [PATCH V3 01/10] PM / Domains: Rename genpd virtual devices as virt_dev Date: Thu, 25 Oct 2018 11:22:38 +0530 Message-Id: X-Mailer: git-send-email 2.19.1.568.g152ad8e3369a In-Reply-To: References: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are several struct device instances that genpd core handles. The most common one is the consumer device structure, which is named (correctly) as "dev" within genpd core. The second one is the genpd's device structure, referenced as genpd->dev. The third one is the virtual device structures created by the genpd core to represent the consumer device for multiple power domain case, currently named as genpd_dev. The naming of these virtual devices isn't very clear or readable and it looks more like the genpd->dev. Rename the virtual device instances within the genpd core as "virt_dev". Signed-off-by: Viresh Kumar --- drivers/base/power/domain.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) -- 2.19.1.568.g152ad8e3369a diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 7f38a92b444a..fe9b0527b161 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2338,7 +2338,7 @@ EXPORT_SYMBOL_GPL(genpd_dev_pm_attach); struct device *genpd_dev_pm_attach_by_id(struct device *dev, unsigned int index) { - struct device *genpd_dev; + struct device *virt_dev; int num_domains; int ret; @@ -2352,31 +2352,31 @@ struct device *genpd_dev_pm_attach_by_id(struct device *dev, return NULL; /* Allocate and register device on the genpd bus. */ - genpd_dev = kzalloc(sizeof(*genpd_dev), GFP_KERNEL); - if (!genpd_dev) + virt_dev = kzalloc(sizeof(*virt_dev), GFP_KERNEL); + if (!virt_dev) return ERR_PTR(-ENOMEM); - dev_set_name(genpd_dev, "genpd:%u:%s", index, dev_name(dev)); - genpd_dev->bus = &genpd_bus_type; - genpd_dev->release = genpd_release_dev; + dev_set_name(virt_dev, "genpd:%u:%s", index, dev_name(dev)); + virt_dev->bus = &genpd_bus_type; + virt_dev->release = genpd_release_dev; - ret = device_register(genpd_dev); + ret = device_register(virt_dev); if (ret) { - kfree(genpd_dev); + kfree(virt_dev); return ERR_PTR(ret); } /* Try to attach the device to the PM domain at the specified index. */ - ret = __genpd_dev_pm_attach(genpd_dev, dev->of_node, index, false); + ret = __genpd_dev_pm_attach(virt_dev, dev->of_node, index, false); if (ret < 1) { - device_unregister(genpd_dev); + device_unregister(virt_dev); return ret ? ERR_PTR(ret) : NULL; } - pm_runtime_enable(genpd_dev); - genpd_queue_power_off_work(dev_to_genpd(genpd_dev)); + pm_runtime_enable(virt_dev); + genpd_queue_power_off_work(dev_to_genpd(virt_dev)); - return genpd_dev; + return virt_dev; } EXPORT_SYMBOL_GPL(genpd_dev_pm_attach_by_id); From patchwork Thu Oct 25 05:52: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: 149512 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp913517ljp; Wed, 24 Oct 2018 22:53:28 -0700 (PDT) X-Google-Smtp-Source: AJdET5djdx6iuC0DdCgPDj46KNaTVcS0LiagXMgdxrxHjerVuaUEU7gSOO/KBN8jj+QX8vPOeVZI X-Received: by 2002:a63:2ad4:: with SMTP id q203-v6mr196500pgq.356.1540446808789; Wed, 24 Oct 2018 22:53:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540446808; cv=none; d=google.com; s=arc-20160816; b=jjDnv41HNot/Ds7FtKWfNZffOxTk4W12S+nYqb6bJSpCsTeJ8cUTcWSV/FusTjmeqf 9DOq3MzAOVBnUi0HyopN9/VKUJ9ifFgk9N47hv4f4RxoOfpY2qdRMSyIRsg9TpP2CCPf NA3F76e8WGh9rcYmfiqnpBrNxSCLrWe4x34Cb/XQHGmo8eZEXQk1Xf4hdNDg9jNdKprC hw76CBk8NCRtW0iR1MYbYZbMpzHHEkT3qNbTESITcAf2QYe5PjzLY5HNqP0IRhX0J0pQ zhvmKsa4E5yZHNTJWhvZPaYEGxKGZYX7CpK1k9mV6m/Lya//e6NNdJE6D+iM65iG0qlM PEbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=iFMPg2Y477Eixw34Pr/S9pCpksPj3HUPJVaQkzWELow=; b=bffOglrxKNfMQnvmbv9i8j/vJznmmxC3So7/FBH+qvyTJCWIXOcdRjcJ6a46IHpYwE Z5M8BERzBOEPnjvGKc27uRfuzhH0Ta0KymMnaf7cCqgMTsdP3Q71+GPfXT8ycUOZbTeR KmIae9Xwhc9FZ2iKVqQzxHBhntP1N2Xdw8533wiT1avYqVRTX7hy0GJ4zTdhKjrgz9vv t4X8/LxkwYxj9jhMvnYlI3Zs0OgbMHK9J2VYWI6ct9DOSlTnha4MAAAg+oqXLa00oxwq TahM61BU3k8u+TPGVNMX0txYJyw0Z4TOxAHdJtnRs3vUcxncC3lxOLi2UBymw9DHdIex MPTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TByAGHbk; 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 e11-v6si4692177pff.272.2018.10.24.22.53.28; Wed, 24 Oct 2018 22:53:28 -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=TByAGHbk; 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 S1727394AbeJYOYd (ORCPT + 32 others); Thu, 25 Oct 2018 10:24:33 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:45303 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727350AbeJYOYd (ORCPT ); Thu, 25 Oct 2018 10:24:33 -0400 Received: by mail-pg1-f196.google.com with SMTP id s3-v6so3469021pga.12 for ; Wed, 24 Oct 2018 22:53: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 :mime-version:content-transfer-encoding; bh=iFMPg2Y477Eixw34Pr/S9pCpksPj3HUPJVaQkzWELow=; b=TByAGHbk7rgoR87DUWV9J3RXadVqjbsoOsoUaThuHgJdg0z9Og9n8AwSIbRFsJk3uJ bXYPvH4fcnsdMnZEdCDnqO69TaKjWDm1FQ2NqvuCJNB9MyWm9yQ1FCSxydLKQAaTrjr2 UQ74d4lTe4d7fRB+B9bEiEKUzZ73731uaHsD4= 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:mime-version:content-transfer-encoding; bh=iFMPg2Y477Eixw34Pr/S9pCpksPj3HUPJVaQkzWELow=; b=lWGvJz1T/g7Bly6VXSuTXdnPTIGfIzsgLQr9J5EvBp24IoxhGCtg7oF/9c1dtIwgtr 3GdxQguib8shBfFVIIxsnX0scJvDDCTRpHFUj/gC93IQVwmQ3MzqwZADdhr/lS70tAPs /+bGS5EW8+kIGTVtifxyEmhK1Tn/FtnRIAqV1mGj6gx8Lo3qJDdbQOLvUvmyKCwjmHN4 SurEHvBfsq94iVMngGXI38YQZ4JsgAbBoXAkzYWxu/Pxa+ZkQ8C+Yvx+oiqf3F/nkPN/ u7KW4ONRTO5XNfrJbatMC1qjmE3nZl5PGXQYpJ00RPtMNHoIizNVQZmChboCi3Rf21dx GXRA== X-Gm-Message-State: AGRZ1gIfnuCWXnVxqu9rTSfH9sCSaCJaW/cmYFzKGiB3BM+kicYt+vxC XoThuBBljBYtPARIXqThbdlkUg== X-Received: by 2002:a62:8301:: with SMTP id h1-v6mr206832pfe.29.1540446802327; Wed, 24 Oct 2018 22:53:22 -0700 (PDT) Received: from localhost ([122.172.217.9]) by smtp.gmail.com with ESMTPSA id u7-v6sm585161pfl.34.2018.10.24.22.53.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Oct 2018 22:53:21 -0700 (PDT) From: Viresh Kumar To: ulf.hansson@linaro.org, Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rafael Wysocki , niklas.cassel@linaro.org, rnayak@codeaurora.org, linux-kernel@vger.kernel.org Subject: [PATCH V3 02/10] OPP: Identify and mark genpd OPP tables Date: Thu, 25 Oct 2018 11:22:39 +0530 Message-Id: <320abb3732333763c6d87e5e6aa81aa80dbace8d.1540446493.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.19.1.568.g152ad8e3369a In-Reply-To: References: MIME-Version: 1.0 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. Reviewed-by: Ulf Hansson Signed-off-by: Viresh Kumar --- drivers/opp/of.c | 6 ++++-- drivers/opp/opp.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) -- 2.19.1.568.g152ad8e3369a diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 5a4b47958073..5f114cd3d88c 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -92,6 +92,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, index); of_node_put(np); @@ -326,8 +329,7 @@ static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table, 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 9c6544b4f4f9..cdb0c2b095e2 100644 --- a/drivers/opp/opp.h +++ b/drivers/opp/opp.h @@ -140,6 +140,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). @@ -178,6 +179,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 Thu Oct 25 05:52:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 149515 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp913588ljp; Wed, 24 Oct 2018 22:53:33 -0700 (PDT) X-Google-Smtp-Source: AJdET5di5kKUP0AOIB6FFqHaSGztwBzj7ZFtCpOt3sno5yF/SiEkBcHJZKeTOrVKwspS5ZW3L+qU X-Received: by 2002:a17:902:2805:: with SMTP id e5-v6mr185239plb.169.1540446813828; Wed, 24 Oct 2018 22:53:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540446813; cv=none; d=google.com; s=arc-20160816; b=XJ/GPxcPMXI8H828r4sduSfwZDUTBVE4c/sNFLRlMpGevfLt+pLpHaiqLngNXyDOAG zjefndmOP6Hd1CXd2sQLC4vuleHwD7JMM1AZvIY2kqJeugRqnMKptYIDYtOSsGcuw+kz FEmkH3RBF1+ckcWqaLLsa6OcW41oIqoDgj6PXrimr+a1OQBXxrKUVXoUvCTbDa4lH6lg oK0GFerZU3kwn98xtp9doQ0bFpncU6BWvhbNawRApsd8y3N/nK0bB0DD7ESJ/3Aszyve k1GPeAYSC9e0zoWtNH16l7Wwy1WWx5xDcRoI8MaakbVBA5qAQNMA5P1ZlVQIWyyDVwmc 08rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=F8xBBQz3Vz3UwvoiZVxTM/564LZrnNByj53ag4krqco=; b=sezWD3Q4KsTARJqICQCRlMmZ0eOmMSQciY0BKPLS3thbipx4ki3o4agw7lMtbHAfjO Iu4VsptgSSsvqeIK0ZR/usr04xBUq08RAtAZ7BwL2J/jo91o6jg3xutpSGbvdSb0W8Ey 6zmSaFekpLTQ79fUkkumh7vsmG2nNfkSh0UusGSZcka/aiRPILeNvmyx7ZtpM39vVvfk H9aepHhjjEy6laa8MWbFq3QGuS9sGi6Qu58gzOEDXG48tp3Ut+9wI05Ah7kw8pBVDY1N f9V9GjKgoZJbg8fr6/hIjl+3odwnbO0+RtfYNQ3FRmRIj7mYrAoAk1sEihF/LWG5g88/ fqog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K3rHbutL; 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 i198-v6si7443500pgd.17.2018.10.24.22.53.33; Wed, 24 Oct 2018 22:53:33 -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=K3rHbutL; 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 S1727461AbeJYOYk (ORCPT + 32 others); Thu, 25 Oct 2018 10:24:40 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:32802 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727398AbeJYOYj (ORCPT ); Thu, 25 Oct 2018 10:24:39 -0400 Received: by mail-pg1-f194.google.com with SMTP id z2-v6so3500451pgp.0 for ; Wed, 24 Oct 2018 22:53:29 -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 :mime-version:content-transfer-encoding; bh=F8xBBQz3Vz3UwvoiZVxTM/564LZrnNByj53ag4krqco=; b=K3rHbutL1/HAKJ2lweceEiVcP69NSP4LXIqIF0iFslTDVYygiTACPcAfmmXXfmHdlM 4xUUmkH49Qhloy/zycCOZgM6OdO/1nv13Fyv1hWx8Oz9HdNINpWeWAspNGghQYE2wO8m Xk7i90qPObNraHpIX1+ut4cziLDaJC2Udko2U= 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:mime-version:content-transfer-encoding; bh=F8xBBQz3Vz3UwvoiZVxTM/564LZrnNByj53ag4krqco=; b=gzMJtEFo5KwsuyRvKNLOW3mG9he6OZwJZNyLuYumTGO8fBDSK/SQIBmk/uGsT+9ozg 6PGIdCc5DRz8ZwlfSz/nOZIhWEjLrwgV6lhu9ckgbWYJm3FmbKHMC+n+G0hIzOOMNYEa 2zrhXnDbTUBLXyNY6xde9eIviPYuiLrsgZdQCHO3hf5z+OC9RyBHNzYlru0FbTykFkjm 2kS4elro5ymBkT++dhlFLM862ZGccWWKm03HG4LMYullU4rGlL6JMJgaWRaCFBAOP2b8 CcZk7UPKfSJLLgDizWLfQNu/ZBjgKns4basjTE8X/BBg8Y3W/ExW1b8ZNd1KbIBHtyHG ZaSQ== X-Gm-Message-State: AGRZ1gKw0pUKaDWFAY8sozww9OosrMZJIc7OV9o8iJQh4LrQ8EN8TGV/ KShFHHFNfRc2j2xQZodN7//sCQ== X-Received: by 2002:a63:ac46:: with SMTP id z6mr209602pgn.162.1540446808933; Wed, 24 Oct 2018 22:53:28 -0700 (PDT) Received: from localhost ([122.172.217.9]) by smtp.gmail.com with ESMTPSA id v26-v6sm8243825pfg.43.2018.10.24.22.53.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Oct 2018 22:53:28 -0700 (PDT) From: Viresh Kumar To: ulf.hansson@linaro.org, Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rafael Wysocki , niklas.cassel@linaro.org, rnayak@codeaurora.org, linux-kernel@vger.kernel.org Subject: [PATCH V3 04/10] OPP: Populate required opp tables from "required-opps" property Date: Thu, 25 Oct 2018 11:22:41 +0530 Message-Id: <345bedbbf99afac2f1c961bcbe87f7b6f53b4f8b.1540446493.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.19.1.568.g152ad8e3369a In-Reply-To: References: MIME-Version: 1.0 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. Reviewed-by: Ulf Hansson Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 2 + drivers/opp/of.c | 147 +++++++++++++++++++++++++++++++++++++++++++++ drivers/opp/opp.h | 8 +++ 3 files changed, 157 insertions(+) -- 2.19.1.568.g152ad8e3369a diff --git a/drivers/opp/core.c b/drivers/opp/core.c index ebb3b648e0fd..85174a5c4850 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -901,6 +901,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, *temp; + _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 5f114cd3d88c..b5605196122a 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -73,6 +73,147 @@ struct opp_table *_managed_opp(struct device *dev, int index) return managed_table; } +/* The caller must call dev_pm_opp_put() after the OPP is used */ +static struct dev_pm_opp *_find_opp_of_np(struct opp_table *opp_table, + struct device_node *opp_np) +{ + struct dev_pm_opp *opp; + + lockdep_assert_held(&opp_table_lock); + + mutex_lock(&opp_table->lock); + + list_for_each_entry(opp, &opp_table->opp_list, node) { + if (opp->np == opp_np) { + dev_pm_opp_get(opp); + mutex_unlock(&opp_table->lock); + return opp; + } + } + + mutex_unlock(&opp_table->lock); + + return NULL; +} + +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 *_find_table_of_opp_np(struct device_node *opp_np) +{ + struct opp_table *opp_table; + struct dev_pm_opp *opp; + + lockdep_assert_held(&opp_table_lock); + + list_for_each_entry(opp_table, &opp_tables, node) { + opp = _find_opp_of_np(opp_table, opp_np); + if (opp) { + dev_pm_opp_put(opp); + _get_opp_table_kref(opp_table); + return 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] = _find_table_of_opp_np(required_np); + of_node_put(required_np); + + if (IS_ERR(required_opp_tables[i])) + goto free_required_tables; + + /* + * We only support genpd's OPPs in the "required-opps" for now, + * as we don't know how much about other cases. Error out if the + * required OPP doesn't belong to a genpd. + */ + if (!required_opp_tables[i]->is_genpd) { + dev_err(dev, "required-opp doesn't belong to genpd: %pOF\n", + required_np); + 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, int index) { @@ -109,9 +250,15 @@ void _of_init_opp_table(struct opp_table *opp_table, struct device *dev, opp_table->np = opp_np; + _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 cdb0c2b095e2..024e1be23d37 100644 --- a/drivers/opp/opp.h +++ b/drivers/opp/opp.h @@ -133,6 +133,9 @@ enum opp_table_access { * @parsed_static_opps: True if OPPs are initialized from DT. * @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. @@ -172,6 +175,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; @@ -208,9 +214,11 @@ void _put_opp_list_kref(struct opp_table *opp_table); #ifdef CONFIG_OF void _of_init_opp_table(struct opp_table *opp_table, struct device *dev, int index); +void _of_clear_opp_table(struct opp_table *opp_table); struct opp_table *_managed_opp(struct device *dev, int index); #else static inline void _of_init_opp_table(struct opp_table *opp_table, struct device *dev, int index) {} +static inline void _of_clear_opp_table(struct opp_table *opp_table) {} static inline struct opp_table *_managed_opp(struct device *dev, int index) { return NULL; } #endif From patchwork Thu Oct 25 05:52:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 149516 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp913605ljp; Wed, 24 Oct 2018 22:53:36 -0700 (PDT) X-Google-Smtp-Source: AJdET5dkDGBitWYa48KRWkVOW3hWC+dHIna07pBDN7onS9EvwWq/UhCL0GZxG0qZMMUhXPN5aO/S X-Received: by 2002:a62:104b:: with SMTP id y72-v6mr197645pfi.113.1540446815920; Wed, 24 Oct 2018 22:53:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540446815; cv=none; d=google.com; s=arc-20160816; b=KY2RqZywR8E4UGMZxDgcomHITp0Vkk/S7yccczuR2+eWTAG7kBsgvlm3unxH3CyBdi fjIVGtln+2kIGj9UsbPDbsMPiLromyLBomMUAbClP58D80jeJ0FVa+di5I/YF3HUp1oS CgCsyEgYocEyh5GfsunBJaqoMCAWozH1Ky/X5sgin3tHtHRpwgfborJzpOB/zpSKfn8x XmgyS6zb39GtGsq0ZHTjg4ipbLdC0CUhAOHqTyGgNwhbVCCurTzQ8yLzLO7qzUbZcjmk XY4mL1DfRFATFF8r1TQr21hsFxpO/DY0cBO5dHLpqG+dUd/OYSQc00jWm+U3pQyayr8i NcfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Fp7IC5dc3v+2e4B0y+2fHWDmlFb+BdqMV9R5pA/jnGE=; b=H0kDMw2bRV1101fdM5fXom8jWtQA+gFyC4jdKpqa2pldjXYWJA1JMFSvZJfgLR6Dvv hpJtw/th8sfdGdMJ1dIQMRM9gdDTkJIFN4TM+aYtRgQZ0jLEzL34Abn7MM/vNcaoinKp VupgUmVu5Fenz9nWR8/FMQNBjZHCO3kbI77X5TgwJI3jjJaPaS8XmfN1q16hGTxPnGH/ G4uOvJqtS5N85EmD3jzcnJCnU/nXLMWvcfyrsW+S9WDaP4ygF534iFXEtunFNM64mUxu HC9ocPDZ2zInyNAVPpFyUDhI3THGqSF4ZsMMp0DjPdIW2cgturnbh7I0sd13B8Wqh7Gm e/nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AQEuGLEX; 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 i187-v6si7821241pfc.25.2018.10.24.22.53.35; Wed, 24 Oct 2018 22:53:35 -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=AQEuGLEX; 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 S1727501AbeJYOYo (ORCPT + 32 others); Thu, 25 Oct 2018 10:24:44 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:40010 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727398AbeJYOYn (ORCPT ); Thu, 25 Oct 2018 10:24:43 -0400 Received: by mail-pf1-f196.google.com with SMTP id g21-v6so3634985pfi.7 for ; Wed, 24 Oct 2018 22:53:32 -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 :mime-version:content-transfer-encoding; bh=Fp7IC5dc3v+2e4B0y+2fHWDmlFb+BdqMV9R5pA/jnGE=; b=AQEuGLEXC5HVD+HfyO0AkubrRPhqkCTiPbkmY0xJqVZQcWsPp7TTcD8ePYOaPIhgea Ik58+zw4R8FDq9Sgk0sh0uyZ4O3iut0XadsE2olMIQm5psc4fFflzy6lDsBqNJM7AL5c 2Bb3aTXh1EjwTDGImvkLDRN622cVILjjYok1w= 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:mime-version:content-transfer-encoding; bh=Fp7IC5dc3v+2e4B0y+2fHWDmlFb+BdqMV9R5pA/jnGE=; b=cS3i8iK4h8lrWBomUo9NfJZvZtrCRQtYSS6SfSvFIy7gVvOoKyv1zAQOxCCDhY43D/ 6jg0CPzukp6AWW6Cd/z2SijDdoC72YjfdJv4V4MKHU/I3BytiYGVsWuZ33//41WgQFdO Ujb9z3FmQQOgZwePupL/Ag/AcJKMx0nJR5xTafaGyQk9v9MwcRTiiz00hZVTAPV956N0 Y0LXki2r0BWN+9KemwjCpVaL+4FxrMOZ1PZlYgIrC3HsMl+2+oSdPPpURtr3kKKVjnqs RQmgAHEKQBanPADRcjqfHDtLiJ/pZvqTVNyrg7W6StYKi2/TxO2rLZnK4yuhv0pP3Iil FoWw== X-Gm-Message-State: AGRZ1gJYngoTBf3FwkPBi9bSqSvCsWlVaPDTq9Ta9220AoGYmuoBIBnx TanNxfNDX6tu3ZX1DAPET9aRtGbdeBc= X-Received: by 2002:a63:9712:: with SMTP id n18-v6mr211308pge.182.1540446812319; Wed, 24 Oct 2018 22:53:32 -0700 (PDT) Received: from localhost ([122.172.217.9]) by smtp.gmail.com with ESMTPSA id z2-v6sm1404750pfm.106.2018.10.24.22.53.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Oct 2018 22:53:31 -0700 (PDT) From: Viresh Kumar To: ulf.hansson@linaro.org, Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rafael Wysocki , niklas.cassel@linaro.org, rnayak@codeaurora.org, linux-kernel@vger.kernel.org Subject: [PATCH V3 05/10] OPP: Populate OPPs from "required-opps" property Date: Thu, 25 Oct 2018 11:22:42 +0530 Message-Id: X-Mailer: git-send-email 2.19.1.568.g152ad8e3369a In-Reply-To: References: MIME-Version: 1.0 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. Reviewed-by: Ulf Hansson Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 1 + drivers/opp/of.c | 81 ++++++++++++++++++++++++++++++++++++++++++++-- drivers/opp/opp.h | 6 ++++ 3 files changed, 86 insertions(+), 2 deletions(-) -- 2.19.1.568.g152ad8e3369a diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 85174a5c4850..02a69a62dac8 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -976,6 +976,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 b5605196122a..ffaeefef98ce 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -259,6 +259,77 @@ 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; + + if (!required_opps) + return; + + for (i = 0; i < opp_table->required_opp_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 **required_opps; + struct opp_table *required_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++) { + required_table = opp_table->required_opp_tables[i]; + + np = of_parse_required_opp(opp->np, i); + if (unlikely(!np)) { + ret = -ENODEV; + goto free_required_opps; + } + + required_opps[i] = _find_opp_of_np(required_table, np); + of_node_put(np); + + 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) { @@ -503,6 +574,10 @@ static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table, 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; @@ -510,14 +585,14 @@ static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table, 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 */ @@ -547,6 +622,8 @@ static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table, blocking_notifier_call_chain(&opp_table->head, OPP_EVENT_ADD, new_opp); return new_opp; +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 024e1be23d37..24b340ad18d1 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; @@ -216,10 +218,14 @@ void _put_opp_list_kref(struct opp_table *opp_table); void _of_init_opp_table(struct opp_table *opp_table, struct device *dev, int index); void _of_clear_opp_table(struct opp_table *opp_table); struct opp_table *_managed_opp(struct device *dev, int index); +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, int index) {} static inline void _of_clear_opp_table(struct opp_table *opp_table) {} static inline struct opp_table *_managed_opp(struct device *dev, int index) { return NULL; } +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 Thu Oct 25 05:52:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 149517 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp913649ljp; Wed, 24 Oct 2018 22:53:39 -0700 (PDT) X-Google-Smtp-Source: AJdET5dfJ2jHCOnLBvNiUeyuqJl+InB1G7n4sZ64OHkaU75ZhN6JfdwlZDzflxwr6iwMMx7OVyPx X-Received: by 2002:a62:4151:: with SMTP id o78-v6mr224382pfa.66.1540446818976; Wed, 24 Oct 2018 22:53:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540446818; cv=none; d=google.com; s=arc-20160816; b=cz0RDly+oBXNUVLCoVglUvWu+TXFSGTspkSe/VzzQrSrR0vib6xcWSbmDDzAhQm5Pw r/WFD/pK6DUqc3dHQyqQkGeLvI1L/ubHsQ0uoxEdx5pTYdVDvYuay4WHV3IknpwK1ptO a7KOHtuyrTbPE62IU+VlzOrxOrYDVA6J7igbF1pppmxnUaBQ2AZOMLscMTfdOfci/8cG tTt1pn3ERiCrgcWejIt+hI3tfSdV5gkNl8r6JTxAf5AJ20/DeaYM56xKTiq7v5PcnyGu 91YPV7d4HOqp6wp1xxryZSMVetAyIegl33cCf/ygqqRUahwcHj6df9x4aWQ15W+r+idz Lelw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DREmCWfscdpbRmqLABL+1ARNsgewbNNclEM2YGn70QU=; b=ut1ow73WXNopY52SlMNhVTnQNAABDg5aRm+c2XqqE6i/b+XT4ZQsHdtHn2hTHeWf7i +nnA0RdRHE/g4w7AguBgupsziLfnDxhToLvzoz/tZn8hXGMVOyJdHo5AAhx0iqf8Vc4I wdYox10CiXdA+OYj8QdqZqo3xAnh0YJO6zCUqegCeSXHxiNJvwbPY32s8IJEgSdQrr71 1+0Bniff6U2Em/Ze7tPGXaKYHhET6NnuhbpYscBGpMFGLH7ibI2dptdPi2OlcDT7J0Ma II6Lfnu8LLsjgWHdmbCc44XZebZ/Rr9nxdziGGZHLyacqXqFhSSHdB4b28QxvS1vZoWO wNiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NyQEdTMm; 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 i187-v6si7821241pfc.25.2018.10.24.22.53.38; Wed, 24 Oct 2018 22:53:38 -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=NyQEdTMm; 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 S1727530AbeJYOYr (ORCPT + 32 others); Thu, 25 Oct 2018 10:24:47 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:46935 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727502AbeJYOYq (ORCPT ); Thu, 25 Oct 2018 10:24:46 -0400 Received: by mail-pl1-f194.google.com with SMTP id bb7-v6so3332522plb.13 for ; Wed, 24 Oct 2018 22:53:36 -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 :mime-version:content-transfer-encoding; bh=DREmCWfscdpbRmqLABL+1ARNsgewbNNclEM2YGn70QU=; b=NyQEdTMmA4psl6Bd/PFMDjhuAKsz4CEmaWHkW6frOoA/VWVk14rQoho2kvKnxP37Ut vQoY3wwxPCEb5nsUrKulHikjV1Uxh3Aqh1GN0xkQm5ugyZGgpGdsA0gvRsov08DrUm+V Tgfvv0idzTcGoOI4VeInxcNgth7u4VDflzUdg= 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:mime-version:content-transfer-encoding; bh=DREmCWfscdpbRmqLABL+1ARNsgewbNNclEM2YGn70QU=; b=Sfa5uSFo80gndrQw0ZqcfC038Wl7Tm3qkX+dtusFUzI8QY8x7HVqlkHa7OawojVmUP cL7nG/2TdGZU9A/je576L/Eq/LjeiWGIcNaSQ4a8pQD4Sh1i06jEsmlqpmRwHlg3CXtN zWwi8qOPFAnRU4g/HQSC5vItLgWjBOZuAZZ2PzBDq1eN0BEXccj6DbehbrtonrhMwIvI 9cGjj79JhTCEsb3Ywxg1ND99MBQ8Do00RXU4GKcMetvZahWWfg202dz3xLWiBx2G3JJp ZWRlj0EpmneYgayVFoK+Z5lZ7cHz0Bnr+yqIXbBJDwspigT3EhRZO6jTl0FWukwzckde lcTQ== X-Gm-Message-State: AGRZ1gK3FP4gITqyOjkGR/KkuDiWQY0PpgARRSN9MwXAAUG5rdqlrJS+ dmn0eojWrkEmHw8V8pW9ZrviKA== X-Received: by 2002:a17:902:7e03:: with SMTP id b3-v6mr202147plm.246.1540446815767; Wed, 24 Oct 2018 22:53:35 -0700 (PDT) Received: from localhost ([122.172.217.9]) by smtp.gmail.com with ESMTPSA id m20-v6sm7734646pfj.171.2018.10.24.22.53.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Oct 2018 22:53:35 -0700 (PDT) From: Viresh Kumar To: ulf.hansson@linaro.org, "Rafael J. Wysocki" , Kevin Hilman , Pavel Machek , Len Brown Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Stephen Boyd , Nishanth Menon , niklas.cassel@linaro.org, rnayak@codeaurora.org, linux-kernel@vger.kernel.org Subject: [PATCH V3 06/10] PM / Domains: Add genpd_opp_to_performance_state() Date: Thu, 25 Oct 2018 11:22:43 +0530 Message-Id: X-Mailer: git-send-email 2.19.1.568.g152ad8e3369a In-Reply-To: References: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The OPP core currently stores the performance state in the consumer device's OPP table, but that is going to change going forward and performance state will rather be set directly in the genpd's OPP table. For that we need to get the performance state for genpd's device structure (genpd->dev) instead of the consumer device's structure. Add a new helper to do that. Signed-off-by: Viresh Kumar --- drivers/base/power/domain.c | 32 ++++++++++++++++++++++++++++++++ include/linux/pm_domain.h | 9 +++++++++ 2 files changed, 41 insertions(+) -- 2.19.1.568.g152ad8e3369a Reviewed-by: Ulf Hansson diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index fe9b0527b161..7be8c94c6b7f 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2520,6 +2520,38 @@ int of_genpd_parse_idle_states(struct device_node *dn, } EXPORT_SYMBOL_GPL(of_genpd_parse_idle_states); +/** + * pm_genpd_opp_to_performance_state - Gets performance state of the genpd from its OPP node. + * + * @genpd_dev: Genpd's device for which the performance-state needs to be found. + * @opp: struct dev_pm_opp of the OPP for which we need to find performance + * state. + * + * Returns performance state encoded in the OPP of the genpd. 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 pm_genpd_opp_to_performance_state(struct device *genpd_dev, + struct dev_pm_opp *opp) +{ + struct generic_pm_domain *genpd = NULL; + int state; + + genpd = container_of(genpd_dev, struct generic_pm_domain, dev); + + if (unlikely(!genpd->opp_to_performance_state)) + return 0; + + genpd_lock(genpd); + state = genpd->opp_to_performance_state(genpd, opp); + genpd_unlock(genpd); + + return state; +} +EXPORT_SYMBOL_GPL(pm_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. diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index 3b5d7280e52e..4f803f934308 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -258,6 +258,8 @@ int of_genpd_add_subdomain(struct of_phandle_args *parent, struct generic_pm_domain *of_genpd_remove_last(struct device_node *np); int of_genpd_parse_idle_states(struct device_node *dn, struct genpd_power_state **states, int *n); +unsigned int pm_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); @@ -299,6 +301,13 @@ static inline int of_genpd_parse_idle_states(struct device_node *dn, return -ENODEV; } +static inline unsigned int +pm_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) From patchwork Thu Oct 25 05:52:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 149518 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp913694ljp; Wed, 24 Oct 2018 22:53:43 -0700 (PDT) X-Google-Smtp-Source: AJdET5f5ZGaxCnBaZRg1qQMTWyh2NNwk+5l9bj7edbtPWOcMzWMsitoCn7ViFfCwkZxXo8ex7LA9 X-Received: by 2002:a17:902:f203:: with SMTP id gn3mr182994plb.93.1540446823577; Wed, 24 Oct 2018 22:53:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540446823; cv=none; d=google.com; s=arc-20160816; b=oqnmEmQgsiauswRrRfBrHbGFl+EE7kRmiy+3X78/Qyat8h3/pwQ/kItaytthlOhvN3 bRChQQq/vDxw+wS4PhlEV2WYPG5PCVIKI8fqeVr9PnauXg3AoVycM/AhMoOFjrg6p8oq FYiAcKL2hYbj7GTfvlk9DIDPwsvrFvjlKbHwN0M2KanigiBV34DlidOEiMvTUWLab02O FKTQ3/1Wk734/UvFv0jC5I49UoYxH+hgU9vIdV1AQu++TxhDJ3uR8GO8q7lhfMO7svEq 2qhLda55MhrD3IAVfopfSd3t8PrrpRMXwfCd5XrIM3+PnvlgRnY3Bd2PkvFIgM0xWbuN VSIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5P54FTiPnHGM/RFoS1jahduTy0+iQ6he2oD3fa4tMvY=; b=gNOlBXGy/ZQ40BATCHLreKL+IlQviGKpYvScoWzAkqttd0xv9MldCUZzLlpqh7Ry6V ntbOaTy2hqltOtvy9lQx9ZvK+g+bR/taW0max0LaNdF9BiifMJSi/JcDNkX3mr5tYh8z wrv+hB1JeXIKuJR9FhWir3Kx+LREachZVDKjC2sptVacIzzPqpP72/WweJlNCPp6ILOw uU9sdeBo3bXHQzqCYouuayjFaKAS6Yh92/9QCQEkH1+l3OginFS8TWTbGIDI7fRjqsdF N/JWYdgVjj1juL2xwhpiCdQivgsDuHnf5owxDMqK0foTXnBJMEiDZVOC3hsRPEo7V3mk 1mMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Fb/20vgG"; 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 c1-v6si6735433pgp.376.2018.10.24.22.53.43; Wed, 24 Oct 2018 22:53:43 -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="Fb/20vgG"; 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 S1727552AbeJYOYv (ORCPT + 32 others); Thu, 25 Oct 2018 10:24:51 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:34061 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727502AbeJYOYu (ORCPT ); Thu, 25 Oct 2018 10:24:50 -0400 Received: by mail-pg1-f196.google.com with SMTP id g12-v6so3498743pgs.1 for ; Wed, 24 Oct 2018 22:53:40 -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 :mime-version:content-transfer-encoding; bh=5P54FTiPnHGM/RFoS1jahduTy0+iQ6he2oD3fa4tMvY=; b=Fb/20vgGGwE87SdvprVQeoZfk6rmBDqKHibaA9IygDPPzhO01gucegVnynvK8Eg+1d 4Nl/h7q2Z9YYDbUkGt36Wax3qXmKV+oe7JnfMkpAv2bf7jhOcTMXUBeG8MyIpbllqeN1 34CsFylSwIFkwIZn44WHU+WhpAa9EnYkSIYhg= 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:mime-version:content-transfer-encoding; bh=5P54FTiPnHGM/RFoS1jahduTy0+iQ6he2oD3fa4tMvY=; b=Mx9wLbcfcNwo7pxKOo0PtQ8xIvYgz++ZQT1/qIuh6Xdn9Us5Kb3BOD2zud/Bnr1e3L lljuoIs2i7YXlZRRFstroAwRzIoAovjYz2iByfrQSztLrwQI+OzlWPilL7oB1dtqaJa5 VjE5btx9MQPwEzqu9wpLIHc/LH8UwH5OvslmN2dGCeIduNps0WW/7I/UrKDEyNIDanPT 4tIAVdG1Mh+rNclzZvNwwgcL/K7iMJrhe/eSKDW/3dHo404AXNBarPeOkeV4mrpamg2h 4KCeJ+r6IHJoJbmSF0rCeePZlbseeFXhxd/rJxHSeUhJXn3YZQ0chHlrCtPwCPEwGUEL bwpw== X-Gm-Message-State: AGRZ1gJw9fpnS+s0CqpAbVJdeerScpc23r+qBl/ansS7co627QgIsZWI L5SP0yYbLFN3qjXR1WNFX7cOKw== X-Received: by 2002:a63:6302:: with SMTP id x2mr185316pgb.183.1540446819747; Wed, 24 Oct 2018 22:53:39 -0700 (PDT) Received: from localhost ([122.172.217.9]) by smtp.gmail.com with ESMTPSA id p124-v6sm1572111pfg.100.2018.10.24.22.53.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Oct 2018 22:53:39 -0700 (PDT) From: Viresh Kumar To: ulf.hansson@linaro.org, Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , niklas.cassel@linaro.org, rnayak@codeaurora.org, linux-kernel@vger.kernel.org Subject: [PATCH V3 07/10] OPP: Add dev_pm_opp_{set|put}_genpd_virt_dev() helper Date: Thu, 25 Oct 2018 11:22:44 +0530 Message-Id: <6a9919dba23fe0d28bfb3a72aef980ec5c3c539b.1540446493.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.19.1.568.g152ad8e3369a In-Reply-To: References: MIME-Version: 1.0 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 consumer device are supported with the help of virtual devices, which are created for each consumer 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 of these virtual devices. These are required only if multiple domains are available for a device, otherwise the actual device structure will be used instead by the OPP core. The new helpers also support the complex cases where the consumer device wouldn't always require all the domains. For example, a camera may require only one power domain during normal operations but two during high resolution operations. The consumer driver can call dev_pm_opp_put_genpd_virt_dev(high_resolution_genpd_virt_dev) if it is currently operating in the normal mode and doesn't have any performance requirements from the genpd which manages high resolution power requirements. The consumer driver can later call dev_pm_opp_set_genpd_virt_dev(high_resolution_genpd_virt_dev) once it switches back to the high resolution mode. The new helpers differ from other OPP set/put helpers as the new ones can be called with OPPs initialized for the table as we may need to call them on the fly because of the complex case explained above. For this reason it is possible that the genpd virt_dev structure may be used in parallel while the new helpers are running and a new mutex is added to protect against that. We didn't use the existing opp_table->lock mutex as that is widely used in the OPP core and we will need this lock in the dev_pm_opp_set_rate() helper while changing OPP and we need to make sure there is not much contention while doing that as that's the hotpath. Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 88 ++++++++++++++++++++++++++++++++++++++++++ drivers/opp/of.c | 16 +++++++- drivers/opp/opp.h | 4 ++ include/linux/pm_opp.h | 8 ++++ 4 files changed, 115 insertions(+), 1 deletion(-) -- 2.19.1.568.g152ad8e3369a diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 02a69a62dac8..cef2ccda355d 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -823,6 +823,7 @@ static struct opp_table *_allocate_opp_table(struct device *dev, int index) return NULL; mutex_init(&opp_table->lock); + mutex_init(&opp_table->genpd_virt_dev_lock); INIT_LIST_HEAD(&opp_table->dev_list); opp_dev = _add_opp_dev(dev, opp_table); @@ -920,6 +921,7 @@ static void _opp_table_kref_release(struct kref *kref) _remove_opp_dev(opp_dev, opp_table); } + mutex_destroy(&opp_table->genpd_virt_dev_lock); mutex_destroy(&opp_table->lock); list_del(&opp_table->node); kfree(opp_table); @@ -1602,6 +1604,92 @@ 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_genpd_virt_dev - Set virtual genpd device for an index + * @dev: Consumer device for which the genpd device is getting set. + * @virt_dev: virtual genpd device. + * @index: index. + * + * Multiple generic power domains for a device are supported with the help of + * virtual genpd devices, which are created for each consumer 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. + * + * This helper will normally be called by the consumer driver of the device + * "dev", as only that has details of the genpd devices. + * + * This helper needs to be called once for each of those virtual devices, but + * only if multiple domains are available for a device. Otherwise the original + * device structure will be used instead by the OPP core. + */ +struct opp_table *dev_pm_opp_set_genpd_virt_dev(struct device *dev, + struct device *virt_dev, + int index) +{ + struct opp_table *opp_table; + + opp_table = dev_pm_opp_get_opp_table(dev); + if (!opp_table) + return ERR_PTR(-ENOMEM); + + mutex_lock(&opp_table->genpd_virt_dev_lock); + + if (unlikely(!opp_table->genpd_virt_devs || + index >= opp_table->required_opp_count || + opp_table->genpd_virt_devs[index])) { + + dev_err(dev, "Invalid request to set required device\n"); + dev_pm_opp_put_opp_table(opp_table); + mutex_unlock(&opp_table->genpd_virt_dev_lock); + + return ERR_PTR(-EINVAL); + } + + opp_table->genpd_virt_devs[index] = virt_dev; + mutex_unlock(&opp_table->genpd_virt_dev_lock); + + return opp_table; +} + +/** + * dev_pm_opp_put_genpd_virt_dev() - Releases resources blocked for genpd device. + * @opp_table: OPP table returned by dev_pm_opp_set_genpd_virt_dev(). + * @virt_dev: virtual genpd device. + * + * This releases the resource previously acquired with a call to + * dev_pm_opp_set_genpd_virt_dev(). The consumer driver shall call this helper + * if it doesn't want OPP core to update performance state of a power domain + * anymore. + */ +void dev_pm_opp_put_genpd_virt_dev(struct opp_table *opp_table, + struct device *virt_dev) +{ + int i; + + /* + * Acquire genpd_virt_dev_lock to make sure virt_dev isn't getting + * used in parallel. + */ + mutex_lock(&opp_table->genpd_virt_dev_lock); + + for (i = 0; i < opp_table->required_opp_count; i++) { + if (opp_table->genpd_virt_devs[i] != virt_dev) + continue; + + opp_table->genpd_virt_devs[i] = NULL; + dev_pm_opp_put_opp_table(opp_table); + + /* Drop the vote */ + dev_pm_genpd_set_performance_state(virt_dev, 0); + break; + } + + mutex_unlock(&opp_table->genpd_virt_dev_lock); + + if (unlikely(i == opp_table->required_opp_count)) + dev_err(virt_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 ffaeefef98ce..71aef28953c2 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -134,6 +134,7 @@ static struct opp_table *_find_table_of_opp_np(struct device_node *opp_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 **genpd_virt_devs = opp_table->genpd_virt_devs; int i; if (!required_opp_tables) @@ -147,8 +148,10 @@ static void _opp_table_free_required_tables(struct opp_table *opp_table) } kfree(required_opp_tables); + kfree(genpd_virt_devs); opp_table->required_opp_count = 0; + opp_table->genpd_virt_devs = NULL; opp_table->required_opp_tables = NULL; } @@ -161,6 +164,7 @@ static void _opp_table_alloc_required_tables(struct opp_table *opp_table, struct device_node *opp_np) { struct opp_table **required_opp_tables; + struct device **genpd_virt_devs = NULL; struct device_node *required_np, *np; int count, i; @@ -175,11 +179,21 @@ static void _opp_table_alloc_required_tables(struct opp_table *opp_table, if (!count) goto put_np; + if (count > 1) { + genpd_virt_devs = kcalloc(count, sizeof(*genpd_virt_devs), + GFP_KERNEL); + if (!genpd_virt_devs) + goto put_np; + } + required_opp_tables = kcalloc(count, sizeof(*required_opp_tables), GFP_KERNEL); - if (!required_opp_tables) + if (!required_opp_tables) { + kfree(genpd_virt_devs); goto put_np; + } + opp_table->genpd_virt_devs = genpd_virt_devs; 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 24b340ad18d1..8aec38792cae 100644 --- a/drivers/opp/opp.h +++ b/drivers/opp/opp.h @@ -135,6 +135,8 @@ enum opp_table_access { * @parsed_static_opps: True if OPPs are initialized from DT. * @shared_opp: OPP is shared between multiple devices. * @suspend_opp: Pointer to OPP to be used during device suspend. + * @genpd_virt_dev_lock: Mutex protecting the genpd virtual device pointers. + * @genpd_virt_devs: 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. @@ -177,6 +179,8 @@ struct opp_table { enum opp_table_access shared_opp; struct dev_pm_opp *suspend_opp; + struct mutex genpd_virt_dev_lock; + struct device **genpd_virt_devs; 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 5d399eeef172..8fed222c089b 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -126,6 +126,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_genpd_virt_dev(struct device *dev, struct device *virt_dev, int index); +void dev_pm_opp_put_genpd_virt_dev(struct opp_table *opp_table, struct device *virt_dev); 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); @@ -272,6 +274,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_genpd_virt_dev(struct device *dev, struct device *virt_dev, int index) +{ + return ERR_PTR(-ENOTSUPP); +} + +static inline void dev_pm_opp_put_genpd_virt_dev(struct opp_table *opp_table, struct device *virt_dev) {} static inline int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) { return -ENOTSUPP; From patchwork Thu Oct 25 05:52:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 149519 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp913724ljp; Wed, 24 Oct 2018 22:53:46 -0700 (PDT) X-Google-Smtp-Source: AJdET5caIqYFDO/+qL2Zh68z4TkE4DKDsdgQb1w3UOFJBLQowSphuwqTYnEnB4UP3vtv4umvJ3oX X-Received: by 2002:a17:902:b692:: with SMTP id c18-v6mr183935pls.191.1540446826791; Wed, 24 Oct 2018 22:53:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540446826; cv=none; d=google.com; s=arc-20160816; b=h/Pt4CDgDvsBLLMoABDeHjv23CI9xN8YPAC88NrrUf5DhVdvDwv/sZXD9ZtdB23nNn GlNIoydNJgclTLuoSylqwCcmaAQpnyzGIGw5z4fTiAxj0AFo2LVlxns7J3iph6zesmjO i5baVGLNu4eJjf9FmNfUZxwpSkHYv4Vytwxny8wUyFUoxI962V1DpwBSjCk4yJo5qcSk kzpQS3J6mxfnYvgBuXuxNmWejEfqIZy5YboPaHyqD88/HObNY0rrYYF9u9mDgsigS3t3 gSsl3Q2XQf6n7eQuRgWe/kujVzzZ1ukEYFUzLoZYfrcUZegiwgeuEhqyJckZjVlhyZed NznQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wVqXjk7n5hkE0ZKH0VVF90h6UKPg3BztsmMsFz9tDjQ=; b=xbANdTV58PMlQrY8eJIiW7hGpOQSzUezBXdStru6oT8aH7kmolAu+65A1m3p333nUT VcantaLpQfTGR7DdOTV/CuMVRYqPOjlflPn5OQPCT2V1cHGT3bAMKWRln9VlHcO4I2Zr BIUdds67yPZRrX6wMMwyr7y0N9ISZ3JyiBncqFBKkK2Q38lPzors57/eRL6ZUcawE5sq mlzAiU3w3odig+t61M/rShLElsQizbqiEWr1GeWlLSG1IkFMMy5an9tESTYWQuwUPyoy EknB9xmZYmXd50AMfcVPrkXXONwzwWmrDeekm7ovVV6eTjbMCGd7Ba/eCW1VV2LlNLD8 Emvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YMOV8aLq; 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 c1-v6si6735433pgp.376.2018.10.24.22.53.46; Wed, 24 Oct 2018 22:53:46 -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=YMOV8aLq; 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 S1727576AbeJYOYz (ORCPT + 32 others); Thu, 25 Oct 2018 10:24:55 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:34574 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727531AbeJYOYx (ORCPT ); Thu, 25 Oct 2018 10:24:53 -0400 Received: by mail-pl1-f194.google.com with SMTP id f10-v6so3364241plr.1 for ; Wed, 24 Oct 2018 22:53:43 -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 :mime-version:content-transfer-encoding; bh=wVqXjk7n5hkE0ZKH0VVF90h6UKPg3BztsmMsFz9tDjQ=; b=YMOV8aLqj0s4wouk2hoc6g3a5TknOvFQwTYrKdRQx4+4IZ+zU6pJsa8DeEHssYaV4K szxmNbene+On3UE0B9vncK5IGLEnb1s5gXmWn1rQ1vlbXaKtUD1RhbAe5lI1HvV38Msw mYNp2dzBVT5xmwnbAmi2PwzKUudqLfCmQaezE= 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:mime-version:content-transfer-encoding; bh=wVqXjk7n5hkE0ZKH0VVF90h6UKPg3BztsmMsFz9tDjQ=; b=HcvNj53dZSn3+kwKMwfy8DbJLEN9u14ZAkbNucDPpvI/4xjO2dTzLnqvboOdAmC8IH wpMYGXtGTP8DhQi4+e3IX7q97BLcIayF1d9BzapQNP5VpEF8hyhS/WRLwynKbFLff5X1 Wv2rkGV8z4Qw8JQynsTy2vJ/4/NhhCpu6v0av40Vpopk9XbtEiQ+CJ2u77Tz1Fe/nZU3 A3GowwVj00yOqWuYAhfHzqpzx48v1+oLRkcc1wnFmxcAhOUw1OTM84AHEVnXkBB9Ef3A kvl7iMwJlMGgfbcWThabWdYyMqLpUfzaxx7rXKZsOoI8eY7sAi5gLMrQWj5acNGSSsXl Dl7A== X-Gm-Message-State: AGRZ1gLqJOTbvKj9Qy3NNLBH7T1L3LjSRrX3HqaONpBob9JC/8AIwZQs ilj98pzA323NT2nP/gjVdiTKag== X-Received: by 2002:a17:902:b70a:: with SMTP id d10-v6mr181769pls.199.1540446823059; Wed, 24 Oct 2018 22:53:43 -0700 (PDT) Received: from localhost ([122.172.217.9]) by smtp.gmail.com with ESMTPSA id d186-v6sm7829835pfg.173.2018.10.24.22.53.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Oct 2018 22:53:42 -0700 (PDT) From: Viresh Kumar To: ulf.hansson@linaro.org, Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rafael Wysocki , niklas.cassel@linaro.org, rnayak@codeaurora.org, linux-kernel@vger.kernel.org Subject: [PATCH V3 08/10] OPP: Configure all required OPPs Date: Thu, 25 Oct 2018 11:22:45 +0530 Message-Id: X-Mailer: git-send-email 2.19.1.568.g152ad8e3369a In-Reply-To: References: MIME-Version: 1.0 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 pm_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 | 113 ++++++++++++++++++++++++++------------------- drivers/opp/of.c | 5 +- 2 files changed, 68 insertions(+), 50 deletions(-) -- 2.19.1.568.g152ad8e3369a Reviewed-by: Ulf Hansson diff --git a/drivers/opp/core.c b/drivers/opp/core.c index cef2ccda355d..0eaa954b3f6c 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -548,44 +548,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, @@ -663,6 +625,56 @@ 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, + struct opp_table *opp_table, + struct dev_pm_opp *opp) +{ + struct opp_table **required_opp_tables = opp_table->required_opp_tables; + struct device **genpd_virt_devs = opp_table->genpd_virt_devs; + unsigned int pstate; + int i, ret = 0; + + if (!required_opp_tables) + return 0; + + /* Single genpd case */ + if (!genpd_virt_devs) { + pstate = opp->required_opps[0]->pstate; + ret = dev_pm_genpd_set_performance_state(dev, pstate); + if (ret) { + dev_err(dev, "Failed to set performance state of %s: %d (%d)\n", + dev_name(dev), pstate, ret); + } + return ret; + } + + /* Multiple genpd case */ + + /* + * Acquire genpd_virt_dev_lock to make sure we don't use a genpd_dev + * after it is freed from another thread. + */ + mutex_lock(&opp_table->genpd_virt_dev_lock); + + for (i = 0; i < opp_table->required_opp_count; i++) { + pstate = opp->required_opps[i]->pstate; + + if (!genpd_virt_devs[i]) + continue; + + ret = dev_pm_genpd_set_performance_state(genpd_virt_devs[i], pstate); + if (ret) { + dev_err(dev, "Failed to set performance rate of %s: %d (%d)\n", + dev_name(genpd_virt_devs[i]), pstate, ret); + break; + } + } + mutex_unlock(&opp_table->genpd_virt_dev_lock); + + return ret; +} + /** * dev_pm_opp_set_rate() - Configure new OPP based on frequency * @dev: device for which we do this operation @@ -730,6 +742,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, @@ -740,19 +759,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 71aef28953c2..4e494720ac25 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -595,12 +595,13 @@ static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table, 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 = pm_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 Thu Oct 25 05:52:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 149520 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp913772ljp; Wed, 24 Oct 2018 22:53:50 -0700 (PDT) X-Google-Smtp-Source: AJdET5de2SYyTJ2TsF96nINxwYpvg45gYKX/iiDrddIQuaoQfm8iKH0i/oGI8BFjtxtGR5Mq6YqB X-Received: by 2002:a17:902:e005:: with SMTP id ca5-v6mr178419plb.195.1540446830597; Wed, 24 Oct 2018 22:53:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540446830; cv=none; d=google.com; s=arc-20160816; b=fpuVIdH8aqafac0oQa/AO4f00srpYn28j1Xe/Jd2+5q2SJoIEAAgMpvdSiZB9VdgDv dceBOaQiqFVovB6GAbH4/YlQOg7KAQM3gHsMvTXNhmftAT9yV1xkitk78VTvO+EADbks ju3pgGL0utz/Y19bzoJ025aCdM24x8oMiJmHQB+q6T2uQcxSv4EzCwaUT7eMqlPYNQ1o 6dyTIww7rbRO8/Okdp+mqoLRMM9jvfcpH6Yq1YfM1Zc6EWoua/yhfrYK6hLgIWtrfh4j isait37hevG9e1OdQR1xLXiwSaEIMqVhPhiL/wa+rhT801axLYnBVNo+1g54ga9wRBGW 972Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YCyv0YPeiesSsQ4IoZUlYIyjO5zGVV/PfYBEjZv38ns=; b=NXm6E2VeaRtOR9v84L+GrIPKa1fzRrrZe6GR3qwSkyfJilc3g/V1i/+cO6G9bK2xbw 1t77QyynaKJqo0DWs1mse7hvbAsVq8H2VUc3W01xdxsjM5TQE/ejQbU8bEhN16EyKga9 DYvspcL4lTJADnZuCTwACyynkzmJQUbRbdupyCyQhYQYiyo2rSwzgLDUn4zVF9waHpnM I2ZFelv+kODtik+HQOkVtbXH2BZ19wFpGWs+nvy9R+V83ByM9bZLtvAJ+oW/E+PS7bNb rhMZLUDh9G8k5LIX9077o9wnyz2txcfuOTfvwQmi39y14IFQkS127Fhrwi7oprNSvkVr 7o8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Tr274oTj; 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 o7-v6si6838476pll.20.2018.10.24.22.53.50; Wed, 24 Oct 2018 22:53:50 -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=Tr274oTj; 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 S1727595AbeJYOY6 (ORCPT + 32 others); Thu, 25 Oct 2018 10:24:58 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:46327 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727531AbeJYOY5 (ORCPT ); Thu, 25 Oct 2018 10:24:57 -0400 Received: by mail-pf1-f196.google.com with SMTP id r64-v6so3626990pfb.13 for ; Wed, 24 Oct 2018 22:53:47 -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 :mime-version:content-transfer-encoding; bh=YCyv0YPeiesSsQ4IoZUlYIyjO5zGVV/PfYBEjZv38ns=; b=Tr274oTjSRe7HrJGKcPK9ZS5P9wSPAwa2j6WXy/z51FssCnW30JuGEChZz4ZM5zJsl Js/6XCYiwcE5Idx3zJz4gzCZoPBYtsCi+mTEQp+Su0XzrNqGZ4CKx/VOXnUaOBA1TTLx YSBdMsDEC1hrzsCrpsAlXoo4L8a6IIYgekpvE= 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:mime-version:content-transfer-encoding; bh=YCyv0YPeiesSsQ4IoZUlYIyjO5zGVV/PfYBEjZv38ns=; b=bXIYGQWBG7sL0NRKWdnu7ZJhoQqS14M2WJAb+eZLS1BeVntSaY2CzqnpogRlORneJW mh0IAW7YHcfEfPeyr6Bsc+VY24iGMkhiruhlcme6nBMmqNqrvBJ1fcCIAY6d5I+RM+v5 VmSVZMJEa29emovZj3KR6/aRDo0pSFvLqktDsLAD5MkkTUza49lzEcEDhnYwzwtUeAKS B+pbrpBNEW3p3sYm04BLTcV1k2IL5qUyO3AII3EZy22BfndWK52Wvkkr8lpwkzlU/yy0 5oz34j9eCqxebvtYFMw7J5GDd3D3p/BkFtoD6nvwrUexBGU3nfjbDOcnn+xTF2Rgd9Mf P+mw== X-Gm-Message-State: AGRZ1gK1LXGhD3CybJb6sxro7eQ3lyIlsNTG2sOtoxt7euq7NgCMJ5xh 3/AC7o2hAx1iMULbWlTYgnaANQ== X-Received: by 2002:a62:8f:: with SMTP id 137-v6mr228758pfa.24.1540446826410; Wed, 24 Oct 2018 22:53:46 -0700 (PDT) Received: from localhost ([122.172.217.9]) by smtp.gmail.com with ESMTPSA id z2-v6sm1408294pfm.106.2018.10.24.22.53.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Oct 2018 22:53:45 -0700 (PDT) From: Viresh Kumar To: ulf.hansson@linaro.org, "Rafael J. Wysocki" , Kevin Hilman , Len Brown , Pavel Machek , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , niklas.cassel@linaro.org, rnayak@codeaurora.org, linux-kernel@vger.kernel.org Subject: [PATCH V3 09/10] OPP: Rename and relocate of_genpd_opp_to_performance_state() Date: Thu, 25 Oct 2018 11:22:46 +0530 Message-Id: <6ac7dd52047805dc1ec211cce261aee561d10abc.1540446493.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.19.1.568.g152ad8e3369a In-Reply-To: References: MIME-Version: 1.0 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_genpd_opp_to_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 | 44 ++++++++++++++++++++++++++++++++++ include/linux/pm_domain.h | 9 ------- include/linux/pm_opp.h | 5 ++++ 4 files changed, 49 insertions(+), 57 deletions(-) -- 2.19.1.568.g152ad8e3369a Reviewed-by: Ulf Hansson diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 7be8c94c6b7f..8e554e6a82a2 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2552,54 +2552,6 @@ unsigned int pm_genpd_opp_to_performance_state(struct device *genpd_dev, } EXPORT_SYMBOL_GPL(pm_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 4e494720ac25..0755ee307b1a 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -969,6 +969,50 @@ 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 = _find_table_of_opp_np(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; + } + + opp = _find_opp_of_np(opp_table, required_np); + if (opp) { + pstate = opp->pstate; + dev_pm_opp_put(opp); + } + + 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 4f803f934308..642036952553 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -260,8 +260,6 @@ int of_genpd_parse_idle_states(struct device_node *dn, struct genpd_power_state **states, int *n); unsigned int pm_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, @@ -308,13 +306,6 @@ pm_genpd_opp_to_performance_state(struct device *genpd_dev, 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 8fed222c089b..889bb347fbd9 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -315,6 +315,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) { @@ -357,6 +358,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 Thu Oct 25 05:52:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 149521 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp913798ljp; Wed, 24 Oct 2018 22:53:53 -0700 (PDT) X-Google-Smtp-Source: AJdET5e2c7d40QNu3YW512wwLoTS/LzSchJwm/+NjebRM+GMMkiJYNNrGfQoHPoxHo/hDiSO7qTj X-Received: by 2002:a63:9e02:: with SMTP id s2-v6mr206979pgd.302.1540446833739; Wed, 24 Oct 2018 22:53:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540446833; cv=none; d=google.com; s=arc-20160816; b=itbTACnZ5Owf8Ti3YWBkz9o627JL4QOAD/crLWFqky4Z1KnHG3b1hr9mm2nFisFCQG ulLQ77Nl4eCu7pux7Dh6q14rVasANpy1g/nWWsFwoT2dOmYvU+JT8sTAfYSktqQTS2xs 5LI//ufXg9AzOxRFfYrsw4j06Qg+i3b+amUpaHqP5Z2RmMbym++KIxcEKZcM3RDico2H yaoBNx8CeO0M6NfIFsCoDaAu6kLk1ZShqMABQmK861goRH7Zn9vhKmjYVHvVwmKsnmMD e0ymmhKco09VNdR5b2c7wW8IJ+JCjaaDz27GICRm9InZb669jOcTEOARUFuK1xdy40Sc KYrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0W5YPpjNuuimwED1mEbhATYnLae0KPefqUWaYo854Dw=; b=yoU6z0aOpEqU/30jNaj0OMvlRjSDwOtKDjzs2J/K+aOiKixr2AgKcvr48dt4mYnyVF d39gCF274qs2b0O1I+yRAS6REQvbzAQQKPuWJ2fNys9MJO97ZDsr6nE3Un9+gDs9gK6a YvEnCnx7eyJ7RHcl8inpfhUgGocV3AuyO/3HGZ6Za6fb8pB4NV4hESabucNZsWX4YepC pnkV78pbEEeqUncxJzbFs9Ew27iFwm0DqabTePh57guJx39Aeff7M7XD7jRTgHtoJSrq 3+Bgr4//ErsEJh9tOPa5IkOxDcbpdjOQSoR6iuUIq1CB5xfuN7MA/394Fe2NRFltcKn/ wd0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="NY/MiQxP"; 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 v13-v6si7112873pgq.26.2018.10.24.22.53.53; Wed, 24 Oct 2018 22:53:53 -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="NY/MiQxP"; 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 S1727615AbeJYOZB (ORCPT + 32 others); Thu, 25 Oct 2018 10:25:01 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:45335 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727531AbeJYOZA (ORCPT ); Thu, 25 Oct 2018 10:25:00 -0400 Received: by mail-pg1-f194.google.com with SMTP id s3-v6so3469445pga.12 for ; Wed, 24 Oct 2018 22:53:50 -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 :mime-version:content-transfer-encoding; bh=0W5YPpjNuuimwED1mEbhATYnLae0KPefqUWaYo854Dw=; b=NY/MiQxP42NnC4FTCCfe6hCoTHxKDld8m7IfnNiMgjIdTSGtH9wRdwybRkxkzM0VsF 57jcemcVi7fiDxbpSJ0dlJX40QFTaaUs+7uVcRloCP9sq6tY+/A4YxjdK4OQJcPhYOtJ W9cgSde6E5VxMimAr6GzkGjFcc0M0DgzGbGF8= 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:mime-version:content-transfer-encoding; bh=0W5YPpjNuuimwED1mEbhATYnLae0KPefqUWaYo854Dw=; b=WUOg4aLfv9PtZ+WHyoXKxz5N96ShvWQdNPfKtF/NCatoInWK1p7pQxqV6rVCFyxGic 8WX84l9iZ8TKatbt6EVFNLpdkjdvUeXJnvPe1t8tWrgNlVB0u0pyiS4wgICYC5QnN6SP f0ANQPQE2uWNCXVaFGyE3xa1kw1uPziEugBpPz12VY4gmSoCzLEf36SuPLuT7l04AEFw kU3y6tTryhWb+L2uEa60rXZa2SBjJQTwBi0YyeZSSEp9BESCw4gAs39aK4eK1cL4qexA yeN2zNtN5VYlEAlxoJ8R9E5lCKti91roQXg3qpjc0XOQTdoXqS530aT1ApuZO9ckNJ1/ 4+FA== X-Gm-Message-State: AGRZ1gK8wis7OPjGyr2FAJtX/s7JrBdZuZTxzSygBUAEKI7j3P/yNxKF 5RZlt2bjN0LbiCnR5B4OEHzvyQ== X-Received: by 2002:a62:250:: with SMTP id 77-v6mr235091pfc.16.1540446829661; Wed, 24 Oct 2018 22:53:49 -0700 (PDT) Received: from localhost ([122.172.217.9]) by smtp.gmail.com with ESMTPSA id 72-v6sm14968758pfr.115.2018.10.24.22.53.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Oct 2018 22:53:49 -0700 (PDT) From: Viresh Kumar To: ulf.hansson@linaro.org, Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , niklas.cassel@linaro.org, rnayak@codeaurora.org, linux-kernel@vger.kernel.org Subject: [PATCH V3 10/10] OPP: Remove of_dev_pm_opp_find_required_opp() Date: Thu, 25 Oct 2018 11:22:47 +0530 Message-Id: X-Mailer: git-send-email 2.19.1.568.g152ad8e3369a In-Reply-To: References: MIME-Version: 1.0 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.19.1.568.g152ad8e3369a Reviewed-by: Ulf Hansson diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 0755ee307b1a..da31874c7fe9 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 889bb347fbd9..2b2c3fd985ab 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -313,7 +313,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 @@ -350,10 +349,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;