From patchwork Fri Dec 22 07:26:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 122628 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1908681qgn; Thu, 21 Dec 2017 23:30:23 -0800 (PST) X-Google-Smtp-Source: ACJfBos58296pM5Ke2gIviX3+BpVvtlFrOqdII+c7B0F6ACCPsbuge4dRWnjWATQvCu0iu/fxp8g X-Received: by 10.98.110.193 with SMTP id j184mr13497396pfc.187.1513927823144; Thu, 21 Dec 2017 23:30:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513927823; cv=none; d=google.com; s=arc-20160816; b=FmSr9JinI+dCqAd6AScVN4wjTH6p/jrVG4I+QckrlW5I1X5BWniNlnPIKP+GwYjE+L XHr4ZILiqGMRWyZcrNaabfPUqqS+oiA1Tg6sCYNliCSUGb4qRNNA7D1nh1+Qb9QtHtC5 sDs1NmeUlIfIbWA4PkQe/HGoWDyuTOTuWmhegENGuqXUwrXtQhL/e+hu4bHYu3uY5Iml YGk8Q05QmIY+CHfrzJCoKvXFEtADK0p4A1oJ4s2SOgDXmQX2YrbfgTMJhDl1Prk4pEP6 KOUPBo34qeArzqywJy+z4gVMC+xUGLeH+CbXFX//DxgmhCTu/VGougtAtCZQWPbVZhju jpZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=RP/DgWyS3C/ibejXurkoyuPj6eSBTO3RrBjl+BOQ6Aw=; b=0/tekjIjKwCOSa2JcjButmgIJuE/1ZeWMCv9/bajZtY4iSQCCEnkUpsJ5u04vtoXYO cXkh4zXqvW5CJ0iEZ0MHsgoKUUpXxRPEycZp61Z6YSkPHacYx28dXijctbyAwdhASgA+ k0y/jbTrq4XdDgjfGoqyOzGrGb6BSl8nsLGjYlgkMsf7vQq+bIEIJjPukrrWOM8k2Htg aKLGi42gYFSfblklWLkE14L6ybICkfmo6X7iPsrVzC9zKizZl9V3ZhE+p5QIQNXimTo5 AYd5XGikeCTW4xFBtchSu7AenOtoh4r30wbej51KVvvE9k9/h3RYz4uozz6WEojwGtcQ CDAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AmcQKmr4; 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 1si16075459plw.770.2017.12.21.23.30.22; Thu, 21 Dec 2017 23:30:23 -0800 (PST) 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=AmcQKmr4; 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 S1753732AbdLVHaT (ORCPT + 28 others); Fri, 22 Dec 2017 02:30:19 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:41385 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753416AbdLVHaO (ORCPT ); Fri, 22 Dec 2017 02:30:14 -0500 Received: by mail-pg0-f68.google.com with SMTP id 77so851643pgd.8 for ; Thu, 21 Dec 2017 23:30:14 -0800 (PST) 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 :in-reply-to:references; bh=RP/DgWyS3C/ibejXurkoyuPj6eSBTO3RrBjl+BOQ6Aw=; b=AmcQKmr4ZDaCr2Kxstn6XgSpYF8b29h6jBEu/2fkS7Mx4/KukBRtC78tfcYpt+kklo w26Fm0kToKKWrI24W1uXvoFBzJD/0RC/q/r0zCL1sRRBI62lSbJsd3xdawEoWGxdqvVN hhd7mn1uun5PJDBb2zIpD0Tzjb47U4NuYdeac= 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:in-reply-to:references; bh=RP/DgWyS3C/ibejXurkoyuPj6eSBTO3RrBjl+BOQ6Aw=; b=jZsQD1OpcC8pxyQWBxwnRQmfpzxXTgYuY/51R9xtAapGnsGFgk4NaASs5ImsSwjQQ9 SYk2Y0NcyLqk/vvpOT0nHx7i65FGeCYsyd/pE5retOJAtc8+sydsvEvFruAuJ/BANrh0 +mxjU07X5yOw/Pbu38cERwfnGaZeh01U48MEDKZBUFFAtug+78qoew0495r+pwjTPgwv OzXHFRX4FbJEfbXtDRamgBNbjOVYkRNxcqCS61xRFhDtLNVqlREkUqbBXPqMZZYrTd7K FFupphNR8flfRsbbCfxAW2MOGt/hTakbCtbrFqC18tda83tQCuSV8dsxC9F2D8zWYZLS FmQA== X-Gm-Message-State: AKGB3mLVkMoFW0cfpjooUl0ufRu7Z8cGKs+piwlc3BSXzSf4zQ+lNEng zpjxeQ0bItVxFM+HVIOUyfU3Gg== X-Received: by 10.101.81.195 with SMTP id i3mr1319668pgq.260.1513927813218; Thu, 21 Dec 2017 23:30:13 -0800 (PST) Received: from localhost ([122.172.139.116]) by smtp.gmail.com with ESMTPSA id g19sm40434571pfb.65.2017.12.21.23.30.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Dec 2017 23:30:12 -0800 (PST) From: Viresh Kumar To: ulf.hansson@linaro.org, Kevin Hilman , Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , robh+dt@kernel.org, rnayak@codeaurora.org, sudeep.holla@arm.com, linux-kernel@vger.kernel.org Subject: [PATCH 1/7] PM / OPP: Implement dev_pm_opp_of_add_table_indexed() Date: Fri, 22 Dec 2017 12:56:25 +0530 Message-Id: <627a1c8658a1c0cd4b96ae087c87bb3dfa1ee70a.1513926033.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The "operating-points-v2" property can contain a list of phandles now, specifically for the power domain providers that provide multiple domains. Add support to parse that. Signed-off-by: Viresh Kumar --- drivers/opp/of.c | 50 +++++++++++++++++++++++++++++++++++++++++--------- include/linux/pm_opp.h | 6 ++++++ 2 files changed, 47 insertions(+), 9 deletions(-) -- 2.15.0.194.g9af6a3dea062 diff --git a/drivers/opp/of.c b/drivers/opp/of.c index cb716aa2f44b..22c9bd191f62 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -250,20 +250,17 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_of_remove_table); /* Returns opp descriptor node for a device node, caller must * do of_node_put() */ -static struct device_node *_opp_of_get_opp_desc_node(struct device_node *np) +static struct device_node *_opp_of_get_opp_desc_node(struct device_node *np, + int index) { - /* - * There should be only ONE phandle present in "operating-points-v2" - * property. - */ - - return of_parse_phandle(np, "operating-points-v2", 0); + /* "operating-points-v2" can be an array for power domain providers */ + return of_parse_phandle(np, "operating-points-v2", index); } /* Returns opp descriptor node for a device, caller must do of_node_put() */ struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev) { - return _opp_of_get_opp_desc_node(dev->of_node); + return _opp_of_get_opp_desc_node(dev->of_node, 0); } EXPORT_SYMBOL_GPL(dev_pm_opp_of_get_opp_desc_node); @@ -509,6 +506,41 @@ int dev_pm_opp_of_add_table(struct device *dev) } EXPORT_SYMBOL_GPL(dev_pm_opp_of_add_table); +/** + * dev_pm_opp_of_add_table_indexed() - Initialize indexed opp table from device tree + * @dev: device pointer used to lookup OPP table. + * @index: Index number. + * + * Register the initial OPP table with the OPP library for given device only + * using the "operating-points-v2" property. + * + * Return: + * 0 On success OR + * Duplicate OPPs (both freq and volt are same) and opp->available + * -EEXIST Freq are same and volt are different OR + * Duplicate OPPs (both freq and volt are same) and !opp->available + * -ENOMEM Memory allocation failure + * -ENODEV when 'operating-points' property is not found or is invalid data + * in device node. + * -ENODATA when empty 'operating-points' property is found + * -EINVAL when invalid entries are found in opp-v2 table + */ +int dev_pm_opp_of_add_table_indexed(struct device *dev, int index) +{ + struct device_node *opp_np; + int ret; + + opp_np = _opp_of_get_opp_desc_node(dev->of_node, index); + if (!opp_np) + return -ENODEV; + + ret = _of_add_opp_table_v2(dev, opp_np); + of_node_put(opp_np); + + return ret; +} +EXPORT_SYMBOL_GPL(dev_pm_opp_of_add_table_indexed); + /* CPU device specific helpers */ /** @@ -613,7 +645,7 @@ int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, } /* Get OPP descriptor node */ - tmp_np = _opp_of_get_opp_desc_node(cpu_np); + tmp_np = _opp_of_get_opp_desc_node(cpu_np, 0); of_node_put(cpu_np); if (!tmp_np) { pr_err("%pOF: Couldn't find opp node\n", cpu_np); diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 6c2d2e88f066..f042fdeaaa3c 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -303,6 +303,7 @@ static inline void dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask #if defined(CONFIG_PM_OPP) && defined(CONFIG_OF) int dev_pm_opp_of_add_table(struct device *dev); +int dev_pm_opp_of_add_table_indexed(struct device *dev, int index); void dev_pm_opp_of_remove_table(struct device *dev); int dev_pm_opp_of_cpumask_add_table(const struct cpumask *cpumask); void dev_pm_opp_of_cpumask_remove_table(const struct cpumask *cpumask); @@ -314,6 +315,11 @@ static inline int dev_pm_opp_of_add_table(struct device *dev) return -ENOTSUPP; } +static inline int dev_pm_opp_of_add_table_indexed(struct device *dev, int index) +{ + return -ENOTSUPP; +} + static inline void dev_pm_opp_of_remove_table(struct device *dev) { } From patchwork Fri Dec 22 07:26:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 122634 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1910029qgn; Thu, 21 Dec 2017 23:31:49 -0800 (PST) X-Google-Smtp-Source: ACJfBosZrryaetsgs5USMOIi6nGire0hPOiCEreyI7qGq3y5QQt5Wej8SEoJDKWW7u+hVTiJquNH X-Received: by 10.99.154.66 with SMTP id e2mr12100839pgo.8.1513927908923; Thu, 21 Dec 2017 23:31:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513927908; cv=none; d=google.com; s=arc-20160816; b=YTlfN++2UuDf4kYrhEVggOwUoFnqhWu7HyTLWRge4zYdGgoCkQIgl1xYAm7RK+3J6b hbjQEs/abkPWrb4cE9hW1Tjn3a2+Ul7kp4sjRBJQDr3fhNLLLwcKH1GKUO/nOPHdfoQ5 BjIQHEsD1R38Mdfnx37Y9KrN6vg7M4y9I/P7zuuVkLhF5+dct/tn3guaoHQFY0eeB49M QlAzLam0+CkbPpfRXgcjp+qs58fvAWQTLqJxJV1Ncpy248naUWYOVFAI6LLc4jb4vzMQ u3qom5E8KgKoCLtwhus4iDyWRpfOkTFYXqLGS4wcRYHWtncu41JXoULCtrnl1H2CmPd3 SU9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=8Sh8IoYgJFrnf4eFvxRVA0oiwAdth8iBB9cshhpvsYw=; b=jyAgbpOaDTJWIGPx95u2giVM+estqtARKGT81wOmP55ztEN9ibofxJ5Di6D6XkOH+N hUrFDdzntx8Wco1c8qb0kYwYtZv9hCOKsEULt1jkHH974vHLr/9oNetocbn5qRhGM57p 4VpM/HshN2lPzDD1cCCMva6CmSfYWw8G+67Lh3Rvp6xsEC0XnlUzu8Af3LejbTqfS7Hn jelHK8PzRiIwLIRIbikC3ioFlT6glxr19wj7MAh0Et9JSc4dJ7CxtLrWzqzc2NoFY1Ox fh4irjJWwKbsGoTNQQfdHAy4v6bhVhS6L91Y3O6C1s1hHiR8P7sLkh+ohBVWoDBb3Gkz CeRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jqjI1zUu; 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 l5si14888688pgs.496.2017.12.21.23.31.48; Thu, 21 Dec 2017 23:31:48 -0800 (PST) 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=jqjI1zUu; 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 S1756020AbdLVHbq (ORCPT + 28 others); Fri, 22 Dec 2017 02:31:46 -0500 Received: from mail-pl0-f65.google.com ([209.85.160.65]:41424 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752968AbdLVHaR (ORCPT ); Fri, 22 Dec 2017 02:30:17 -0500 Received: by mail-pl0-f65.google.com with SMTP id g2so12479016pli.8 for ; Thu, 21 Dec 2017 23:30:17 -0800 (PST) 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 :in-reply-to:references; bh=8Sh8IoYgJFrnf4eFvxRVA0oiwAdth8iBB9cshhpvsYw=; b=jqjI1zUukTBKcS9WwUAh9pZ8Lt3Zsyl8RJ/Je3fi2/DKAVQtO+4DiyJPhg8FneARdR 4oIh4My9UAkACcIOXjlhhf211qnsY5dK8FdKzCatHGIXShnlwb3b68cP00L/KAyVvY7W yyJf6Z4XPXoq2syib3iNRfw3IgG+DDSOh1c3c= 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:in-reply-to:references; bh=8Sh8IoYgJFrnf4eFvxRVA0oiwAdth8iBB9cshhpvsYw=; b=TQdQwKzsceeJe/j/8DrQknPVRh2FuUic2ulRN6mgwTg7mVtGh+4kPrt/61euy9VsRQ LrMnBghxkabs/apwS7o4iiZ45u5KHk545lvQBqjbDML89o3tQDJxgoVNVXnbHcLdJQxd CsaStPqwtVySGt1R5d6Wgo3Z5wt1IwRPLrzZW9bniDgCzKFHhsFXIlFA0XU4SlFVSS45 +bQu6bEOKJkT2rJAh5erAwsUhZ+G19Snk+VjHxQJ8QmEOEIi9BOa2THTD/yxthv5NiJh T7dUH41PPy+P2D0aubzjJqT85T1MQ11WYDWQgcPlQ2joKcGiYaZOqGEczPuTTBOayhW4 8mEA== X-Gm-Message-State: AKGB3mKNDGouQZFymAMowyULoAudhwUSJcck8q9Mi8jTci6Cafs7x4w0 X9UgaXkpv8WcUWGeuF2tTglicQ== X-Received: by 10.159.197.67 with SMTP id d3mr13304056plo.409.1513927816644; Thu, 21 Dec 2017 23:30:16 -0800 (PST) Received: from localhost ([122.172.139.116]) by smtp.gmail.com with ESMTPSA id q69sm42942579pfa.161.2017.12.21.23.30.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Dec 2017 23:30:15 -0800 (PST) From: Viresh Kumar To: ulf.hansson@linaro.org, Kevin Hilman , Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , robh+dt@kernel.org, rnayak@codeaurora.org, sudeep.holla@arm.com, linux-kernel@vger.kernel.org Subject: [PATCH 2/7] PM / OPP: Implement of_dev_pm_opp_find_required_opp() Date: Fri, 22 Dec 2017 12:56:26 +0530 Message-Id: X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A device's DT node or its OPP nodes can contain a phandle to other device's OPP node, in the "required-opp" property. This patch implements a routine to find that required OPP from the node that contains the "required-opp" property. Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 4 +--- drivers/opp/of.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ drivers/opp/opp.h | 1 + include/linux/pm_opp.h | 6 ++++++ 4 files changed, 61 insertions(+), 3 deletions(-) -- 2.15.0.194.g9af6a3dea062 diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 92fa94a6dcc1..bfcad8983fd1 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -33,8 +33,6 @@ LIST_HEAD(opp_tables); /* Lock to allow exclusive modification to the device and opp lists */ DEFINE_MUTEX(opp_table_lock); -static void dev_pm_opp_get(struct dev_pm_opp *opp); - static struct opp_device *_find_opp_dev(const struct device *dev, struct opp_table *opp_table) { @@ -892,7 +890,7 @@ static void _opp_kref_release(struct kref *kref) dev_pm_opp_put_opp_table(opp_table); } -static void dev_pm_opp_get(struct dev_pm_opp *opp) +void dev_pm_opp_get(struct dev_pm_opp *opp) { kref_get(&opp->kref); } diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 22c9bd191f62..2d1bb348ae73 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -665,3 +665,56 @@ int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, return ret; } EXPORT_SYMBOL_GPL(dev_pm_opp_of_get_sharing_cpus); + +/** + * 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-opp" property. + * + * Returns the OPP of the device 'dev', whose phandle is present in the "np" + * node. + * + * 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-opp", 0); + if (unlikely(!required_np)) { + dev_err(dev, "Unable to parse required-opp\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); diff --git a/drivers/opp/opp.h b/drivers/opp/opp.h index 4d00061648a3..b181032e6938 100644 --- a/drivers/opp/opp.h +++ b/drivers/opp/opp.h @@ -187,6 +187,7 @@ struct opp_table { }; /* Routines internal to opp core */ +void dev_pm_opp_get(struct dev_pm_opp *opp); void _get_opp_table_kref(struct opp_table *opp_table); struct opp_table *_find_opp_table(struct device *dev); struct opp_device *_add_opp_dev(const struct device *dev, struct opp_table *opp_table); diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index f042fdeaaa3c..70686f434c13 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -309,6 +309,7 @@ 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); #else static inline int dev_pm_opp_of_add_table(struct device *dev) { @@ -342,6 +343,11 @@ 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; +} #endif #endif /* __LINUX_OPP_H__ */ From patchwork Fri Dec 22 07:26:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 122629 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1908822qgn; Thu, 21 Dec 2017 23:30:32 -0800 (PST) X-Google-Smtp-Source: ACJfBos4AthxNKGnKDa6Ku+a9JdQjcuM7Dt2H0rFTw+f5RGGme2MBO7nifWef8/GcvcFNFgxPVSm X-Received: by 10.99.49.75 with SMTP id x72mr12226019pgx.123.1513927831919; Thu, 21 Dec 2017 23:30:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513927831; cv=none; d=google.com; s=arc-20160816; b=irxbMZLqDqWf/6Brh6z6c5YOywKLUSqTpgaWeAyHnp5+IA+08rzj847UbfvhdAsHEo u2/e/mO5iVTGjgy5s6qBM0naZGa6HyJPCz7mOWSWDF9repbk14a6udJ+9vW7leoVw4za IBkKwoaBQ0GMVY+lvNv1As4FoxKs+VELXAQcfK48/gGGd9fEJCSNy8W9aI79SUXIuSjk t5xaXuvoX49CyQhBKmGZjj2j+LGmd9Z/MMbYGq3UU4SOGogHxIApnwTEh+YRYEI7PQS5 tm4CLS1q0NnlJOKTSCN8NCdFlVv81Gi85/O4hB5P6TmRzC2gG3sTrHqG1EaUvp+NySCw hpGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=zl+NeZIFEqERsvHNx/Vffb2UiLVHPv9RPXU3IpDG0zA=; b=INM+3o1F6rdTYELES3NKPiqsxd7178fTjltwUDlmIQAnu9LjkUMa9X1UH1rF2UPkVL r61JlMlzzwSKClv1pgjv5rgtl1/W5MFVTDSuhoy2Ky8H/nx4OL9FaFqDih+YrS+THcvW 0a8kfAwl2ItlQQWl0K53J5OVL86HkdmZKY72XiA8mhrxZrtlXljrabvqHou2xyXE/DKZ pIdsReLudvwDQvwFdUYy36Zbxz01l2dobrtwETRkxNPiFJwNmGhFz93DvKryvXb6CBrn 3aQCErAWb8TBF1HeeMjJIPonX3/huYQsK9qJIFiZ4LDqdD1Q/W1ufv/lnjXpeYGNUhfp Msgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VuMUGmn/; 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 i187si8044784pgc.532.2017.12.21.23.30.31; Thu, 21 Dec 2017 23:30:31 -0800 (PST) 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=VuMUGmn/; 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 S1755379AbdLVHa2 (ORCPT + 28 others); Fri, 22 Dec 2017 02:30:28 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:44268 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753856AbdLVHaX (ORCPT ); Fri, 22 Dec 2017 02:30:23 -0500 Received: by mail-pg0-f67.google.com with SMTP id j9so14210182pgc.11 for ; Thu, 21 Dec 2017 23:30:23 -0800 (PST) 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 :in-reply-to:references; bh=zl+NeZIFEqERsvHNx/Vffb2UiLVHPv9RPXU3IpDG0zA=; b=VuMUGmn/Uukfy2iRWglTHqivgb5MhaYH1Nm7QFdkg4WdnDCyZejweyfCn6bTjqmbsv TIz393f33gqn3h/n7B9Y8GLqljfWr14akcJLgjT4Jl3lx3pZZHzccniqOBG4tZenv4uF nha+EGczs/LP+Gj04Mv8cctMG1mQyyK04zBEk= 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:in-reply-to:references; bh=zl+NeZIFEqERsvHNx/Vffb2UiLVHPv9RPXU3IpDG0zA=; b=AbFKg4mJGu0Oc1n/h2i67wuMfQw9KRwqrJ7chjyjv+adxax8dw+nXNLSm2pv51CAla +8v+7vMp5R4Yd65YhJCiSVBMQ53jJuRpBEeriqsZmwz5C7tRipi3vTO7YWaY8ed1Qr6I QGChSp0+2y926cmqtWTOUqNU/ATCk1y9utJs8LU0791DrO1Tfe9jQYMHTsKJvXnc4rIu ohA2VP+imk+zApDNdVQGwWd7YrthSP1btBkE04owKCJtOeyPYhDRWWArE7Uy6VkKy/r9 Nh3H0o9XyUh7LPkCxDellEM51VV9z0OIKvsY9uiAheEtfMUy8ZS4VIT4bbkcLltfbuQZ k1Fg== X-Gm-Message-State: AKGB3mJ7KDjUDI6G03shWMsR+R1l4em7g212YKBB52/moftLgHsZLOCz JxP8NmrZmbTApjeQw+lONExX/Q== X-Received: by 10.99.67.195 with SMTP id q186mr12060314pga.163.1513927822859; Thu, 21 Dec 2017 23:30:22 -0800 (PST) Received: from localhost ([122.172.139.116]) by smtp.gmail.com with ESMTPSA id u6sm43969698pfk.126.2017.12.21.23.30.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Dec 2017 23:30:22 -0800 (PST) From: Viresh Kumar To: ulf.hansson@linaro.org, Kevin Hilman , "Rafael J. Wysocki" , Len Brown , Pavel Machek Cc: Viresh Kumar , linux-pm@vger.kernel.org, Stephen Boyd , Nishanth Menon , Vincent Guittot , robh+dt@kernel.org, rnayak@codeaurora.org, sudeep.holla@arm.com, linux-kernel@vger.kernel.org Subject: [PATCH 3/7] PM / Domain: Add struct device to genpd Date: Fri, 22 Dec 2017 12:56:27 +0530 Message-Id: X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The power-domain core would be using the OPP core going forward and the OPP core has the basic requirement of a device structure for its working. Add a struct device to the genpd structure and also add a genpd bus type for the devices. Signed-off-by: Viresh Kumar --- drivers/base/power/domain.c | 37 +++++++++++++++++++++++++++++++++++++ include/linux/pm_domain.h | 1 + 2 files changed, 38 insertions(+) -- 2.15.0.194.g9af6a3dea062 diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 0c80bea05bcb..013c1e206167 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -1630,6 +1630,10 @@ static void genpd_lock_init(struct generic_pm_domain *genpd) } } +static struct bus_type genpd_bus_type = { + .name = "genpd", +}; + /** * pm_genpd_init - Initialize a generic I/O PM domain object. * @genpd: PM domain object to initialize. @@ -1687,6 +1691,18 @@ int pm_genpd_init(struct generic_pm_domain *genpd, return ret; } + genpd->dev.bus = &genpd_bus_type; + device_initialize(&genpd->dev); + dev_set_name(&genpd->dev, "%s", genpd->name); + + ret = device_add(&genpd->dev); + if (ret) { + dev_err(&genpd->dev, "failed to add device: %d\n", ret); + put_device(&genpd->dev); + kfree(genpd->free); + return ret; + } + mutex_lock(&gpd_list_lock); list_add(&genpd->gpd_list_node, &gpd_list); mutex_unlock(&gpd_list_lock); @@ -1724,6 +1740,7 @@ static int genpd_remove(struct generic_pm_domain *genpd) list_del(&genpd->gpd_list_node); genpd_unlock(genpd); + device_del(&genpd->dev); cancel_work_sync(&genpd->power_off_work); kfree(genpd->free); pr_debug("%s: removed %s\n", __func__, genpd->name); @@ -1888,6 +1905,7 @@ int of_genpd_add_provider_simple(struct device_node *np, if (!ret) { genpd->provider = &np->fwnode; genpd->has_provider = true; + genpd->dev.of_node = np; } } @@ -1924,6 +1942,7 @@ int of_genpd_add_provider_onecell(struct device_node *np, data->domains[i]->provider = &np->fwnode; data->domains[i]->has_provider = true; + data->domains[i]->dev.of_node = np; } ret = genpd_add_provider(np, data->xlate, data); @@ -2691,3 +2710,21 @@ static void __exit genpd_debug_exit(void) } __exitcall(genpd_debug_exit); #endif /* CONFIG_DEBUG_FS */ + +static int __init pm_genpd_core_init(void) +{ + int ret; + + ret = bus_register(&genpd_bus_type); + if (ret) + pr_err("bus_register failed (%d)\n", ret); + + return ret; +} +pure_initcall(pm_genpd_core_init); + +static void __exit pm_genpd_core_exit(void) +{ + bus_unregister(&genpd_bus_type); +} +__exitcall(pm_genpd_core_exit); diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index 04dbef9847d3..aaacaa35005d 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -49,6 +49,7 @@ struct genpd_power_state { struct genpd_lock_ops; struct generic_pm_domain { + struct device dev; struct dev_pm_domain domain; /* PM domain operations */ struct list_head gpd_list_node; /* Node in the global PM domains list */ struct list_head master_links; /* Links with PM domain as a master */ From patchwork Fri Dec 22 07:26:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 122631 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1909153qgn; Thu, 21 Dec 2017 23:30:55 -0800 (PST) X-Google-Smtp-Source: ACJfBouQNfC9O/8HNooohl+l1cJvE0RCKkMkKFhEh22KKFLOzYJlzyEY6fNaARPKIFkMDx2jCq7n X-Received: by 10.98.247.16 with SMTP id h16mr13225480pfi.242.1513927854978; Thu, 21 Dec 2017 23:30:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513927854; cv=none; d=google.com; s=arc-20160816; b=0p0L6b0T6q0LZQqtkaMfXvD7Qc7TEUrmBrW5h7zqHOkn7l1kYllbPnLHln6khEwljT wz+uU3kUFW+Pf8ewxZob2Yu0v/RJ4e34gxKl3cTK+8Ajh8S5QHtxFmMSo6BPlXZAWBxi yjhgTaVN3VxP3uuvxkRtB+jpmQkBpxOYer/6H7dn+SbPJZMqW9Bg3idxuhta6zV1BsuJ HLISqo2LhgJUkq1CaQagL7jdfP9S2/5/4Jfuua3/o+0BqcymlrKjhF4nQ9ClOCJ9cY0a 7cE4Yjmp8xj84bPNg4MPSi9i/DgOB6Ia7et4v/IAuezTUZZ2tCMQiNd0kvFVDevNo/Z1 xhvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=ExC73asIywp2Liwd6U/tX41Ktc+XpKrNEqPs2xq3pJc=; b=IkRWjrZj/O259sITURLatkZnTQDOlTut0VVyfEfXY694Jir1RP7hAXjzmL+1W8v8q7 Cutp8AS5FG7FgLOtmFlhVhfsFgGmhCki8mBSTOGOv6QGNE7PEN53gGucVlfv46AxMdfr 9Krb15Fo7LLhZth8TC/xd2QUuIA/OaZID7PQlOlJXmtsivm8hr9i7TTkMDEuKYjqzuR5 jTmOZ9HFvzC8ojP1u7irBGOP2TYyXvtsnEVSYLDKDesswb0sCw/WhXaBZe42LisW8kgS DtZDxmJbkp3A2oaaNxD4LTIYqM0O/k5lZOiPCXHqFkgTtO2M+iPdITVBPgHhPZOEc5Z8 G4ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FKWbUSn6; 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 e91si16288349plb.28.2017.12.21.23.30.54; Thu, 21 Dec 2017 23:30:54 -0800 (PST) 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=FKWbUSn6; 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 S1752198AbdLVHav (ORCPT + 28 others); Fri, 22 Dec 2017 02:30:51 -0500 Received: from mail-pl0-f66.google.com ([209.85.160.66]:32952 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755757AbdLVHaq (ORCPT ); Fri, 22 Dec 2017 02:30:46 -0500 Received: by mail-pl0-f66.google.com with SMTP id 1so11022259plv.0 for ; Thu, 21 Dec 2017 23:30:46 -0800 (PST) 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 :in-reply-to:references; bh=ExC73asIywp2Liwd6U/tX41Ktc+XpKrNEqPs2xq3pJc=; b=FKWbUSn6+vvf9ZlQxhbLYmtNsVhNWRO/PESu2kzP6oz/2Z8FzDuGhYKzVxrl8uJPb+ OCwu4jV5LYyN0cTUnxy2xSqk0wK17B3MhObh71mL+f+3t3GGPl1E8YdQuL/IwSQwLNYi nsR1ZOm0m9BChkQGWoq2WIo9BvJrhSXR4gsY8= 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:in-reply-to:references; bh=ExC73asIywp2Liwd6U/tX41Ktc+XpKrNEqPs2xq3pJc=; b=IS0JxM7er7k8XB6TPyU0cLLPVQOj/BpU/rz/jekTjQdlUF/l7ryLcrFZC9WGFwzFgO CwerSS+4P+/W4FKj/3NX5OMHlbxQfoINnQQwJx5e8gg33wkr45RqZTuF+x1tlkrrQkEE 6/YVqf/Fm/89p0/gp6C2IZcwLzol6o63TepW9ZLL0AwT2bVLp6cqmaJ7iFVv+Gt3mzGO Gtr3jK37SU6MKJdgxlwO2jDF3RzsOmYv17X76L4MSwNbAOfqlYxupMrhUrq+PTsogyxj 0fqNItJllWpqXHoSwdx8G81M8VSPONvUHpvqub2NZeWxJz5KRQg3dbO9jHTpPe2j6Q1W P3QA== X-Gm-Message-State: AKGB3mIH+JMKKf7rorlyc/pPQHgAMNFxis+u5lYR+n4HKjczFB1L90r1 PnU4voa/ek0Dt4lor2HSTix8XQ== X-Received: by 10.84.217.131 with SMTP id p3mr13579747pli.270.1513927846049; Thu, 21 Dec 2017 23:30:46 -0800 (PST) Received: from localhost ([122.172.139.116]) by smtp.gmail.com with ESMTPSA id o70sm44031027pfk.79.2017.12.21.23.30.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Dec 2017 23:30:45 -0800 (PST) From: Viresh Kumar To: ulf.hansson@linaro.org, Kevin Hilman , "Rafael J. Wysocki" , Len Brown , Pavel Machek Cc: Viresh Kumar , linux-pm@vger.kernel.org, Stephen Boyd , Nishanth Menon , Vincent Guittot , robh+dt@kernel.org, rnayak@codeaurora.org, sudeep.holla@arm.com, linux-kernel@vger.kernel.org Subject: [PATCH 5/7] PM / Domain: Implement of_dev_pm_genpd_get_performance_state() Date: Fri, 22 Dec 2017 12:56:29 +0530 Message-Id: <755aabf2ad16d3a2131483407d7f580431571a00.1513926033.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This implements of_dev_pm_genpd_get_performance_state() which can be used from the device drivers or the OPP core to find the performance state encoded in the "required-opp" property of a node. Different platforms may encode the performance state differently using the OPP table (they may simply return value of opp-hz or opp-microvolt, or apply some algorithm on top of those values) and so a new callback is implemented to allow platform specific drivers to convert the power domain OPP to a performance state. Signed-off-by: Viresh Kumar --- drivers/base/power/domain.c | 48 +++++++++++++++++++++++++++++++++++++++++++++ include/linux/pm_domain.h | 11 +++++++++++ 2 files changed, 59 insertions(+) -- 2.15.0.194.g9af6a3dea062 diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 1ad4ad0b0de0..ef43b75982fa 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2415,6 +2415,54 @@ int of_genpd_parse_idle_states(struct device_node *dn, } EXPORT_SYMBOL_GPL(of_genpd_parse_idle_states); +/** + * of_dev_pm_genpd_get_performance_state- Gets performance state of device's + * power domain corresponding to a DT node's "required-opp" property. + * + * @dev: Device for which the performance-state needs to be found. + * @np: DT node where the "required-opp" 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). + * @state: Pointer to return performance state. + * + * Returns performance state corresponding to the "required-opp" property of + * a DT node. This calls platform specific genpd->get_performance_state() + * callback to translate power domain OPP to performance state. + * + * Returns performance state on success and 0 on failure. + */ +unsigned int of_dev_pm_genpd_get_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)) { + state = PTR_ERR(opp); + goto unlock; + } + + state = genpd->get_performance_state(genpd, opp); + dev_pm_opp_put(opp); + +unlock: + genpd_unlock(genpd); + + return state; +} +EXPORT_SYMBOL_GPL(of_dev_pm_genpd_get_performance_state); + #endif /* CONFIG_PM_GENERIC_DOMAINS_OF */ diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index aaacaa35005d..4edbdaa54cec 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -47,6 +47,7 @@ struct genpd_power_state { }; struct genpd_lock_ops; +struct dev_pm_opp; struct generic_pm_domain { struct device dev; @@ -68,6 +69,8 @@ struct generic_pm_domain { unsigned int performance_state; /* Aggregated max performance state */ int (*power_off)(struct generic_pm_domain *domain); int (*power_on)(struct generic_pm_domain *domain); + unsigned int (*get_performance_state)(struct generic_pm_domain *genpd, + struct dev_pm_opp *opp); int (*set_performance_state)(struct generic_pm_domain *genpd, unsigned int state); struct gpd_dev_ops dev_ops; @@ -244,6 +247,8 @@ extern int of_genpd_add_subdomain(struct of_phandle_args *parent, extern struct generic_pm_domain *of_genpd_remove_last(struct device_node *np); extern int of_genpd_parse_idle_states(struct device_node *dn, struct genpd_power_state **states, int *n); +extern unsigned int of_dev_pm_genpd_get_performance_state(struct device *dev, + struct device_node *np); int genpd_dev_pm_attach(struct device *dev); #else /* !CONFIG_PM_GENERIC_DOMAINS_OF */ @@ -279,6 +284,12 @@ static inline int of_genpd_parse_idle_states(struct device_node *dn, return -ENODEV; } +static inline unsigned int of_dev_pm_genpd_get_performance_state(struct device *dev, + struct device_node *np) +{ + return -ENODEV; +} + static inline int genpd_dev_pm_attach(struct device *dev) { return -ENODEV; From patchwork Fri Dec 22 07:26:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 122632 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1909256qgn; Thu, 21 Dec 2017 23:31:02 -0800 (PST) X-Google-Smtp-Source: ACJfBot7WWIGombv3J+Bj/goSnMWPRF5t9tS1Uvx/zYrDpjIB42cNrH05fEdIF2q6JfO1q2UO+Fx X-Received: by 10.99.3.9 with SMTP id 9mr11822205pgd.10.1513927862227; Thu, 21 Dec 2017 23:31:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513927862; cv=none; d=google.com; s=arc-20160816; b=ZCGfgmvEjm3WprykAIe+MzoK/hncjVKoG2Bg7gCEhhaTkjYyhOvAoVQ4kEjCHVs/3x Q/2fZSwbccJGHhAyAKPjFYK1LKIAOs93wbaJozDptxFDH21pVnuw7CvSv/0dPod/Xry4 90c/Kj+oVfFXCCJiEYLeYnxT+cjrE3iE4454kxIyRHEUri215zyHA2kW4AfmWq82se3q gaOSW6h8xhyMI3PCIkRl7u5eSq44ONHVhxFqfqx1XxBvDciZq9CGmtwGURsUL050ZDD4 bxuiHw5Qzenim5/6WzgkZ05rtuyApZhYqVolfOcz4hMo0CMQHY22GZFKv8FMKZTVdpvZ ay9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=4Z6/NG1kC9DAbVHgekL+MiFyHMChJedsVTshilvGh0I=; b=xisBNEshUQZmCLyzHrrIcUPfO9+o4Gez2uTPlzjDKa4i6W/UYmwdvNvu1EZ/vEa7J2 Q+CasNxGxz4ZVwhF5MH2fYTHO5ukl6ufJG6Gn2EDXRLZWkqF2NiVn+xW1ZJ+LikXtJBS oZiOKPGKgwnybeSc06/3zH4p7D4LJofxxkfypDypF2TnQ9adqiqOKofpZ5iNUseUyaiY uq47aqyqDIkoGm4EgKSpvwFI125cF6OBsVK/eA1DWAXR6HPHxiTVgP90CTMKn8S+08ot Y9xRgoe0WjtrXAI7mD0PUEgLwF7P2ChaKDdOZOWTjS54xc5hpp6nMmK09f84YmY9gIco mvBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gLwKFvGV; 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 g9si14699661pgr.775.2017.12.21.23.31.01; Thu, 21 Dec 2017 23:31:02 -0800 (PST) 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=gLwKFvGV; 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 S1755928AbdLVHa6 (ORCPT + 28 others); Fri, 22 Dec 2017 02:30:58 -0500 Received: from mail-pl0-f68.google.com ([209.85.160.68]:42050 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755862AbdLVHaw (ORCPT ); Fri, 22 Dec 2017 02:30:52 -0500 Received: by mail-pl0-f68.google.com with SMTP id bd8so12474506plb.9 for ; Thu, 21 Dec 2017 23:30:51 -0800 (PST) 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 :in-reply-to:references; bh=4Z6/NG1kC9DAbVHgekL+MiFyHMChJedsVTshilvGh0I=; b=gLwKFvGVHIu14Wq73qS0ZbdAJjxXAfN5bACBzgR2sCAjldcRasQ2KYvn2xzughR/rZ uzYbYvKsdcvOK2imgEjh0cN5UkBdirp8goqtUoMPojKc1ygScYDuiq7ANvF3rpNGYZwf DsKAX7WHmrHhm02zvDVzZDqEe7P9kp4i16zoo= 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:in-reply-to:references; bh=4Z6/NG1kC9DAbVHgekL+MiFyHMChJedsVTshilvGh0I=; b=fpA6cnr6AEGbECWNYJCNN7K3fBjpLS8gj1lJsYOxx0IOm0xwyUIkihPE9xNGITVxPe eAGdjj8SR8e4HoVjQHuzMltSroz7HrD82ssuT0DBy3+GKV7jLVdGDUjiqpJIKmhfbBzA Mi/tid/EI7jtMs5FkoFYHB8hlHtiGkzi3eIOY7NBULp5pPaxDnGSLGM46CWBKhGIaNmp uhMQjZ45FkxN7XKJ923J5vNstUAOMEwO853U8zeFPdqPpahqmS+jrdHZRISJzGpv53Gy CYLBDnsX32v9wYFuCa59Jgm+cr6tMu5bsjXNP7KalEgm5CWuw4cXh+bsM4jKqP2mKCfu 0NBg== X-Gm-Message-State: AKGB3mKW7GlGMpgDCo9VR8Q8lOQu5SbvfspdEThbOKo2UptjW4lp03EF 15wzSs3NaPrggTBpbBGJ3aXJFg== X-Received: by 10.84.195.36 with SMTP id i33mr13502575pld.189.1513927851512; Thu, 21 Dec 2017 23:30:51 -0800 (PST) Received: from localhost ([122.172.139.116]) by smtp.gmail.com with ESMTPSA id k14sm23172599pgt.48.2017.12.21.23.30.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Dec 2017 23:30:50 -0800 (PST) From: Viresh Kumar To: ulf.hansson@linaro.org, Kevin Hilman , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , Rafael Wysocki , linux-pm@vger.kernel.org, Vincent Guittot , robh+dt@kernel.org, rnayak@codeaurora.org, sudeep.holla@arm.com, linux-kernel@vger.kernel.org Subject: [PATCH 6/7] PM / OPP: Get performance state using genpd helper Date: Fri, 22 Dec 2017 12:56:30 +0530 Message-Id: X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The genpd core provides an API now to retrieve the performance state from DT, use that instead of the ->get_pstate() callback. Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 3 --- drivers/opp/of.c | 20 +++++++++++++++++++- 2 files changed, 19 insertions(+), 4 deletions(-) -- 2.15.0.194.g9af6a3dea062 Reviewed-by: Ulf Hansson diff --git a/drivers/opp/core.c b/drivers/opp/core.c index bfcad8983fd1..6194219fb95f 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1034,9 +1034,6 @@ int _opp_add(struct device *dev, struct dev_pm_opp *new_opp, return ret; } - if (opp_table->get_pstate) - new_opp->pstate = opp_table->get_pstate(dev, new_opp->rate); - list_add(&new_opp->node, head); mutex_unlock(&opp_table->lock); diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 2d1bb348ae73..21265af55117 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -321,6 +322,8 @@ static int _opp_add_static_v2(struct opp_table *opp_table, struct device *dev, if (!of_property_read_u32(np, "clock-latency-ns", &val)) new_opp->clock_latency_ns = val; + new_opp->pstate = of_dev_pm_genpd_get_performance_state(dev, np); + ret = opp_parse_supplies(new_opp, dev, opp_table); if (ret) goto free_opp; @@ -371,7 +374,8 @@ static int _of_add_opp_table_v2(struct device *dev, struct device_node *opp_np) { struct device_node *np; struct opp_table *opp_table; - int ret = 0, count = 0; + int ret = 0, count = 0, pstate_count = 0; + struct dev_pm_opp *opp; opp_table = _managed_opp(opp_np); if (opp_table) { @@ -405,6 +409,20 @@ static int _of_add_opp_table_v2(struct device *dev, struct device_node *opp_np) goto put_opp_table; } + list_for_each_entry(opp, &opp_table->opp_list, node) + pstate_count += !!opp->pstate; + + /* Either all or none of the nodes shall have performance state set */ + if (pstate_count && pstate_count != count) { + dev_err(dev, "Not all nodes have performance state set (%d: %d)\n", + count, pstate_count); + ret = -ENOENT; + goto put_opp_table; + } + + if (pstate_count) + opp_table->genpd_performance_state = true; + opp_table->np = opp_np; if (of_property_read_bool(opp_np, "opp-shared")) opp_table->shared_opp = OPP_TABLE_ACCESS_SHARED; From patchwork Fri Dec 22 07:26:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 122633 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1909513qgn; Thu, 21 Dec 2017 23:31:17 -0800 (PST) X-Google-Smtp-Source: ACJfBouoax7AVCpVpVnsuyXVSMYyfle/zAAN0NIGaHmBdFWRpVU74Ph8EmdJa1QhyfZOgb0UWL8y X-Received: by 10.99.186.70 with SMTP id l6mr11989310pgu.443.1513927876878; Thu, 21 Dec 2017 23:31:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513927876; cv=none; d=google.com; s=arc-20160816; b=ohTrwu63UzhCCrgY3W4EI+RCMX+PHkLzFGNudDCBGsDUP1i9P/srOnhT0ZiWiIsZxc +O9hU8FkQqF23A8utJT2Ux25gErCY5VXjhVmY9Xe05tO14sC9jcGh0T40bSlbqUaxdZK wRQoFJFGR3XGjos0oJaLWQL5H+7tjFFtjn3Ky9Su3zWO1lKFN43b70d+Zbt2gp5AS4Oc 6D7PocUFzytUAjbigi/kpIG1DvzYkznuzc7fsP17C3LG8UzoFKSwzZLMgXjuPxS075pQ JfAiNTdLGT6++ka3APV2iXJYawpsymPHMpiHE6xwO/ia9uTHGft0Yn44ZViZeljy3YRP Jn1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=Eeen5grZjp9buKGoXBTmE6S8FibVf2W0pHK9I2THLvE=; b=iIDps5GVuAJITXVlqcUXwpf1WkEwQgOjOkFjnkT8a5BUXP3rqto60T2JvmdmudJaaN q6UiSCneAIaYNc4s3n/5YReFWc0SsKMq0l0DhuumsRkEMNDe1gL0STdOMnoB1d4ZwiM6 prG8/ySRzCXjNCGzlI2lBIM4jzKHSLgkwLHZSADS5Seg40POp8UZ/uSWxEs3LqIgpwn8 PVd5f1M9nyJe7NWK3TUvXjw4MAaw7q9M5pHcJYLY+VRK8cCBPvJvjNibOfIBSa6+2ecg +hZtvFzPcaHSLSw/dXBafK7ovpPJAtj88l9HQDrG3prYBqqVegQnoSfbRcZtQAATg2Xm JFOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VeDyGRR1; 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 l5si14888688pgs.496.2017.12.21.23.31.16; Thu, 21 Dec 2017 23:31:16 -0800 (PST) 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=VeDyGRR1; 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 S1755982AbdLVHbN (ORCPT + 28 others); Fri, 22 Dec 2017 02:31:13 -0500 Received: from mail-pl0-f65.google.com ([209.85.160.65]:41494 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755876AbdLVHaz (ORCPT ); Fri, 22 Dec 2017 02:30:55 -0500 Received: by mail-pl0-f65.google.com with SMTP id g2so12479655pli.8 for ; Thu, 21 Dec 2017 23:30:55 -0800 (PST) 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 :in-reply-to:references; bh=Eeen5grZjp9buKGoXBTmE6S8FibVf2W0pHK9I2THLvE=; b=VeDyGRR1gSrwhEdST29Fs3hYVLl/6HeuDUXig87zFZR2Z4vev3zgxjxElV8nDEGX9b EqTDlmJRLP1pBejwHQj2Qnb13RPdNuD1cMrizNeZItZHn3IjPgHzvtLggg0ClbmYYa8Q kbDT70VhHUld08Int+NJ/8qbM6l3JZCLIjCBg= 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:in-reply-to:references; bh=Eeen5grZjp9buKGoXBTmE6S8FibVf2W0pHK9I2THLvE=; b=HX8KvTkZWoYyQQ97kJICRLMYUiPADDuHwClXlm+SlvvmlDPjt1FpmewlvTdLlilfOb qNXLEiomUx8Nok0H2s+2dh6g4yTaeEvw2FGaSL+AtTuPZkhDTKa3FC4kjA7p+teluVkP DufsWcILXv8D9BE7hh10MPpXo1b64/5nToolXLC1BqLV+YZzjGnISDXwKRugdO/ILYII 7PD5NxIMcrDFyHwH+IG0e26LYbd3eEC7KSxHT1zTl1UU2AZxjEQPQRNhZ2tZT9jc7yZe Cv3So6w9rzI8GoUPYOEl0+z4YRQ4di6/nF4vnOwKQDn4xO6q9FS6oVxd3wvtRLbNXW5W 9otg== X-Gm-Message-State: AKGB3mK08hZshtaZn+gZa0UkckMKX5wsgOblqsc0v+M8g1j34OP1oBIE SiTuzLU5aguNm3dNO03SZARIVzwDKns= X-Received: by 10.84.231.1 with SMTP id f1mr13371527plk.352.1513927854680; Thu, 21 Dec 2017 23:30:54 -0800 (PST) Received: from localhost ([122.172.139.116]) by smtp.gmail.com with ESMTPSA id 69sm44016199pft.11.2017.12.21.23.30.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Dec 2017 23:30:54 -0800 (PST) From: Viresh Kumar To: ulf.hansson@linaro.org, Kevin Hilman , Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , robh+dt@kernel.org, rnayak@codeaurora.org, sudeep.holla@arm.com, linux-kernel@vger.kernel.org Subject: [PATCH 7/7] PM / OPP: Remove dev_pm_opp_{un}register_get_pstate_helper() Date: Fri, 22 Dec 2017 12:56:31 +0530 Message-Id: <46a62463d9a0a04648672d5cd3a9803ad99bd36b.1513926033.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org These helpers aren't used anymore, remove them. Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 75 -------------------------------------------------- drivers/opp/opp.h | 2 -- include/linux/pm_opp.h | 10 ------- 3 files changed, 87 deletions(-) -- 2.15.0.194.g9af6a3dea062 diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 6194219fb95f..9e3c40437991 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1545,81 +1545,6 @@ 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_register_get_pstate_helper() - Register get_pstate() helper. - * @dev: Device for which the helper is getting registered. - * @get_pstate: Helper. - * - * TODO: Remove this callback after the same information is available via Device - * Tree. - * - * This allows a platform to initialize the performance states of individual - * OPPs for its devices, until we get similar information directly from DT. - * - * This must be called before the OPPs are initialized for the device. - */ -struct opp_table *dev_pm_opp_register_get_pstate_helper(struct device *dev, - int (*get_pstate)(struct device *dev, unsigned long rate)) -{ - struct opp_table *opp_table; - int ret; - - if (!get_pstate) - return ERR_PTR(-EINVAL); - - opp_table = dev_pm_opp_get_opp_table(dev); - if (!opp_table) - return ERR_PTR(-ENOMEM); - - /* This should be called before OPPs are initialized */ - if (WARN_ON(!list_empty(&opp_table->opp_list))) { - ret = -EBUSY; - goto err; - } - - /* Already have genpd_performance_state set */ - if (WARN_ON(opp_table->genpd_performance_state)) { - ret = -EBUSY; - goto err; - } - - opp_table->genpd_performance_state = true; - opp_table->get_pstate = get_pstate; - - return opp_table; - -err: - dev_pm_opp_put_opp_table(opp_table); - - return ERR_PTR(ret); -} -EXPORT_SYMBOL_GPL(dev_pm_opp_register_get_pstate_helper); - -/** - * dev_pm_opp_unregister_get_pstate_helper() - Releases resources blocked for - * get_pstate() helper - * @opp_table: OPP table returned from dev_pm_opp_register_get_pstate_helper(). - * - * Release resources blocked for platform specific get_pstate() helper. - */ -void dev_pm_opp_unregister_get_pstate_helper(struct opp_table *opp_table) -{ - if (!opp_table->genpd_performance_state) { - pr_err("%s: Doesn't have performance states set\n", - __func__); - return; - } - - /* Make sure there are no concurrent readers while updating opp_table */ - WARN_ON(!list_empty(&opp_table->opp_list)); - - opp_table->genpd_performance_state = false; - opp_table->get_pstate = NULL; - - dev_pm_opp_put_opp_table(opp_table); -} -EXPORT_SYMBOL_GPL(dev_pm_opp_unregister_get_pstate_helper); - /** * 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/opp.h b/drivers/opp/opp.h index b181032e6938..ae99295b5382 100644 --- a/drivers/opp/opp.h +++ b/drivers/opp/opp.h @@ -140,7 +140,6 @@ enum opp_table_access { * @genpd_performance_state: Device's power domain support performance state. * @set_opp: Platform specific set_opp callback * @set_opp_data: Data to be passed to set_opp callback - * @get_pstate: Platform specific get_pstate callback * @dentry: debugfs dentry pointer of the real device directory (not links). * @dentry_name: Name of the real dentry. * @@ -178,7 +177,6 @@ struct opp_table { int (*set_opp)(struct dev_pm_set_opp_data *data); struct dev_pm_set_opp_data *set_opp_data; - int (*get_pstate)(struct device *dev, unsigned long rate); #ifdef CONFIG_DEBUG_FS struct dentry *dentry; diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 70686f434c13..528a7d9cf2ef 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -125,8 +125,6 @@ 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_register_get_pstate_helper(struct device *dev, int (*get_pstate)(struct device *dev, unsigned long rate)); -void dev_pm_opp_unregister_get_pstate_helper(struct opp_table *opp_table); 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); @@ -247,14 +245,6 @@ static inline struct opp_table *dev_pm_opp_register_set_opp_helper(struct device static inline void dev_pm_opp_unregister_set_opp_helper(struct opp_table *opp_table) {} -static inline struct opp_table *dev_pm_opp_register_get_pstate_helper(struct device *dev, - int (*get_pstate)(struct device *dev, unsigned long rate)) -{ - return ERR_PTR(-ENOTSUPP); -} - -static inline void dev_pm_opp_unregister_get_pstate_helper(struct opp_table *opp_table) {} - static inline struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, const char *name) { return ERR_PTR(-ENOTSUPP);