From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B273C43334 for ; Fri, 1 Jul 2022 08:20:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236173AbiGAIUz (ORCPT ); Fri, 1 Jul 2022 04:20:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233082AbiGAIUt (ORCPT ); Fri, 1 Jul 2022 04:20:49 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B82D70AF7 for ; Fri, 1 Jul 2022 01:20:47 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id x4so1795447pfq.2 for ; Fri, 01 Jul 2022 01:20: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=WfE4CypbYijTDGyXwa2amCPLxG9OKV5lx3ftdIcweMc=; b=gIi+0f/OZ7Q4mL+LlGusDtcoH6RxVYkUMUCHAIMeisFQDkyy7OwTU0tgU81l1n1jj9 VgVY28MjNCBU1LyjLYHj9GagCLrnjG5N/sc79X3W3bTpO7pLLExU7sVOqRQrqZjcIyOg 7eQ5EteEuM3RjKe0oHieqwn03wPtDW7ZwjPynIDdbCM5zNrYaz8NFaHnhUh+9E5xGzah XyqNTVPh/YO1Z04Yjh23qbs2G7GuW6bd3eKvuE7dNztaoh/T0C/1ZTOCGjZf4nIxpkDT vEv4yi3dp9QdzuH8Lk3+wdB+fm4fXfEBI7mwyYla5r3TapH8hoFqFfre/KQWRkUF2to/ OaVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WfE4CypbYijTDGyXwa2amCPLxG9OKV5lx3ftdIcweMc=; b=uG1WUBFr/Ob6MOGJ4yt+uxkBjH0cVV0ExO+HBFNggtW5eojZT8p3CH1jJMRVl+CJPF Vz61y+ajd75XwL3PANE3SGhq0v8Z4e8z6fcKLWmjE1Im5XSVReHNrnZHKWkg0gyK0E6O zCgu/N8atIKt9yY/fWu8HjKWHEJgIsBjHH1HU7kKh2fU05YCTF7IavWi/D7U+WkVmQXv DWb0yfRdF8beapIJ3dq65LzxVU82X7XmARWNmFvkKSLQk8hKm7aUHTvKVq0Ya31SHZYs ozhhUFZR9c1y3ps3NFbkpF2GCPMg1g8KR1IVGIb3Czmoh7eoCpV9EU1l1hl7p5w142HG bnWg== X-Gm-Message-State: AJIora/X+XL+muEpYA7V0fwVByPjPSEDDN6/RyDbA2Ri40VpSt27UqRc V8m7znG6xoH+RlcvEQ+L05xXtA== X-Google-Smtp-Source: AGRyM1swGiO0ewfIye+zPiLRXSr7kFVxOMCJ3AM/MC5SFIE8HwCt/zs/q/NtUvv6NTDnFE0TocWqvQ== X-Received: by 2002:a63:560b:0:b0:411:3ecb:ae86 with SMTP id k11-20020a63560b000000b004113ecbae86mr11575208pgb.434.1656663647226; Fri, 01 Jul 2022 01:20:47 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id n17-20020a170903405100b0016a25ba1f46sm14629217pla.256.2022.07.01.01.20.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:20:46 -0700 (PDT) From: Viresh Kumar To: Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org Subject: [PATCH V2 01/30] OPP: Track if clock name is configured by platform Date: Fri, 1 Jul 2022 13:49:56 +0530 Message-Id: <0a43452bb6b1f499b695b123e9fedf4b1a9bbf64.1656660185.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Track if the clock name is configured by the platform or not. This is a preparatory change and will be used by later commits. This also makes the behavior of the clkname API similar to other ones, which allow repeated calls to the same API for each CPU. Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 7 +++++++ drivers/opp/opp.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index b2715950e76d..e166bfe5fc90 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -2277,6 +2277,10 @@ struct opp_table *dev_pm_opp_set_clkname(struct devi= ce *dev, const char *name) goto err; } =20 + /* Another CPU that shares the OPP table has set the clkname ? */ + if (opp_table->clk_configured) + return opp_table; + /* clk shouldn't be initialized at this point */ if (WARN_ON(opp_table->clk)) { ret =3D -EBUSY; @@ -2291,6 +2295,8 @@ struct opp_table *dev_pm_opp_set_clkname(struct devic= e *dev, const char *name) goto err; } =20 + opp_table->clk_configured =3D true; + return opp_table; =20 err: @@ -2311,6 +2317,7 @@ void dev_pm_opp_put_clkname(struct opp_table *opp_tab= le) =20 clk_put(opp_table->clk); opp_table->clk =3D ERR_PTR(-EINVAL); + opp_table->clk_configured =3D false; =20 dev_pm_opp_put_opp_table(opp_table); } diff --git a/drivers/opp/opp.h b/drivers/opp/opp.h index 45e3a55239a1..9e1cfcb0ea98 100644 --- a/drivers/opp/opp.h +++ b/drivers/opp/opp.h @@ -149,6 +149,7 @@ enum opp_table_access { * @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. + * @clk_configured: Clock name is configured by the platform. * @clk: Device's clock handle * @regulators: Supply regulators * @regulator_count: Number of power supply regulators. Its value can be -1 @@ -200,6 +201,7 @@ struct opp_table { unsigned int *supported_hw; unsigned int supported_hw_count; const char *prop_name; + bool clk_configured; struct clk *clk; struct regulator **regulators; int regulator_count; --=20 2.31.1.272.g89b43f80a514 From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6201AC433EF for ; Fri, 1 Jul 2022 08:21:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233082AbiGAIVC (ORCPT ); Fri, 1 Jul 2022 04:21:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235789AbiGAIUw (ORCPT ); Fri, 1 Jul 2022 04:20:52 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4B4070AF7 for ; Fri, 1 Jul 2022 01:20:50 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id c6-20020a17090abf0600b001eee794a478so5727739pjs.1 for ; Fri, 01 Jul 2022 01:20: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=Rd2Uisd5Y4W/VJAGdhobqO4GQLVcYGgmZc11srtGLLA=; b=WkpdupNLmmTJbNdi75+tw8qqz16nkcR7kXI60KBWPn45KSRjpCbo+EstSlYMyePbJC ZwK73GCR5WxIhjrHsulCMclv5IUWnMR1/esv5YEq8U8vSS3B+Yho6OhZZydHoEqqDXzq 8fIoGc2smB/PRHLugv8g9P/vBm63HXswfopg7ZULXlVRjwdXMNSvUMi/1d7YYVjHcU3k pzhzYZxnYzNNbQ1u2G6PFtJrH9uM6l0hZuoyszwa/VaQ7RphpMapjZcXMX+P8rm6SGe3 LY2yhxFOoy3tNidO1Ojh3x5a02mTQwmx1ig1UApWe60yKvfmGm22H44WyM1NnwcXh5uD cbhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Rd2Uisd5Y4W/VJAGdhobqO4GQLVcYGgmZc11srtGLLA=; b=vn9QG9Xs9oM9i2FRi2v2IGgEygO0WnLf/GGUtd0Wk7F0HniWcyEZxLhf30XABSYDDw AynDuQBbVEdreuq93ISx+sWbndzoAPRyRjr7wVb62d+UZoD5kpol4O61bTb4j5EVSWeE dDrVV0VdjKu6NTuuEOAmW1jz6Qpymn6kiwKyGeM7h2BY8YjgdABSmVnvTbqPSpYeJHgr fS5ULFDW7rs08kRrMOQzptAYM0ljCCCTSJd8RUxUzCLLDA4gV5R5W5A+JfWqsq53TPAG EZqe2QL1FfeOEUElxg5COZoA2/HQCGPckjIlCLJR0HY8HZ9y01/y5o729V5y3q5VVWvx 54tQ== X-Gm-Message-State: AJIora99UsJl6YCj01idFigfKzXYUaSykmNtvxRWa37/DkDJoakTsP5L azDhd0CwLnZn0eIdZlIHVK+yHg== X-Google-Smtp-Source: AGRyM1uPQeSi/N29UBRniR+zsVejTf6T7LB6AVWdO2jFxrIu8vQA6gQ2aLgxKWsu4uYIdoGIIWwu0Q== X-Received: by 2002:a17:902:ec85:b0:16a:1d00:4ef6 with SMTP id x5-20020a170902ec8500b0016a1d004ef6mr19294082plg.62.1656663650372; Fri, 01 Jul 2022 01:20:50 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id w2-20020a1709029a8200b001634d581adfsm14765758plp.157.2022.07.01.01.20.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:20:50 -0700 (PDT) From: Viresh Kumar To: Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Dmitry Osipenko , linux-kernel@vger.kernel.org Subject: [PATCH V2 02/30] OPP: Add dev_pm_opp_set_config() and friends Date: Fri, 1 Jul 2022 13:49:57 +0530 Message-Id: <1ac36a9ad618ed182d7584bb04d1e834720a3fea.1656660185.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The OPP core already have few configuration specific APIs and it is getting complex or messy for both the OPP core and its users. Lets introduce a new set of API which will be used for all kind of different configurations, and shall eventually replace all the existing ones. The new API, returns a unique token instead of a pointer to the OPP table, which allows the OPP core to drop the resources selectively later on. Tested-by: Dmitry Osipenko Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 214 ++++++++++++++++++++++++++++++++++++++++- drivers/opp/opp.h | 21 ++++ include/linux/pm_opp.h | 45 +++++++++ 3 files changed, 279 insertions(+), 1 deletion(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index e166bfe5fc90..c77ea05ee2cd 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -13,11 +13,12 @@ #include #include #include -#include #include #include #include #include +#include +#include =20 #include "opp.h" =20 @@ -36,6 +37,9 @@ DEFINE_MUTEX(opp_table_lock); /* Flag indicating that opp_tables list is being updated at the moment */ static bool opp_tables_busy; =20 +/* OPP ID allocator */ +static DEFINE_XARRAY_ALLOC1(opp_configs); + static bool _find_opp_dev(const struct device *dev, struct opp_table *opp_= table) { struct opp_device *opp_dev; @@ -2618,6 +2622,214 @@ int devm_pm_opp_attach_genpd(struct device *dev, co= nst char * const *names, } EXPORT_SYMBOL_GPL(devm_pm_opp_attach_genpd); =20 +static void _opp_clear_config(struct opp_config_data *data) +{ + if (data->flags & OPP_CONFIG_GENPD) + dev_pm_opp_detach_genpd(data->opp_table); + if (data->flags & OPP_CONFIG_REGULATOR) + dev_pm_opp_put_regulators(data->opp_table); + if (data->flags & OPP_CONFIG_SUPPORTED_HW) + dev_pm_opp_put_supported_hw(data->opp_table); + if (data->flags & OPP_CONFIG_REGULATOR_HELPER) + dev_pm_opp_unregister_set_opp_helper(data->opp_table); + if (data->flags & OPP_CONFIG_PROP_NAME) + dev_pm_opp_put_prop_name(data->opp_table); + if (data->flags & OPP_CONFIG_CLK) + dev_pm_opp_put_clkname(data->opp_table); + + dev_pm_opp_put_opp_table(data->opp_table); + kfree(data); +} + +/** + * dev_pm_opp_set_config() - Set OPP configuration for the device. + * @dev: Device for which configuration is being set. + * @config: OPP configuration. + * + * This allows all device OPP configurations to be performed at once. + * + * This must be called before any OPPs are initialized for the device. Thi= s may + * be called multiple times for the same OPP table, for example once for e= ach + * CPU that share the same table. This must be balanced by the same number= of + * calls to dev_pm_opp_clear_config() in order to free the OPP table prope= rly. + * + * This returns a token to the caller, which must be passed to + * dev_pm_opp_clear_config() to free the resources later. The value of the + * returned token will be >=3D 1 for success and negative for errors. The = minimum + * value of 1 is chosen here to make it easy for callers to manage the res= ource. + */ +int dev_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *co= nfig) +{ + struct opp_table *opp_table, *err; + struct opp_config_data *data; + unsigned int id; + int ret; + + data =3D kmalloc(sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + opp_table =3D _add_opp_table(dev, false); + if (IS_ERR(opp_table)) { + kfree(data); + return PTR_ERR(opp_table); + } + + data->opp_table =3D opp_table; + data->flags =3D 0; + + /* This should be called before OPPs are initialized */ + if (WARN_ON(!list_empty(&opp_table->opp_list))) { + ret =3D -EBUSY; + goto err; + } + + /* Configure clocks */ + if (config->clk_names) { + /* We support only one clock name for now */ + if (config->clk_count !=3D 1) { + ret =3D -EINVAL; + goto err; + } + + err =3D dev_pm_opp_set_clkname(dev, config->clk_names[0]); + if (IS_ERR(err)) { + ret =3D PTR_ERR(err); + goto err; + } + + data->flags |=3D OPP_CONFIG_CLK; + } + + /* Configure property names */ + if (config->prop_name) { + err =3D dev_pm_opp_set_prop_name(dev, config->prop_name); + if (IS_ERR(err)) { + ret =3D PTR_ERR(err); + goto err; + } + + data->flags |=3D OPP_CONFIG_PROP_NAME; + } + + /* Configure opp helper */ + if (config->set_opp) { + err =3D dev_pm_opp_register_set_opp_helper(dev, config->set_opp); + if (IS_ERR(err)) { + ret =3D PTR_ERR(err); + goto err; + } + + data->flags |=3D OPP_CONFIG_REGULATOR_HELPER; + } + + /* Configure supported hardware */ + if (config->supported_hw) { + err =3D dev_pm_opp_set_supported_hw(dev, config->supported_hw, + config->supported_hw_count); + if (IS_ERR(err)) { + ret =3D PTR_ERR(err); + goto err; + } + + data->flags |=3D OPP_CONFIG_SUPPORTED_HW; + } + + /* Configure supplies */ + if (config->regulator_names) { + err =3D dev_pm_opp_set_regulators(dev, config->regulator_names, + config->regulator_count); + if (IS_ERR(err)) { + ret =3D PTR_ERR(err); + goto err; + } + + data->flags |=3D OPP_CONFIG_REGULATOR; + } + + /* Attach genpds */ + if (config->genpd_names) { + err =3D dev_pm_opp_attach_genpd(dev, config->genpd_names, + config->virt_devs); + if (IS_ERR(err)) { + ret =3D PTR_ERR(err); + goto err; + } + + data->flags |=3D OPP_CONFIG_GENPD; + } + + ret =3D xa_alloc(&opp_configs, &id, data, XA_LIMIT(1, INT_MAX), + GFP_KERNEL); + if (ret) + goto err; + + return id; + +err: + _opp_clear_config(data); + return ret; +} +EXPORT_SYMBOL_GPL(dev_pm_opp_set_config); + +/** + * dev_pm_opp_clear_config() - Releases resources blocked for OPP configur= ation. + * @opp_table: OPP table returned from dev_pm_opp_set_config(). + * + * This allows all device OPP configurations to be cleared at once. This m= ust be + * called once for each call made to dev_pm_opp_set_config(), in order to = free + * the OPPs properly. + * + * Currently the first call itself ends up freeing all the OPP configurati= ons, + * while the later ones only drop the OPP table reference. This works well= for + * now as we would never want to use an half initialized OPP table and wan= t to + * remove the configurations together. + */ +void dev_pm_opp_clear_config(int token) +{ + struct opp_config_data *data; + + /* + * This lets the callers call this unconditionally and keep their code + * simple. + */ + if (unlikely(token <=3D 0)) + return; + + data =3D xa_erase(&opp_configs, token); + if (WARN_ON(!data)) + return; + + _opp_clear_config(data); +} +EXPORT_SYMBOL_GPL(dev_pm_opp_clear_config); + +static void devm_pm_opp_config_release(void *token) +{ + dev_pm_opp_clear_config((unsigned long)token); +} + +/** + * devm_pm_opp_set_config() - Set OPP configuration for the device. + * @dev: Device for which configuration is being set. + * @config: OPP configuration. + * + * This allows all device OPP configurations to be performed at once. + * This is a resource-managed variant of dev_pm_opp_set_config(). + * + * Return: 0 on success and errorno otherwise. + */ +int devm_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *c= onfig) +{ + int token =3D dev_pm_opp_set_config(dev, config); + if (token < 0) + return token; + + return devm_add_action_or_reset(dev, devm_pm_opp_config_release, + (void *) ((unsigned long) token)); +} +EXPORT_SYMBOL_GPL(devm_pm_opp_set_config); + /** * dev_pm_opp_xlate_required_opp() - Find required OPP for @src_table OPP. * @src_table: OPP table which has @dst_table as one of its required OPP t= able. diff --git a/drivers/opp/opp.h b/drivers/opp/opp.h index 9e1cfcb0ea98..d652f0cc84f1 100644 --- a/drivers/opp/opp.h +++ b/drivers/opp/opp.h @@ -28,6 +28,27 @@ extern struct mutex opp_table_lock; =20 extern struct list_head opp_tables, lazy_opp_tables; =20 +/* OPP Config flags */ +#define OPP_CONFIG_CLK BIT(0) +#define OPP_CONFIG_REGULATOR BIT(1) +#define OPP_CONFIG_REGULATOR_HELPER BIT(2) +#define OPP_CONFIG_PROP_NAME BIT(3) +#define OPP_CONFIG_SUPPORTED_HW BIT(4) +#define OPP_CONFIG_GENPD BIT(5) + +/** + * struct opp_config_data - data for set config operations + * @opp_table: OPP table + * @flags: OPP config flags + * + * This structure stores the OPP config information for each OPP table + * configuration by the callers. + */ +struct opp_config_data { + struct opp_table *opp_table; + unsigned int flags; +}; + /* * Internal data structure organization with the OPP layer library is as * follows: diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 6708b4ec244d..467bed35130e 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -90,6 +90,35 @@ struct dev_pm_set_opp_data { struct device *dev; }; =20 +/** + * struct dev_pm_opp_config - Device OPP configuration values + * @clk_names: Clk name. + * @clk_count: Number of clocks, max 1 for now. + * @prop_name: Name to postfix to properties. + * @set_opp: Custom set OPP helper. + * @supported_hw: Array of hierarchy of versions to match. + * @supported_hw_count: Number of elements in the array. + * @regulator_names: Array of pointers to the names of the regulator. + * @regulator_count: Number of regulators. + * @genpd_names: Null terminated array of pointers containing names of gen= pd to + * attach. + * @virt_devs: Pointer to return the array of virtual devices. + * + * This structure contains platform specific OPP configurations for the de= vice. + */ +struct dev_pm_opp_config { + const char * const *clk_names; + unsigned int clk_count; + const char *prop_name; + int (*set_opp)(struct dev_pm_set_opp_data *data); + unsigned int *supported_hw; + unsigned int supported_hw_count; + const char * const *regulator_names; + unsigned int regulator_count; + const char * const *genpd_names; + struct device ***virt_devs; +}; + #if defined(CONFIG_PM_OPP) =20 struct opp_table *dev_pm_opp_get_opp_table(struct device *dev); @@ -154,6 +183,10 @@ int dev_pm_opp_disable(struct device *dev, unsigned lo= ng freq); int dev_pm_opp_register_notifier(struct device *dev, struct notifier_block= *nb); int dev_pm_opp_unregister_notifier(struct device *dev, struct notifier_blo= ck *nb); =20 +int dev_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *co= nfig); +int devm_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *c= onfig); +void dev_pm_opp_clear_config(int token); + struct opp_table *dev_pm_opp_set_supported_hw(struct device *dev, const u3= 2 *versions, unsigned int count); void dev_pm_opp_put_supported_hw(struct opp_table *opp_table); int devm_pm_opp_set_supported_hw(struct device *dev, const u32 *versions, = unsigned int count); @@ -419,6 +452,18 @@ static inline int devm_pm_opp_attach_genpd(struct devi= ce *dev, return -EOPNOTSUPP; } =20 +static inline int dev_pm_opp_set_config(struct device *dev, struct dev_pm_= opp_config *config) +{ + return -EOPNOTSUPP; +} + +static inline int devm_pm_opp_set_config(struct device *dev, struct dev_pm= _opp_config *config) +{ + return -EOPNOTSUPP; +} + +static inline void dev_pm_opp_clear_config(int token) {} + static inline struct dev_pm_opp *dev_pm_opp_xlate_required_opp(struct opp_= table *src_table, struct opp_table *dst_table, struct dev_pm_opp *src_opp) { --=20 2.31.1.272.g89b43f80a514 From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A661FC43334 for ; Fri, 1 Jul 2022 08:21:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233257AbiGAIVE (ORCPT ); Fri, 1 Jul 2022 04:21:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234437AbiGAIVB (ORCPT ); Fri, 1 Jul 2022 04:21:01 -0400 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6ABEB70E43 for ; Fri, 1 Jul 2022 01:20:53 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id x138so1789355pfc.3 for ; Fri, 01 Jul 2022 01:20:53 -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=5sBbegLJ1lchy2hqalQ5gJ7BZ0uunI8SG7qvUv41a9Y=; b=LtIggMzGQOAaeuUsH5+tfhe8ltdiSJAT7ASyNnbMKUFwg5LRGyfiXxcle/SSV3NIfW GQx6G+M3HwU+tGz8WVhrwKpvnD+qxamu07mrJMSSs/0srPapAZo80RW4dEZjQcTXyHls K3W0fNeg6V086Ehpk8Xs3rbfyBwd0uu3rlLw41Cb9Do8OTDOOUrFx0l7MGq9ATh1GCEe cksw4Ni/rTwjaO7EyJIu6wLnrCu75x0oloKisDodgwtR/wlb9pyibOWZ8qFCsM1WWV+s P7zuR7ZQLb9ZlwxBaYaLz4eDRX5qaMGQ5zSwoNL2Cw8PjF/0Bchum01YJKqkzUAyKtm9 H90w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5sBbegLJ1lchy2hqalQ5gJ7BZ0uunI8SG7qvUv41a9Y=; b=l5d1hNppgsIcbU46BtaGa3oQjb26qzBdW29W9tfs602YiTS/+Tp+O/8qzPWcKJJzne G2+zZ+xaRCLS4BVqMY8qlOUaCpUcBtG0hiQj4o/TuJp8K8vlXTGbcfCfwTuEsANSkPUc NIMV3fIIEWjHwh9iYV8o+4bRiq43ucW92tQiXWq/1Ix1IvtBgQaPHw1uKqQXNEMEYkWB okPfsz2EGQJRbnOtUsWmRHQ96a01hkX6ZkVcTqC6VryxJaCtGyXjcSj1xsZBVShOecys riw5IwUo7ypAo1pSWamf/k4hM0NcrNDSYYrNPXe353pMdgtarZ8UO8OD1wvlV7kpfAUh BOug== X-Gm-Message-State: AJIora9+QEV/h3+EJdMld3Br6fQqP1S+ZietxUmB//ncnNXeV08EgGnY upXvFXq69uCLIB6cAQY9dfTHAw== X-Google-Smtp-Source: AGRyM1uu8zggOPnDHNiBGQHOAPYQblLb5K23eAAtyPxBWbytzSoamd5/4G+YcLRQ/dpteT5fpwljKw== X-Received: by 2002:a63:455b:0:b0:411:bf36:f56e with SMTP id u27-20020a63455b000000b00411bf36f56emr4288740pgk.105.1656663653143; Fri, 01 Jul 2022 01:20:53 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id cm24-20020a17090afa1800b001ec87220fb9sm5938601pjb.16.2022.07.01.01.20.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:20:52 -0700 (PDT) From: Viresh Kumar To: "Rafael J. Wysocki" , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , Stephen Boyd , Nishanth Menon , Dmitry Osipenko , linux-kernel@vger.kernel.org Subject: [PATCH V2 03/30] cpufreq: dt: Migrate to dev_pm_opp_set_config() Date: Fri, 1 Jul 2022 13:49:58 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The OPP core now provides a unified API for setting all configuration types, i.e. dev_pm_opp_set_config(). Lets start using it. Tested-by: Dmitry Osipenko Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq-dt.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index 8fcaba541539..9e25bf86e512 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c @@ -29,8 +29,8 @@ struct private_data { =20 cpumask_var_t cpus; struct device *cpu_dev; - struct opp_table *opp_table; struct cpufreq_frequency_table *freq_table; + int opp_token; bool have_static_opps; }; =20 @@ -220,12 +220,16 @@ static int dt_cpufreq_early_init(struct device *dev, = int cpu) */ reg_name =3D find_supply_name(cpu_dev); if (reg_name) { - priv->opp_table =3D dev_pm_opp_set_regulators(cpu_dev, ®_name, - 1); - if (IS_ERR(priv->opp_table)) { - ret =3D PTR_ERR(priv->opp_table); + struct dev_pm_opp_config config =3D { + .regulator_names =3D ®_name, + .regulator_count =3D 1, + }; + + priv->opp_token =3D dev_pm_opp_set_config(cpu_dev, &config); + if (priv->opp_token < 0) { + ret =3D priv->opp_token; if (ret !=3D -EPROBE_DEFER) - dev_err(cpu_dev, "failed to set regulators: %d\n", + dev_err(cpu_dev, "failed to set OPP config: %d\n", ret); goto free_cpumask; } @@ -295,7 +299,7 @@ static int dt_cpufreq_early_init(struct device *dev, in= t cpu) out: if (priv->have_static_opps) dev_pm_opp_of_cpumask_remove_table(priv->cpus); - dev_pm_opp_put_regulators(priv->opp_table); + dev_pm_opp_clear_config(priv->opp_token); free_cpumask: free_cpumask_var(priv->cpus); return ret; @@ -309,7 +313,7 @@ static void dt_cpufreq_release(void) dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &priv->freq_table); if (priv->have_static_opps) dev_pm_opp_of_cpumask_remove_table(priv->cpus); - dev_pm_opp_put_regulators(priv->opp_table); + dev_pm_opp_clear_config(priv->opp_token); free_cpumask_var(priv->cpus); list_del(&priv->node); } --=20 2.31.1.272.g89b43f80a514 From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF2E7C433EF for ; Fri, 1 Jul 2022 08:21:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233601AbiGAIVJ (ORCPT ); Fri, 1 Jul 2022 04:21:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235165AbiGAIVB (ORCPT ); Fri, 1 Jul 2022 04:21:01 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 718C970E44 for ; Fri, 1 Jul 2022 01:20:56 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id h15-20020a17090a648f00b001ef3c529d77so4474895pjj.2 for ; Fri, 01 Jul 2022 01:20:56 -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=cgbOoygWZaIIuor1RyiZGwebLyI7PYxrQBZVGVTI33I=; b=obCdm4rJzIAby9ExFqqvOXIVGWgQpZy95pRUIC38dC0eIr+MePjuGhl1A0Zzh7axhV oBTLRLs1niE+fF8sOtY4QAoyO5VqRj4FZiAT4ciUZy89txYOpFTijV/C8PXTfU3HfjBh l/A2STUX1L+mLvU2uMHF5BI4sqqxkKPFGsm6AtheWMfuRp1xCzdvxgUG9Q9xcntIlAa9 3cLH720S30gUMnG57CrFy2k9ohBVVKyh7eHcCQ0amnV0ErJt5H3RfocVMUm0iG68H4qz oYjM28jiKUptzVA7+M27RYNIWBIAcLj3CtdfPEc5KNkLMZj6C6JBlREteUNoz2tdZWXI VI6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cgbOoygWZaIIuor1RyiZGwebLyI7PYxrQBZVGVTI33I=; b=ID8yTg899hoGr3sV3MMcSfX2lz3rUVBjG7S3mpDrFxmQrTAI37Uf0IhRfrkEMoszbY vgbuc/3qrKFt30haIbNie1g8SR6kvZf2AimUtRu5oMbm2tpa5vO9uAd8IZa43QBJt6Qg qzBollChTXtjPTA0FhmWjX/BIHxz10xc/iOwh5NTbuV0MSRDyMDfzLWELjNx8Vv/xiw1 79rtr62OhL5nk6huPU0ga5ywp3rzD9KYs+wydgBcCO7mk9ZK7NeZJC7T0XjTgrKttkND YJCLdQEAWMNzqcnMk7EZrWfwNgYRr+M/ARPsW3ic0b47qwGRUOaxwfiac993i6dv87LF IZmA== X-Gm-Message-State: AJIora/ZfgLQIdO/11NxQkkJWkrtc1EZOk3oNMPd9N4+Zh1g0aSKARA7 txbIRQEtW190hzD3/syxvxyerg== X-Google-Smtp-Source: AGRyM1tqcjCws6zg/SRdbpK7iJxqkiNnbiwu1OmSnN8KGWw1G6+vGEDusVUxK4VpgHd/fEzFYQ04bA== X-Received: by 2002:a17:90b:4b48:b0:1ec:fc87:691c with SMTP id mi8-20020a17090b4b4800b001ecfc87691cmr17043869pjb.120.1656663655997; Fri, 01 Jul 2022 01:20:55 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id a3-20020a1709027e4300b0016b8b35d725sm7861957pln.95.2022.07.01.01.20.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:20:55 -0700 (PDT) From: Viresh Kumar To: "Rafael J. Wysocki" , Viresh Kumar , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team Cc: linux-pm@vger.kernel.org, Vincent Guittot , Stephen Boyd , Nishanth Menon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 04/30] cpufreq: imx: Migrate to dev_pm_opp_set_config() Date: Fri, 1 Jul 2022 13:49:59 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The OPP core now provides a unified API for setting all configuration types, i.e. dev_pm_opp_set_config(). Lets start using it. Signed-off-by: Viresh Kumar --- drivers/cpufreq/imx-cpufreq-dt.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/cpufreq/imx-cpufreq-dt.c b/drivers/cpufreq/imx-cpufreq= -dt.c index 3fe9125156b4..8104fed4ff7c 100644 --- a/drivers/cpufreq/imx-cpufreq-dt.c +++ b/drivers/cpufreq/imx-cpufreq-dt.c @@ -31,8 +31,8 @@ =20 /* cpufreq-dt device registered by imx-cpufreq-dt */ static struct platform_device *cpufreq_dt_pdev; -static struct opp_table *cpufreq_opp_table; static struct device *cpu_dev; +static int cpufreq_opp_token; =20 enum IMX7ULP_CPUFREQ_CLKS { ARM, @@ -86,6 +86,10 @@ static int imx_cpufreq_dt_probe(struct platform_device *= pdev) u32 cell_value, supported_hw[2]; int speed_grade, mkt_segment; int ret; + struct dev_pm_opp_config config =3D { + .supported_hw =3D supported_hw, + .supported_hw_count =3D ARRAY_SIZE(supported_hw), + }; =20 cpu_dev =3D get_cpu_device(0); =20 @@ -153,17 +157,17 @@ static int imx_cpufreq_dt_probe(struct platform_devic= e *pdev) dev_info(&pdev->dev, "cpu speed grade %d mkt segment %d supported-hw %#x = %#x\n", speed_grade, mkt_segment, supported_hw[0], supported_hw[1]); =20 - cpufreq_opp_table =3D dev_pm_opp_set_supported_hw(cpu_dev, supported_hw, = 2); - if (IS_ERR(cpufreq_opp_table)) { - ret =3D PTR_ERR(cpufreq_opp_table); - dev_err(&pdev->dev, "Failed to set supported opp: %d\n", ret); + cpufreq_opp_token =3D dev_pm_opp_set_config(cpu_dev, &config); + if (cpufreq_opp_token < 0) { + ret =3D cpufreq_opp_token; + dev_err(&pdev->dev, "Failed to set Opp config: %d\n", ret); return ret; } =20 cpufreq_dt_pdev =3D platform_device_register_data( &pdev->dev, "cpufreq-dt", -1, NULL, 0); if (IS_ERR(cpufreq_dt_pdev)) { - dev_pm_opp_put_supported_hw(cpufreq_opp_table); + dev_pm_opp_clear_config(cpufreq_opp_token); ret =3D PTR_ERR(cpufreq_dt_pdev); dev_err(&pdev->dev, "Failed to register cpufreq-dt: %d\n", ret); return ret; @@ -176,7 +180,7 @@ static int imx_cpufreq_dt_remove(struct platform_device= *pdev) { platform_device_unregister(cpufreq_dt_pdev); if (!of_machine_is_compatible("fsl,imx7ulp")) - dev_pm_opp_put_supported_hw(cpufreq_opp_table); + dev_pm_opp_clear_config(cpufreq_opp_token); else clk_bulk_put(ARRAY_SIZE(imx7ulp_clks), imx7ulp_clks); =20 --=20 2.31.1.272.g89b43f80a514 From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA296C433EF for ; Fri, 1 Jul 2022 08:21:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234642AbiGAIVK (ORCPT ); Fri, 1 Jul 2022 04:21:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236170AbiGAIVB (ORCPT ); Fri, 1 Jul 2022 04:21:01 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4833970E58 for ; Fri, 1 Jul 2022 01:20:59 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id d17so1765595pfq.9 for ; Fri, 01 Jul 2022 01:20:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xl1HN34mhSotDnvkt8tXbixjNJQAdLGe7tUjPgb4h/M=; b=i7M5+MWQM/Wqyk1fA5iuLZE9bqsbrbc3WDWPOdi3fxmV/AJTwIEE7Si1xPTx5n2Xhn LOSApbAqXS878yYMItr7z4UBSPclNrnv36g5iFVV6jM84cVz4aZ1MCOHvI4E9Lw5JF2u u6SeJygVMbhOGlHlVjNyuv/RcUvYRGwMFWpcpNQJVYbNsAPnd79yR7+c9NJ8IMookw+U MkTEgtPVhXcuZ7cijPlnKYk0euz/zP2qHiPxelFniNIa1bjPNnBOqMx6nTor+cFORIbK HEQ2dTbvlms6brsUkKvwNKNz+C+cX7Ful6WWCTold3g5lPNYADIzEr2fTSm+w6C5shAJ Wrbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xl1HN34mhSotDnvkt8tXbixjNJQAdLGe7tUjPgb4h/M=; b=w5aVHIdmCqyFh2KX6UoZbBMNHQHWGmnVYwFJ3tOU13rsi7G8zVYZnhY++gV2+H+YCf LEs1EPNNZZYrYHu1O2JlkqDwvaV0iwOgHtYuvxBcokahtgH+ke9hbyTdMFusuIb2XYUv Erettp5t/SgpEA5ra+ZfZKZp/zXXEpZubYrVeQOGCyDxjKVZqRf59c4Pcy8gio5gAHJr aYMiWvsYAnXwAw9mu/pymJKluI5dxp4seMBsmaGqpKQYtlPL9U0rcIwa6zHtFglDSPSP NiNCOVb8iGzkZP+Csw5M7oC71ASsZmL6vlZGhBF7VRWTUUkJS/RLzssosLfJVWQhboyg X5CA== X-Gm-Message-State: AJIora8YoQXcOiOavtzrFSpjTASJ2HhxtprSr3G2txUhFm0v5/3vsv8D Z/uEDULxPKSAOBiFKByD6nHTQA== X-Google-Smtp-Source: AGRyM1uXWoz/xWc2GMqHOJsNXnU5IHLjBXiEnxQDiL/VVRBiBKY0HSQeRbsyqOL4jGI0ag21bGXGrQ== X-Received: by 2002:a05:6a00:c91:b0:525:8c3f:269 with SMTP id a17-20020a056a000c9100b005258c3f0269mr20249956pfv.66.1656663658830; Fri, 01 Jul 2022 01:20:58 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id n1-20020a170902dc8100b00163c6ac211fsm14910383pld.111.2022.07.01.01.20.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:20:58 -0700 (PDT) From: Viresh Kumar To: Ilia Lin , Andy Gross , Bjorn Andersson , "Rafael J. Wysocki" , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , Stephen Boyd , Nishanth Menon , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 05/30] cpufreq: qcom-nvmem: Migrate to dev_pm_opp_set_config() Date: Fri, 1 Jul 2022 13:50:00 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The OPP core now provides a unified API for setting all configuration types, i.e. dev_pm_opp_set_config(). Lets start using it. Signed-off-by: Viresh Kumar --- drivers/cpufreq/qcom-cpufreq-nvmem.c | 109 +++++++-------------------- 1 file changed, 28 insertions(+), 81 deletions(-) diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cp= ufreq-nvmem.c index 6dfa86971a75..863548f59c3e 100644 --- a/drivers/cpufreq/qcom-cpufreq-nvmem.c +++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c @@ -55,9 +55,7 @@ struct qcom_cpufreq_match_data { }; =20 struct qcom_cpufreq_drv { - struct opp_table **names_opp_tables; - struct opp_table **hw_opp_tables; - struct opp_table **genpd_opp_tables; + int *opp_tokens; u32 versions; const struct qcom_cpufreq_match_data *data; }; @@ -315,72 +313,43 @@ static int qcom_cpufreq_probe(struct platform_device = *pdev) } of_node_put(np); =20 - drv->names_opp_tables =3D kcalloc(num_possible_cpus(), - sizeof(*drv->names_opp_tables), + drv->opp_tokens =3D kcalloc(num_possible_cpus(), sizeof(*drv->opp_tokens), GFP_KERNEL); - if (!drv->names_opp_tables) { + if (!drv->opp_tokens) { ret =3D -ENOMEM; goto free_drv; } - drv->hw_opp_tables =3D kcalloc(num_possible_cpus(), - sizeof(*drv->hw_opp_tables), - GFP_KERNEL); - if (!drv->hw_opp_tables) { - ret =3D -ENOMEM; - goto free_opp_names; - } - - drv->genpd_opp_tables =3D kcalloc(num_possible_cpus(), - sizeof(*drv->genpd_opp_tables), - GFP_KERNEL); - if (!drv->genpd_opp_tables) { - ret =3D -ENOMEM; - goto free_opp; - } =20 for_each_possible_cpu(cpu) { + struct dev_pm_opp_config config =3D { + .supported_hw =3D NULL, + }; + cpu_dev =3D get_cpu_device(cpu); if (NULL =3D=3D cpu_dev) { ret =3D -ENODEV; - goto free_genpd_opp; + goto free_opp; } =20 if (drv->data->get_version) { + config.supported_hw =3D &drv->versions; + config.supported_hw_count =3D 1; =20 - if (pvs_name) { - drv->names_opp_tables[cpu] =3D dev_pm_opp_set_prop_name( - cpu_dev, - pvs_name); - if (IS_ERR(drv->names_opp_tables[cpu])) { - ret =3D PTR_ERR(drv->names_opp_tables[cpu]); - dev_err(cpu_dev, "Failed to add OPP name %s\n", - pvs_name); - goto free_opp; - } - } - - drv->hw_opp_tables[cpu] =3D dev_pm_opp_set_supported_hw( - cpu_dev, &drv->versions, 1); - if (IS_ERR(drv->hw_opp_tables[cpu])) { - ret =3D PTR_ERR(drv->hw_opp_tables[cpu]); - dev_err(cpu_dev, - "Failed to set supported hardware\n"); - goto free_genpd_opp; - } + if (pvs_name) + config.prop_name =3D pvs_name; } =20 if (drv->data->genpd_names) { - drv->genpd_opp_tables[cpu] =3D - dev_pm_opp_attach_genpd(cpu_dev, - drv->data->genpd_names, - NULL); - if (IS_ERR(drv->genpd_opp_tables[cpu])) { - ret =3D PTR_ERR(drv->genpd_opp_tables[cpu]); - if (ret !=3D -EPROBE_DEFER) - dev_err(cpu_dev, - "Could not attach to pm_domain: %d\n", - ret); - goto free_genpd_opp; + config.genpd_names =3D drv->data->genpd_names; + config.virt_devs =3D NULL; + } + + if (config.supported_hw || config.genpd_names) { + drv->opp_tokens[cpu] =3D dev_pm_opp_set_config(cpu_dev, &config); + if (drv->opp_tokens[cpu] < 0) { + ret =3D drv->opp_tokens[cpu]; + dev_err(cpu_dev, "Failed to set OPP config\n"); + goto free_opp; } } } @@ -395,27 +364,10 @@ static int qcom_cpufreq_probe(struct platform_device = *pdev) ret =3D PTR_ERR(cpufreq_dt_pdev); dev_err(cpu_dev, "Failed to register platform device\n"); =20 -free_genpd_opp: - for_each_possible_cpu(cpu) { - if (IS_ERR(drv->genpd_opp_tables[cpu])) - break; - dev_pm_opp_detach_genpd(drv->genpd_opp_tables[cpu]); - } - kfree(drv->genpd_opp_tables); free_opp: - for_each_possible_cpu(cpu) { - if (IS_ERR(drv->names_opp_tables[cpu])) - break; - dev_pm_opp_put_prop_name(drv->names_opp_tables[cpu]); - } - for_each_possible_cpu(cpu) { - if (IS_ERR(drv->hw_opp_tables[cpu])) - break; - dev_pm_opp_put_supported_hw(drv->hw_opp_tables[cpu]); - } - kfree(drv->hw_opp_tables); -free_opp_names: - kfree(drv->names_opp_tables); + for_each_possible_cpu(cpu) + dev_pm_opp_clear_config(drv->opp_tokens[cpu]); + kfree(drv->opp_tokens); free_drv: kfree(drv); =20 @@ -429,15 +381,10 @@ static int qcom_cpufreq_remove(struct platform_device= *pdev) =20 platform_device_unregister(cpufreq_dt_pdev); =20 - for_each_possible_cpu(cpu) { - dev_pm_opp_put_supported_hw(drv->names_opp_tables[cpu]); - dev_pm_opp_put_supported_hw(drv->hw_opp_tables[cpu]); - dev_pm_opp_detach_genpd(drv->genpd_opp_tables[cpu]); - } + for_each_possible_cpu(cpu) + dev_pm_opp_clear_config(drv->opp_tokens[cpu]); =20 - kfree(drv->names_opp_tables); - kfree(drv->hw_opp_tables); - kfree(drv->genpd_opp_tables); + kfree(drv->opp_tokens); kfree(drv); =20 return 0; --=20 2.31.1.272.g89b43f80a514 From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F22EC433EF for ; Fri, 1 Jul 2022 08:21:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235789AbiGAIVU (ORCPT ); Fri, 1 Jul 2022 04:21:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236201AbiGAIVD (ORCPT ); Fri, 1 Jul 2022 04:21:03 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EE1470AFF for ; Fri, 1 Jul 2022 01:21:02 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id n12so1832434pfq.0 for ; Fri, 01 Jul 2022 01:21:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KxgLelNuWT5l4LKZo/aKRP7N8N8MOwnW7uf8T3lO5YM=; b=RIqayPswkbEVZ3ZMVbRpS2q5QXKz8JXz6cJQ0EH2xhUIXtemnD0X2jEy+t2eVl5yw+ Hv/MQd/ESQj1lVAskkrBZtJ0rVB4O4HlGHVnxXYl2oImWDBc2nfZQ3VQ5yVBW8Nnlgg2 CQpYfPbVjOwBZn1jLGEYCFpe10LcwFlRAD96bVL4s/HjdnEIPkwM/YwqUFRk/oFtR2SC dDiZuIRbpV3mdvTYtRPeG1C2V//NGF+iS0NZhzKFEmhrVJobhNhRYHMgJ5Sp7WjyRsyC hRq3+tYiH4bHY6QiL6Pi84K0JliTjskicQ8c83gZg6kkT+OtTVAiqzNVRrPyU8tMic/i lVgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KxgLelNuWT5l4LKZo/aKRP7N8N8MOwnW7uf8T3lO5YM=; b=IKR8seeHQgeP+PhPw/63xgUfXGWUPuu20zpyd/iZPwKFmEC7cfrtPoDvveleho6jLQ zFGi2AO8SlNOnFbq+LPNIbXsXrjNGbuNKN7QFFQYo9kQMeB5+UU0NwHBMzdDdRIpscr1 Nybb7/ic5YNUJUGu4pYBDngBojAGtP5G11O4HGlZlmV4Qoc9JOr7uEiu2Kv2DkTgaDtx j19wkpf/XcKQLR8Ccjc9stC3g+lrV8g9Qg4fBOJZ1eTYfCmnKJRyhI7941FCWNu6bfug PXghaGmtyIHFciSl/P8WDreZGOrk8TCqd3HhhIoT9mxvUQoQO1t2LtXAKCuhO8P43Gel 3VIA== X-Gm-Message-State: AJIora+n9VSzhOx1G4rK8soUckO+76+zdmpYUAYJup52kuVWWoqNRpxd bKKxqq3+DH5f3qO76auF2+i8dA== X-Google-Smtp-Source: AGRyM1uXq5wOQbUjInZMGnjqZB6uOUcrrsaHSAqLeSNKbmgBCDl3OTWafESheg7frLTic7Ml4STGXw== X-Received: by 2002:a05:6a00:10d0:b0:4f7:5af4:47b6 with SMTP id d16-20020a056a0010d000b004f75af447b6mr20268070pfu.6.1656663661463; Fri, 01 Jul 2022 01:21:01 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id u10-20020a170902714a00b001693bd7427asm14959831plm.170.2022.07.01.01.21.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:21:01 -0700 (PDT) From: Viresh Kumar To: Patrice Chotard , "Rafael J. Wysocki" , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , Stephen Boyd , Nishanth Menon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 06/30] cpufreq: sti: Migrate to dev_pm_opp_set_config() Date: Fri, 1 Jul 2022 13:50:01 +0530 Message-Id: <808b80fad5be3ca92c3b873d8943a85e9ceb0215.1656660185.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The OPP core now provides a unified API for setting all configuration types, i.e. dev_pm_opp_set_config(). Lets start using it. Signed-off-by: Viresh Kumar --- drivers/cpufreq/sti-cpufreq.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/drivers/cpufreq/sti-cpufreq.c b/drivers/cpufreq/sti-cpufreq.c index fdb0a722d881..a67df90848c2 100644 --- a/drivers/cpufreq/sti-cpufreq.c +++ b/drivers/cpufreq/sti-cpufreq.c @@ -156,9 +156,13 @@ static int sti_cpufreq_set_opp_info(void) unsigned int hw_info_offset; unsigned int version[VERSION_ELEMENTS]; int pcode, substrate, major, minor; - int ret; + int opp_token, ret; char name[MAX_PCODE_NAME_LEN]; - struct opp_table *opp_table; + struct dev_pm_opp_config config =3D { + .supported_hw =3D version, + .supported_hw_count =3D ARRAY_SIZE(version), + .prop_name =3D name, + }; =20 reg_fields =3D sti_cpufreq_match(); if (!reg_fields) { @@ -210,21 +214,14 @@ static int sti_cpufreq_set_opp_info(void) =20 snprintf(name, MAX_PCODE_NAME_LEN, "pcode%d", pcode); =20 - opp_table =3D dev_pm_opp_set_prop_name(dev, name); - if (IS_ERR(opp_table)) { - dev_err(dev, "Failed to set prop name\n"); - return PTR_ERR(opp_table); - } - version[0] =3D BIT(major); version[1] =3D BIT(minor); version[2] =3D BIT(substrate); =20 - opp_table =3D dev_pm_opp_set_supported_hw(dev, version, VERSION_ELEMENTS); - if (IS_ERR(opp_table)) { - dev_err(dev, "Failed to set supported hardware\n"); - ret =3D PTR_ERR(opp_table); - goto err_put_prop_name; + opp_token =3D dev_pm_opp_set_config(dev, &config); + if (opp_token < 0) { + dev_err(dev, "Failed to set OPP config\n"); + return opp_token; } =20 dev_dbg(dev, "pcode: %d major: %d minor: %d substrate: %d\n", @@ -233,10 +230,6 @@ static int sti_cpufreq_set_opp_info(void) version[0], version[1], version[2]); =20 return 0; - -err_put_prop_name: - dev_pm_opp_put_prop_name(opp_table); - return ret; } =20 static int sti_cpufreq_fetch_syscon_registers(void) --=20 2.31.1.272.g89b43f80a514 From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1956AC43334 for ; Fri, 1 Jul 2022 08:21:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236228AbiGAIVe (ORCPT ); Fri, 1 Jul 2022 04:21:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236229AbiGAIVH (ORCPT ); Fri, 1 Jul 2022 04:21:07 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 259E970E58 for ; Fri, 1 Jul 2022 01:21:04 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id n10so1757831plp.0 for ; Fri, 01 Jul 2022 01:21:04 -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=UP0yoNhFLIHXiHpKMoJOvGvXM3qtPgVsBeDYDxFaexg=; b=qqFUbB4lPwvbdMFxiQhId3PlyWslWgqsVhgJF1Bry2po60wBJ5SBPQVqo0Efv5yhwX EouPmk6sI8onPh1qSQa0sspYochs4rfrmIwTSZfgcS/kud3GriovNPYKQ4kxBGLzPqkY 0mgFYO8PU8nd0RfJTa4Yyhd/lMBpJswGvBwoqT0LZbZmi2Mx8KyBw94j3834LusE68UQ lHNHmyn3ROVMfXLfS1VUiN5GkyacbAifavQnqeCnYU6FFrgyUiL+ObpmOlzPPvlk00Ub ixm3g8LFPtUiOah0AW2j4fkTGCApWETRqm4Y2SyKR0PvBIJlrh7C7BpT4jM2dgsq+h0D nt4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UP0yoNhFLIHXiHpKMoJOvGvXM3qtPgVsBeDYDxFaexg=; b=x7G28qsp87w0xscz0SwJAERZuA+Y91DTPrDo/AkDGQtMOiaCFvKrzW3w2t9wdozAmM aewWoGIXOm6dMJhcpaTa7u6uwInPKNVj/p2WfD/dwGi51NsfL/7KyYjSdldzVvWc5ykn 6NUmX6CPJSUcxwK711UUzvZFSqWQk/qE4QZ1ctcayAfZIpdUfkJnSGaPx4uVVgQAj3zr CAR3h5gxpMPIllfkRKwtKxDREeHJSeTzkUWc/DggBkX0WncoDsAuqsOKa1LkONJu+odB MvIb8isaSQespEBLwJI3/mP3ePz8XRGYHDtrgLUbpZy/Gz2BjTpw0Z7/nXTg4sAeuFpj eNsw== X-Gm-Message-State: AJIora8Ag5PYmfnOVoWDG17aI1FlI3g7vMdxvzK3AsZI32YkcdXBHI5Y sS199MS7xt0yhS+gdptbXxEJUg== X-Google-Smtp-Source: AGRyM1td7OiTDDJKC5UOCJKA2KSSdhXte5R0MVbBPWtzUOmmETfHP5pTi96toOOFE2DuqbeHR+O24A== X-Received: by 2002:a17:90b:1e47:b0:1ed:2723:981a with SMTP id pi7-20020a17090b1e4700b001ed2723981amr17170127pjb.144.1656663664161; Fri, 01 Jul 2022 01:21:04 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id h18-20020a170902f7d200b001624cd63bbbsm14841818plw.133.2022.07.01.01.21.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:21:03 -0700 (PDT) From: Viresh Kumar To: Yangtao Li , "Rafael J. Wysocki" , Viresh Kumar , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: linux-pm@vger.kernel.org, Vincent Guittot , Stephen Boyd , Nishanth Menon , linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH V2 07/30] cpufreq: sun50i: Migrate to dev_pm_opp_set_config() Date: Fri, 1 Jul 2022 13:50:02 +0530 Message-Id: <195383ea6386102e430140f14d349769f6893fd6.1656660185.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The OPP core now provides a unified API for setting all configuration types, i.e. dev_pm_opp_set_config(). Lets start using it. Signed-off-by: Viresh Kumar --- drivers/cpufreq/sun50i-cpufreq-nvmem.c | 36 +++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/cpufreq/sun50i-cpufreq-nvmem.c b/drivers/cpufreq/sun50= i-cpufreq-nvmem.c index 75e1bf3a08f7..afb1a11f781c 100644 --- a/drivers/cpufreq/sun50i-cpufreq-nvmem.c +++ b/drivers/cpufreq/sun50i-cpufreq-nvmem.c @@ -86,26 +86,29 @@ static int sun50i_cpufreq_get_efuse(u32 *versions) =20 static int sun50i_cpufreq_nvmem_probe(struct platform_device *pdev) { - struct opp_table **opp_tables; + int *opp_tokens; char name[MAX_NAME_LEN]; unsigned int cpu; u32 speed =3D 0; int ret; =20 - opp_tables =3D kcalloc(num_possible_cpus(), sizeof(*opp_tables), + opp_tokens =3D kcalloc(num_possible_cpus(), sizeof(*opp_tokens), GFP_KERNEL); - if (!opp_tables) + if (!opp_tokens) return -ENOMEM; =20 ret =3D sun50i_cpufreq_get_efuse(&speed); if (ret) { - kfree(opp_tables); + kfree(opp_tokens); return ret; } =20 snprintf(name, MAX_NAME_LEN, "speed%d", speed); =20 for_each_possible_cpu(cpu) { + struct dev_pm_opp_config config =3D { + .prop_name =3D name, + }; struct device *cpu_dev =3D get_cpu_device(cpu); =20 if (!cpu_dev) { @@ -113,10 +116,10 @@ static int sun50i_cpufreq_nvmem_probe(struct platform= _device *pdev) goto free_opp; } =20 - opp_tables[cpu] =3D dev_pm_opp_set_prop_name(cpu_dev, name); - if (IS_ERR(opp_tables[cpu])) { - ret =3D PTR_ERR(opp_tables[cpu]); - pr_err("Failed to set prop name\n"); + opp_tokens[cpu] =3D dev_pm_opp_set_config(cpu_dev, &config); + if (opp_tokens[cpu] < 0) { + ret =3D opp_tokens[cpu]; + pr_err("Failed to set OPP config\n"); goto free_opp; } } @@ -124,7 +127,7 @@ static int sun50i_cpufreq_nvmem_probe(struct platform_d= evice *pdev) cpufreq_dt_pdev =3D platform_device_register_simple("cpufreq-dt", -1, NULL, 0); if (!IS_ERR(cpufreq_dt_pdev)) { - platform_set_drvdata(pdev, opp_tables); + platform_set_drvdata(pdev, opp_tokens); return 0; } =20 @@ -132,27 +135,24 @@ static int sun50i_cpufreq_nvmem_probe(struct platform= _device *pdev) pr_err("Failed to register platform device\n"); =20 free_opp: - for_each_possible_cpu(cpu) { - if (IS_ERR_OR_NULL(opp_tables[cpu])) - break; - dev_pm_opp_put_prop_name(opp_tables[cpu]); - } - kfree(opp_tables); + for_each_possible_cpu(cpu) + dev_pm_opp_clear_config(opp_tokens[cpu]); + kfree(opp_tokens); =20 return ret; } =20 static int sun50i_cpufreq_nvmem_remove(struct platform_device *pdev) { - struct opp_table **opp_tables =3D platform_get_drvdata(pdev); + int *opp_tokens =3D platform_get_drvdata(pdev); unsigned int cpu; =20 platform_device_unregister(cpufreq_dt_pdev); =20 for_each_possible_cpu(cpu) - dev_pm_opp_put_prop_name(opp_tables[cpu]); + dev_pm_opp_clear_config(opp_tokens[cpu]); =20 - kfree(opp_tables); + kfree(opp_tokens); =20 return 0; } --=20 2.31.1.272.g89b43f80a514 From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B9A4C43334 for ; Fri, 1 Jul 2022 08:21:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232813AbiGAIVk (ORCPT ); Fri, 1 Jul 2022 04:21:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236237AbiGAIVK (ORCPT ); Fri, 1 Jul 2022 04:21:10 -0400 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 507DF70E63 for ; Fri, 1 Jul 2022 01:21:07 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id a15so1752506pfv.13 for ; Fri, 01 Jul 2022 01:21:07 -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=ythbHY3HGZXqavoZCsWCeWM4NB+A+Z15e7P5aMati+I=; b=KQmB5ZcFd9+cVWdlyXtKlYgu/OkQKiHszPPacTNHNiJ2RQFBM2UQBdHc+2QuTNdSt0 vBDx8hXQBVHDDnYsAStjhO+uFLzQeWvZRmdEsOPdKPAVKJj9gbOi+Z2XixLhmmfx2w23 SB7RYF0Y1YFexpb2981vcVDBMf/d6JqZneKCyCQ4a80/kh+M68+zi2vvQZu1w98LGDGX /p0iwiGtEJHe6JcOUjSjpzOc6dDsaefaaLlp4NKlJacwje30emCGo+r42WF34HhtAtkA 3R22xGdVftk+1Koe2wwt8MOcLARgvco2JTeP2ZS8JjSr5NkA/CS8OnJ/1j0Kon/LBe9+ pQ9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ythbHY3HGZXqavoZCsWCeWM4NB+A+Z15e7P5aMati+I=; b=mTH2zQV/CKraL5GOBQ087P9K5SHoZs4+IKYU5Z+X/Vn9HtO08b2oEU7sTthYd+C1hg nkn3yyc7Tom5eSxAWleynpEavCtETFtvJQlZN6LP9R84O0wldTu5RaQrD0B3ItZ1D2Hb hrl5QNTHewO1WRRQrvjg3u9NpiU8sDFARtv2k0MRh3NV/ZNBqLaljeyyoYxzwKfap28x znJC9xKagdRkD4AF/eE79d616QFEeSssYJmhgqwKp9V4RoMMfX5MYmGqRFdydcgtDIWW wVzjQwrjBQAczryqXeKBoY3IxB8PcmLUP+wlDuYgzqtrr7ilRXv3C8goA/HL58aOQQt6 I6hg== X-Gm-Message-State: AJIora+pd5pk7e8WRp2D3eXA79tsCj/qdwfhMIdqnOblXWheo6nKoNxA CmK8s+s3Dj6c9zbmTJykJ1ydiw== X-Google-Smtp-Source: AGRyM1ua02yOf1KjCRiYGbqfbo7BgHFhNhA1zPuRmxQvnkx9Jj4XIv4wKzRvD7G48zrZnA5RYHWt4g== X-Received: by 2002:a05:6a00:cd5:b0:525:5211:7d96 with SMTP id b21-20020a056a000cd500b0052552117d96mr19002524pfv.56.1656663666825; Fri, 01 Jul 2022 01:21:06 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id s26-20020a65645a000000b0040c755b7651sm14811432pgv.41.2022.07.01.01.21.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:21:06 -0700 (PDT) From: Viresh Kumar To: "Rafael J. Wysocki" , Viresh Kumar , Thierry Reding , Jonathan Hunter Cc: linux-pm@vger.kernel.org, Vincent Guittot , Stephen Boyd , Nishanth Menon , Dmitry Osipenko , linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 08/30] cpufreq: tegra20: Migrate to dev_pm_opp_set_config() Date: Fri, 1 Jul 2022 13:50:03 +0530 Message-Id: <1a6fb3ccfb18b82c062ca587422e100064814f4d.1656660185.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The OPP core now provides a unified API for setting all configuration types, i.e. dev_pm_opp_set_config(). Lets start using it. Tested-by: Dmitry Osipenko Signed-off-by: Viresh Kumar --- drivers/cpufreq/tegra20-cpufreq.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/cpufreq/tegra20-cpufreq.c b/drivers/cpufreq/tegra20-cp= ufreq.c index e8db3d75be25..edd738e641f8 100644 --- a/drivers/cpufreq/tegra20-cpufreq.c +++ b/drivers/cpufreq/tegra20-cpufreq.c @@ -32,9 +32,9 @@ static bool cpu0_node_has_opp_v2_prop(void) return ret; } =20 -static void tegra20_cpufreq_put_supported_hw(void *opp_table) +static void tegra20_cpufreq_put_supported_hw(void *opp_token) { - dev_pm_opp_put_supported_hw(opp_table); + dev_pm_opp_clear_config((unsigned long) opp_token); } =20 static void tegra20_cpufreq_dt_unregister(void *cpufreq_dt) @@ -45,10 +45,13 @@ static void tegra20_cpufreq_dt_unregister(void *cpufreq= _dt) static int tegra20_cpufreq_probe(struct platform_device *pdev) { struct platform_device *cpufreq_dt; - struct opp_table *opp_table; struct device *cpu_dev; u32 versions[2]; int err; + struct dev_pm_opp_config config =3D { + .supported_hw =3D versions, + .supported_hw_count =3D ARRAY_SIZE(versions), + }; =20 if (!cpu0_node_has_opp_v2_prop()) { dev_err(&pdev->dev, "operating points not found\n"); @@ -71,16 +74,15 @@ static int tegra20_cpufreq_probe(struct platform_device= *pdev) if (WARN_ON(!cpu_dev)) return -ENODEV; =20 - opp_table =3D dev_pm_opp_set_supported_hw(cpu_dev, versions, 2); - err =3D PTR_ERR_OR_ZERO(opp_table); - if (err) { - dev_err(&pdev->dev, "failed to set supported hw: %d\n", err); + err =3D dev_pm_opp_set_config(cpu_dev, &config); + if (err < 0) { + dev_err(&pdev->dev, "failed to set OPP config: %d\n", err); return err; } =20 err =3D devm_add_action_or_reset(&pdev->dev, tegra20_cpufreq_put_supported_hw, - opp_table); + (void *)((unsigned long) err)); if (err) return err; =20 --=20 2.31.1.272.g89b43f80a514 From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEAD5C43334 for ; Fri, 1 Jul 2022 08:21:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234113AbiGAIVn (ORCPT ); Fri, 1 Jul 2022 04:21:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233748AbiGAIVS (ORCPT ); Fri, 1 Jul 2022 04:21:18 -0400 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DE5170E77 for ; Fri, 1 Jul 2022 01:21:10 -0700 (PDT) Received: by mail-pg1-x52b.google.com with SMTP id o18so580469pgu.9 for ; Fri, 01 Jul 2022 01:21:10 -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=cLvm+NAa5BeE/i7Qo/3zGWdB4t6pSp8QC+y5KpzRMdM=; b=fwnyXMMkk7P3ih5uDwdTYK5Y0ERrPr6v0+GufM5RKzbD6qO14fEsskiV4ITy7/TT1K N8mZFTLF1vS0cVi2PzQHjDsWkiGzMO0mKp4wHVliBpaTHyrIJpcoeaz6IQWtp4ECIrym 4uKpHNYn0heUaULAGTA/TKcBHIH9w4vBpKoBvdjNch4Q5uo9KYKKP7lwcWvyoBBlv67J Fd+GdHfKU2/nFaEebtnD5+BbZLfrHaYyVMeLQlAD7gTJivuaMjHEtp8oFjS0uXiFjRch JQ6i/+xV+EXSO+xkmjlCkexFR8ReX2o6r4NKCvpgSISIdFTXwsDKFqCSWM7K4zYd2vbU kt8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cLvm+NAa5BeE/i7Qo/3zGWdB4t6pSp8QC+y5KpzRMdM=; b=tFRFCvE9ETJwRMLdwOckSoM+VW0UCDhzxu4ZEgSzC87CfoC1bVYP5x1w9nXJWf4FYs xtPu1pHBYeNKioYAdxef8X7KTjHxCyhuXkBUxSjyy2B7LYb3Joh8rnTW14nVJ/Gt1Amv m2opfLKZc7W358n0E/QzLN7gnLizXOx6cNKQ8UckiQARZBTjH0AZF2EBmiSrI/ziLaqQ jzCh9FTGaASWt0K9ZDx7nPkn7wA3oMDPMgpcDSEakdVGdgagbg5bqjcpOBEWaUIuQfi7 wXpZ+jfPPI5v3NVvy3gUU8JVpARDNHtJgTikSDMhAxE6B2XwfX8w+EqrVdOLivmMBv9N i9lA== X-Gm-Message-State: AJIora9Gwin02waApx2837HIDYuzJLHHWHFt2r9PCvPxpT6aVZ0XK8+r DAkhaXVwn+pibCIWjFXkeIgdKg== X-Google-Smtp-Source: AGRyM1s4oLyclufYs9wYwvrJNAdDcdUB4yykbH68vm/CdHwFSxjeFTYOUoGC4sTrKOYQvZyHzhfZlA== X-Received: by 2002:a05:6a00:1312:b0:528:2ed8:7e35 with SMTP id j18-20020a056a00131200b005282ed87e35mr2521119pfu.13.1656663669507; Fri, 01 Jul 2022 01:21:09 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id h15-20020a170902680f00b00161e50e2245sm14766175plk.178.2022.07.01.01.21.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:21:09 -0700 (PDT) From: Viresh Kumar To: "Rafael J. Wysocki" , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , Stephen Boyd , Nishanth Menon , linux-kernel@vger.kernel.org Subject: [PATCH V2 09/30] cpufreq: ti: Migrate to dev_pm_opp_set_config() Date: Fri, 1 Jul 2022 13:50:04 +0530 Message-Id: <26dccec60b69c4a6b6902128de25a6b264bc57a4.1656660185.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The OPP core now provides a unified API for setting all configuration types, i.e. dev_pm_opp_set_config(). Lets start using it. Signed-off-by: Viresh Kumar --- drivers/cpufreq/ti-cpufreq.c | 38 ++++++++++++++---------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/drivers/cpufreq/ti-cpufreq.c b/drivers/cpufreq/ti-cpufreq.c index 8f9fdd864391..92a873e4d646 100644 --- a/drivers/cpufreq/ti-cpufreq.c +++ b/drivers/cpufreq/ti-cpufreq.c @@ -60,7 +60,6 @@ struct ti_cpufreq_data { struct device_node *opp_node; struct regmap *syscon; const struct ti_cpufreq_soc_data *soc_data; - struct opp_table *opp_table; }; =20 static unsigned long amx3_efuse_xlate(struct ti_cpufreq_data *opp_data, @@ -324,10 +323,13 @@ static int ti_cpufreq_probe(struct platform_device *p= dev) { u32 version[VERSION_COUNT]; const struct of_device_id *match; - struct opp_table *ti_opp_table; struct ti_cpufreq_data *opp_data; const char * const default_reg_names[] =3D {"vdd", "vbb"}; int ret; + struct dev_pm_opp_config config =3D { + .supported_hw =3D version, + .supported_hw_count =3D ARRAY_SIZE(version), + }; =20 match =3D dev_get_platdata(&pdev->dev); if (!match) @@ -370,33 +372,23 @@ static int ti_cpufreq_probe(struct platform_device *p= dev) if (ret) goto fail_put_node; =20 - ti_opp_table =3D dev_pm_opp_set_supported_hw(opp_data->cpu_dev, - version, VERSION_COUNT); - if (IS_ERR(ti_opp_table)) { - dev_err(opp_data->cpu_dev, - "Failed to set supported hardware\n"); - ret =3D PTR_ERR(ti_opp_table); - goto fail_put_node; - } - - opp_data->opp_table =3D ti_opp_table; - if (opp_data->soc_data->multi_regulator) { - const char * const *reg_names =3D default_reg_names; + config.regulator_count =3D ARRAY_SIZE(default_reg_names); =20 if (opp_data->soc_data->reg_names) - reg_names =3D opp_data->soc_data->reg_names; - ti_opp_table =3D dev_pm_opp_set_regulators(opp_data->cpu_dev, - reg_names, - ARRAY_SIZE(default_reg_names)); - if (IS_ERR(ti_opp_table)) { - dev_pm_opp_put_supported_hw(opp_data->opp_table); - ret =3D PTR_ERR(ti_opp_table); - goto fail_put_node; - } + config.regulator_names =3D opp_data->soc_data->reg_names; + else + config.regulator_names =3D default_reg_names; + } + + ret =3D dev_pm_opp_set_config(opp_data->cpu_dev, &config); + if (ret < 0) { + dev_err(opp_data->cpu_dev, "Failed to set OPP config\n"); + goto fail_put_node; } =20 of_node_put(opp_data->opp_node); + register_cpufreq_dt: platform_device_register_simple("cpufreq-dt", -1, NULL, 0); =20 --=20 2.31.1.272.g89b43f80a514 From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D8D8C43334 for ; Fri, 1 Jul 2022 08:21:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234593AbiGAIVp (ORCPT ); Fri, 1 Jul 2022 04:21:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233676AbiGAIV2 (ORCPT ); Fri, 1 Jul 2022 04:21:28 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0CCF7124A for ; Fri, 1 Jul 2022 01:21:12 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id q18so1680732pld.13 for ; Fri, 01 Jul 2022 01:21:12 -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=qsU9wtO366QGqn2stFTSeEtjcXZrw3Fi++5zsewllw4=; b=mYbS8wl99X3HCAP868Vx551nyMcsU2v27Yzpw3q4wB28iGCSEzCU3T0L8B0sy6bCqv 9aJFzKf3Vy6vNlnXsdYt/mCa4W/t+sqSy3Pmq9d4xWm5xNJjSPgyulzm9a9b59WMhV3d 7XQGmImKOgc+60IYmIPEAY6dCC83cYEJEoNsFbS+XNuKPQD/938dZxx7pqInsIkjx/nO +ppaJFCWTUvdJj66YGKGgpj4WgDu3Cey9bLwQsUKp/R50GCosKHyQq2bPAxjY+UP2v7/ wzjNBbh3hGEdsoHbuc0EIBBu4sPWBFfKorijzTYSyLupD4nRXlDPybYJnS/jvV+8s4a1 rjcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qsU9wtO366QGqn2stFTSeEtjcXZrw3Fi++5zsewllw4=; b=biCgckbzpQDlhLNj/P39qgcEoUhvRgqcItXYy01X58+VPCf4B6rPVMlzAvXtHJd1ln E1nx7KBJ2DAlWoWphWSixg7aSfuwfqEGLVZPJyNSD0P0g++fSMm7bo+Tdsyh3uOwzeoh 39w/Nnxgo+IqiQ77QxvLE+SRETYkF+1BYo0yJwL+uQg8XfIgSd3nXFmNtXpc9Xd05qA4 Vs4/VODARblCJAYdfDBlua2FTDaKJl9B/jlrYgwlbLK9jGxIXms4DbUcf+WWoxNWuUni OsnoFGKBQcJxC+P1ODBA9TU2VXXt4fVNLfg4VU5dqBPXuLWtNb5HiEWlmwlqYSv2l00A v7EA== X-Gm-Message-State: AJIora/5xX7Xw7gp/Hzy2T4DNtSwRvqstPVhpwCozOlrWlNo4ni5oNKp jKGA1xb36qa1mGN1fJ20ySXCFw== X-Google-Smtp-Source: AGRyM1sFl5EDfJmLxUmQIL9clpelCvUmhUe8DIu10IpEDNEAFe1uijgj4nsnsYzo39Vt/eVZslGEtA== X-Received: by 2002:a17:902:e546:b0:16b:8f8a:3344 with SMTP id n6-20020a170902e54600b0016b8f8a3344mr18796467plf.130.1656663672403; Fri, 01 Jul 2022 01:21:12 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id h8-20020a056a00170800b0050dc762819bsm15055700pfc.117.2022.07.01.01.21.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:21:12 -0700 (PDT) From: Viresh Kumar To: Chanwoo Choi , MyungJoo Ham , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , "Rafael J. Wysocki" , Stephen Boyd , Nishanth Menon , linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 10/30] devfreq: exynos: Migrate to dev_pm_opp_set_config() Date: Fri, 1 Jul 2022 13:50:05 +0530 Message-Id: <14d236f519900b7bb7859b4690aca62979b78ce6.1656660185.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The OPP core now provides a unified API for setting all configuration types, i.e. dev_pm_opp_set_config(). Lets start using it. Signed-off-by: Viresh Kumar --- drivers/devfreq/exynos-bus.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c index e689101abc93..b5615e667e31 100644 --- a/drivers/devfreq/exynos-bus.c +++ b/drivers/devfreq/exynos-bus.c @@ -33,7 +33,7 @@ struct exynos_bus { =20 unsigned long curr_freq; =20 - struct opp_table *opp_table; + int opp_token; struct clk *clk; unsigned int ratio; }; @@ -161,8 +161,7 @@ static void exynos_bus_exit(struct device *dev) =20 dev_pm_opp_of_remove_table(dev); clk_disable_unprepare(bus->clk); - dev_pm_opp_put_regulators(bus->opp_table); - bus->opp_table =3D NULL; + dev_pm_opp_clear_config(bus->opp_token); } =20 static void exynos_bus_passive_exit(struct device *dev) @@ -179,18 +178,20 @@ static int exynos_bus_parent_parse_of(struct device_n= ode *np, struct exynos_bus *bus) { struct device *dev =3D bus->dev; - struct opp_table *opp_table; const char *vdd =3D "vdd"; int i, ret, count, size; + struct dev_pm_opp_config config =3D { + .regulator_names =3D &vdd, + .regulator_count =3D 1, + }; =20 - opp_table =3D dev_pm_opp_set_regulators(dev, &vdd, 1); - if (IS_ERR(opp_table)) { - ret =3D PTR_ERR(opp_table); - dev_err(dev, "failed to set regulators %d\n", ret); + ret =3D dev_pm_opp_set_config(dev, &config); + if (ret < 0) { + dev_err(dev, "failed to set OPP config %d\n", ret); return ret; } =20 - bus->opp_table =3D opp_table; + bus->opp_token =3D ret; =20 /* * Get the devfreq-event devices to get the current utilization of @@ -236,8 +237,7 @@ static int exynos_bus_parent_parse_of(struct device_nod= e *np, return 0; =20 err_regulator: - dev_pm_opp_put_regulators(bus->opp_table); - bus->opp_table =3D NULL; + dev_pm_opp_clear_config(bus->opp_token); =20 return ret; } @@ -459,8 +459,7 @@ static int exynos_bus_probe(struct platform_device *pde= v) dev_pm_opp_of_remove_table(dev); clk_disable_unprepare(bus->clk); err_reg: - dev_pm_opp_put_regulators(bus->opp_table); - bus->opp_table =3D NULL; + dev_pm_opp_clear_config(bus->opp_token); =20 return ret; } --=20 2.31.1.272.g89b43f80a514 From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8DCFC43334 for ; Fri, 1 Jul 2022 08:22:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234263AbiGAIWB (ORCPT ); Fri, 1 Jul 2022 04:22:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236048AbiGAIVd (ORCPT ); Fri, 1 Jul 2022 04:21:33 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E8D67125F for ; Fri, 1 Jul 2022 01:21:15 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id r1so1692119plo.10 for ; Fri, 01 Jul 2022 01:21:15 -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=aJVM4zFbFbhC4PcmmIcXH43PSItTV2w1+waf0FbvJO8=; b=ac3+8dQHtEe1GOgSD/+czOHQobsLexnh9mWvBEggRIwxaSkJBUDtOkg+DdQaX5UU4E /gF3RRVm1g4RdX3XjTJQAcgHRHoZT54dk8B20CgpadbZbkeIczX08V0uSVwJZ/2fHpOc BrxDO5WkUpbdEm5ZsGV4KXnf8tLMdR9fC5obVM1zvtSDdtsWzQqeuANKELx6Z0FiWqeh Xpy4r/vAGHlZOBjNPfjrlhLmEIdrQaRr2fS57CCpFMYLsBczqnDWqCURvTumj1Y6c1Mb sac7u8Q5HUOdteP+2VnJmr6qovBq50d5MAhM1sgP+0JN/+NPK4UjkYBMtVaMxEyWS+KA FaDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aJVM4zFbFbhC4PcmmIcXH43PSItTV2w1+waf0FbvJO8=; b=Fn/sYBdEDg2ElgFTVQelTJeHWLDueWMI2wtDGPzvqTNBNdPq3WEKihCcDB+twGqdgb 1AKXR/FpzbUkt84aonTc6DIPf6F7HORX/GqYsMNjXtVYhJRW6tj4IbW5S/j90UQP28xQ 6hImhepkLGiVJmLEkLYvDv8dGPEbS6+SqI+c5J9bT0y3pZAE25BRLtqwCT91JgDOb4cZ M+8C0MCdAlmAd+5AaBZj0NUifI0J9BzPxtB0cETjeDDpaOtfAeaT/QAZA2WjeSZ602ar CY+MNCnfObwn1SIUkLu8CbVj8aYTzxB1zas0DzSu/BgeWoHD/L7Ye+LGmdw9dYXyxKgW +lNg== X-Gm-Message-State: AJIora+wR43AgJ0+3cAvZbbDBpoAE6PnZXe/ocNfbWIO8K89U3x5wIy1 3jc+3BCcHh04CyzwkpJKpUCmj3jKVlCnag== X-Google-Smtp-Source: AGRyM1vu5xQ/FaApTDjk/0jnEWXTkKjAl95QQ8Gbqhs9UyvgMPjWnaNlxNRSi4k/foLg6slD829VNA== X-Received: by 2002:a17:902:f650:b0:15f:3a10:a020 with SMTP id m16-20020a170902f65000b0015f3a10a020mr18701639plg.61.1656663675180; Fri, 01 Jul 2022 01:21:15 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id n17-20020a056a0007d100b0051bada81bc7sm14907263pfu.161.2022.07.01.01.21.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:21:14 -0700 (PDT) From: Viresh Kumar To: MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , "Rafael J. Wysocki" , Stephen Boyd , Nishanth Menon , linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH V2 11/30] devfreq: sun8i: Migrate to dev_pm_opp_set_config() Date: Fri, 1 Jul 2022 13:50:06 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The OPP core now provides a unified API for setting all configuration types, i.e. dev_pm_opp_set_config(). Lets start using it. Signed-off-by: Viresh Kumar --- drivers/devfreq/sun8i-a33-mbus.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/devfreq/sun8i-a33-mbus.c b/drivers/devfreq/sun8i-a33-m= bus.c index 13d32213139f..0dcc13cae7d7 100644 --- a/drivers/devfreq/sun8i-a33-mbus.c +++ b/drivers/devfreq/sun8i-a33-mbus.c @@ -337,6 +337,10 @@ static int sun8i_a33_mbus_probe(struct platform_device= *pdev) unsigned int max_state; const char *err; int i, ret; + struct dev_pm_opp_config config =3D { + .clk_names =3D (const char *[]){ "dram" }, + .clk_count =3D 1, + }; =20 variant =3D device_get_match_data(dev); if (!variant) @@ -404,9 +408,9 @@ static int sun8i_a33_mbus_probe(struct platform_device = *pdev) priv->profile.freq_table =3D priv->freq_table; priv->profile.max_state =3D max_state; =20 - ret =3D devm_pm_opp_set_clkname(dev, "dram"); + ret =3D devm_pm_opp_set_config(dev, &config); if (ret) { - err =3D "failed to add OPP table\n"; + err =3D "failed to set OPP config\n"; goto err_unlock_mbus; } =20 --=20 2.31.1.272.g89b43f80a514 From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EC6CC43334 for ; Fri, 1 Jul 2022 08:22:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234391AbiGAIWJ (ORCPT ); Fri, 1 Jul 2022 04:22:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236254AbiGAIVf (ORCPT ); Fri, 1 Jul 2022 04:21:35 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5F9E70E41 for ; Fri, 1 Jul 2022 01:21:18 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id 23so1759089pgc.8 for ; Fri, 01 Jul 2022 01:21:18 -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=SmGTIYV9FDLFGI4jK1+FoR+lci5+sJh4AzD8/oQcdbg=; b=juyeYcmRqKE8ZfARk0lcbwy6tu+ZB0ulGjr/lLCu++TX5ZJk/CNv1KHk6nbl7kDM2m FmfADw75Fj/MiatBD/GA+5t+g8s7XaUAWdBMpklU2l0QsCOCirrASDzS33oug+YkJw8r FLKihZMXInXOWTmxwTBmz/Wd5iukHZbttsz4adkuxZLgaJbY8CdtXc2g7jscYPrubLNF uoxJbxww/g6lo64YvPf3OuQ6p5W0ziZ4mvofrS9xCkCRxv3zO8xy9XaAPlT3sy4cYoN3 AGzQ4GkFCYgATrIjP2F/EclWnHCLkeIpteF3yJcIEk/AGWd51itQu7O/x0XUIgFZ61Sr Q+uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SmGTIYV9FDLFGI4jK1+FoR+lci5+sJh4AzD8/oQcdbg=; b=3uw7lfE0dZfN0qmjP20tb3Oy7HYfZBAJfFpkXgNavbjPzsJO7IKB3kQS3ONo0iqhD/ VO/E1FDWCJeQtYYUuPzar/tyRxLF1+RqASiUBG9G2beJZNLkx3rdM+YPbx0rOX76DLn9 L+5g+q0flFl0qPtI9/9G0ADsUoI0BFhLy6h6lLoHPmI3gmr7ziUEC4FpIYRCN3uCcqyl rwD00eDaUt15QS+JrVcMLqgZSpNd9srT7A0VDl5oiAM1NP8wgVhPVZhJ24dvIW+iA7aq xEOeFfoPlLoIUpNuJ7yDOfNxxpcwM231/cusvQgxKLisGta/cKaW4uGs0JO/Z4akMC2W 3oqA== X-Gm-Message-State: AJIora8ogF3H+70GtUQ7/NJmzvPAhXyJaPkurlEBVZd4p1u6RifOiuBD Es48XBeAgQcbcf3laf6aLo6KURjgGe7AWQ== X-Google-Smtp-Source: AGRyM1uG7t68HKBiWzgw2xrep0YucaMynfNBRQTv5cXNo7Gg5Z/DX7PdOIAzDwjt/nml3pQ/mZYRaA== X-Received: by 2002:a63:86c7:0:b0:40d:af99:608 with SMTP id x190-20020a6386c7000000b0040daf990608mr11495152pgd.515.1656663678039; Fri, 01 Jul 2022 01:21:18 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id 72-20020a62154b000000b00522c5e40574sm3181115pfv.129.2022.07.01.01.21.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:21:17 -0700 (PDT) From: Viresh Kumar To: Dmitry Osipenko , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Thierry Reding , Jonathan Hunter Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , "Rafael J. Wysocki" , Stephen Boyd , Nishanth Menon , Dmitry Osipenko , linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 12/30] devfreq: tegra30: Migrate to dev_pm_opp_set_config() Date: Fri, 1 Jul 2022 13:50:07 +0530 Message-Id: <932a2d8ddad8e21456b583faf25a9b2a272d5d72.1656660185.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The OPP core now provides a unified API for setting all configuration types, i.e. dev_pm_opp_set_config(). Lets start using it. Tested-by: Dmitry Osipenko Signed-off-by: Viresh Kumar --- drivers/devfreq/tegra30-devfreq.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/devfreq/tegra30-devfreq.c b/drivers/devfreq/tegra30-de= vfreq.c index 65ecf17a36f4..30382bdfc655 100644 --- a/drivers/devfreq/tegra30-devfreq.c +++ b/drivers/devfreq/tegra30-devfreq.c @@ -830,6 +830,10 @@ static int tegra_devfreq_probe(struct platform_device = *pdev) unsigned int i; long rate; int err; + struct dev_pm_opp_config config =3D { + .supported_hw =3D &hw_version, + .supported_hw_count =3D 1, + }; =20 tegra =3D devm_kzalloc(&pdev->dev, sizeof(*tegra), GFP_KERNEL); if (!tegra) @@ -874,9 +878,9 @@ static int tegra_devfreq_probe(struct platform_device *= pdev) return err; } =20 - err =3D devm_pm_opp_set_supported_hw(&pdev->dev, &hw_version, 1); + err =3D devm_pm_opp_set_config(&pdev->dev, &config); if (err) { - dev_err(&pdev->dev, "Failed to set supported HW: %d\n", err); + dev_err(&pdev->dev, "Failed to set OPP config: %d\n", err); return err; } =20 --=20 2.31.1.272.g89b43f80a514 From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5423BC43334 for ; Fri, 1 Jul 2022 08:22:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232578AbiGAIWM (ORCPT ); Fri, 1 Jul 2022 04:22:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236264AbiGAIVh (ORCPT ); Fri, 1 Jul 2022 04:21:37 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F2B07127C for ; Fri, 1 Jul 2022 01:21:21 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id n10so1758386plp.0 for ; Fri, 01 Jul 2022 01:21:21 -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=3JX/iuVBCiH5yj/WHuJ1/f+3WaqUl5eDHzSMUfsG02Q=; b=oXr6tPXGRlwJyo7ncqnJ8UPZRb3uawOmoReKvVpwTiZjWFBXYflSM7jEaKzg8PZYPE dD/4ilotL0U7US5/tlJkTQmmuzQKM0G/yZFuhApDntNmMoKE/AVOST/FGLSgcrwIg6Ta P9DRyk09nOuLX3FhQ8BKO6hZrP1HDaUoTf5E8YxYOPBfNl3O4QiTqdMDTC5QvmAm0XgL LfzMOWe1uBs53DHy7YUSfj97XsELS/VwZMIKr+LaxQ8Pdshf9gt3DvKbl6oGyX02DQDc 8nOMM223R5lXDqAY0SJ1Hsu5QI3pT7pzqUqAZzWIrhfwUqai0bSpy66fdZnMiMEpi7Jq pE2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3JX/iuVBCiH5yj/WHuJ1/f+3WaqUl5eDHzSMUfsG02Q=; b=5hctzTiPJiqBowyyG9NZgCoK/+bebJA6IZgSQwcgjLeofn9SWjKt6+bOnr0eL4E7bs nEA8jT6slgsuoT/PdOThXX7z9HHhzY8tukXmU0ShFpfo8/hUanCKBEOb+UdUCdY6tzKr MOdtOG78p/4onnHpGoBgivqy9NA0OAPiG9lehT3N9LJVhb40I/PZ+ddTywr0XNFelFcH 3mv5iRk5BmCO36jHTX4Va8OuW08h7K/qpj0ntHMmcfcvfXuYpim0QX4n6hvhl/0/QZwb 9thT1j4hYzJlmtpMD3DptHi5IezGgCpD3FKIJ/7Lr7ChYdR7qqMwPwIfGTXU0Pc2QWzw LJJQ== X-Gm-Message-State: AJIora8REY+xmtZyFtbWNmu1ZaVRMXHwXjmhsKXwxB29LW8Y3mzpvcI2 JxiuQCNZS0HTG4vCvIyspegmEQ== X-Google-Smtp-Source: AGRyM1v9z853kLDeBAeq79Scb9HDzro3Uyn0gVbpfMw6suMfjPhB2mkfyUWMkJIrsml3S0jT+kWzwA== X-Received: by 2002:a17:903:40cd:b0:16a:2dcf:408f with SMTP id t13-20020a17090340cd00b0016a2dcf408fmr18611553pld.18.1656663680823; Fri, 01 Jul 2022 01:21:20 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id b21-20020a17090a8c9500b001ec8d191db4sm5883557pjo.17.2022.07.01.01.21.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:21:20 -0700 (PDT) From: Viresh Kumar To: Qiang Yu Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , "Rafael J. Wysocki" , Stephen Boyd , Nishanth Menon , dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 13/30] drm/lima: Migrate to dev_pm_opp_set_config() Date: Fri, 1 Jul 2022 13:50:08 +0530 Message-Id: <9e65578ab96ae33acbe7bcba664ef65663fff938.1656660185.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The OPP core now provides a unified API for setting all configuration types, i.e. dev_pm_opp_set_config(). Lets start using it. Signed-off-by: Viresh Kumar --- drivers/gpu/drm/lima/lima_devfreq.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/lima/lima_devfreq.c b/drivers/gpu/drm/lima/lim= a_devfreq.c index 8989e215dfc9..d8c67843fa1b 100644 --- a/drivers/gpu/drm/lima/lima_devfreq.c +++ b/drivers/gpu/drm/lima/lima_devfreq.c @@ -111,6 +111,12 @@ int lima_devfreq_init(struct lima_device *ldev) struct dev_pm_opp *opp; unsigned long cur_freq; int ret; + struct dev_pm_opp_config config =3D { + .regulator_names =3D (const char *[]){ "mali" }, + .regulator_count =3D 1, + .clk_names =3D (const char *[]){ "core" }, + .clk_count =3D 1, + }; =20 if (!device_property_present(dev, "operating-points-v2")) /* Optional, continue without devfreq */ @@ -118,11 +124,7 @@ int lima_devfreq_init(struct lima_device *ldev) =20 spin_lock_init(&ldevfreq->lock); =20 - ret =3D devm_pm_opp_set_clkname(dev, "core"); - if (ret) - return ret; - - ret =3D devm_pm_opp_set_regulators(dev, (const char *[]){ "mali" }, 1); + ret =3D devm_pm_opp_set_config(dev, &config); if (ret) { /* Continue if the optional regulator is missing */ if (ret !=3D -ENODEV) --=20 2.31.1.272.g89b43f80a514 From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B380DC43334 for ; Fri, 1 Jul 2022 08:22:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233967AbiGAIWS (ORCPT ); Fri, 1 Jul 2022 04:22:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236280AbiGAIVi (ORCPT ); Fri, 1 Jul 2022 04:21:38 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60BA871BC9 for ; Fri, 1 Jul 2022 01:21:24 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id r1so1692409plo.10 for ; Fri, 01 Jul 2022 01:21:24 -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=jb0snNKbqdGMcNSHmZUstipe/vA8ntyU7tLSAh8qCE4=; b=EmWdXESfxTD6CClfgXeW3XMNSv/G8xk8QvfxlF5biP6edTuTajQaVQMVDMpOdy7Fuv MwktxJ+WJTVnMxJhs1Gt4E6SyL9e0EQF3iWsiK/Aifv7j0qHi6OiVTmSQ1dunx/oI6ty bY8yGaJDED/u5I76xENmYt5NI3WaoCl+80vM3DMnJWlKurKeE2tZ6SzpuqU3dfPSRHJh E7NAgHUpWVjxfDsLEWGa636YIKIemPdqiFQEgVykN8HoNsjUSMcIIQPW5sDXdqkWtnmU 8+9h5nbQKWOjn7ZdmKio1PcWeIPAzY0nvAROsypuOs3sPOZvKhBZLZLJx4jsTf4+bhcg sgmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jb0snNKbqdGMcNSHmZUstipe/vA8ntyU7tLSAh8qCE4=; b=DHt2LsI0V0R4LeUNMxqkpVn+5j2tj+BYdRQ9j45rUTWbN4jL48J/WMAw7wK3tjCOh4 FoXg2918XjV6FLJyf57ivXSNwCt9+bKbtcTOYXpGcSHBHzt9aI0Mq+EKfKK5V2Sfhekd tBD2O5mjh3jeQ1ew8SzVX2q+MwaNXaUPdHxU5yUb0Zimw9T/3AbEeO6DOy91LdGuJMGE WXnAIristaK8Z8ACH3hgN7+fhS77rl7oF9sIgbUN3a8FTONhU5IONNZw2bPUhhyzT+h7 Z+jRIk/J08hLF/aC6jjiEakaz/F0SHlDrGh0Y5oce3OAQUmN4KPwTSoLGRaecGttyruu az3w== X-Gm-Message-State: AJIora+8Mb5jDmroRdVt+H8rdLLCb3wtV1P2p8jlStnuP03x7uinNEl3 rsHiUBK2v8YGr8CpLfNTrcMFLQ== X-Google-Smtp-Source: AGRyM1u7YOcVYA6e7JC8Afc3cO0uF+FowHj00X8PP+5fdNddz6P/PTLix/S0GqoELPlK91hqfqoM/g== X-Received: by 2002:a17:90a:e2c5:b0:1ec:ea7f:a85c with SMTP id fr5-20020a17090ae2c500b001ecea7fa85cmr15486494pjb.232.1656663684098; Fri, 01 Jul 2022 01:21:24 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id e12-20020a170902784c00b0016a35649186sm14830427pln.195.2022.07.01.01.21.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:21:23 -0700 (PDT) From: Viresh Kumar To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , "Rafael J. Wysocki" , Stephen Boyd , Nishanth Menon , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 14/30] drm/msm: Migrate to dev_pm_opp_set_config() Date: Fri, 1 Jul 2022 13:50:09 +0530 Message-Id: <31b74e43d3af263e1b943bca1dd3debe885521d8.1656660185.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The OPP core now provides a unified API for setting all configuration types, i.e. dev_pm_opp_set_config(). Lets start using it. Signed-off-by: Viresh Kumar --- drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 8 ++++++-- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 10 +++++----- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 6 +++++- drivers/gpu/drm/msm/dp/dp_ctrl.c | 6 +++++- drivers/gpu/drm/msm/dsi/dsi_host.c | 6 +++++- 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/ad= reno/a5xx_gpu.c index c424e9a37669..6ebb5a28c501 100644 --- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c @@ -1723,10 +1723,14 @@ static void check_speed_bin(struct device *dev) { struct nvmem_cell *cell; u32 val; + struct dev_pm_opp_config config =3D { + .supported_hw =3D &val, + .supported_hw_count =3D 1, + }; =20 /* * If the OPP table specifies a opp-supported-hw property then we have - * to set something with dev_pm_opp_set_supported_hw() or the table + * to set something with dev_pm_opp_set_config() or the table * doesn't get populated so pick an arbitrary value that should * ensure the default frequencies are selected but not conflict with any * actual bins @@ -1748,7 +1752,7 @@ static void check_speed_bin(struct device *dev) nvmem_cell_put(cell); } =20 - devm_pm_opp_set_supported_hw(dev, &val, 1); + devm_pm_opp_set_config(dev, &config); } =20 struct msm_gpu *a5xx_gpu_init(struct drm_device *dev) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/ad= reno/a6xx_gpu.c index 42ed9a3c4905..82801311f7d4 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -1800,6 +1800,10 @@ static int a6xx_set_supported_hw(struct device *dev,= struct adreno_rev rev) u32 supp_hw =3D UINT_MAX; u32 speedbin; int ret; + struct dev_pm_opp_config config =3D { + .supported_hw =3D &supp_hw, + .supported_hw_count =3D 1, + }; =20 ret =3D adreno_read_speedbin(dev, &speedbin); /* @@ -1818,11 +1822,7 @@ static int a6xx_set_supported_hw(struct device *dev,= struct adreno_rev rev) supp_hw =3D fuse_to_supp_hw(dev, rev, speedbin); =20 done: - ret =3D devm_pm_opp_set_supported_hw(dev, &supp_hw, 1); - if (ret) - return ret; - - return 0; + return devm_pm_opp_set_config(dev, &config); } =20 static const struct adreno_gpu_funcs funcs =3D { diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/= disp/dpu1/dpu_kms.c index e23e2552e802..2213ce52d2fa 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -1215,12 +1215,16 @@ static int dpu_kms_init(struct drm_device *ddev) struct dev_pm_opp *opp; int ret =3D 0; unsigned long max_freq =3D ULONG_MAX; + struct dev_pm_opp_config config =3D { + .clk_names =3D (const char *[]){ "core" }, + .clk_count =3D 1, + }; =20 dpu_kms =3D devm_kzalloc(&pdev->dev, sizeof(*dpu_kms), GFP_KERNEL); if (!dpu_kms) return -ENOMEM; =20 - ret =3D devm_pm_opp_set_clkname(dev, "core"); + ret =3D devm_pm_opp_set_config(dev, &config); if (ret) return ret; /* OPP table is optional */ diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.c b/drivers/gpu/drm/msm/dp/dp_c= trl.c index b7f5b8d3bbd6..0c8fc151b4be 100644 --- a/drivers/gpu/drm/msm/dp/dp_ctrl.c +++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c @@ -2022,6 +2022,10 @@ struct dp_ctrl *dp_ctrl_get(struct device *dev, stru= ct dp_link *link, { struct dp_ctrl_private *ctrl; int ret; + struct dev_pm_opp_config config =3D { + .clk_names =3D (const char *[]){ "ctrl_link" }, + .clk_count =3D 1, + }; =20 if (!dev || !panel || !aux || !link || !catalog) { @@ -2035,7 +2039,7 @@ struct dp_ctrl *dp_ctrl_get(struct device *dev, struc= t dp_link *link, return ERR_PTR(-ENOMEM); } =20 - ret =3D devm_pm_opp_set_clkname(dev, "ctrl_link"); + ret =3D devm_pm_opp_set_config(dev, &config); if (ret) { dev_err(dev, "invalid DP OPP table in device tree\n"); /* caller do PTR_ERR(opp_table) */ diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/d= si_host.c index a95d5df52653..35b6722d1cf9 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -2034,6 +2034,10 @@ int msm_dsi_host_init(struct msm_dsi *msm_dsi) struct msm_dsi_host *msm_host =3D NULL; struct platform_device *pdev =3D msm_dsi->pdev; int ret; + struct dev_pm_opp_config config =3D { + .clk_names =3D (const char *[]){ "byte" }, + .clk_count =3D 1, + }; =20 msm_host =3D devm_kzalloc(&pdev->dev, sizeof(*msm_host), GFP_KERNEL); if (!msm_host) { @@ -2095,7 +2099,7 @@ int msm_dsi_host_init(struct msm_dsi *msm_dsi) goto fail; } =20 - ret =3D devm_pm_opp_set_clkname(&pdev->dev, "byte"); + ret =3D devm_pm_opp_set_config(&pdev->dev, &config); if (ret) return ret; /* OPP table is optional */ --=20 2.31.1.272.g89b43f80a514 From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 935FFC43334 for ; Fri, 1 Jul 2022 08:23:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233336AbiGAIXT (ORCPT ); Fri, 1 Jul 2022 04:23:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231437AbiGAIVz (ORCPT ); Fri, 1 Jul 2022 04:21:55 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4310A71BDC for ; Fri, 1 Jul 2022 01:21:27 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id jb13so1699235plb.9 for ; Fri, 01 Jul 2022 01:21:27 -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=MggsQ4TY4XeBgvA7QVMGXMCN2KhkYB30faLk4meCgmY=; b=rs/NQg8B3YMz/mXdzfqsGOdveJ25PwZxde1vf73UXhbF5yk92CA9Jlpgam3cHheIz+ fzhXNzj9WbYhPukIx/QifaABEy4k6mAmPVzssxaxdU8XH4Zwvf32Mt4ujAyhrUwi7Dvu Rdmd4ZLrrjbPNPC7R24anUQBoxNTFyvJOFLoRH6i9+IpoFw9Rr88F3imH7ZcFACORMkl 1MMREqAd8Jkc10wZs5+Hz5+TCzm80Uha7wjOobc+ExAg1fUWK52q28mkJGkLKt0zQWLH 2cGq5zSLUbqY92VpoHLmzxJ5yfFDEl5UGRYgWVPfUIBFU0k7op4RU/DWdWathnO5TlA3 +tkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MggsQ4TY4XeBgvA7QVMGXMCN2KhkYB30faLk4meCgmY=; b=B8PiHIOyfDimjP+3+RSSaqGfVQ3YriSjxl+ljzI84fUhClDFE6bqk4u1qEq49Ifr5d o3CJcKo/4kjsj5wGomN6KKTVDcB/EjLEOZ89m0Ay3SCQ/+XhUq9RnqeBSgrnoJHhRF0F owNE5yMEJ8qP+G8Tt823aZePWPPfm1pbCs4ln/+xzrcIr2D/GZOtcod+CYRaTpF4N7AM lLrSSxgmAxa9OFLzf+DhV4E3GT+sgvUcgwWMJSV0jhliIy6VEwta37wCbJdYFC7PDING b4C0Ry+APxJ9nhcCn7EjbDyvNDuY8eAjcd+Kd7pQZ01Pm9nDMaXKkcCeYx3etE99gKNY xbPA== X-Gm-Message-State: AJIora81nGYUDy8H2sRb8uH/uewjPbBWDlqYNcUZrOiBBh1SUFmnETg8 6LHCk4D+dq/yK185LGrwIReQOw== X-Google-Smtp-Source: AGRyM1sOKtre5vBYoEvJpv35QmWxmGVHmbIKmanb1KOI/w0yrthBM5qY5HTR/cBv6eUk4S4fhX5bCw== X-Received: by 2002:a17:902:ea47:b0:16b:a612:208d with SMTP id r7-20020a170902ea4700b0016ba612208dmr10862224plg.96.1656663686760; Fri, 01 Jul 2022 01:21:26 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id i4-20020a17090aee8400b001eb162ffaa3sm5884839pjz.25.2022.07.01.01.21.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:21:26 -0700 (PDT) From: Viresh Kumar To: Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , "Rafael J. Wysocki" , Stephen Boyd , Nishanth Menon , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 15/30] drm/panfrost: Migrate to dev_pm_opp_set_config() Date: Fri, 1 Jul 2022 13:50:10 +0530 Message-Id: <1179832f813aafc02c408b65765f299e7f668ad3.1656660185.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The OPP core now provides a unified API for setting all configuration types, i.e. dev_pm_opp_set_config(). Lets start using it. Acked-by: Steven Price Signed-off-by: Viresh Kumar --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/= panfrost/panfrost_devfreq.c index 194af7f607a6..7826d9366d35 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -91,6 +91,10 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) struct devfreq *devfreq; struct thermal_cooling_device *cooling; struct panfrost_devfreq *pfdevfreq =3D &pfdev->pfdevfreq; + struct dev_pm_opp_config config =3D { + .regulator_names =3D pfdev->comp->supply_names, + .regulator_count =3D pfdev->comp->num_supplies, + }; =20 if (pfdev->comp->num_supplies > 1) { /* @@ -101,13 +105,12 @@ int panfrost_devfreq_init(struct panfrost_device *pfd= ev) return 0; } =20 - ret =3D devm_pm_opp_set_regulators(dev, pfdev->comp->supply_names, - pfdev->comp->num_supplies); + ret =3D devm_pm_opp_set_config(dev, &config); if (ret) { /* Continue if the optional regulator is missing */ if (ret !=3D -ENODEV) { if (ret !=3D -EPROBE_DEFER) - DRM_DEV_ERROR(dev, "Couldn't set OPP regulators\n"); + DRM_DEV_ERROR(dev, "Couldn't set OPP config\n"); return ret; } } --=20 2.31.1.272.g89b43f80a514 From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07B2ECCA482 for ; Fri, 1 Jul 2022 08:22:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233604AbiGAIWt (ORCPT ); Fri, 1 Jul 2022 04:22:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234116AbiGAIV5 (ORCPT ); Fri, 1 Jul 2022 04:21:57 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 285FA71255 for ; Fri, 1 Jul 2022 01:21:30 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id g16-20020a17090a7d1000b001ea9f820449so5686500pjl.5 for ; Fri, 01 Jul 2022 01:21:30 -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=63pbLSKne9f5UCaDcrJmMmenMVeEUp+bxWKacPvU73Q=; b=PRw8pWiNZY18pWGJgVJIoN7OQ1s2yw48mle6GY/4XbqXfOM8W+/dPuxPjnVsAfDGVD A8m3pSEoZP2W9Wg38cQ0bbaNVAzWswoC+nKCFc5XCEUUvMoqG+yW9f+wcJB9/ETVNZdE nKZmCNjpve7XuRAN7ahyVkdcfDMzxh43YpC8OXHMdkvtfaGo7J4qx9vShhtdTpHbehD5 wVHcFFMn7nLHFi/wvIRCCZVlt95Rq/qbO3FoUn/v11UMiq4rPMaLoG3T6vdbH0dMdE+P 8U33SaenNIGQFDAOssieTM5n/BXEZBYaAw6ptyOuBYLvlncREiMhWug52kkrzT9h7GP7 raLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=63pbLSKne9f5UCaDcrJmMmenMVeEUp+bxWKacPvU73Q=; b=te1y+ls96ybFXt1iKc4A6l8fdIrBt36AxKQOnI9R+X7QoxeQbLSw8q4KcfzOT0MDMg yIsG6EsOfMTufQ9kq0wAWJ0idChZQKlVlFEUR6kCgoBc9lD9cBvY1+gZ+7Ic8616awEV nBlgK0hxZAogRH24e6RGFvujGd/Z94r3JZAaIsygqyBx/eRqgmbBG78U3w+9iJnH00Ry Vu1LoxYYSmYLkLWA6JDjBh/43vDF3xiuA41k2LHmhxAdFoaOzScdHqergwFQ4qs3JkkS /OtGlYJxbVQnLblJ77W1ebwOUjR4MHnIFDtNm69RULh2T+Ty1rG383zpD48mwCk9Aiu7 DPpw== X-Gm-Message-State: AJIora/oBRfxuVZlPxI54+wUw7W0zpkoAhotJe03j754cpjOAydgMdDG 23D9SHMt+bhZKI6SF0bcIap0oA== X-Google-Smtp-Source: AGRyM1uxAmkNLUVQoSG5Xz0/hnQf267BwGjWNVZUTXaOfD1kC8GpNyCWX61Jw76VoQZ5wANEVlh6sw== X-Received: by 2002:a17:902:e84a:b0:16a:5435:b5fc with SMTP id t10-20020a170902e84a00b0016a5435b5fcmr20837549plg.119.1656663689707; Fri, 01 Jul 2022 01:21:29 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id d59-20020a17090a6f4100b001ec7ba41fe7sm6182063pjk.48.2022.07.01.01.21.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:21:29 -0700 (PDT) From: Viresh Kumar To: Thierry Reding , Jonathan Hunter Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , "Rafael J. Wysocki" , Stephen Boyd , Nishanth Menon , Dmitry Osipenko , dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 16/30] drm/tegra: Migrate to dev_pm_opp_set_config() Date: Fri, 1 Jul 2022 13:50:11 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The OPP core now provides a unified API for setting all configuration types, i.e. dev_pm_opp_set_config(). Lets start using it. Tested-by: Dmitry Osipenko Signed-off-by: Viresh Kumar --- drivers/gpu/drm/tegra/gr3d.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/tegra/gr3d.c b/drivers/gpu/drm/tegra/gr3d.c index a1fd3113ea96..05c45c104e13 100644 --- a/drivers/gpu/drm/tegra/gr3d.c +++ b/drivers/gpu/drm/tegra/gr3d.c @@ -389,6 +389,10 @@ static int gr3d_init_power(struct device *dev, struct = gr3d *gr3d) struct device_link *link; unsigned int i; int err; + struct dev_pm_opp_config config =3D { + .genpd_names =3D opp_genpd_names, + .virt_devs =3D &opp_virt_devs, + }; =20 err =3D of_count_phandle_with_args(dev->of_node, "power-domains", "#power-domain-cells"); @@ -421,7 +425,7 @@ static int gr3d_init_power(struct device *dev, struct g= r3d *gr3d) if (dev->pm_domain) return 0; =20 - err =3D devm_pm_opp_attach_genpd(dev, opp_genpd_names, &opp_virt_devs); + err =3D devm_pm_opp_set_config(dev, &config); if (err) return err; =20 --=20 2.31.1.272.g89b43f80a514 From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 114B8C43334 for ; Fri, 1 Jul 2022 08:23:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231697AbiGAIXB (ORCPT ); Fri, 1 Jul 2022 04:23:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233919AbiGAIV6 (ORCPT ); Fri, 1 Jul 2022 04:21:58 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2C5B70E4C for ; Fri, 1 Jul 2022 01:21:32 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id g20-20020a17090a579400b001ed52939d72so1961795pji.4 for ; Fri, 01 Jul 2022 01:21: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=I+uUN8YmF6Y3SMg45UrmTSTfreR+Uuwz5CwiR64yruQ=; b=ai3Ck45InrudUZgQWOt7Efro+1T4l8qeSZrIoa5VX0J5lQUZUvtOWQji0YMj37k3zg hAb2l8LXQJ7wf4HcLU5fpbPV5AoadiebA5ojy+FCW1TwljfqL04dqdpGsNFt8OcNH5co zMNl9alI9601sDUayUWxUJNzqnyUh7k28gVgpL5Px8ahRbeWq7SU+iOxN+MCLoptgTBp ITbDdXOwOW3/YpfHq2QUtFZt2SLmOU7AJrOksQwK+TKjG90hxHC89OBzVJZ/52Hhnb+r Ff+VEsOQ38lcF2bJgWBXSUUctNQd/YTk9tTOIz0+XfxFAGhZCJv1Fu3UR0LmArlQ0SCP MZIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=I+uUN8YmF6Y3SMg45UrmTSTfreR+Uuwz5CwiR64yruQ=; b=G7wyn6xVPg4yc6MwlVDEwyECROW0WEWukUBsown2ZyZxWDjdeDGqbQmvSjRtWeemvH 0qTFo9Y/FRXMThDoSDbTVkOrDOOH/Hh7dmFv4QGB6KlyJXYKXuMigJAr80pw+J/h+Z9e U+yZ4Ndq+9olc+lON2PD2aXfw/5WktIjukMv2QEaSoveCWZZD/k0FNbQS5EqcP9x2GM2 QJFgB6ceTuGuIoulFSSxAeCiebtRYIOzUo+aHASwTsbc143TjjPekUu3efiPRfw804pY YvYIMBUhvci8zvDrscJyMVKvpaWJ8sUrHXRNgaOFkK5LD0uehJO7iHCNMpcDunov2uZp p+sw== X-Gm-Message-State: AJIora8N9dN04KqpBPtPa6GEdxpaWOBqs4sj46KK76psoKjSzLxeieif qsdhm7nKyd6Clh1if33OWVBgrw== X-Google-Smtp-Source: AGRyM1sF4UOt+eefyjUdDM65skipT1RPGgPcN3j7d+pLAC1n7IhL0v/+hLjDRiJ6xNliShlWFibWdQ== X-Received: by 2002:a17:90b:1a81:b0:1ed:3c0:3abb with SMTP id ng1-20020a17090b1a8100b001ed03c03abbmr15494279pjb.5.1656663692462; Fri, 01 Jul 2022 01:21:32 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id g29-20020aa79f1d000000b0051c4f6d2d95sm15033596pfr.106.2022.07.01.01.21.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:21:32 -0700 (PDT) From: Viresh Kumar To: Stanimir Varbanov , Andy Gross , Bjorn Andersson Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , "Rafael J. Wysocki" , Stephen Boyd , Nishanth Menon , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 17/30] media: venus: Migrate to dev_pm_opp_set_config() Date: Fri, 1 Jul 2022 13:50:12 +0530 Message-Id: <989d085e6ff7ca6196e7076bba3aad8ac8851b00.1656660185.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The OPP core now provides a unified API for setting all configuration types, i.e. dev_pm_opp_set_config(). Lets start using it. Signed-off-by: Viresh Kumar --- drivers/media/platform/qcom/venus/pm_helpers.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media= /platform/qcom/venus/pm_helpers.c index cb48c5ff3dee..f68cc938ebff 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -294,12 +294,16 @@ static int load_scale_v1(struct venus_inst *inst) static int core_get_v1(struct venus_core *core) { int ret; + struct dev_pm_opp_config config =3D { + .clk_names =3D (const char *[]){ "core" }, + .clk_count =3D 1, + }; =20 ret =3D core_clks_get(core); if (ret) return ret; =20 - ret =3D devm_pm_opp_set_clkname(core->dev, "core"); + ret =3D devm_pm_opp_set_config(core->dev, &config); if (ret) return ret; =20 @@ -862,6 +866,10 @@ static int vcodec_domains_get(struct venus_core *core) const struct venus_resources *res =3D core->res; struct device *pd; unsigned int i; + struct dev_pm_opp_config config =3D { + .genpd_names =3D res->opp_pmdomain, + .virt_devs =3D &opp_virt_dev, + }; =20 if (!res->vcodec_pmdomains_num) goto skip_pmdomains; @@ -879,7 +887,7 @@ static int vcodec_domains_get(struct venus_core *core) return 0; =20 /* Attach the power domain for setting performance state */ - ret =3D devm_pm_opp_attach_genpd(dev, res->opp_pmdomain, &opp_virt_dev); + ret =3D devm_pm_opp_set_config(dev, &config); if (ret) goto opp_attach_err; =20 @@ -978,6 +986,10 @@ static int core_get_v4(struct venus_core *core) struct device *dev =3D core->dev; const struct venus_resources *res =3D core->res; int ret; + struct dev_pm_opp_config config =3D { + .clk_names =3D (const char *[]){ "core" }, + .clk_count =3D 1, + }; =20 ret =3D core_clks_get(core); if (ret) @@ -1003,7 +1015,7 @@ static int core_get_v4(struct venus_core *core) if (legacy_binding) return 0; =20 - ret =3D devm_pm_opp_set_clkname(dev, "core"); + ret =3D devm_pm_opp_set_config(dev, &config); if (ret) return ret; =20 --=20 2.31.1.272.g89b43f80a514 From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0065C43334 for ; Fri, 1 Jul 2022 08:22:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233329AbiGAIW5 (ORCPT ); Fri, 1 Jul 2022 04:22:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234645AbiGAIWB (ORCPT ); Fri, 1 Jul 2022 04:22:01 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6881D70E63 for ; Fri, 1 Jul 2022 01:21:35 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id 23so1759693pgc.8 for ; Fri, 01 Jul 2022 01:21:35 -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=bNEnKpORd3QNjxmd6zUBrP8J5Frzy4cYVk636zNrdD0=; b=NInfjvO3HxDbJt56x0UYfx+nwvC1lR93+qkcsX05NDwK5rNzTDLLw03Y/CGBpgN+0F 42bNNL8xJYwDLGgG/Ykhb8FwLm9q44K+YQeq6yGhoul+TvAZIvJZ7fQBSlgtSReLl3hU UrohJgZTbFVwxMOKGPQND7n6nVnq9+w0OMtzOM42N5ghKCaZN1xZ26FNFO61XNMS8jtc BfouMkbIzHbqaFMUQ0VLJub2rcav1Tnbg61uO893IIz0TTAd/So5sl/RDnLNuponV8Xn JQls62z6q0j1+ZvbzjXnFLzpiXo9QPhYOkKiSEq1lrbPT8fdvwRte6cDj0li4Wkh9Xp4 0V7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bNEnKpORd3QNjxmd6zUBrP8J5Frzy4cYVk636zNrdD0=; b=LVHITs7GpUyABmGRmsSOJl7FIiaXNixE43mKS/LSLHqPr7Wz6HgbJwkHLTLbNTSOE1 hjvV0VWzWHZu6xadUaFemDC32tePUzXqHp3GG/pzNDauih8n0sp9TXhiqP3ayJ9fXMGR d/YIGcvV0R5EwsI/ev4uDlvXuYLE3V966qGzhSiad4SBCY/tbDE7hbZcbIJs/gITxOEk nJxW6R0tKktI3py+0XzLIYVGAugC93Ubs69uJpm4yQfeB9bVEoBJ8pp5QVkU4Mp21TyY ZZpseRU0V8cNxRxh7mOrultEe71gnK3oicuTOfI+dSK5wAmUEffeLmVqi9W6Ep35xuce nhzg== X-Gm-Message-State: AJIora+IPHrpXk+rIYYcOCVzdcvID9WdRdoOE4dkwJR4iods662LT1v9 beDBMGpeg4TGuvvK9Nr5USCoOA== X-Google-Smtp-Source: AGRyM1uYcdqOf+57d5/HlFxYYKsxbNuIuRKJ9aqdI/aVgWcgYUkw2wQLaX4vKBZMZrBpE8TsLtScWA== X-Received: by 2002:a05:6a00:a12:b0:527:dba9:c416 with SMTP id p18-20020a056a000a1200b00527dba9c416mr15334406pfh.33.1656663695136; Fri, 01 Jul 2022 01:21:35 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id o12-20020a170902d4cc00b0016a3f9e4865sm15039024plg.148.2022.07.01.01.21.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:21:34 -0700 (PDT) From: Viresh Kumar To: Krzysztof Kozlowski , Thierry Reding , Jonathan Hunter Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , "Rafael J. Wysocki" , Stephen Boyd , Nishanth Menon , Dmitry Osipenko , linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH V2 18/30] memory: tegra: Migrate to dev_pm_opp_set_config() Date: Fri, 1 Jul 2022 13:50:13 +0530 Message-Id: <74e3e4c6f63ea155aebd1c113d99e39bc2f8fd80.1656660185.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The OPP core now provides a unified API for setting all configuration types, i.e. dev_pm_opp_set_config(). Lets start using it. Tested-by: Dmitry Osipenko Signed-off-by: Viresh Kumar --- drivers/memory/tegra/tegra124-emc.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/memory/tegra/tegra124-emc.c b/drivers/memory/tegra/teg= ra124-emc.c index 908f8d5392b2..8da6baa4c369 100644 --- a/drivers/memory/tegra/tegra124-emc.c +++ b/drivers/memory/tegra/tegra124-emc.c @@ -1395,15 +1395,18 @@ static int tegra_emc_interconnect_init(struct tegra= _emc *emc) static int tegra_emc_opp_table_init(struct tegra_emc *emc) { u32 hw_version =3D BIT(tegra_sku_info.soc_speedo_id); - struct opp_table *hw_opp_table; - int err; + int opp_token, err; + struct dev_pm_opp_config config =3D { + .supported_hw =3D &hw_version, + .supported_hw_count =3D 1, + }; =20 - hw_opp_table =3D dev_pm_opp_set_supported_hw(emc->dev, &hw_version, 1); - err =3D PTR_ERR_OR_ZERO(hw_opp_table); - if (err) { - dev_err(emc->dev, "failed to set OPP supported HW: %d\n", err); + err =3D dev_pm_opp_set_config(emc->dev, &config); + if (err < 0) { + dev_err(emc->dev, "failed to set OPP config: %d\n", err); return err; } + opp_token =3D err; =20 err =3D dev_pm_opp_of_add_table(emc->dev); if (err) { @@ -1430,7 +1433,7 @@ static int tegra_emc_opp_table_init(struct tegra_emc = *emc) remove_table: dev_pm_opp_of_remove_table(emc->dev); put_hw_table: - dev_pm_opp_put_supported_hw(hw_opp_table); + dev_pm_opp_clear_config(opp_token); =20 return err; } --=20 2.31.1.272.g89b43f80a514 From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1872BC43334 for ; Fri, 1 Jul 2022 08:23:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233291AbiGAIXH (ORCPT ); Fri, 1 Jul 2022 04:23:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234398AbiGAIWI (ORCPT ); Fri, 1 Jul 2022 04:22:08 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B19870E7D for ; Fri, 1 Jul 2022 01:21:38 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id m14-20020a17090a668e00b001ee6ece8368so5702345pjj.3 for ; Fri, 01 Jul 2022 01:21:38 -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=/5O8HtibDyhyKfPcXegSlcVtfe6YcZDhYRydgSEzbr0=; b=Q5+hIz3misrwGjtVkcwPGiY6SsSZJoHazFfpDneO8cv0SmpOfUE2TCUYFNf53aNpC5 ySuFYkkHvYZ0fCE0v1RMv6useoSkB+meDqAIMS3SMe/Ny6XJSG84u28lqRgA4F4YQRPA 3dLE+Z1hDroFKpraCga3cIab2AgkJKa0KJ3Ug1XI7IMozj+I85CW6jxkwCCStRfGfRHX H/VIuDY6xIUTomsG6LMeAIVUyPBnsCbwrbmP07Q4LqbNg8AxLEX6jwj1uskFJ27NqJS7 0aVDYtNpByYlvKJjBaf5VA5fktLznoOTngiOCBhzcEW9jKE/iS1r+mORXU9u4utkdw39 YdAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/5O8HtibDyhyKfPcXegSlcVtfe6YcZDhYRydgSEzbr0=; b=6Tg2P8San7WGRddb6ViJ2inYSuagbBt6rqxiQsumncNzSK6y9z+e3ihphQIHfG09J1 CvHlWpEDc6+IScmNhxWfjR2Nns1sGLYMEG0+bXzRRiyaY2QgGDbYH4LY6aZXkA6w/DDO ihmbLUPa982im9U19GF705K6GzHPl8QKqi/JGnnXuw9IxgELc7TuQF6S04Ljvp6ZyMgb 79L+QTIzPuJANhYRC/Uep2ojrusGg6e0bCNtD/i2UNEjJo9JbmozuVe+qaZIaNOWmI5i q3Eo+gDPsaTEsP6GXxmRsnV+T495B93/gdb8Z/XOtFq5WHP8wRj8PvHFqdkqni96DsJ/ woog== X-Gm-Message-State: AJIora9/qv6kI6hzydMw/BhMKOuh9kyVpMJIVWl5OGDCJAzYE81FAb3/ YOH++QyC+ct7NB/ZKJKC2RfKbA== X-Google-Smtp-Source: AGRyM1uE34LiugWoSOiCI/R/CIeUM3AeDcL6MBnSlwEJpw4aDlvU1YVki6qfw7/sbXujeSoA7MkgIg== X-Received: by 2002:a17:90b:1d0e:b0:1ef:1a2c:c628 with SMTP id on14-20020a17090b1d0e00b001ef1a2cc628mr15422174pjb.52.1656663697862; Fri, 01 Jul 2022 01:21:37 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id x2-20020a170902b40200b00168dadc7354sm14806724plr.78.2022.07.01.01.21.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:21:37 -0700 (PDT) From: Viresh Kumar To: Andy Gross , Bjorn Andersson , Adrian Hunter , Ulf Hansson Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , "Rafael J. Wysocki" , Stephen Boyd , Nishanth Menon , linux-mmc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 19/30] mmc: sdhci-msm: Migrate to dev_pm_opp_set_config() Date: Fri, 1 Jul 2022 13:50:14 +0530 Message-Id: <9c63b2dd7990e8215105774cf977231a841a5a31.1656660185.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The OPP core now provides a unified API for setting all configuration types, i.e. dev_pm_opp_set_config(). Lets start using it. Acked-by: Ulf Hansson Signed-off-by: Viresh Kumar --- Ulf, I have kept your Ack as the diff is really small, clk_names is an array now. drivers/mmc/host/sdhci-msm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c index e395411fb6fd..a018b45c5a9a 100644 --- a/drivers/mmc/host/sdhci-msm.c +++ b/drivers/mmc/host/sdhci-msm.c @@ -2559,6 +2559,10 @@ static int sdhci_msm_probe(struct platform_device *p= dev) const struct sdhci_msm_offset *msm_offset; const struct sdhci_msm_variant_info *var_info; struct device_node *node =3D pdev->dev.of_node; + struct dev_pm_opp_config opp_config =3D { + .clk_names =3D (const char *[]){ "core" }, + .clk_count =3D 1, + }; =20 host =3D sdhci_pltfm_init(pdev, &sdhci_msm_pdata, sizeof(*msm_host)); if (IS_ERR(host)) @@ -2631,7 +2635,7 @@ static int sdhci_msm_probe(struct platform_device *pd= ev) if (ret) goto bus_clk_disable; =20 - ret =3D devm_pm_opp_set_clkname(&pdev->dev, "core"); + ret =3D devm_pm_opp_set_config(&pdev->dev, &opp_config); if (ret) goto bus_clk_disable; =20 --=20 2.31.1.272.g89b43f80a514 From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10603CCA479 for ; Fri, 1 Jul 2022 08:22:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233815AbiGAIWv (ORCPT ); Fri, 1 Jul 2022 04:22:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235258AbiGAIWZ (ORCPT ); Fri, 1 Jul 2022 04:22:25 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26C0871BFC for ; Fri, 1 Jul 2022 01:21:41 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id h15-20020a17090a648f00b001ef3c529d77so4476527pjj.2 for ; Fri, 01 Jul 2022 01:21:41 -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=KAc+kN1ySAvqp/Eud8dE8Wbnfg0J+jhcZxT1spa0gTc=; b=HUaPH/BI6kU1br9WqbHqHqSqVN9ff10jniY8/NQouz1HB8c6uAVq/qJg/Mka0+sM/7 P2YRz4dSTvbvEJKl+GweFNhRyJPH7OJmozxlXWZ4447PLurjA6ER97g45KIwT3A7gBws jBo4qeHYyS88784WGlNCEXfGzPvSjEXYSsYBKIwoYHqG4LnA3nhUl2sHFxljWFtqWwkJ 2OBCbkZ9gnsQK1p96B8sOLetG0Vc40VTJK2kquhIrU/JjbsBx14jb2vxpmyBH/K6kw6g W4Hl+0u/Z3a3zt/G5J6L78nFvOkZNHq9NbmqtbJ3/DFGXheyKrTS+KeFP/MBmez4aMQt aXlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KAc+kN1ySAvqp/Eud8dE8Wbnfg0J+jhcZxT1spa0gTc=; b=L7vq8mIRv3snncM6E9uylx/g6at3RvlOZsXcdPy385fmcGesXqSAHegIueT54EC+LK q4OxxQzUKE4feo1jnCarSSLd7cW2mE5sIcTPdXlF7ur6rD6ISWsXFWO0BuHDTCPbTlzJ JLOyw81vOBc6QNzXEGon2deKLGW316lVJjo7VOlCfrlCcl03UGKRcnBjahaWcVr/wUWe I/a6OgsTRPsLJMpFZB7ig2oiz93rHhonhp/H7nPD/eszWRwU+NHFC+6WV+EUkjP/i4iJ 7uSYJWE/KBUyZpINhhJM3wjbm9ZfbZMd/VQtJxFBB2Ex5EHL92YI63yyqgxPIS6RqQLt Q7bQ== X-Gm-Message-State: AJIora8CYClwDer8gQov2h/E59sNWuMhY7WZH14fbvJZdBQFkkPqsWMn D1W8LeivUvY0BtJx2DP43kvMSA== X-Google-Smtp-Source: AGRyM1v1kqhqtK/oHYzbUIbUj2OqYg5rnC/os5FGevGXj5S7g/n8eBMUivPzzlqKWYPfnaz/Mz9mMQ== X-Received: by 2002:a17:903:41d2:b0:16a:2cca:4869 with SMTP id u18-20020a17090341d200b0016a2cca4869mr19791613ple.13.1656663700704; Fri, 01 Jul 2022 01:21:40 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id t2-20020a1709028c8200b0016a3248376esm14700448plo.181.2022.07.01.01.21.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:21:40 -0700 (PDT) From: Viresh Kumar To: Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org Subject: [PATCH V2 20/30] OPP: ti: Migrate to dev_pm_opp_set_config() Date: Fri, 1 Jul 2022 13:50:15 +0530 Message-Id: <2fc93a6fc1b07d0dec80e47376bf1dd53b6ad0ee.1656660185.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The OPP core now provides a unified API for setting all configuration types, i.e. dev_pm_opp_set_config(). Lets start using it. Signed-off-by: Viresh Kumar --- drivers/opp/ti-opp-supply.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/opp/ti-opp-supply.c b/drivers/opp/ti-opp-supply.c index bd4771f388ab..26e929377ebd 100644 --- a/drivers/opp/ti-opp-supply.c +++ b/drivers/opp/ti-opp-supply.c @@ -382,6 +382,9 @@ static int ti_opp_supply_probe(struct platform_device *= pdev) const struct of_device_id *match; const struct ti_opp_supply_of_data *of_data; int ret =3D 0; + struct dev_pm_opp_config config =3D { + .set_opp =3D ti_opp_supply_set_opp, + }; =20 match =3D of_match_device(ti_opp_supply_of_match, dev); if (!match) { @@ -405,9 +408,8 @@ static int ti_opp_supply_probe(struct platform_device *= pdev) return ret; } =20 - ret =3D PTR_ERR_OR_ZERO(dev_pm_opp_register_set_opp_helper(cpu_dev, - ti_opp_supply_set_opp)); - if (ret) + ret =3D dev_pm_opp_set_config(cpu_dev, &config); + if (ret < 0) _free_optimized_voltages(dev, &opp_data); =20 return ret; --=20 2.31.1.272.g89b43f80a514 From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E008C43334 for ; Fri, 1 Jul 2022 08:23:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233824AbiGAIXK (ORCPT ); Fri, 1 Jul 2022 04:23:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235985AbiGAIW1 (ORCPT ); Fri, 1 Jul 2022 04:22:27 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B225F72ECB for ; Fri, 1 Jul 2022 01:21:43 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id r1so1693055plo.10 for ; Fri, 01 Jul 2022 01:21: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=MkV+K20z+SrLBFTmdhzZDzVO0y1dFuzDvpTTKeDqBqE=; b=yzdRH8X6v7XjVbWCRmhQya6HuMcF5QDs3XhGwV0qUuOVC7N9Vjw37/iNdrHs/HUQxV y74PcIn1/3l0cSSs8nvADtawNuwHVw24Tj5pE/Y5YZ/SrnAIiyn37VtRAcWc6F2VTdPH Og0S9HJ7/t0sSbyZOabJ8szydSfhBN26udvPspUSGWc7QC1l21GFd2nWHe4uU2zGABcy 0llFeMCk2bCaTiH50HqxyLUS9wHn05ko/MYu3aAaOjbdab2MHDn8azhy3W61Sn1Fk7xe itPeaif5tkizyseanEr7m+J/gTbum7xOL3kVh0NZeeo1JdU5dV1hpkdf8pt99F63mI9/ p9JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MkV+K20z+SrLBFTmdhzZDzVO0y1dFuzDvpTTKeDqBqE=; b=1QWkvdsqKV7IHNuxjOLXNivPuCEuP94SJcCsUt9jD4B/bePzyBsSTpWwDQl1I7wZz4 c8vemBfK+cY9Y74k1/cpLVKPYcCnt+PDAujcz6YsXcIkwiOCQ8TtOL8d0A7xDDH9GCnl LP0pXqUqHuqhxkUQ/uGhw8Ofv/HLGCKtsXSUGeaPIyO4xzwx0PV31s8i8uIqFs2kN43O 1+hupipylcTCPiyYBQ9ZAJDRPGdEdc58OXnytL8Wm1gsOc8x4ky5V8XcVHLRIBNR7koC w1TQlXeJ80vD38UohOunYGw/4lE96ZVosgz6hpGfPS3Sr2nDIKyHtXNmjPgoRe+mnSIL b+Kw== X-Gm-Message-State: AJIora+UKZu9bJlo9hLw6wbWNrydm+27324491Z3rA7vfKOe9OGK0yFU 3r9De8Xqk1XZVCnZv8FRaK90meJUFQasAA== X-Google-Smtp-Source: AGRyM1u79Bc2S58wPQPdFbJkDACJ+sZ7/b/+tANdARi2YjYY5IPeQwazkB2h7rZACs0vqq6yAt9e4Q== X-Received: by 2002:a17:902:db08:b0:16a:4b7e:af5f with SMTP id m8-20020a170902db0800b0016a4b7eaf5fmr19884988plx.143.1656663703361; Fri, 01 Jul 2022 01:21:43 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id j8-20020a17090a318800b001ed2fae2271sm3331446pjb.31.2022.07.01.01.21.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:21:43 -0700 (PDT) From: Viresh Kumar To: Thierry Reding , Jonathan Hunter Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , "Rafael J. Wysocki" , Stephen Boyd , Nishanth Menon , Dmitry Osipenko , linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 21/30] soc/tegra: Add comment over devm_pm_opp_set_clkname() Date: Fri, 1 Jul 2022 13:50:16 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Explain why special handling was required here, it isn't obvious at all. Tested-by: Dmitry Osipenko Signed-off-by: Viresh Kumar --- drivers/soc/tegra/common.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/soc/tegra/common.c b/drivers/soc/tegra/common.c index 32c346b72635..9f3fdeb1a11c 100644 --- a/drivers/soc/tegra/common.c +++ b/drivers/soc/tegra/common.c @@ -108,6 +108,13 @@ int devm_tegra_core_dev_init_opp_table(struct device *= dev, u32 hw_version; int err; =20 + /* + * For some devices we don't have any OPP table in the DT, and in order + * to use the same code path for all the devices, we create a dummy OPP + * table for them via this call. The dummy OPP table is only capable of + * doing clk_set_rate() on invocation of dev_pm_opp_set_rate() and + * doesn't provide any other functionality. + */ err =3D devm_pm_opp_set_clkname(dev, NULL); if (err) { dev_err(dev, "failed to set OPP clk: %d\n", err); --=20 2.31.1.272.g89b43f80a514 From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 950AACCA479 for ; Fri, 1 Jul 2022 08:23:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234422AbiGAIXX (ORCPT ); Fri, 1 Jul 2022 04:23:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236272AbiGAIWb (ORCPT ); Fri, 1 Jul 2022 04:22:31 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFDF672ECF for ; Fri, 1 Jul 2022 01:21:46 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id w24so1915582pjg.5 for ; Fri, 01 Jul 2022 01:21:46 -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=dhuAUlxL6a2wqcLbBiio6+uEDAJd6LpL5jQUwIGjd+Y=; b=xuoDlNsMbbYjbf5K40c63W+oxOO2ayJobd0+7IcXkuEkBNqTF1PoOLTU2YepPNcQCy otKMcRGNKYW4t7Y6i345UxRRekCEEoHsvVpwa0N48AiXpwSHpn1lUUxdnIVqRTySs6Je //p8brfMIo9Kx7VS3I2MeKBBd2E/AGT0GIeMJVMrihp/VPDA0umCIk4MTKHTggEcQOa5 2dlQ/xC7B8V+lxOJQmX3LhuQldkh1fmJQ8g7lVXEY5YQdPVMr6XXj93C6Ofofvy7GLxB c4N/ZrAtbosldmENE7W/SeDQuk4+4Rl0B4TGvReCUFR60S8PHa8eOEZ6A9OFEOl6GuRf 73nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dhuAUlxL6a2wqcLbBiio6+uEDAJd6LpL5jQUwIGjd+Y=; b=HWletEazGia1edNA/XtJSGj4puAbu+DhHQQQXJHSx/dQewQZZraMpTe85U7fIMslxa L0z6/C1WcNgznBA6if8PZf2mrL6dc7LobTJaalCTWyQCMRxkCNgKdmn4eSnbJvs5YkA/ jk0adxZG1FNTo31YGcVQPjrtSsKK1w1nI346cFvyeBvtWKAiGo++bZlM8UvNuH9P0IFF BKuTIIBYLBtqJM+JbP73shKypEmaWQVJeNBl1xKU/GIolx502MluCE15K0aBSsm4laaZ 4FUO3CtqWKGfw6bhSpqOIEJf8RpBjeUPlovqpACoZq8ZSUaJV3n/2Amde1aECIY8iRve fTqw== X-Gm-Message-State: AJIora/rF+AHb9KDMHoj1ZfWTbu3/JS8mJS9VBh90ZIlhl10s+2ZbDsm WF2q/gByprov34pu0YN/Z1D/Kw== X-Google-Smtp-Source: AGRyM1tShnw3nTxkpxq16des5jB4bU3hNiiZjUQRlbjeaDKskqJ/swhYj0egAaSFGfeBgUwAgc7/tw== X-Received: by 2002:a17:90b:4b81:b0:1ec:adbe:3b0b with SMTP id lr1-20020a17090b4b8100b001ecadbe3b0bmr15524702pjb.147.1656663706133; Fri, 01 Jul 2022 01:21:46 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id i17-20020a17090320d100b0016a38f8ba7fsm14843586plb.162.2022.07.01.01.21.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:21:45 -0700 (PDT) From: Viresh Kumar To: Thierry Reding , Jonathan Hunter Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , "Rafael J. Wysocki" , Stephen Boyd , Nishanth Menon , Dmitry Osipenko , linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 22/30] soc/tegra: Migrate to dev_pm_opp_set_config() Date: Fri, 1 Jul 2022 13:50:17 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The OPP core now provides a unified API for setting all configuration types, i.e. dev_pm_opp_set_config(). Lets start using it. Tested-by: Dmitry Osipenko Signed-off-by: Viresh Kumar --- drivers/soc/tegra/common.c | 52 +++++++++++++++++++++----------------- drivers/soc/tegra/pmc.c | 8 ++++-- 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/drivers/soc/tegra/common.c b/drivers/soc/tegra/common.c index 9f3fdeb1a11c..6a099d764cce 100644 --- a/drivers/soc/tegra/common.c +++ b/drivers/soc/tegra/common.c @@ -107,36 +107,42 @@ int devm_tegra_core_dev_init_opp_table(struct device = *dev, { u32 hw_version; int err; - - /* - * For some devices we don't have any OPP table in the DT, and in order - * to use the same code path for all the devices, we create a dummy OPP - * table for them via this call. The dummy OPP table is only capable of - * doing clk_set_rate() on invocation of dev_pm_opp_set_rate() and - * doesn't provide any other functionality. - */ - err =3D devm_pm_opp_set_clkname(dev, NULL); - if (err) { - dev_err(dev, "failed to set OPP clk: %d\n", err); - return err; - } - - /* Tegra114+ doesn't support OPP yet */ - if (!of_machine_is_compatible("nvidia,tegra20") && - !of_machine_is_compatible("nvidia,tegra30")) - return -ENODEV; - - if (of_machine_is_compatible("nvidia,tegra20")) + struct dev_pm_opp_config config =3D { + /* + * For some devices we don't have any OPP table in the DT, and + * in order to use the same code path for all the devices, we + * create a dummy OPP table for them via this. The dummy OPP + * table is only capable of doing clk_set_rate() on invocation + * of dev_pm_opp_set_rate() and doesn't provide any other + * functionality. + */ + .clk_names =3D (const char *[]){ NULL }, + .clk_count =3D 1, + }; + + if (of_machine_is_compatible("nvidia,tegra20")) { hw_version =3D BIT(tegra_sku_info.soc_process_id); - else + config.supported_hw =3D &hw_version; + config.supported_hw_count =3D 1; + } else if (of_machine_is_compatible("nvidia,tegra30")) { hw_version =3D BIT(tegra_sku_info.soc_speedo_id); + config.supported_hw =3D &hw_version; + config.supported_hw_count =3D 1; + } =20 - err =3D devm_pm_opp_set_supported_hw(dev, &hw_version, 1); + err =3D devm_pm_opp_set_config(dev, &config); if (err) { - dev_err(dev, "failed to set OPP supported HW: %d\n", err); + dev_err(dev, "failed to set OPP config: %d\n", err); return err; } =20 + /* + * Tegra114+ doesn't support OPP yet, return early for non tegra20/30 + * case. + */ + if (!config.supported_hw) + return -ENODEV; + /* * Older device-trees have an empty OPP table, we will get * -ENODEV from devm_pm_opp_of_add_table() in this case. diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c index 5611d14d3ba2..64d74a227261 100644 --- a/drivers/soc/tegra/pmc.c +++ b/drivers/soc/tegra/pmc.c @@ -1386,6 +1386,10 @@ static int tegra_pmc_core_pd_add(struct tegra_pmc *p= mc, struct device_node *np) struct generic_pm_domain *genpd; const char *rname =3D "core"; int err; + struct dev_pm_opp_config config =3D { + .regulator_names =3D &rname, + .regulator_count =3D 1, + }; =20 genpd =3D devm_kzalloc(pmc->dev, sizeof(*genpd), GFP_KERNEL); if (!genpd) @@ -1395,10 +1399,10 @@ static int tegra_pmc_core_pd_add(struct tegra_pmc *= pmc, struct device_node *np) genpd->set_performance_state =3D tegra_pmc_core_pd_set_performance_state; genpd->opp_to_performance_state =3D tegra_pmc_core_pd_opp_to_performance_= state; =20 - err =3D devm_pm_opp_set_regulators(pmc->dev, &rname, 1); + err =3D devm_pm_opp_set_config(pmc->dev, &config); if (err) return dev_err_probe(pmc->dev, err, - "failed to set core OPP regulator\n"); + "failed to set OPP config\n"); =20 err =3D pm_genpd_init(genpd, NULL, false); if (err) { --=20 2.31.1.272.g89b43f80a514 From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 146EEC43334 for ; Fri, 1 Jul 2022 08:23:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234619AbiGAIX0 (ORCPT ); Fri, 1 Jul 2022 04:23:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236326AbiGAIWd (ORCPT ); Fri, 1 Jul 2022 04:22:33 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65AB372EF3 for ; Fri, 1 Jul 2022 01:21:49 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id s206so1781045pgs.3 for ; Fri, 01 Jul 2022 01:21:49 -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=RyxNHb/WQ8LrNXSqNKNJKWjupHwbyKneSV+LOjKKPXE=; b=uOVQ4n4h08T7IuN6KoAE+gQY7eWAHlRu5SCNDJLjFwYc5drt5YI6uQaz8KcufNiKYo ReQ9iDTSUK6OYYym6wlYwFFWXMXQKoYXLa9JzGzdGN4LHUeN2bllMjQZpGGOR0IdPaBT CkMH1PSTSlpDWIM4FG5C8nfWbqI4yKAr9TPy8mQnKY2wwRXaFEUoDegc5dj+8B13E4YE tS1IUkWYhr8gJdRQnSiunLrXqtLhEyhOTNyf/Bv2kdZ/POyi8Rvi3s8EJ6RfPR754XoE IqUMnYlSo+xUHUVmR4/7HTK4HJWHUCfWXWxk4CktXB42mQit+a8gjc2yWOqogvALGr90 4yuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RyxNHb/WQ8LrNXSqNKNJKWjupHwbyKneSV+LOjKKPXE=; b=QWTCiu1Z2QOPMM356/OArgO06PlplyNYDXIMjhubZJ12ZeVwVvSwO+XMzdUohNzW6Z bgiTtoCig2YEoEP8Uc3Zj7vI/04ynoN2Yz7u0BZObtfASWXUOmPQwO0RDMsOBYCHNzTP JCVgB5J+8jZL6zI7kB2uyz18WRZWzDwxOOahPpaMChxw8NJcZTgG8tMzZcYKWUyRAv6x pJPaQIOr3wJpPgwuqd5AplHGyV436xvo/S23HcG/mSflaCNQu3D7Gal5K74DdfBL46Ku Jlm3vM0gH8mNxFx6Gofy7tqfn3p569GQoSxeYR7av3gxKKRSCgCiyanDqsShSRB8MDjN nI6g== X-Gm-Message-State: AJIora/Jgo55EytRDBqwfvXHIehnuLqu8jTP4QRlIDt3L04ZHebHW1m6 VvBLSb4hZ1sdj4/R8ckDwNkOAPFlfx0Etw== X-Google-Smtp-Source: AGRyM1uSv2NbtHLEM0xY2pfQz10qfkB5qmBDotngIRAO8ceMzGxHfOY0DUW/Ub5fB+AniWRE/Wqv6w== X-Received: by 2002:a63:7448:0:b0:40c:7d4b:e7c6 with SMTP id e8-20020a637448000000b0040c7d4be7c6mr11292239pgn.140.1656663709116; Fri, 01 Jul 2022 01:21:49 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id j4-20020a170902c3c400b00163f5028fd6sm14979185plj.5.2022.07.01.01.21.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:21:48 -0700 (PDT) From: Viresh Kumar To: Andy Gross , Bjorn Andersson , Mark Brown Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , "Rafael J. Wysocki" , Stephen Boyd , Nishanth Menon , linux-arm-msm@vger.kernel.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 23/30] spi: qcom: Migrate to dev_pm_opp_set_config() Date: Fri, 1 Jul 2022 13:50:18 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The OPP core now provides a unified API for setting all configuration types, i.e. dev_pm_opp_set_config(). Lets start using it. Acked-by: Mark Brown Signed-off-by: Viresh Kumar --- Mark, I have kept your Ack as the diff is really small, clk_names is an arr= ay now. drivers/spi/spi-geni-qcom.c | 6 +++++- drivers/spi/spi-qcom-qspi.c | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-geni-qcom.c b/drivers/spi/spi-geni-qcom.c index 4e83cc5b445d..428585bae6a8 100644 --- a/drivers/spi/spi-geni-qcom.c +++ b/drivers/spi/spi-geni-qcom.c @@ -892,6 +892,10 @@ static int spi_geni_probe(struct platform_device *pdev) void __iomem *base; struct clk *clk; struct device *dev =3D &pdev->dev; + struct dev_pm_opp_config config =3D { + .clk_names =3D (const char *[]){ "se" }, + .clk_count =3D 1, + }; =20 irq =3D platform_get_irq(pdev, 0); if (irq < 0) @@ -922,7 +926,7 @@ static int spi_geni_probe(struct platform_device *pdev) mas->se.base =3D base; mas->se.clk =3D clk; =20 - ret =3D devm_pm_opp_set_clkname(&pdev->dev, "se"); + ret =3D devm_pm_opp_set_config(&pdev->dev, &config); if (ret) return ret; /* OPP table is optional */ diff --git a/drivers/spi/spi-qcom-qspi.c b/drivers/spi/spi-qcom-qspi.c index c334dfec4117..7e7732d61b25 100644 --- a/drivers/spi/spi-qcom-qspi.c +++ b/drivers/spi/spi-qcom-qspi.c @@ -458,6 +458,10 @@ static int qcom_qspi_probe(struct platform_device *pde= v) struct device *dev; struct spi_master *master; struct qcom_qspi *ctrl; + struct dev_pm_opp_config config =3D { + .clk_names =3D (const char *[]){ "core" }, + .clk_count =3D 1, + }; =20 dev =3D &pdev->dev; =20 @@ -529,7 +533,7 @@ static int qcom_qspi_probe(struct platform_device *pdev) master->handle_err =3D qcom_qspi_handle_err; master->auto_runtime_pm =3D true; =20 - ret =3D devm_pm_opp_set_clkname(&pdev->dev, "core"); + ret =3D devm_pm_opp_set_config(&pdev->dev, &config); if (ret) return ret; /* OPP table is optional */ --=20 2.31.1.272.g89b43f80a514 From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00F55C433EF for ; Fri, 1 Jul 2022 08:23:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235097AbiGAIXm (ORCPT ); Fri, 1 Jul 2022 04:23:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236459AbiGAIWk (ORCPT ); Fri, 1 Jul 2022 04:22:40 -0400 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 905837358E for ; Fri, 1 Jul 2022 01:21:52 -0700 (PDT) Received: by mail-pl1-x634.google.com with SMTP id m2so1723725plx.3 for ; Fri, 01 Jul 2022 01:21:52 -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=noUyypKftE40ROE3MTZpJWzx7cTIt4r0kQzFClbiivU=; b=anUlmuF/xY4AUURsJoVDq8a+6jE3vDG+mIzYb/pfyha56fzt1qv/ljhrQgm9o+bxve Zg0ABJUz/n+zxKw73Awhp/GQGUsZXYw7TDDlWjqgXybkdK0MERUWp/DkHyskqb5XPGe1 /rT6mYQuDi5mQB1f2FwcTxYkYRoe0c8N347t6v6kuxFQiAHypSUnhxg162GHuKs7y1dl jiXER+GymjG9CHTkKUPKi8QGEkoblsvt7ZT3NLr4WCCoDU3eNAsPSvublTsus9S+2cAD mw4DNjfGPTozwMVO1IvEyIq+Wha2nniZQBmxW7pqJJ158/L866DL+fEUU50434hmeVwP rsRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=noUyypKftE40ROE3MTZpJWzx7cTIt4r0kQzFClbiivU=; b=w/doCSrw/aukxnLYJi6LbP7isgJGdXMxOr9ZsF1R9rP2giZzv3RJqThvO8bB52RKGk M43NaHeI07cg3yi5Kl43kOeKWSkXfwfwC6zSDStgYk+VVpC/xqJftNlN1pTaD9zC3U5I k4mOYVFb7ANZL4AQ4tn0fTYCuEc07PwuPaMn3P8PmkWgLru8hJhzti1BGDx6ktYHU+qG 7y+ldV7lQcMkgVMLOc7J6BcpbhK7MwmY6btN2lNdj7fDdMfkaXy56JOwyrjLLOrod0mB YmSACLvpXHPpZ+G+wpRPf1oLv+KUeK3VCFowFeZBrYScwujcTSCJwQ1t+eV13TItwFMJ cdqg== X-Gm-Message-State: AJIora9z2SxcWTAVm08lopbN7IgGGuJcl8mttNpyWi3tTNsfUs4zZEwr R+G9F+Lwi9s/eWudGOuagM/Vcw== X-Google-Smtp-Source: AGRyM1vPBHYPyEmnR6pJN+h8oaoYat/QQyCYYbGDGAZ6ThwRx3949kCJYsfczawiYp2t+ZlbH+644w== X-Received: by 2002:a17:90a:f8d2:b0:1ec:b55b:2fdc with SMTP id l18-20020a17090af8d200b001ecb55b2fdcmr15087951pjd.115.1656663712055; Fri, 01 Jul 2022 01:21:52 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id y41-20020a056a001ca900b00518d06efbc8sm15099135pfw.98.2022.07.01.01.21.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:21:51 -0700 (PDT) From: Viresh Kumar To: Andy Gross , Bjorn Andersson , Greg Kroah-Hartman , Jiri Slaby Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , "Rafael J. Wysocki" , Stephen Boyd , Nishanth Menon , linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 24/30] serial: qcom: Migrate to dev_pm_opp_set_config() Date: Fri, 1 Jul 2022 13:50:19 +0530 Message-Id: <1f3328dafaf9e2944fba8ec9e55e3072a63a4192.1656660185.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The OPP core now provides a unified API for setting all configuration types, i.e. dev_pm_opp_set_config(). Lets start using it. Signed-off-by: Viresh Kumar --- drivers/tty/serial/qcom_geni_serial.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qco= m_geni_serial.c index 4733a233bd0c..ab667838d082 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -1347,6 +1347,10 @@ static int qcom_geni_serial_probe(struct platform_de= vice *pdev) int irq; bool console =3D false; struct uart_driver *drv; + struct dev_pm_opp_config config =3D { + .clk_names =3D (const char *[]){ "se" }, + .clk_count =3D 1, + }; =20 if (of_device_is_compatible(pdev->dev.of_node, "qcom,geni-debug-uart")) console =3D true; @@ -1430,7 +1434,7 @@ static int qcom_geni_serial_probe(struct platform_dev= ice *pdev) if (of_property_read_bool(pdev->dev.of_node, "cts-rts-swap")) port->cts_rts_swap =3D true; =20 - ret =3D devm_pm_opp_set_clkname(&pdev->dev, "se"); + ret =3D devm_pm_opp_set_config(&pdev->dev, &config); if (ret) return ret; /* OPP table is optional */ --=20 2.31.1.272.g89b43f80a514 From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E558C43334 for ; Fri, 1 Jul 2022 08:23:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233236AbiGAIXw (ORCPT ); Fri, 1 Jul 2022 04:23:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232594AbiGAIWn (ORCPT ); Fri, 1 Jul 2022 04:22:43 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EA5473599 for ; Fri, 1 Jul 2022 01:21:55 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id d14so1925270pjs.3 for ; Fri, 01 Jul 2022 01:21:55 -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=crygxFK87eEaJSYA5aOZhpi4Df1w8ys65sC4v5ffens=; b=kXecoXn8caaRsH99aYcVNrxI+LEFLvRi8Ie0t4paFBsjOalZPXlhCtB7JuiOtw72rw Gd0jvkF+/iXhZUo7/Ks6Ak9ylG/HCPCbB5bEIWn7hiedJ25UeCge4I0cMHJMwD6Z9rbx qLSBnAukCipBFg0iYDag8vIEcevYgP89jc9PCL0kNrayy0M5PLz3bEe/JNcl9wwbrcon 1Lsm4DALGAqKvwbWfHjp5ybDXaNuz7xomV700LtNOKJO5PvaGb/6T9erNJIjdA+fB0dE t7W6EXpCOt0IGN25ESQ8p2eJl7CUEwMi7RgINyJjl0MnL7gCsjt5itNoiqwPp+4Jsjrw fqcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=crygxFK87eEaJSYA5aOZhpi4Df1w8ys65sC4v5ffens=; b=ysGTqJSiWCGc+jlggJ9znso0pkjOx4VKnR65crzqrHYoiLGVXZS46JRmDi5dcVucpb 0YVkMPedkF7BpBbP8WhXkI35zk55HpdQkHxA7bIWkq6fPZW7dxnr1kEe9mV5PdCC1HGS OD0NRWzoCiy4TnnUSdG05L47wdnxKTppqYErRZhA9A7njih25Mnmf8FZM83jI7U0ttue wEEGiuKmY4L3YHiU9I6DRzZ5uvJ/9hY3RI6zlQeaqD6g8WrFJBdtZbaceSDGloe9pMNf Dwo2yIUdTdQngIIyFmlANmKh6I8zo2zkzwcq6jIONyzk/k9hgtWJBhx3CDiQX64zjjQ4 BQoQ== X-Gm-Message-State: AJIora8J5jxZgwUKDhn/hIkSSUlJsXWIZ1pdrupN7pWcNBIZnfKjXcL5 atOu0WdCbGKCYXXjWIWpv0WjxQ== X-Google-Smtp-Source: AGRyM1vEoNgBJMaMW7uCv2ZUckPLmdNP1SmWYvXp6o7N8Ccdms8gxqRDN4kS+TiqjGx/9pqo3LA0DQ== X-Received: by 2002:a17:90b:4b41:b0:1ec:cb06:2fa3 with SMTP id mi1-20020a17090b4b4100b001eccb062fa3mr14795607pjb.55.1656663715023; Fri, 01 Jul 2022 01:21:55 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id n3-20020a170902e54300b00161a9df4de8sm15046287plf.145.2022.07.01.01.21.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:21:54 -0700 (PDT) From: Viresh Kumar To: Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Dmitry Osipenko , linux-kernel@vger.kernel.org Subject: [PATCH V2 25/30] OPP: Remove dev_pm_opp_set_regulators() and friends Date: Fri, 1 Jul 2022 13:50:20 +0530 Message-Id: <0929adcdec2aad013235f36c8c5c2910b6f64a66.1656660185.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Now that everyone has migrated to dev_pm_opp_set_config(), remove the public interface for dev_pm_opp_set_regulators() and friends. Tested-by: Dmitry Osipenko Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 93 +++++++++--------------------------------- include/linux/pm_opp.h | 17 -------- 2 files changed, 19 insertions(+), 91 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index c77ea05ee2cd..fc3cd87ee7df 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -991,8 +991,8 @@ static int _set_opp_custom(const struct opp_table *opp_= table, int size; =20 /* - * We support this only if dev_pm_opp_set_regulators() was called - * earlier. + * We support this only if dev_pm_opp_set_config() was called + * earlier to set regulators. */ if (opp_table->sod_supplies) { size =3D sizeof(*old_opp->supplies) * opp_table->regulator_count; @@ -2097,7 +2097,7 @@ void dev_pm_opp_put_prop_name(struct opp_table *opp_t= able) EXPORT_SYMBOL_GPL(dev_pm_opp_put_prop_name); =20 /** - * dev_pm_opp_set_regulators() - Set regulator names for the device + * _opp_set_regulators() - Set regulator names for the device * @dev: Device for which regulator name is being set. * @names: Array of pointers to the names of the regulator. * @count: Number of regulators. @@ -2108,36 +2108,22 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_put_prop_name); * * This must be called before any OPPs are initialized for the device. */ -struct opp_table *dev_pm_opp_set_regulators(struct device *dev, - const char * const names[], - unsigned int count) +static int _opp_set_regulators(struct opp_table *opp_table, struct device = *dev, + const char * const names[], unsigned int count) { struct dev_pm_opp_supply *supplies; - struct opp_table *opp_table; struct regulator *reg; int ret, i; =20 - opp_table =3D _add_opp_table(dev, false); - if (IS_ERR(opp_table)) - return opp_table; - - /* This should be called before OPPs are initialized */ - if (WARN_ON(!list_empty(&opp_table->opp_list))) { - ret =3D -EBUSY; - goto err; - } - /* Another CPU that shares the OPP table has set the regulators ? */ if (opp_table->regulators) - return opp_table; + return 0; =20 opp_table->regulators =3D kmalloc_array(count, sizeof(*opp_table->regulators), GFP_KERNEL); - if (!opp_table->regulators) { - ret =3D -ENOMEM; - goto err; - } + if (!opp_table->regulators) + return -ENOMEM; =20 for (i =3D 0; i < count; i++) { reg =3D regulator_get_optional(dev, names[i]); @@ -2167,7 +2153,7 @@ struct opp_table *dev_pm_opp_set_regulators(struct de= vice *dev, } mutex_unlock(&opp_table->lock); =20 - return opp_table; + return 0; =20 free_regulators: while (i !=3D 0) @@ -2176,26 +2162,20 @@ struct opp_table *dev_pm_opp_set_regulators(struct = device *dev, kfree(opp_table->regulators); opp_table->regulators =3D NULL; opp_table->regulator_count =3D -1; -err: - dev_pm_opp_put_opp_table(opp_table); =20 - return ERR_PTR(ret); + return ret; } -EXPORT_SYMBOL_GPL(dev_pm_opp_set_regulators); =20 /** - * dev_pm_opp_put_regulators() - Releases resources blocked for regulator - * @opp_table: OPP table returned from dev_pm_opp_set_regulators(). + * _opp_put_regulators() - Releases resources blocked for regulator + * @opp_table: OPP table returned from _opp_set_regulators(). */ -void dev_pm_opp_put_regulators(struct opp_table *opp_table) +static void _opp_put_regulators(struct opp_table *opp_table) { int i; =20 - if (unlikely(!opp_table)) - return; - if (!opp_table->regulators) - goto put_opp_table; + return; =20 if (opp_table->enabled) { for (i =3D opp_table->regulator_count - 1; i >=3D 0; i--) @@ -2218,41 +2198,7 @@ void dev_pm_opp_put_regulators(struct opp_table *opp= _table) kfree(opp_table->regulators); opp_table->regulators =3D NULL; opp_table->regulator_count =3D -1; - -put_opp_table: - dev_pm_opp_put_opp_table(opp_table); -} -EXPORT_SYMBOL_GPL(dev_pm_opp_put_regulators); - -static void devm_pm_opp_regulators_release(void *data) -{ - dev_pm_opp_put_regulators(data); -} - -/** - * devm_pm_opp_set_regulators() - Set regulator names for the device - * @dev: Device for which regulator name is being set. - * @names: Array of pointers to the names of the regulator. - * @count: Number of regulators. - * - * This is a resource-managed variant of dev_pm_opp_set_regulators(). - * - * Return: 0 on success and errorno otherwise. - */ -int devm_pm_opp_set_regulators(struct device *dev, - const char * const names[], - unsigned int count) -{ - struct opp_table *opp_table; - - opp_table =3D dev_pm_opp_set_regulators(dev, names, count); - if (IS_ERR(opp_table)) - return PTR_ERR(opp_table); - - return devm_add_action_or_reset(dev, devm_pm_opp_regulators_release, - opp_table); } -EXPORT_SYMBOL_GPL(devm_pm_opp_set_regulators); =20 /** * dev_pm_opp_set_clkname() - Set clk name for the device @@ -2627,7 +2573,7 @@ static void _opp_clear_config(struct opp_config_data = *data) if (data->flags & OPP_CONFIG_GENPD) dev_pm_opp_detach_genpd(data->opp_table); if (data->flags & OPP_CONFIG_REGULATOR) - dev_pm_opp_put_regulators(data->opp_table); + _opp_put_regulators(data->opp_table); if (data->flags & OPP_CONFIG_SUPPORTED_HW) dev_pm_opp_put_supported_hw(data->opp_table); if (data->flags & OPP_CONFIG_REGULATOR_HELPER) @@ -2737,12 +2683,11 @@ int dev_pm_opp_set_config(struct device *dev, struc= t dev_pm_opp_config *config) =20 /* Configure supplies */ if (config->regulator_names) { - err =3D dev_pm_opp_set_regulators(dev, config->regulator_names, - config->regulator_count); - if (IS_ERR(err)) { - ret =3D PTR_ERR(err); + ret =3D _opp_set_regulators(opp_table, dev, + config->regulator_names, + config->regulator_count); + if (ret) goto err; - } =20 data->flags |=3D OPP_CONFIG_REGULATOR; } diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 467bed35130e..0dc45d4403ce 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -192,9 +192,6 @@ void dev_pm_opp_put_supported_hw(struct opp_table *opp_= table); int devm_pm_opp_set_supported_hw(struct device *dev, const u32 *versions, = unsigned int count); struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, const char = *name); void dev_pm_opp_put_prop_name(struct opp_table *opp_table); -struct opp_table *dev_pm_opp_set_regulators(struct device *dev, const char= * const names[], unsigned int count); -void dev_pm_opp_put_regulators(struct opp_table *opp_table); -int devm_pm_opp_set_regulators(struct device *dev, const char * const name= s[], unsigned int count); struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char *n= ame); void dev_pm_opp_put_clkname(struct opp_table *opp_table); int devm_pm_opp_set_clkname(struct device *dev, const char *name); @@ -412,20 +409,6 @@ static inline struct opp_table *dev_pm_opp_set_prop_na= me(struct device *dev, con =20 static inline void dev_pm_opp_put_prop_name(struct opp_table *opp_table) {} =20 -static inline struct opp_table *dev_pm_opp_set_regulators(struct device *d= ev, const char * const names[], unsigned int count) -{ - return ERR_PTR(-EOPNOTSUPP); -} - -static inline void dev_pm_opp_put_regulators(struct opp_table *opp_table) = {} - -static inline int devm_pm_opp_set_regulators(struct device *dev, - const char * const names[], - unsigned int count) -{ - return -EOPNOTSUPP; -} - static inline struct opp_table *dev_pm_opp_set_clkname(struct device *dev,= const char *name) { return ERR_PTR(-EOPNOTSUPP); --=20 2.31.1.272.g89b43f80a514 From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AF0CCCA479 for ; Fri, 1 Jul 2022 08:24:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234054AbiGAIYC (ORCPT ); Fri, 1 Jul 2022 04:24:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233477AbiGAIXE (ORCPT ); Fri, 1 Jul 2022 04:23:04 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63F3B7125B for ; Fri, 1 Jul 2022 01:21:58 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id h15-20020a17090a648f00b001ef3c529d77so4477145pjj.2 for ; Fri, 01 Jul 2022 01:21:58 -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=99kWlkiHu2hHhG+VivUNv2hFuFfBll5HWzikFasPu24=; b=DMaYsD3mTetExcF9rZkyMXNTFgskw2W7VSCO8XpnMcV+BdXpzuSIQjoYmJQcMb+Fgb /u+ShdYfU/zOZnM8Hd0M0regAz38Pp+lLJBG/LJzISbR4/GQZ9hzgshm5Nub24UvbQUv 85yy1hpSkgH/FDzQntvMivKB5pSIzJ26BWPuPSOlPdhRAnSlAIltLBhvhoyPD4TznYVk ogwISgBoDoHTWHazKomPCKky6bffH2CaFP2WtfImiQJ0Q8P1oscuQ2EzpEoP8ZDe/SMA 7vj35XhP0RmmvzpP/QWJGCINfCca7g+ZjypphBPBxPvo8EORDoNgUNnVHOSKPGy0QRa0 N/gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=99kWlkiHu2hHhG+VivUNv2hFuFfBll5HWzikFasPu24=; b=kTh1OjdhVjRi6Phbk4N0LP6jGeZfq2lTixf2Z0ojS1Pl271Clx6ezW81VMbIRFjmDd HwgcMjqcsNdeUxG+zJ1/ZVX/XU/ZgdcuIbVbgFaA0Wx8uI39+HVoxPuovrbFF7fiXA26 kl5MkTeiUZadoVqNdxVe40Lt1aVIeSRX4Jb3dkDkx08ZuUjnxgJ1zAphz6gM1zcqgvGZ TnR9N2m/ae9bp65nAp9ef5xxLgFDQWXtkFtUMWp7pNHa3j18n6Z+JmrIqJpAMKKdcrhf Z1N6FwXqdl2AqgITAaqmjLfJCfM7jZkwnTZIvT/AaX9oTg1K92jF7cIpksFz+NP3Mfut /1oA== X-Gm-Message-State: AJIora+8wxwtEpnDR04dHtBHL74+vhNW+DcNU4Cae5CMN2I/+9Hh+ovi UCn5JmLLnfKOZpZejvjF0PPm3A== X-Google-Smtp-Source: AGRyM1sh7RUfMx1CByYxFCx6CKvOSwM+Hwx5URm4/ODCBI+SqFSCoFTooP0GZDqY/CpgUpBkjBL/sw== X-Received: by 2002:a17:902:8309:b0:167:9a4c:cd58 with SMTP id bd9-20020a170902830900b001679a4ccd58mr19716789plb.166.1656663717968; Fri, 01 Jul 2022 01:21:57 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id f15-20020a170902684f00b0015e8d4eb2ddsm9372325pln.295.2022.07.01.01.21.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:21:57 -0700 (PDT) From: Viresh Kumar To: Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Dmitry Osipenko , linux-kernel@vger.kernel.org Subject: [PATCH V2 26/30] OPP: Remove dev_pm_opp_set_supported_hw() and friends Date: Fri, 1 Jul 2022 13:50:21 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Now that everyone has migrated to dev_pm_opp_set_config(), remove the public interface for dev_pm_opp_set_supported_hw() and friends. Tested-by: Dmitry Osipenko Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 87 ++++++++++-------------------------------- include/linux/pm_opp.h | 19 --------- 2 files changed, 20 insertions(+), 86 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index fc3cd87ee7df..66ffe501a7c8 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1952,7 +1952,7 @@ int _opp_add_v1(struct opp_table *opp_table, struct d= evice *dev, } =20 /** - * dev_pm_opp_set_supported_hw() - Set supported platforms + * _opp_set_supported_hw() - Set supported platforms * @dev: Device for which supported-hw has to be set. * @versions: Array of hierarchy of versions to match. * @count: Number of elements in the array. @@ -1962,84 +1962,39 @@ int _opp_add_v1(struct opp_table *opp_table, struct= device *dev, * OPPs, which are available for those versions, based on its 'opp-support= ed-hw' * property. */ -struct opp_table *dev_pm_opp_set_supported_hw(struct device *dev, - const u32 *versions, unsigned int count) +static int _opp_set_supported_hw(struct opp_table *opp_table, + const u32 *versions, unsigned int count) { - struct opp_table *opp_table; - - opp_table =3D _add_opp_table(dev, false); - if (IS_ERR(opp_table)) - return opp_table; - - /* Make sure there are no concurrent readers while updating opp_table */ - WARN_ON(!list_empty(&opp_table->opp_list)); - /* Another CPU that shares the OPP table has set the property ? */ if (opp_table->supported_hw) - return opp_table; + return 0; =20 opp_table->supported_hw =3D kmemdup(versions, count * sizeof(*versions), GFP_KERNEL); - if (!opp_table->supported_hw) { - dev_pm_opp_put_opp_table(opp_table); - return ERR_PTR(-ENOMEM); - } + if (!opp_table->supported_hw) + return -ENOMEM; =20 opp_table->supported_hw_count =3D count; =20 - return opp_table; + return 0; } -EXPORT_SYMBOL_GPL(dev_pm_opp_set_supported_hw); =20 /** - * dev_pm_opp_put_supported_hw() - Releases resources blocked for supporte= d hw - * @opp_table: OPP table returned by dev_pm_opp_set_supported_hw(). + * _opp_put_supported_hw() - Releases resources blocked for supported hw + * @opp_table: OPP table returned by _opp_set_supported_hw(). * * This is required only for the V2 bindings, and is called for a matching - * dev_pm_opp_set_supported_hw(). Until this is called, the opp_table stru= cture + * _opp_set_supported_hw(). Until this is called, the opp_table structure * will not be freed. */ -void dev_pm_opp_put_supported_hw(struct opp_table *opp_table) +static void _opp_put_supported_hw(struct opp_table *opp_table) { - if (unlikely(!opp_table)) - return; - - kfree(opp_table->supported_hw); - opp_table->supported_hw =3D NULL; - opp_table->supported_hw_count =3D 0; - - dev_pm_opp_put_opp_table(opp_table); -} -EXPORT_SYMBOL_GPL(dev_pm_opp_put_supported_hw); - -static void devm_pm_opp_supported_hw_release(void *data) -{ - dev_pm_opp_put_supported_hw(data); -} - -/** - * devm_pm_opp_set_supported_hw() - Set supported platforms - * @dev: Device for which supported-hw has to be set. - * @versions: Array of hierarchy of versions to match. - * @count: Number of elements in the array. - * - * This is a resource-managed variant of dev_pm_opp_set_supported_hw(). - * - * Return: 0 on success and errorno otherwise. - */ -int devm_pm_opp_set_supported_hw(struct device *dev, const u32 *versions, - unsigned int count) -{ - struct opp_table *opp_table; - - opp_table =3D dev_pm_opp_set_supported_hw(dev, versions, count); - if (IS_ERR(opp_table)) - return PTR_ERR(opp_table); - - return devm_add_action_or_reset(dev, devm_pm_opp_supported_hw_release, - opp_table); + if (opp_table->supported_hw) { + kfree(opp_table->supported_hw); + opp_table->supported_hw =3D NULL; + opp_table->supported_hw_count =3D 0; + } } -EXPORT_SYMBOL_GPL(devm_pm_opp_set_supported_hw); =20 /** * dev_pm_opp_set_prop_name() - Set prop-extn name @@ -2575,7 +2530,7 @@ static void _opp_clear_config(struct opp_config_data = *data) if (data->flags & OPP_CONFIG_REGULATOR) _opp_put_regulators(data->opp_table); if (data->flags & OPP_CONFIG_SUPPORTED_HW) - dev_pm_opp_put_supported_hw(data->opp_table); + _opp_put_supported_hw(data->opp_table); if (data->flags & OPP_CONFIG_REGULATOR_HELPER) dev_pm_opp_unregister_set_opp_helper(data->opp_table); if (data->flags & OPP_CONFIG_PROP_NAME) @@ -2671,12 +2626,10 @@ int dev_pm_opp_set_config(struct device *dev, struc= t dev_pm_opp_config *config) =20 /* Configure supported hardware */ if (config->supported_hw) { - err =3D dev_pm_opp_set_supported_hw(dev, config->supported_hw, - config->supported_hw_count); - if (IS_ERR(err)) { - ret =3D PTR_ERR(err); + ret =3D _opp_set_supported_hw(opp_table, config->supported_hw, + config->supported_hw_count); + if (ret) goto err; - } =20 data->flags |=3D OPP_CONFIG_SUPPORTED_HW; } diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 0dc45d4403ce..dfbb07b871a8 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -187,9 +187,6 @@ int dev_pm_opp_set_config(struct device *dev, struct de= v_pm_opp_config *config); int devm_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *c= onfig); void dev_pm_opp_clear_config(int token); =20 -struct opp_table *dev_pm_opp_set_supported_hw(struct device *dev, const u3= 2 *versions, unsigned int count); -void dev_pm_opp_put_supported_hw(struct opp_table *opp_table); -int devm_pm_opp_set_supported_hw(struct device *dev, const u32 *versions, = unsigned int count); struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, const char = *name); void dev_pm_opp_put_prop_name(struct opp_table *opp_table); struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char *n= ame); @@ -372,22 +369,6 @@ static inline int dev_pm_opp_unregister_notifier(struc= t device *dev, struct noti return -EOPNOTSUPP; } =20 -static inline struct opp_table *dev_pm_opp_set_supported_hw(struct device = *dev, - const u32 *versions, - unsigned int count) -{ - return ERR_PTR(-EOPNOTSUPP); -} - -static inline void dev_pm_opp_put_supported_hw(struct opp_table *opp_table= ) {} - -static inline int devm_pm_opp_set_supported_hw(struct device *dev, - const u32 *versions, - unsigned int count) -{ - return -EOPNOTSUPP; -} - static inline struct opp_table *dev_pm_opp_register_set_opp_helper(struct = device *dev, int (*set_opp)(struct dev_pm_set_opp_data *data)) { --=20 2.31.1.272.g89b43f80a514 From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F32E9C3F2D4 for ; Fri, 1 Jul 2022 08:24:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234645AbiGAIYL (ORCPT ); Fri, 1 Jul 2022 04:24:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234346AbiGAIXJ (ORCPT ); Fri, 1 Jul 2022 04:23:09 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A6F67126B for ; Fri, 1 Jul 2022 01:22:01 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id d14so1925455pjs.3 for ; Fri, 01 Jul 2022 01:22:01 -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=OYSJNC/pxLs1fKmIBWBqgxu7Bni+gXbmGVB5WErQGn4=; b=fu/mglIbqflokGQBdnsQPAuKVDtpaa1SyiudbdrhcujrHyHZunBCK7fAa7bo9Dsg1Y aahfMTCfkJjiMwKWBNKBykWqWB0XZaXyaPaHyK1iwhriKeMRsgr8NEorrctfM4+FdSS9 nG3BGsaYuJR/GNhhR64NgiFB7yJFZJI7Va0qwhdY2OkFmGNaKni9EIMGoqEXRz++t1bm xvzl8bPHHQ9JS8ty0pA73WI0JIuiakZuE1lfWycRCKMTsYGcjc6d1I5fDMm4/5KUMS0I aM/TKW3RbjI2TzUNTXqoACoq+J65JBIaHXkgwL1D2QKoe7UqVS5rkRqVPpv3tHV+tXMx r1aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OYSJNC/pxLs1fKmIBWBqgxu7Bni+gXbmGVB5WErQGn4=; b=3aApayUUS9cLa7ljV1/DeJDNK+L5TerDwde8sUo7E1D2b900w8hjzPWXXTn3YXVg+k MUY0qL7gzwi9rzu9BOYLvu4LbSLYgplyWvQTsex8okELKMd880oPfc2VZkKtWybgXQ9G sGxhXBFQxTrC1fkn/1LBqtcBTiIht6ZjpZkkYUeQIv/4r+t/96Z85CHbWqenvrhoqoAJ pG/MP3qYNNAqT2RFt3jHHn5xhi4n07sv21t+IlBi3FSwjnxRO9s1k99cMCGnB+5I9AvQ Cl6pEWfroMQTuyrk5BQnb5JiDfuzRWftal45ysOSj3QOl3dj2PsU/dvPm1pbOu02en4H 2pUQ== X-Gm-Message-State: AJIora+PXKtgUzJCWv6N9hl2nxN5MYG2cms+YE5vAe85Y4Yka9ShjEON yepO1qztLu8pTgZu8wzDhnIuZA== X-Google-Smtp-Source: AGRyM1ukDUHC1+0Sbq/sEDCtUq0uU0SW9/OZkM9DwAOTrWDcL7ZMMh7Bq9enUEWUKNuFKpB5TqXqwg== X-Received: by 2002:a17:903:1208:b0:16b:81f6:e992 with SMTP id l8-20020a170903120800b0016b81f6e992mr20105169plh.55.1656663720928; Fri, 01 Jul 2022 01:22:00 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id j2-20020a654282000000b003fe28130b12sm14651748pgp.62.2022.07.01.01.22.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:22:00 -0700 (PDT) From: Viresh Kumar To: Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Dmitry Osipenko , linux-kernel@vger.kernel.org Subject: [PATCH V2 27/30] OPP: Remove dev_pm_opp_set_clkname() and friends Date: Fri, 1 Jul 2022 13:50:22 +0530 Message-Id: <66e6aa4cc95262e2e6909a5fec79ec63ee7c1c6b.1656660185.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Now that everyone has migrated to dev_pm_opp_set_config(), remove the public interface for dev_pm_opp_set_clkname() and friends. Tested-by: Dmitry Osipenko Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 118 +++++++++++------------------------------ include/linux/pm_opp.h | 15 ------ 2 files changed, 32 insertions(+), 101 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 66ffe501a7c8..9b4f67994993 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -2156,104 +2156,57 @@ static void _opp_put_regulators(struct opp_table *= opp_table) } =20 /** - * dev_pm_opp_set_clkname() - Set clk name for the device - * @dev: Device for which clk name is being set. - * @name: Clk name. - * - * In order to support OPP switching, OPP layer needs to get pointer to the - * clock for the device. Simple cases work fine without using this routine= (i.e. - * by passing connection-id as NULL), but for a device with multiple clocks - * available, the OPP core needs to know the exact name of the clk to use. + * _opp_set_clknames() - Set clk names for the device + * @dev: Device for which clk names is being set. + * @names: Clk names. + * + * In order to support OPP switching, OPP layer needs to get pointers to t= he + * clocks for the device. Simple cases work fine without using this routine + * (i.e. by passing connection-id as NULL), but for a device with multiple + * clocks available, the OPP core needs to know the exact names of the clk= s to + * use. * * This must be called before any OPPs are initialized for the device. */ -struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char *n= ame) +static int _opp_set_clknames(struct opp_table *opp_table, struct device *d= ev, + const char * const names[], unsigned int count) { - struct opp_table *opp_table; - int ret; - - opp_table =3D _add_opp_table(dev, false); - if (IS_ERR(opp_table)) - return opp_table; - - /* This should be called before OPPs are initialized */ - if (WARN_ON(!list_empty(&opp_table->opp_list))) { - ret =3D -EBUSY; - goto err; - } + /* We support only one clock name for now */ + if (count !=3D 1) + return -EINVAL; =20 /* Another CPU that shares the OPP table has set the clkname ? */ if (opp_table->clk_configured) - return opp_table; + return 0; =20 /* clk shouldn't be initialized at this point */ - if (WARN_ON(opp_table->clk)) { - ret =3D -EBUSY; - goto err; - } + if (WARN_ON(opp_table->clk)) + return -EBUSY; =20 /* Find clk for the device */ - opp_table->clk =3D clk_get(dev, name); + opp_table->clk =3D clk_get(dev, names[0]); if (IS_ERR(opp_table->clk)) { - ret =3D dev_err_probe(dev, PTR_ERR(opp_table->clk), + return dev_err_probe(dev, PTR_ERR(opp_table->clk), "%s: Couldn't find clock\n", __func__); - goto err; } =20 opp_table->clk_configured =3D true; =20 - return opp_table; - -err: - dev_pm_opp_put_opp_table(opp_table); - - return ERR_PTR(ret); -} -EXPORT_SYMBOL_GPL(dev_pm_opp_set_clkname); - -/** - * dev_pm_opp_put_clkname() - Releases resources blocked for clk. - * @opp_table: OPP table returned from dev_pm_opp_set_clkname(). - */ -void dev_pm_opp_put_clkname(struct opp_table *opp_table) -{ - if (unlikely(!opp_table)) - return; - - clk_put(opp_table->clk); - opp_table->clk =3D ERR_PTR(-EINVAL); - opp_table->clk_configured =3D false; - - dev_pm_opp_put_opp_table(opp_table); -} -EXPORT_SYMBOL_GPL(dev_pm_opp_put_clkname); - -static void devm_pm_opp_clkname_release(void *data) -{ - dev_pm_opp_put_clkname(data); + return 0; } =20 /** - * devm_pm_opp_set_clkname() - Set clk name for the device - * @dev: Device for which clk name is being set. - * @name: Clk name. - * - * This is a resource-managed variant of dev_pm_opp_set_clkname(). - * - * Return: 0 on success and errorno otherwise. + * _opp_put_clknames() - Releases resources blocked for clks. + * @opp_table: OPP table returned from _opp_set_clknames(). */ -int devm_pm_opp_set_clkname(struct device *dev, const char *name) +static void _opp_put_clknames(struct opp_table *opp_table) { - struct opp_table *opp_table; - - opp_table =3D dev_pm_opp_set_clkname(dev, name); - if (IS_ERR(opp_table)) - return PTR_ERR(opp_table); - - return devm_add_action_or_reset(dev, devm_pm_opp_clkname_release, - opp_table); + if (opp_table->clk_configured) { + clk_put(opp_table->clk); + opp_table->clk =3D ERR_PTR(-EINVAL); + opp_table->clk_configured =3D false; + } } -EXPORT_SYMBOL_GPL(devm_pm_opp_set_clkname); =20 /** * dev_pm_opp_register_set_opp_helper() - Register custom set OPP helper @@ -2536,7 +2489,7 @@ static void _opp_clear_config(struct opp_config_data = *data) if (data->flags & OPP_CONFIG_PROP_NAME) dev_pm_opp_put_prop_name(data->opp_table); if (data->flags & OPP_CONFIG_CLK) - dev_pm_opp_put_clkname(data->opp_table); + _opp_put_clknames(data->opp_table); =20 dev_pm_opp_put_opp_table(data->opp_table); kfree(data); @@ -2587,17 +2540,10 @@ int dev_pm_opp_set_config(struct device *dev, struc= t dev_pm_opp_config *config) =20 /* Configure clocks */ if (config->clk_names) { - /* We support only one clock name for now */ - if (config->clk_count !=3D 1) { - ret =3D -EINVAL; - goto err; - } - - err =3D dev_pm_opp_set_clkname(dev, config->clk_names[0]); - if (IS_ERR(err)) { - ret =3D PTR_ERR(err); + ret =3D _opp_set_clknames(opp_table, dev, config->clk_names, + config->clk_count); + if (ret) goto err; - } =20 data->flags |=3D OPP_CONFIG_CLK; } diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index dfbb07b871a8..31062dc216f3 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -189,9 +189,6 @@ void dev_pm_opp_clear_config(int token); =20 struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, const char = *name); void dev_pm_opp_put_prop_name(struct opp_table *opp_table); -struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char *n= ame); -void dev_pm_opp_put_clkname(struct opp_table *opp_table); -int devm_pm_opp_set_clkname(struct device *dev, const char *name); struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev, i= nt (*set_opp)(struct dev_pm_set_opp_data *data)); void dev_pm_opp_unregister_set_opp_helper(struct opp_table *opp_table); int devm_pm_opp_register_set_opp_helper(struct device *dev, int (*set_opp)= (struct dev_pm_set_opp_data *data)); @@ -390,18 +387,6 @@ static inline struct opp_table *dev_pm_opp_set_prop_na= me(struct device *dev, con =20 static inline void dev_pm_opp_put_prop_name(struct opp_table *opp_table) {} =20 -static inline struct opp_table *dev_pm_opp_set_clkname(struct device *dev,= const char *name) -{ - return ERR_PTR(-EOPNOTSUPP); -} - -static inline void dev_pm_opp_put_clkname(struct opp_table *opp_table) {} - -static inline int devm_pm_opp_set_clkname(struct device *dev, const char *= name) -{ - return -EOPNOTSUPP; -} - static inline struct opp_table *dev_pm_opp_attach_genpd(struct device *dev= , const char * const *names, struct device ***virt_devs) { return ERR_PTR(-EOPNOTSUPP); --=20 2.31.1.272.g89b43f80a514 From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01337C433EF for ; Fri, 1 Jul 2022 08:24:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235127AbiGAIYR (ORCPT ); Fri, 1 Jul 2022 04:24:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234708AbiGAIXh (ORCPT ); Fri, 1 Jul 2022 04:23:37 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EECBE735A6 for ; Fri, 1 Jul 2022 01:22:04 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id n10so1759784plp.0 for ; Fri, 01 Jul 2022 01:22:04 -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=occJkHHu6x23QwNkK+mJiCbcRgGi/dU2FHiFOrlSYbY=; b=DfpOjzJqDmPgNlzLJG3E0dPhRhARULlPZWnEvfN4mlod27WHw/HwD4Ex/MzoFQt1lq ifaj5yfIE6DUaoG5Bt1xQzabIKqyNR6Q8zkPi3nHG8wYin+qUA65PczAZvfLhvzrl49v B/XMtibfwIDlAHCsII0r2WlMX7JCcVnq4WPQv/6RlKMJe7V4AwcBdUGILNGqlZF80IYB QqlCJQUhhzZ/8EBF6XHG6ZzpS0vfmOgQtZu1KGHr77B71D6PiWItGdTq5CJtpeym+DLx D8iMcM2dppFv/MbFWz1rCqIZ9EybSx18pDpie1y7iI+befL7X0w+1ht/ZG44Sd1eWdHa nCyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=occJkHHu6x23QwNkK+mJiCbcRgGi/dU2FHiFOrlSYbY=; b=17hhEnewnpY+oN6emjKPKO1Ly/9UpMHO12SnAdWxbDaZRvW3pbIVi5a8ahvrl/4db4 fzelTFHDe97rzuCvWzB53H/Zy1rL6ktCQs8A1LZwk3H2IbgEKrfo92l7MARWBdC7RUYt a5QFqHKV9Pjprh2vFlP2OMRGfeg+M1CZDaeQexwJfUAH/bt9p4c0uVLMeOPdqkku99iA xtYrhnKEKf1Qn56us67IQqOuLORsypb6p45mV+A/9S0lifVXCdRHjCWi7HhhxqyK0feO wB9mN9WExb9+/En4EyrGi49REBzJf857969vd8WMWNdfodgv+aoDz028PU8vNX4jqStZ DpHg== X-Gm-Message-State: AJIora/cfcajfc02+6ZAVULssR0fQn9E97S/osVX7hE2P7DafYA9IYTV u3jToFYpt47NuS9XvOe1TgsFcg== X-Google-Smtp-Source: AGRyM1tRf7aYIs8kaHYiDj0HDOku3J/sNXhwvKbJc66rflsZjIYdVXvYfQ3uUMgzTYIS8F1RbLX8mA== X-Received: by 2002:a17:90b:194:b0:1ec:96dd:fef2 with SMTP id t20-20020a17090b019400b001ec96ddfef2mr14832285pjs.195.1656663723813; Fri, 01 Jul 2022 01:22:03 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id a5-20020a1709027e4500b0016784c93f23sm14762687pln.197.2022.07.01.01.22.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:22:03 -0700 (PDT) From: Viresh Kumar To: Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Dmitry Osipenko , linux-kernel@vger.kernel.org Subject: [PATCH V2 28/30] OPP: Remove dev_pm_opp_register_set_opp_helper() and friends Date: Fri, 1 Jul 2022 13:50:23 +0530 Message-Id: <188bd4f0cdaa5aa79e5d112d2dd623c0603ef25c.1656660185.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Now that everyone has migrated to dev_pm_opp_set_config(), remove the public interface for dev_pm_opp_register_set_opp_helper() and friends. Tested-by: Dmitry Osipenko Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 89 ++++++++++-------------------------------- include/linux/pm_opp.h | 17 -------- 2 files changed, 20 insertions(+), 86 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 9b4f67994993..3040e735fe1c 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -2209,7 +2209,7 @@ static void _opp_put_clknames(struct opp_table *opp_t= able) } =20 /** - * dev_pm_opp_register_set_opp_helper() - Register custom set OPP helper + * _opp_register_set_opp_helper() - Register custom set OPP helper * @dev: Device for which the helper is getting registered. * @set_opp: Custom set OPP helper. * @@ -2218,32 +2218,18 @@ static void _opp_put_clknames(struct opp_table *opp= _table) * * This must be called before any OPPs are initialized for the device. */ -struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev, - int (*set_opp)(struct dev_pm_set_opp_data *data)) +static int _opp_register_set_opp_helper(struct opp_table *opp_table, + struct device *dev, int (*set_opp)(struct dev_pm_set_opp_data *data)) { struct dev_pm_set_opp_data *data; - struct opp_table *opp_table; - - if (!set_opp) - return ERR_PTR(-EINVAL); - - opp_table =3D _add_opp_table(dev, false); - if (IS_ERR(opp_table)) - return opp_table; - - /* This should be called before OPPs are initialized */ - if (WARN_ON(!list_empty(&opp_table->opp_list))) { - dev_pm_opp_put_opp_table(opp_table); - return ERR_PTR(-EBUSY); - } =20 /* Another CPU that shares the OPP table has set the helper ? */ if (opp_table->set_opp) - return opp_table; + return 0; =20 data =3D kzalloc(sizeof(*data), GFP_KERNEL); if (!data) - return ERR_PTR(-ENOMEM); + return -ENOMEM; =20 mutex_lock(&opp_table->lock); opp_table->set_opp_data =3D data; @@ -2256,60 +2242,26 @@ struct opp_table *dev_pm_opp_register_set_opp_helpe= r(struct device *dev, =20 opp_table->set_opp =3D set_opp; =20 - return opp_table; + return 0; } -EXPORT_SYMBOL_GPL(dev_pm_opp_register_set_opp_helper); =20 /** - * dev_pm_opp_unregister_set_opp_helper() - Releases resources blocked for - * set_opp helper - * @opp_table: OPP table returned from dev_pm_opp_register_set_opp_helper(= ). + * _opp_unregister_set_opp_helper() - Releases resources blocked for set_o= pp helper + * @opp_table: OPP table returned from _opp_register_set_opp_helper(). * * Release resources blocked for platform specific set_opp helper. */ -void dev_pm_opp_unregister_set_opp_helper(struct opp_table *opp_table) +static void _opp_unregister_set_opp_helper(struct opp_table *opp_table) { - if (unlikely(!opp_table)) - return; - - opp_table->set_opp =3D NULL; - - mutex_lock(&opp_table->lock); - kfree(opp_table->set_opp_data); - opp_table->set_opp_data =3D NULL; - mutex_unlock(&opp_table->lock); - - dev_pm_opp_put_opp_table(opp_table); -} -EXPORT_SYMBOL_GPL(dev_pm_opp_unregister_set_opp_helper); - -static void devm_pm_opp_unregister_set_opp_helper(void *data) -{ - dev_pm_opp_unregister_set_opp_helper(data); -} - -/** - * devm_pm_opp_register_set_opp_helper() - Register custom set OPP helper - * @dev: Device for which the helper is getting registered. - * @set_opp: Custom set OPP helper. - * - * This is a resource-managed version of dev_pm_opp_register_set_opp_helpe= r(). - * - * Return: 0 on success and errorno otherwise. - */ -int devm_pm_opp_register_set_opp_helper(struct device *dev, - int (*set_opp)(struct dev_pm_set_opp_data *data)) -{ - struct opp_table *opp_table; - - opp_table =3D dev_pm_opp_register_set_opp_helper(dev, set_opp); - if (IS_ERR(opp_table)) - return PTR_ERR(opp_table); + if (opp_table->set_opp) { + opp_table->set_opp =3D NULL; =20 - return devm_add_action_or_reset(dev, devm_pm_opp_unregister_set_opp_helpe= r, - opp_table); + mutex_lock(&opp_table->lock); + kfree(opp_table->set_opp_data); + opp_table->set_opp_data =3D NULL; + mutex_unlock(&opp_table->lock); + } } -EXPORT_SYMBOL_GPL(devm_pm_opp_register_set_opp_helper); =20 static void _opp_detach_genpd(struct opp_table *opp_table) { @@ -2485,7 +2437,7 @@ static void _opp_clear_config(struct opp_config_data = *data) if (data->flags & OPP_CONFIG_SUPPORTED_HW) _opp_put_supported_hw(data->opp_table); if (data->flags & OPP_CONFIG_REGULATOR_HELPER) - dev_pm_opp_unregister_set_opp_helper(data->opp_table); + _opp_unregister_set_opp_helper(data->opp_table); if (data->flags & OPP_CONFIG_PROP_NAME) dev_pm_opp_put_prop_name(data->opp_table); if (data->flags & OPP_CONFIG_CLK) @@ -2561,11 +2513,10 @@ int dev_pm_opp_set_config(struct device *dev, struc= t dev_pm_opp_config *config) =20 /* Configure opp helper */ if (config->set_opp) { - err =3D dev_pm_opp_register_set_opp_helper(dev, config->set_opp); - if (IS_ERR(err)) { - ret =3D PTR_ERR(err); + ret =3D _opp_register_set_opp_helper(opp_table, dev, + config->set_opp); + if (ret) goto err; - } =20 data->flags |=3D OPP_CONFIG_REGULATOR_HELPER; } diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 31062dc216f3..75edb6a14a76 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -189,9 +189,6 @@ void dev_pm_opp_clear_config(int token); =20 struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, const char = *name); void dev_pm_opp_put_prop_name(struct opp_table *opp_table); -struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev, i= nt (*set_opp)(struct dev_pm_set_opp_data *data)); -void dev_pm_opp_unregister_set_opp_helper(struct opp_table *opp_table); -int devm_pm_opp_register_set_opp_helper(struct device *dev, int (*set_opp)= (struct dev_pm_set_opp_data *data)); struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, const char *= const *names, struct device ***virt_devs); void dev_pm_opp_detach_genpd(struct opp_table *opp_table); int devm_pm_opp_attach_genpd(struct device *dev, const char * const *names= , struct device ***virt_devs); @@ -366,20 +363,6 @@ static inline int dev_pm_opp_unregister_notifier(struc= t device *dev, struct noti return -EOPNOTSUPP; } =20 -static inline struct opp_table *dev_pm_opp_register_set_opp_helper(struct = device *dev, - int (*set_opp)(struct dev_pm_set_opp_data *data)) -{ - return ERR_PTR(-EOPNOTSUPP); -} - -static inline void dev_pm_opp_unregister_set_opp_helper(struct opp_table *= opp_table) {} - -static inline int devm_pm_opp_register_set_opp_helper(struct device *dev, - int (*set_opp)(struct dev_pm_set_opp_data *data)) -{ - return -EOPNOTSUPP; -} - static inline struct opp_table *dev_pm_opp_set_prop_name(struct device *de= v, const char *name) { return ERR_PTR(-EOPNOTSUPP); --=20 2.31.1.272.g89b43f80a514 From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59DBAC43334 for ; Fri, 1 Jul 2022 08:24:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233477AbiGAIY0 (ORCPT ); Fri, 1 Jul 2022 04:24:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232001AbiGAIXt (ORCPT ); Fri, 1 Jul 2022 04:23:49 -0400 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF37971240 for ; Fri, 1 Jul 2022 01:22:07 -0700 (PDT) Received: by mail-pf1-x431.google.com with SMTP id 65so1761870pfw.11 for ; Fri, 01 Jul 2022 01:22:07 -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=XANjbhTBub5XHoBRNLuZd7Pb6PVjD97S/pZFiEt1YbY=; b=W7Cx0Lg4EyDga4Yut++xv8T+KBTxqHhtic0ssx/v94LPGfHUtZDXUx3qcvBM75BvBa wCjH7I2TvWbnLfBaJ37xv3n/uFYuc+yC4IZ9hoy2/8Oz0wV2563WaPtGlcStCdOysvmC zF5evz+GvUQYhPIavMYMJTGuUIhEptEuligjkj3BOtjVFOuBoe7vbnxBJvhCiqE80l1S F6VUnRerktHX/u8e/y7Ab4wozE7v+31JC3aYKGbrQ/rOdiWcLY7awhDC2+5OPkfwnvT0 tu7gUMHg7PpRZy3KIEx0wL71KoQf7dZwr5Zrg4vV8y1byAyhRXEICArmNhmtgVMsCgBR OTyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XANjbhTBub5XHoBRNLuZd7Pb6PVjD97S/pZFiEt1YbY=; b=WooYAYQ0MvcleijfblbEMwG3WxU8DCbOI7wEkHJ0QU1RSDOIUBNeTQzD0akHhNzA/L cRYHVxRChXdwgncm9Ymwc03IxFzvMKb3+Xk/LFtp4agfBl1TiJX8/+7ENhKFh+c1u5Si RDccoSbtUHxerCg6bkrSb+XMb8LlEyb6J9hu28oTgUch8LFoB5lu0GcD0bK9RYgQQhj4 D8TMNtTizt2hRFwBDW8hVLHygk00rfhYyXR1FaQOTAf1ZOoQLtPw+YhfDmzXqkhQF01j h+LvI7+rABzZ4d7VMWUh7X64JBPQfh91hta4JGXlDB2ro8b7Cq3U71A4v5gAWH2RRLPL K2og== X-Gm-Message-State: AJIora8bVk/zTWsVpEG4FHavJqFUKq5km8N6xVUzmP1m/SRFhdSsSLRz i1rwJyccz8pNE83i98XL8SCEeNfBXTsQBA== X-Google-Smtp-Source: AGRyM1t84AdrZW1AhlOsY0MmPKB6SaWGJmuBXLJYddD+X/DPin5PVzUGLJ1t4zWBJeGX8IaPMcVrKQ== X-Received: by 2002:a63:234f:0:b0:405:3981:be7 with SMTP id u15-20020a63234f000000b0040539810be7mr11390828pgm.15.1656663727059; Fri, 01 Jul 2022 01:22:07 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id p5-20020a1709026b8500b00163fbb1eec5sm14766729plk.229.2022.07.01.01.22.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:22:06 -0700 (PDT) From: Viresh Kumar To: Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Dmitry Osipenko , linux-kernel@vger.kernel.org Subject: [PATCH V2 29/30] OPP: Remove dev_pm_opp_attach_genpd() and friends Date: Fri, 1 Jul 2022 13:50:24 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Now that everyone has migrated to dev_pm_opp_set_config(), remove the public interface for dev_pm_opp_attach_genpd() and friends. Tested-by: Dmitry Osipenko Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 85 +++++++++--------------------------------- include/linux/pm_opp.h | 17 --------- 2 files changed, 18 insertions(+), 84 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 3040e735fe1c..17e9d272026f 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -2263,7 +2263,7 @@ static void _opp_unregister_set_opp_helper(struct opp= _table *opp_table) } } =20 -static void _opp_detach_genpd(struct opp_table *opp_table) +static void _detach_genpd(struct opp_table *opp_table) { int index; =20 @@ -2283,7 +2283,7 @@ static void _opp_detach_genpd(struct opp_table *opp_t= able) } =20 /** - * dev_pm_opp_attach_genpd - Attach genpd(s) for the device and save virtu= al device pointer + * _opp_attach_genpd - Attach genpd(s) for the device and save virtual dev= ice pointer * @dev: Consumer device for which the genpd is getting attached. * @names: Null terminated array of pointers containing names of genpd to = attach. * @virt_devs: Pointer to return the array of virtual devices. @@ -2304,30 +2304,23 @@ static void _opp_detach_genpd(struct opp_table *opp= _table) * The order of entries in the names array must match the order in which * "required-opps" are added in DT. */ -struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, - const char * const *names, struct device ***virt_devs) +static int _opp_attach_genpd(struct opp_table *opp_table, struct device *d= ev, + const char * const *names, struct device ***virt_devs) { - struct opp_table *opp_table; struct device *virt_dev; int index =3D 0, ret =3D -EINVAL; const char * const *name =3D names; =20 - opp_table =3D _add_opp_table(dev, false); - if (IS_ERR(opp_table)) - return opp_table; - if (opp_table->genpd_virt_devs) - return opp_table; + return 0; =20 /* * If the genpd's OPP table isn't already initialized, parsing of the * required-opps fail for dev. We should retry this after genpd's OPP * table is added. */ - if (!opp_table->required_opp_count) { - ret =3D -EPROBE_DEFER; - goto put_table; - } + if (!opp_table->required_opp_count) + return -EPROBE_DEFER; =20 mutex_lock(&opp_table->genpd_virt_dev_lock); =20 @@ -2360,78 +2353,38 @@ struct opp_table *dev_pm_opp_attach_genpd(struct de= vice *dev, *virt_devs =3D opp_table->genpd_virt_devs; mutex_unlock(&opp_table->genpd_virt_dev_lock); =20 - return opp_table; + return 0; =20 err: - _opp_detach_genpd(opp_table); + _detach_genpd(opp_table); unlock: mutex_unlock(&opp_table->genpd_virt_dev_lock); + return ret; =20 -put_table: - dev_pm_opp_put_opp_table(opp_table); - - return ERR_PTR(ret); } -EXPORT_SYMBOL_GPL(dev_pm_opp_attach_genpd); =20 /** - * dev_pm_opp_detach_genpd() - Detach genpd(s) from the device. - * @opp_table: OPP table returned by dev_pm_opp_attach_genpd(). + * _opp_detach_genpd() - Detach genpd(s) from the device. + * @opp_table: OPP table returned by _opp_attach_genpd(). * * This detaches the genpd(s), resets the virtual device pointers, and put= s the * OPP table. */ -void dev_pm_opp_detach_genpd(struct opp_table *opp_table) +static void _opp_detach_genpd(struct opp_table *opp_table) { - if (unlikely(!opp_table)) - return; - /* * Acquire genpd_virt_dev_lock to make sure virt_dev isn't getting * used in parallel. */ mutex_lock(&opp_table->genpd_virt_dev_lock); - _opp_detach_genpd(opp_table); + _detach_genpd(opp_table); mutex_unlock(&opp_table->genpd_virt_dev_lock); - - dev_pm_opp_put_opp_table(opp_table); } -EXPORT_SYMBOL_GPL(dev_pm_opp_detach_genpd); - -static void devm_pm_opp_detach_genpd(void *data) -{ - dev_pm_opp_detach_genpd(data); -} - -/** - * devm_pm_opp_attach_genpd - Attach genpd(s) for the device and save virt= ual - * device pointer - * @dev: Consumer device for which the genpd is getting attached. - * @names: Null terminated array of pointers containing names of genpd to = attach. - * @virt_devs: Pointer to return the array of virtual devices. - * - * This is a resource-managed version of dev_pm_opp_attach_genpd(). - * - * Return: 0 on success and errorno otherwise. - */ -int devm_pm_opp_attach_genpd(struct device *dev, const char * const *names, - struct device ***virt_devs) -{ - struct opp_table *opp_table; - - opp_table =3D dev_pm_opp_attach_genpd(dev, names, virt_devs); - if (IS_ERR(opp_table)) - return PTR_ERR(opp_table); - - return devm_add_action_or_reset(dev, devm_pm_opp_detach_genpd, - opp_table); -} -EXPORT_SYMBOL_GPL(devm_pm_opp_attach_genpd); =20 static void _opp_clear_config(struct opp_config_data *data) { if (data->flags & OPP_CONFIG_GENPD) - dev_pm_opp_detach_genpd(data->opp_table); + _opp_detach_genpd(data->opp_table); if (data->flags & OPP_CONFIG_REGULATOR) _opp_put_regulators(data->opp_table); if (data->flags & OPP_CONFIG_SUPPORTED_HW) @@ -2544,12 +2497,10 @@ int dev_pm_opp_set_config(struct device *dev, struc= t dev_pm_opp_config *config) =20 /* Attach genpds */ if (config->genpd_names) { - err =3D dev_pm_opp_attach_genpd(dev, config->genpd_names, - config->virt_devs); - if (IS_ERR(err)) { - ret =3D PTR_ERR(err); + ret =3D _opp_attach_genpd(opp_table, dev, config->genpd_names, + config->virt_devs); + if (ret) goto err; - } =20 data->flags |=3D OPP_CONFIG_GENPD; } diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 75edb6a14a76..63ad7870ae11 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -189,9 +189,6 @@ void dev_pm_opp_clear_config(int token); =20 struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, const char = *name); void dev_pm_opp_put_prop_name(struct opp_table *opp_table); -struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, const char *= const *names, struct device ***virt_devs); -void dev_pm_opp_detach_genpd(struct opp_table *opp_table); -int devm_pm_opp_attach_genpd(struct device *dev, const char * const *names= , struct device ***virt_devs); struct dev_pm_opp *dev_pm_opp_xlate_required_opp(struct opp_table *src_tab= le, struct opp_table *dst_table, struct dev_pm_opp *src_opp); int dev_pm_opp_xlate_performance_state(struct opp_table *src_table, struct= opp_table *dst_table, unsigned int pstate); int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq); @@ -370,20 +367,6 @@ static inline struct opp_table *dev_pm_opp_set_prop_na= me(struct device *dev, con =20 static inline void dev_pm_opp_put_prop_name(struct opp_table *opp_table) {} =20 -static inline struct opp_table *dev_pm_opp_attach_genpd(struct device *dev= , const char * const *names, struct device ***virt_devs) -{ - return ERR_PTR(-EOPNOTSUPP); -} - -static inline void dev_pm_opp_detach_genpd(struct opp_table *opp_table) {} - -static inline int devm_pm_opp_attach_genpd(struct device *dev, - const char * const *names, - struct device ***virt_devs) -{ - return -EOPNOTSUPP; -} - static inline int dev_pm_opp_set_config(struct device *dev, struct dev_pm_= opp_config *config) { return -EOPNOTSUPP; --=20 2.31.1.272.g89b43f80a514 From nobody Tue Apr 28 11:19:02 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 133E9C433EF for ; Fri, 1 Jul 2022 08:24:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236248AbiGAIYb (ORCPT ); Fri, 1 Jul 2022 04:24:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233994AbiGAIYB (ORCPT ); Fri, 1 Jul 2022 04:24:01 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B99C473904 for ; Fri, 1 Jul 2022 01:22:10 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id g7so1940724pjj.2 for ; Fri, 01 Jul 2022 01:22:10 -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=b7SNzEv2Y0yMoLr0YW1Rr4xpG010Vhadeq8nxGyUQ7g=; b=AuEQTOaWqe6eTjPtJvstSxgy2AATbxAiNYqJCbiYyAruGoKmeax/KPtEzFE8BZBJz3 oUJCxJM00l3FliWHHMVx+C0vwCxSL3G7n4I23Flwy07sszZiEamRbMbBgrcqQD332OaZ xZTBHv8XLmpiM2Zi4JAGOWsZFduMuM53NSHjVMYYzJoLNdeZkX1M0bAYPDeRPBXgCtJx AEJmetHGYtoKEKviGJ3y1QgRm4TzV0yqSFfbg4UfePNRkwYRnthFiLRgXRN1C/gcZMb7 K7iN+pu5eTUo2DccCPImrvoqwM+8Yx8woObRknJvjFZqKBMJtRXoCEoGng4XGfNQ0J1j giGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=b7SNzEv2Y0yMoLr0YW1Rr4xpG010Vhadeq8nxGyUQ7g=; b=rpzC3raSVJk+wyQzhGfVDNK7PdE5NdL2HqZvbpSSwGbZcKQFxLuzqJxrq1IaVsxB/z RJnRS5f9nMU+7TxG9OOew7LTG7JxjTMzTDl+uzwwsCQm6GzUNn6qOATFw9714n5IsfUv V2jVW1pG2/lWO1O1Z0L+6lhCVkJ7pGq8kS2/n4flLrxLawoHGmVH1D6/GmBIjxFMOTYT 0/ZImbFl4jVSqwMGcvFgxzLUmXX7PWdMj50VbEjhJxVrxZuNlCz3z4DHr7T61qDLOI8+ vKfjvyUVovHv2zkDk6ELa5Ai1kfwu5utyXEvO5YrPAwSge02dA0VpY21nlvm4nbVXUlw 0kGA== X-Gm-Message-State: AJIora+72wTlQRl83EqGO9wTC7D7Q6VpaG2x/gMOcgvXvL7SlKX2NuOT lkDame7Xsi29ZriCfjc2kv1Uqg== X-Google-Smtp-Source: AGRyM1umn8qHkGZedvpCETfMBY/tg0uf0IicbyM848kvybseXS0QBaHz8B9yPUnGvGAzb16e6fVmtg== X-Received: by 2002:a17:902:e983:b0:16a:2221:fc99 with SMTP id f3-20020a170902e98300b0016a2221fc99mr18533979plb.19.1656663730172; Fri, 01 Jul 2022 01:22:10 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id s26-20020a65645a000000b0040c755b7651sm14813778pgv.41.2022.07.01.01.22.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:22:09 -0700 (PDT) From: Viresh Kumar To: Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Dmitry Osipenko , linux-kernel@vger.kernel.org Subject: [PATCH V2 30/30] OPP: Remove dev_pm_opp_set_prop_name() and friends Date: Fri, 1 Jul 2022 13:50:25 +0530 Message-Id: <100facac98a8f481fdb4f3cedd6a760c627d0239.1656660185.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Now that everyone has migrated to dev_pm_opp_set_config(), remove the public interface for dev_pm_opp_set_prop_name() and friends. Tested-by: Dmitry Osipenko Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 55 ++++++++++++++---------------------------- include/linux/pm_opp.h | 9 ------- 2 files changed, 18 insertions(+), 46 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 17e9d272026f..75bb570d30e4 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1997,7 +1997,7 @@ static void _opp_put_supported_hw(struct opp_table *o= pp_table) } =20 /** - * dev_pm_opp_set_prop_name() - Set prop-extn name + * _opp_set_prop_name() - Set prop-extn name * @dev: Device for which the prop-name has to be set. * @name: name to postfix to properties. * @@ -2006,50 +2006,33 @@ static void _opp_put_supported_hw(struct opp_table = *opp_table) * which the extension will apply are opp-microvolt and opp-microamp. OPP = core * should postfix the property name with - while looking for them. */ -struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, const char = *name) +static int _opp_set_prop_name(struct opp_table *opp_table, const char *nam= e) { - struct opp_table *opp_table; - - opp_table =3D _add_opp_table(dev, false); - if (IS_ERR(opp_table)) - return opp_table; - - /* Make sure there are no concurrent readers while updating opp_table */ - WARN_ON(!list_empty(&opp_table->opp_list)); - /* Another CPU that shares the OPP table has set the property ? */ - if (opp_table->prop_name) - return opp_table; - - opp_table->prop_name =3D kstrdup(name, GFP_KERNEL); if (!opp_table->prop_name) { - dev_pm_opp_put_opp_table(opp_table); - return ERR_PTR(-ENOMEM); + opp_table->prop_name =3D kstrdup(name, GFP_KERNEL); + if (!opp_table->prop_name) + return -ENOMEM; } =20 - return opp_table; + return 0; } -EXPORT_SYMBOL_GPL(dev_pm_opp_set_prop_name); =20 /** - * dev_pm_opp_put_prop_name() - Releases resources blocked for prop-name - * @opp_table: OPP table returned by dev_pm_opp_set_prop_name(). + * _opp_put_prop_name() - Releases resources blocked for prop-name + * @opp_table: OPP table returned by _opp_set_prop_name(). * * This is required only for the V2 bindings, and is called for a matching - * dev_pm_opp_set_prop_name(). Until this is called, the opp_table structu= re + * _opp_set_prop_name(). Until this is called, the opp_table structure * will not be freed. */ -void dev_pm_opp_put_prop_name(struct opp_table *opp_table) +static void _opp_put_prop_name(struct opp_table *opp_table) { - if (unlikely(!opp_table)) - return; - - kfree(opp_table->prop_name); - opp_table->prop_name =3D NULL; - - dev_pm_opp_put_opp_table(opp_table); + if (opp_table->prop_name) { + kfree(opp_table->prop_name); + opp_table->prop_name =3D NULL; + } } -EXPORT_SYMBOL_GPL(dev_pm_opp_put_prop_name); =20 /** * _opp_set_regulators() - Set regulator names for the device @@ -2392,7 +2375,7 @@ static void _opp_clear_config(struct opp_config_data = *data) if (data->flags & OPP_CONFIG_REGULATOR_HELPER) _opp_unregister_set_opp_helper(data->opp_table); if (data->flags & OPP_CONFIG_PROP_NAME) - dev_pm_opp_put_prop_name(data->opp_table); + _opp_put_prop_name(data->opp_table); if (data->flags & OPP_CONFIG_CLK) _opp_put_clknames(data->opp_table); =20 @@ -2419,7 +2402,7 @@ static void _opp_clear_config(struct opp_config_data = *data) */ int dev_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *co= nfig) { - struct opp_table *opp_table, *err; + struct opp_table *opp_table; struct opp_config_data *data; unsigned int id; int ret; @@ -2455,11 +2438,9 @@ int dev_pm_opp_set_config(struct device *dev, struct= dev_pm_opp_config *config) =20 /* Configure property names */ if (config->prop_name) { - err =3D dev_pm_opp_set_prop_name(dev, config->prop_name); - if (IS_ERR(err)) { - ret =3D PTR_ERR(err); + ret =3D _opp_set_prop_name(opp_table, config->prop_name); + if (ret) goto err; - } =20 data->flags |=3D OPP_CONFIG_PROP_NAME; } diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 63ad7870ae11..26653be21dc0 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -187,8 +187,6 @@ int dev_pm_opp_set_config(struct device *dev, struct de= v_pm_opp_config *config); int devm_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *c= onfig); void dev_pm_opp_clear_config(int token); =20 -struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, const char = *name); -void dev_pm_opp_put_prop_name(struct opp_table *opp_table); struct dev_pm_opp *dev_pm_opp_xlate_required_opp(struct opp_table *src_tab= le, struct opp_table *dst_table, struct dev_pm_opp *src_opp); int dev_pm_opp_xlate_performance_state(struct opp_table *src_table, struct= opp_table *dst_table, unsigned int pstate); int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq); @@ -360,13 +358,6 @@ static inline int dev_pm_opp_unregister_notifier(struc= t device *dev, struct noti return -EOPNOTSUPP; } =20 -static inline struct opp_table *dev_pm_opp_set_prop_name(struct device *de= v, const char *name) -{ - return ERR_PTR(-EOPNOTSUPP); -} - -static inline void dev_pm_opp_put_prop_name(struct opp_table *opp_table) {} - static inline int dev_pm_opp_set_config(struct device *dev, struct dev_pm_= opp_config *config) { return -EOPNOTSUPP; --=20 2.31.1.272.g89b43f80a514