From patchwork Fri Jul 1 08:19:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902905 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 E97DFC433EF for ; Fri, 1 Jul 2022 08:20:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234435AbiGAIUt (ORCPT ); Fri, 1 Jul 2022 04:20:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229609AbiGAIUt (ORCPT ); Fri, 1 Jul 2022 04:20:49 -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 0B8FF70AF9 for ; Fri, 1 Jul 2022 01:20:47 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id x138so1789171pfc.3 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=6vBbYxQe4WubHBFItg3cZtGfGjbi/Ge4OJN0lTIaowhrh24RYFE5kH51IAjMED5M8F 3D2w3qDTad2djiyxo/wznCB+2L39885KWXtwB6deMI/2j8/pc4oKbvd+A/T6d9gX/7I2 NemUD5RFISjSZWjQJoxrpQmHGKcji/atwEMjDJTIy9iZBLEZvnVIXOUZIPv/HhqqAjT6 0+du2pmNZtJpBCXqQ/UXYjavhGXyjb+VFiD98TRd9bgirA27olVd2COYz6O8z+aqzwXN FtFaLNviT/wVFBSuNa7+L2vd5kDG7bHG8higgsqx2g7Ek/AE7cbUTZ7g9r4+i/LGpnJu /OKw== X-Gm-Message-State: AJIora9NPGCG8+Gd7O4nogh3MGcd5ZsaAIbNKtkPnnQStrzSyNs0SE8F MnrdWr+J2RyW0Mo9ekMXc1lPzgC2ooLOHQ== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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 device *dev, const char *name) goto err; } + /* 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 = -EBUSY; @@ -2291,6 +2295,8 @@ struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char *name) goto err; } + opp_table->clk_configured = true; + return opp_table; err: @@ -2311,6 +2317,7 @@ void dev_pm_opp_put_clkname(struct opp_table *opp_table) clk_put(opp_table->clk); opp_table->clk = ERR_PTR(-EINVAL); + opp_table->clk_configured = false; 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; From patchwork Fri Jul 1 08:19:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902906 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 174B3C43334 for ; Fri, 1 Jul 2022 08:21:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234917AbiGAIVB (ORCPT ); Fri, 1 Jul 2022 04:21:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236169AbiGAIUw (ORCPT ); Fri, 1 Jul 2022 04:20:52 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4C8C70AF9 for ; Fri, 1 Jul 2022 01:20:50 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id c4so1700108plc.8 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=e6weqckUQZnLcOCVmoVFURtGvjmZi36b6igrHuEjdI//eN64jPrbxmglSj87l4QSvD MQhD5zDRPSbmz4Xd79ocyYff/dzC2WFF8NFf0Gftoi0jAMp/QD/MbTo/Y0EBlkN8vXPo OLdSwkIv/+Nab3Hj8DAT5eNgNwEz2oVt16Iw5BTQ+suS9vS6s9K9yRp6sr9QzaNFY3jX /PKbb3oD9I82NnrtLDKQLd9ye62zalCf3fhv1sKWHcSpaGeACfpq49IJxUKMLqLkbwjl Lde/6zGwVTwtllSc9Qy8A/p3G3WVvuoIzdIIMmB7xmbJyrWn65IxwE2mONV7F6vH7vzB Zflg== X-Gm-Message-State: AJIora/4UU1/2q1ndwzJvFRs1TF89NbffIQPV1rEVLIv9SbrHfawBAdj nCvKibs4alzArIVh0jRUk8SJXKhk6yIADA== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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 #include "opp.h" @@ -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; +/* 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, const char * const *names, } EXPORT_SYMBOL_GPL(devm_pm_opp_attach_genpd); +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. This may + * be called multiple times for the same OPP table, for example once for each + * 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 properly. + * + * 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 >= 1 for success and negative for errors. The minimum + * value of 1 is chosen here to make it easy for callers to manage the resource. + */ +int dev_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *config) +{ + struct opp_table *opp_table, *err; + struct opp_config_data *data; + unsigned int id; + int ret; + + data = kmalloc(sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + opp_table = _add_opp_table(dev, false); + if (IS_ERR(opp_table)) { + kfree(data); + return PTR_ERR(opp_table); + } + + data->opp_table = opp_table; + data->flags = 0; + + /* This should be called before OPPs are initialized */ + if (WARN_ON(!list_empty(&opp_table->opp_list))) { + ret = -EBUSY; + goto err; + } + + /* Configure clocks */ + if (config->clk_names) { + /* We support only one clock name for now */ + if (config->clk_count != 1) { + ret = -EINVAL; + goto err; + } + + err = dev_pm_opp_set_clkname(dev, config->clk_names[0]); + if (IS_ERR(err)) { + ret = PTR_ERR(err); + goto err; + } + + data->flags |= OPP_CONFIG_CLK; + } + + /* Configure property names */ + if (config->prop_name) { + err = dev_pm_opp_set_prop_name(dev, config->prop_name); + if (IS_ERR(err)) { + ret = PTR_ERR(err); + goto err; + } + + data->flags |= OPP_CONFIG_PROP_NAME; + } + + /* Configure opp helper */ + if (config->set_opp) { + err = dev_pm_opp_register_set_opp_helper(dev, config->set_opp); + if (IS_ERR(err)) { + ret = PTR_ERR(err); + goto err; + } + + data->flags |= OPP_CONFIG_REGULATOR_HELPER; + } + + /* Configure supported hardware */ + if (config->supported_hw) { + err = dev_pm_opp_set_supported_hw(dev, config->supported_hw, + config->supported_hw_count); + if (IS_ERR(err)) { + ret = PTR_ERR(err); + goto err; + } + + data->flags |= OPP_CONFIG_SUPPORTED_HW; + } + + /* Configure supplies */ + if (config->regulator_names) { + err = dev_pm_opp_set_regulators(dev, config->regulator_names, + config->regulator_count); + if (IS_ERR(err)) { + ret = PTR_ERR(err); + goto err; + } + + data->flags |= OPP_CONFIG_REGULATOR; + } + + /* Attach genpds */ + if (config->genpd_names) { + err = dev_pm_opp_attach_genpd(dev, config->genpd_names, + config->virt_devs); + if (IS_ERR(err)) { + ret = PTR_ERR(err); + goto err; + } + + data->flags |= OPP_CONFIG_GENPD; + } + + ret = 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 configuration. + * @opp_table: OPP table returned from dev_pm_opp_set_config(). + * + * This allows all device OPP configurations to be cleared at once. This must 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 configurations, + * 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 want 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 <= 0)) + return; + + data = 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 *config) +{ + int token = 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 table. 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; extern struct list_head opp_tables, lazy_opp_tables; +/* 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; }; +/** + * 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 genpd to + * attach. + * @virt_devs: Pointer to return the array of virtual devices. + * + * This structure contains platform specific OPP configurations for the device. + */ +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) 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 long 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_block *nb); +int dev_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *config); +int devm_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *config); +void dev_pm_opp_clear_config(int token); + struct opp_table *dev_pm_opp_set_supported_hw(struct device *dev, const u32 *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 device *dev, return -EOPNOTSUPP; } +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) { From patchwork Fri Jul 1 08:19:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902908 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 7D25ECCA47F for ; Fri, 1 Jul 2022 08:21:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235466AbiGAIVD (ORCPT ); Fri, 1 Jul 2022 04:21:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234608AbiGAIVB (ORCPT ); Fri, 1 Jul 2022 04:21: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 9BE1B70E47 for ; Fri, 1 Jul 2022 01:20:53 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id s206so1779105pgs.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=Fkenr/DiLEppaM8vNGlQ1Cex3uTJhf2Z+hPbSsqC+QwLCQ6C1c6pnGRR8i3u5+jM9s MUuTLhEMapQ9JzCeotD76H2DE13sL/9x8flL5jEhGVYEyvmlissdrCktwCQFSOHb6SPv xmVmBoobuO309+0P+3/ipMAnd753KRb6qdkD05ylKmmLDqJgvTJte6D31SzXYfMoEbnO GadogLg4xNtBo82MuWwoqqfSLFttvGeu34ejLzmjMzpgMlkBynk1ZGQGUJg3C/wHeXCI 2kCmVXaYY8gAe95vjaqul1NJP3Qcy4fymeegeTnZK1noYKcJj/STfSBs4oAkWliR+ywM CWJQ== X-Gm-Message-State: AJIora++5Oq8hw0cD1DKKYpd+Hy9cR6zNlInjni6Uo9bNvAPb7lscpUW nszyR0oT4gzW87Z/Ywgx6AhoAQ== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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 { 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; }; @@ -220,12 +220,16 @@ static int dt_cpufreq_early_init(struct device *dev, int cpu) */ reg_name = find_supply_name(cpu_dev); if (reg_name) { - priv->opp_table = dev_pm_opp_set_regulators(cpu_dev, ®_name, - 1); - if (IS_ERR(priv->opp_table)) { - ret = PTR_ERR(priv->opp_table); + struct dev_pm_opp_config config = { + .regulator_names = ®_name, + .regulator_count = 1, + }; + + priv->opp_token = dev_pm_opp_set_config(cpu_dev, &config); + if (priv->opp_token < 0) { + ret = priv->opp_token; if (ret != -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, int 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); } From patchwork Fri Jul 1 08:19:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902907 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 D1F3ECCA479 for ; Fri, 1 Jul 2022 08:21:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236020AbiGAIVD (ORCPT ); Fri, 1 Jul 2022 04:21:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236175AbiGAIVB (ORCPT ); Fri, 1 Jul 2022 04:21:01 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 728BC70E4C for ; Fri, 1 Jul 2022 01:20:56 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id g7so1938020pjj.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=PGVtPJjREghUTwXnRkncWk73UaqZyxsuKui7aPa9OeqHYGM8D4U+3ChGO6WUxI7W/d T0OgOaaSx0Wb4C5T4zjTQFudEnfkBDtW1mj/srq8PiCfOcu35zJzBsuEXzw54hgFQFD7 sTXznykKCQRbOAnKBbEOaJeAdcJ0aYm0mOINAHkcZ8NAXPJeDv6AdH7S2v2LYzn5rCYT D6vLGnFi8sbD5soP/zlQx59gtOZvYgz8q6Rjd3MpA/UPNemgb2QcVr6RrO3EIDDIwkA+ 7loCJVwdgcrqKbLBFVgy6rXnNes5/BPKeCwcXzSC5a8MGxu0dorr3BU1r2HiRoYmE+2A lPjA== X-Gm-Message-State: AJIora+1LyB3g4u9FFlnYi1CNDfLZZ/ECi6rGsVia8HRLvC4bzJsUzRP WDm/dUzXJ2k156wC6LFinmD86A== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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 @@ /* 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; 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 = { + .supported_hw = supported_hw, + .supported_hw_count = ARRAY_SIZE(supported_hw), + }; cpu_dev = get_cpu_device(0); @@ -153,17 +157,17 @@ static int imx_cpufreq_dt_probe(struct platform_device *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]); - cpufreq_opp_table = dev_pm_opp_set_supported_hw(cpu_dev, supported_hw, 2); - if (IS_ERR(cpufreq_opp_table)) { - ret = PTR_ERR(cpufreq_opp_table); - dev_err(&pdev->dev, "Failed to set supported opp: %d\n", ret); + cpufreq_opp_token = dev_pm_opp_set_config(cpu_dev, &config); + if (cpufreq_opp_token < 0) { + ret = cpufreq_opp_token; + dev_err(&pdev->dev, "Failed to set Opp config: %d\n", ret); return ret; } cpufreq_dt_pdev = 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 = 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); From patchwork Fri Jul 1 08:20:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902909 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 A2F65C433EF for ; Fri, 1 Jul 2022 08:21:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234281AbiGAIVF (ORCPT ); Fri, 1 Jul 2022 04:21:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236182AbiGAIVB (ORCPT ); Fri, 1 Jul 2022 04:21:01 -0400 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48A2170E59 for ; Fri, 1 Jul 2022 01:20:59 -0700 (PDT) Received: by mail-pg1-x52a.google.com with SMTP id v126so1741487pgv.11 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=AH7MlLfATncfcgPqT2e7ZMLbZWMw4Nx4FKPr6NCMOdCar0KoLolXL8VbDZQ+74A02y 726PSw9AuQjfslDA1tYmNrrBa7USfYxartlg5AGNaV6i3ZjxMw8SW19Wek7EsxBi4LdO rsIow/UNFMA9TQyzXZvprGRCRgYwXJcCauyXnT9Wv+d4sVghW5OiQHobOYdTz0iJbYam tw7zHKi7gppIfQX7k+I1X1DSaBSe+08Ti6AWsMpXJX2anpxvWI/nrgSdQuJPX8l2vSio 1u4v4I7uSaM/n1MNwqafgnKwlFNY/1aAun7WbsoLBADMcnF0i6r1OQRpEyNQbwPlw1T8 mdeg== X-Gm-Message-State: AJIora/t9lepuDv1FaUFBI4LnNmOgy1hhR5MAswlFnIG1n6ZOTmNTDB3 2K1dqYM7yPDH2tEbD+eKqZMkFA== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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-cpufreq-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 { }; 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); - drv->names_opp_tables = kcalloc(num_possible_cpus(), - sizeof(*drv->names_opp_tables), + drv->opp_tokens = kcalloc(num_possible_cpus(), sizeof(*drv->opp_tokens), GFP_KERNEL); - if (!drv->names_opp_tables) { + if (!drv->opp_tokens) { ret = -ENOMEM; goto free_drv; } - drv->hw_opp_tables = kcalloc(num_possible_cpus(), - sizeof(*drv->hw_opp_tables), - GFP_KERNEL); - if (!drv->hw_opp_tables) { - ret = -ENOMEM; - goto free_opp_names; - } - - drv->genpd_opp_tables = kcalloc(num_possible_cpus(), - sizeof(*drv->genpd_opp_tables), - GFP_KERNEL); - if (!drv->genpd_opp_tables) { - ret = -ENOMEM; - goto free_opp; - } for_each_possible_cpu(cpu) { + struct dev_pm_opp_config config = { + .supported_hw = NULL, + }; + cpu_dev = get_cpu_device(cpu); if (NULL == cpu_dev) { ret = -ENODEV; - goto free_genpd_opp; + goto free_opp; } if (drv->data->get_version) { + config.supported_hw = &drv->versions; + config.supported_hw_count = 1; - if (pvs_name) { - drv->names_opp_tables[cpu] = dev_pm_opp_set_prop_name( - cpu_dev, - pvs_name); - if (IS_ERR(drv->names_opp_tables[cpu])) { - ret = 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] = dev_pm_opp_set_supported_hw( - cpu_dev, &drv->versions, 1); - if (IS_ERR(drv->hw_opp_tables[cpu])) { - ret = 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 = pvs_name; } if (drv->data->genpd_names) { - drv->genpd_opp_tables[cpu] = - dev_pm_opp_attach_genpd(cpu_dev, - drv->data->genpd_names, - NULL); - if (IS_ERR(drv->genpd_opp_tables[cpu])) { - ret = PTR_ERR(drv->genpd_opp_tables[cpu]); - if (ret != -EPROBE_DEFER) - dev_err(cpu_dev, - "Could not attach to pm_domain: %d\n", - ret); - goto free_genpd_opp; + config.genpd_names = drv->data->genpd_names; + config.virt_devs = NULL; + } + + if (config.supported_hw || config.genpd_names) { + drv->opp_tokens[cpu] = dev_pm_opp_set_config(cpu_dev, &config); + if (drv->opp_tokens[cpu] < 0) { + ret = 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 = PTR_ERR(cpufreq_dt_pdev); dev_err(cpu_dev, "Failed to register platform device\n"); -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); @@ -429,15 +381,10 @@ static int qcom_cpufreq_remove(struct platform_device *pdev) platform_device_unregister(cpufreq_dt_pdev); - 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]); - kfree(drv->names_opp_tables); - kfree(drv->hw_opp_tables); - kfree(drv->genpd_opp_tables); + kfree(drv->opp_tokens); kfree(drv); return 0; From patchwork Fri Jul 1 08:20:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902910 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 7869CC43334 for ; Fri, 1 Jul 2022 08:21:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235578AbiGAIVU (ORCPT ); Fri, 1 Jul 2022 04:21:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234485AbiGAIVD (ORCPT ); Fri, 1 Jul 2022 04:21:03 -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 0EEFE70E40 for ; Fri, 1 Jul 2022 01:21:02 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id p14so1777755pfh.6 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=61LoDQBHYQeLFPL25i3bp8H344NM3IlmhDIR+yRZ/3Thr3In7wyJmH6Cl0sOiq1E1y XSnePzRIjsdPBBbwLOOKgxighSX0YO8vw5znR+VvfevkorFoxkgjnB/shoCJ1C2QQgPW D/V7I0QaHaJ/g2paq8xxWVQDF16KGa0DHB/YBjmgMkqb1ohZ/Ob7j3FFY5cuHtZcvPLu ZWidMcAr4iuCNZm3f9tNqhRc86a6kggPDz3uID3xnYbr19wJzD/TavryDjJ5TXUX2Jsa MsXi7GK3RQMuMa3I/ZLT9RUd2Q8W4lOGlYuMaa9qnVo4enhenOAB3s7cm8E9y69dUG0T oIRA== X-Gm-Message-State: AJIora8Rqc2ej6TZ8MPWhTIla9GsL2vBmq7RKSgUPFaVPLI6UJdUhvxp UoqjHRItoFizcVIpF3udGzC5ow== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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 = { + .supported_hw = version, + .supported_hw_count = ARRAY_SIZE(version), + .prop_name = name, + }; reg_fields = sti_cpufreq_match(); if (!reg_fields) { @@ -210,21 +214,14 @@ static int sti_cpufreq_set_opp_info(void) snprintf(name, MAX_PCODE_NAME_LEN, "pcode%d", pcode); - opp_table = 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] = BIT(major); version[1] = BIT(minor); version[2] = BIT(substrate); - opp_table = 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 = PTR_ERR(opp_table); - goto err_put_prop_name; + opp_token = dev_pm_opp_set_config(dev, &config); + if (opp_token < 0) { + dev_err(dev, "Failed to set OPP config\n"); + return opp_token; } 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]); return 0; - -err_put_prop_name: - dev_pm_opp_put_prop_name(opp_table); - return ret; } static int sti_cpufreq_fetch_syscon_registers(void) From patchwork Fri Jul 1 08:20:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902911 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 9D4C8C43334 for ; Fri, 1 Jul 2022 08:21:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235168AbiGAIVc (ORCPT ); Fri, 1 Jul 2022 04:21:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236228AbiGAIVH (ORCPT ); Fri, 1 Jul 2022 04:21:07 -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 1FAB3675BD for ; Fri, 1 Jul 2022 01:21:04 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id w1-20020a17090a6b8100b001ef26ab992bso2023886pjj.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=OB6CT2hOmwr5l2ggc2S4Y2v/tY+58EV0I+AME4h1qRRMR4zLU75qNK7vtLRCzjqrum fgJFPj4gpnrBmphUOHrAzgBnfnzm1IQ2JHADQM7ntcE7EoIxnYkWvtdrlg2Ko002C1mW asmBlbksyJwhiX3ugbtFF3OzbbWMCaPWRkcjPc8h45PAWm/UQC5u22i3aCf+NdvjSm6N 4FcmduEqI8bNqvzTzapH+wq30D9Fx2PXrL8EZGqqNp3s05A8hWi8gf/ToCbhaUfUVTMv RloYgOQlcn80cRZUTY5I0lIl9ccciHLjXR2u5ehxd7y4m6xhhzAuasdB/qHNxtc9Ycch v+Ew== X-Gm-Message-State: AJIora8cEa8ya+ny8IACnY5O982E9tp7G9OJh46tRNMUdQk9Qp2/oNNt /ZKRIGpssAtF5Qp+vB880HNQDw== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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/sun50i-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) 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 = 0; int ret; - opp_tables = kcalloc(num_possible_cpus(), sizeof(*opp_tables), + opp_tokens = kcalloc(num_possible_cpus(), sizeof(*opp_tokens), GFP_KERNEL); - if (!opp_tables) + if (!opp_tokens) return -ENOMEM; ret = sun50i_cpufreq_get_efuse(&speed); if (ret) { - kfree(opp_tables); + kfree(opp_tokens); return ret; } snprintf(name, MAX_NAME_LEN, "speed%d", speed); for_each_possible_cpu(cpu) { + struct dev_pm_opp_config config = { + .prop_name = name, + }; struct device *cpu_dev = get_cpu_device(cpu); if (!cpu_dev) { @@ -113,10 +116,10 @@ static int sun50i_cpufreq_nvmem_probe(struct platform_device *pdev) goto free_opp; } - opp_tables[cpu] = dev_pm_opp_set_prop_name(cpu_dev, name); - if (IS_ERR(opp_tables[cpu])) { - ret = PTR_ERR(opp_tables[cpu]); - pr_err("Failed to set prop name\n"); + opp_tokens[cpu] = dev_pm_opp_set_config(cpu_dev, &config); + if (opp_tokens[cpu] < 0) { + ret = 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_device *pdev) cpufreq_dt_pdev = 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; } @@ -132,27 +135,24 @@ static int sun50i_cpufreq_nvmem_probe(struct platform_device *pdev) pr_err("Failed to register platform device\n"); 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); return ret; } static int sun50i_cpufreq_nvmem_remove(struct platform_device *pdev) { - struct opp_table **opp_tables = platform_get_drvdata(pdev); + int *opp_tokens = platform_get_drvdata(pdev); unsigned int cpu; platform_device_unregister(cpufreq_dt_pdev); for_each_possible_cpu(cpu) - dev_pm_opp_put_prop_name(opp_tables[cpu]); + dev_pm_opp_clear_config(opp_tokens[cpu]); - kfree(opp_tables); + kfree(opp_tokens); return 0; } From patchwork Fri Jul 1 08:20:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902912 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 2ACA9CCA479 for ; Fri, 1 Jul 2022 08:21:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236249AbiGAIVe (ORCPT ); Fri, 1 Jul 2022 04:21:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234117AbiGAIVK (ORCPT ); Fri, 1 Jul 2022 04:21:10 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50F2670E64 for ; Fri, 1 Jul 2022 01:21:07 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id y141so1774052pfb.7 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=CRai3ThfrvsBOT1k6/sW+EDA31s348CQzdoYkNsuOss2V+ishvk2SuQNsaibAZyheN SQpLS4kjcwBmUi7WMH9g5NJfTDupdgTz1/crrv3jWL1lkvMMFwJ/gleGdoOVJeXeD1Nd GEzV2w95YNdOkfHYCyk/vwc6ZXT6UaugTJsk/VVQnS6Tl08E01psZw7KQ+YXBXly6OQL gU7b1zR0o4YeFz0oe/SYAiSfzaEr73w0jL55SXmyt0o0bU9/zfhefVYtn9a1fYa6lmhl 13dRyFS/lgsmhA8AVd7gFpsL1iwrYMgQJzfLanOxCJVI/YIjL6o3wMJZgDVG0RWj6a7k gNdA== X-Gm-Message-State: AJIora8KW16Df1evb6icTqmCyURqFFzMj82PF0wXJ0c6CYMd1LGX2WWv LjA5NS9nDUgdim62TEd1yOJv2A== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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-cpufreq.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; } -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); } 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 = { + .supported_hw = versions, + .supported_hw_count = ARRAY_SIZE(versions), + }; 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; - opp_table = dev_pm_opp_set_supported_hw(cpu_dev, versions, 2); - err = PTR_ERR_OR_ZERO(opp_table); - if (err) { - dev_err(&pdev->dev, "failed to set supported hw: %d\n", err); + err = 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; } err = devm_add_action_or_reset(&pdev->dev, tegra20_cpufreq_put_supported_hw, - opp_table); + (void *)((unsigned long) err)); if (err) return err; From patchwork Fri Jul 1 08:20:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902913 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 6F5CCC433EF for ; Fri, 1 Jul 2022 08:21:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232946AbiGAIVi (ORCPT ); Fri, 1 Jul 2022 04:21:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233958AbiGAIVT (ORCPT ); Fri, 1 Jul 2022 04:21:19 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DED770E78 for ; Fri, 1 Jul 2022 01:21:10 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id q140so1764765pgq.6 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=ERNVZYOj8ylodoiK1lkQKuJ79ufv3DRPNWKdo0pR1CxMl7615g5vGAMvrdcZb+sXVU yYjAKLLVJEicQ1f/mxleosqoIx+qRzD7sc2lfvla/Vi1AgJvmIMlGTBYmwpzVslEy0R7 et1BCxYRnV5sGD5l4a/4ngas3Jx3GBl5r4RkVHCfyXjGpRwv2SzeR9v0jbxxLoACW3/t tEaedYKZo3G80hJP62xtDie9xJbQCSxLavOHMASl4hxBICS5EF0sRMx4mavEvgYD+N9o AvWbuXrIb6vkFnYIb9HeS/McLgJ8pZf23uEedXAgMwE2tmOdkK6hZP0N72LsYRRG2pFY 6zZQ== X-Gm-Message-State: AJIora9E4OYcBCUqGvRutkqXkheSxht3lYC01k21zIN8r9dnaO9U8jyE G3JUjfjHTEcJ2eU1fOd2p6ne8ON2C7WGMQ== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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; }; static unsigned long amx3_efuse_xlate(struct ti_cpufreq_data *opp_data, @@ -324,10 +323,13 @@ static int ti_cpufreq_probe(struct platform_device *pdev) { 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[] = {"vdd", "vbb"}; int ret; + struct dev_pm_opp_config config = { + .supported_hw = version, + .supported_hw_count = ARRAY_SIZE(version), + }; match = dev_get_platdata(&pdev->dev); if (!match) @@ -370,33 +372,23 @@ static int ti_cpufreq_probe(struct platform_device *pdev) if (ret) goto fail_put_node; - ti_opp_table = 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 = PTR_ERR(ti_opp_table); - goto fail_put_node; - } - - opp_data->opp_table = ti_opp_table; - if (opp_data->soc_data->multi_regulator) { - const char * const *reg_names = default_reg_names; + config.regulator_count = ARRAY_SIZE(default_reg_names); if (opp_data->soc_data->reg_names) - reg_names = opp_data->soc_data->reg_names; - ti_opp_table = 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 = PTR_ERR(ti_opp_table); - goto fail_put_node; - } + config.regulator_names = opp_data->soc_data->reg_names; + else + config.regulator_names = default_reg_names; + } + + ret = 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; } of_node_put(opp_data->opp_node); + register_cpufreq_dt: platform_device_register_simple("cpufreq-dt", -1, NULL, 0); From patchwork Fri Jul 1 08:20:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902914 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 0C98EC433EF for ; Fri, 1 Jul 2022 08:21:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232328AbiGAIVn (ORCPT ); Fri, 1 Jul 2022 04:21:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234113AbiGAIVZ (ORCPT ); Fri, 1 Jul 2022 04:21:25 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAE0271248 for ; Fri, 1 Jul 2022 01:21:12 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id c4so1700831plc.8 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=shaGeqLl2cxfbw/hFOjEbWnlWcKN59JmRI0vMlVmGVvtfN/u6GfzoVBbEPz1+Z6ZuZ zMn6hA3Sc+sJX8OpGPE6ZX4cEQjPVru6+INco6a/zqthGq6BcYQnBleK4/4rKuY+ohB6 nBLFDPbjdsqNUxWxKnr8XfN1D2xl7zc9thelRHNrsGvTXIkzFrIbQwb4r38FZMpMKK83 BtJdZ7i85CskhVC3q+5PsYt/5QMfMfu6VjGB6vSMOCc1ffrFuLtpqj+3ZkDysUOhjP2C eockjghk7ch5qk8CDeVDidnwooOdRMU5xattZavPmDWickm30Mq+t2OAmOGgerwJ0Dda 4Gvw== X-Gm-Message-State: AJIora9j5rYu+hQkgkxHShLL/6Tkc7TAaeQdDQlwVszpK4sqB5AMo0PX pbIR8uKMjZ+0KpL7fllhMFzjcpSjTc4/CA== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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 { unsigned long curr_freq; - 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) dev_pm_opp_of_remove_table(dev); clk_disable_unprepare(bus->clk); - dev_pm_opp_put_regulators(bus->opp_table); - bus->opp_table = NULL; + dev_pm_opp_clear_config(bus->opp_token); } static void exynos_bus_passive_exit(struct device *dev) @@ -179,18 +178,20 @@ static int exynos_bus_parent_parse_of(struct device_node *np, struct exynos_bus *bus) { struct device *dev = bus->dev; - struct opp_table *opp_table; const char *vdd = "vdd"; int i, ret, count, size; + struct dev_pm_opp_config config = { + .regulator_names = &vdd, + .regulator_count = 1, + }; - opp_table = dev_pm_opp_set_regulators(dev, &vdd, 1); - if (IS_ERR(opp_table)) { - ret = PTR_ERR(opp_table); - dev_err(dev, "failed to set regulators %d\n", ret); + ret = dev_pm_opp_set_config(dev, &config); + if (ret < 0) { + dev_err(dev, "failed to set OPP config %d\n", ret); return ret; } - bus->opp_table = opp_table; + bus->opp_token = ret; /* * Get the devfreq-event devices to get the current utilization of @@ -236,8 +237,7 @@ static int exynos_bus_parent_parse_of(struct device_node *np, return 0; err_regulator: - dev_pm_opp_put_regulators(bus->opp_table); - bus->opp_table = NULL; + dev_pm_opp_clear_config(bus->opp_token); return ret; } @@ -459,8 +459,7 @@ static int exynos_bus_probe(struct platform_device *pdev) 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 = NULL; + dev_pm_opp_clear_config(bus->opp_token); return ret; } From patchwork Fri Jul 1 08:20:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902915 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 93B0CC43334 for ; Fri, 1 Jul 2022 08:22:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234125AbiGAIV7 (ORCPT ); Fri, 1 Jul 2022 04:21:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236169AbiGAIVd (ORCPT ); Fri, 1 Jul 2022 04:21:33 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA55C71261 for ; Fri, 1 Jul 2022 01:21:15 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id x20so1711475plx.6 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=N6Cpwu/njjx0/gSx96IX+S0rYdnmHsZaAFmh6RzZ4xQRVCTjij69OF63RJSNe/DkUQ 6auvj75bN+9fI5QnWDK8iV7JpJ0DTU6ymFQs8NDmw1wamSmpoKBUCEQTzAnvtY1AzmnT maI9OLjq4Cp80Dgw9GzPEQ2ygFkLxzkmamnpHjmoXtZ1vM8qwKJn/Zx7+Ow4eeINQ1R1 OqLjj9QBHa4v4Arviz9wLDwI8wf6vC7HZSSav2U3r3g/7eL/D6HyCwRV9qxa7d/tNlae BAFop1mdlOUAcpMLvzXJKxWUHQP819EbYQnIQZkxS5YG61ctjXly/F74qrngwv78owJQ dUGA== X-Gm-Message-State: AJIora9EQAbMBNl1+cbvZKgpItCbzk9YOjxVmwzRnxwTaVaGXn0SbSD4 nVj0d2cL8penREeQQLP2RyROLQ== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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-mbus.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 = { + .clk_names = (const char *[]){ "dram" }, + .clk_count = 1, + }; variant = 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 = priv->freq_table; priv->profile.max_state = max_state; - ret = devm_pm_opp_set_clkname(dev, "dram"); + ret = devm_pm_opp_set_config(dev, &config); if (ret) { - err = "failed to add OPP table\n"; + err = "failed to set OPP config\n"; goto err_unlock_mbus; } From patchwork Fri Jul 1 08:20:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902916 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 9F33BC433EF for ; Fri, 1 Jul 2022 08:22:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234918AbiGAIWB (ORCPT ); Fri, 1 Jul 2022 04:22:01 -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 S232975AbiGAIVe (ORCPT ); Fri, 1 Jul 2022 04:21:34 -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 608F871277 for ; Fri, 1 Jul 2022 01:21:18 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id x4so1796373pfq.2 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=Axg4Amd1f9HUlRPBnpY/YhcYE0/pYYHAzuSAmjx87IZ38p65aoLqmz1ZTJgMlJpWVu cYriWExM+EiqGmeIA0aQmo32rdmCtdyy2VlpZtLIaG9zo6t/96K8aAQspF7lbnSdIh6z 6kc3zXvTGH85oNE5ujQrhT2fVQ57wpIhxO2OFTz0NdGYYyllZp+aeK/5R3HZMdHE0nx3 4TYZd/z1BFs195vwUai7sp/pdv2zbzL3yU1DFa0e75NW4JH7nVxUlWrIXW/+v6Vhga7L ig+j5uXb/PNRs3TW6IH1RoNNJmRQQ14UBlvtOPTK+4FpM8HbS0Tgm+Eagoof7Ccq/s+a 1D6Q== X-Gm-Message-State: AJIora/o+/LnzaJkrNrtLkxZK7EoUq3G2bzsSSFxrS+8QbZeln54naL8 +TBoTDLZYyn6z+TAf6+u5SwdQg== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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-devfreq.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 = { + .supported_hw = &hw_version, + .supported_hw_count = 1, + }; tegra = 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; } - err = devm_pm_opp_set_supported_hw(&pdev->dev, &hw_version, 1); + err = 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; } From patchwork Fri Jul 1 08:20:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902917 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 03497CCA479 for ; Fri, 1 Jul 2022 08:22:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235198AbiGAIWJ (ORCPT ); Fri, 1 Jul 2022 04:22:09 -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 S236265AbiGAIVh (ORCPT ); Fri, 1 Jul 2022 04:21:37 -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 1F5607127D for ; Fri, 1 Jul 2022 01:21:21 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id c6-20020a17090abf0600b001eee794a478so5728821pjs.1 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=kDfPp0tAFDklhsO3JdgrIVU6JHFyw+xDoVj5LQONM8NLx5qYeRIESQfS2RTKY1OHnN qCgQ+Ypy84PAueux91eJAOZ43JdJCKoXStHXVwDTHsJ9Us5+qFHl5eiJY3Gwd0+a9co2 CBBq6TX+oAHIlN1j/VvROWJhf5TUm5b/BMCdAikoGVd2lgChzXYgB3KKo0lKrPapyLrg ecu0c5sJwcMkQ6tSRoL2/Pg+I/ZP6uBgWRnofxS6UE+1R9x9EOvsEofVTzTGC3r7hlNV Hl6C76xpav10RmBXPMcKh3xr7Q7b86WOGqUG+yC0s6CwxsRoUzG9O7dloX0brzSVuRr9 BrHg== X-Gm-Message-State: AJIora91dUIE0HVO5fHEevWtp6A3Nrjh/Cjn+Ni+I52kJLlLVfIZ3XrS rAYtNNGvL6upODXf2PjpMCxrUw== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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/lima_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 = { + .regulator_names = (const char *[]){ "mali" }, + .regulator_count = 1, + .clk_names = (const char *[]){ "core" }, + .clk_count = 1, + }; if (!device_property_present(dev, "operating-points-v2")) /* Optional, continue without devfreq */ @@ -118,11 +124,7 @@ int lima_devfreq_init(struct lima_device *ldev) spin_lock_init(&ldevfreq->lock); - ret = devm_pm_opp_set_clkname(dev, "core"); - if (ret) - return ret; - - ret = devm_pm_opp_set_regulators(dev, (const char *[]){ "mali" }, 1); + ret = devm_pm_opp_set_config(dev, &config); if (ret) { /* Continue if the optional regulator is missing */ if (ret != -ENODEV) From patchwork Fri Jul 1 08:20:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902918 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 62555C43334 for ; Fri, 1 Jul 2022 08:22:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232323AbiGAIWn (ORCPT ); Fri, 1 Jul 2022 04:22:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236281AbiGAIVi (ORCPT ); Fri, 1 Jul 2022 04:21:38 -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 8E48B71BCC for ; Fri, 1 Jul 2022 01:21:24 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id jh14so1731912plb.1 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=buDCHAsqmRLC4QzeK7A2lcWVt3gQPhmkEqpXIoCRTWcpe3w51F0Zqt6h4OGKHoTtkK NVU3eiWljqNwl8FRZQGhWBKh6J1yBRVbtTETzGzxdyg5tLprTClGb5UP8SXqAjc2afxz qEM7Irhzc6j55gaiFK+72WIKYo1J65HV/QgFBGvAi7re9Md+SMeHpe0uTxB7TlBJ3VM+ 16R52rC7bSf5DlZ5ENYVRQlrJAjaPqcETdeTyJ419H7css/t2miR2O497xye6OFVVN6b pBct0sGroH11ZHopRcV4BdkYEqGwEUTkdqGQOwmdimtErY+bkTsNuHUZMHrL0euIKGie iECA== X-Gm-Message-State: AJIora96YGBSagzIYQtUjmE8FULiomEioL76RlzbQi1hr+WPelJrD6Ri 7A/xT8IL+q8ELr6GGg5A3DaPXw== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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/adreno/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 = { + .supported_hw = &val, + .supported_hw_count = 1, + }; /* * 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); } - devm_pm_opp_set_supported_hw(dev, &val, 1); + devm_pm_opp_set_config(dev, &config); } 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/adreno/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 = UINT_MAX; u32 speedbin; int ret; + struct dev_pm_opp_config config = { + .supported_hw = &supp_hw, + .supported_hw_count = 1, + }; ret = adreno_read_speedbin(dev, &speedbin); /* @@ -1818,11 +1822,7 @@ static int a6xx_set_supported_hw(struct device *dev, struct adreno_rev rev) supp_hw = fuse_to_supp_hw(dev, rev, speedbin); done: - ret = devm_pm_opp_set_supported_hw(dev, &supp_hw, 1); - if (ret) - return ret; - - return 0; + return devm_pm_opp_set_config(dev, &config); } static const struct adreno_gpu_funcs funcs = { 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 = 0; unsigned long max_freq = ULONG_MAX; + struct dev_pm_opp_config config = { + .clk_names = (const char *[]){ "core" }, + .clk_count = 1, + }; dpu_kms = devm_kzalloc(&pdev->dev, sizeof(*dpu_kms), GFP_KERNEL); if (!dpu_kms) return -ENOMEM; - ret = devm_pm_opp_set_clkname(dev, "core"); + ret = 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_ctrl.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, struct dp_link *link, { struct dp_ctrl_private *ctrl; int ret; + struct dev_pm_opp_config config = { + .clk_names = (const char *[]){ "ctrl_link" }, + .clk_count = 1, + }; if (!dev || !panel || !aux || !link || !catalog) { @@ -2035,7 +2039,7 @@ struct dp_ctrl *dp_ctrl_get(struct device *dev, struct dp_link *link, return ERR_PTR(-ENOMEM); } - ret = devm_pm_opp_set_clkname(dev, "ctrl_link"); + ret = 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/dsi_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 = NULL; struct platform_device *pdev = msm_dsi->pdev; int ret; + struct dev_pm_opp_config config = { + .clk_names = (const char *[]){ "byte" }, + .clk_count = 1, + }; msm_host = 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; } - ret = devm_pm_opp_set_clkname(&pdev->dev, "byte"); + ret = devm_pm_opp_set_config(&pdev->dev, &config); if (ret) return ret; /* OPP table is optional */ From patchwork Fri Jul 1 08:20:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902919 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 4AF6DCCA479 for ; Fri, 1 Jul 2022 08:22:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232635AbiGAIWo (ORCPT ); Fri, 1 Jul 2022 04:22:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233217AbiGAIV4 (ORCPT ); Fri, 1 Jul 2022 04:21:56 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BFC771BDD for ; Fri, 1 Jul 2022 01:21:27 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id jh14so1732018plb.1 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=rgkh4MQVeWuqdVlY96g3Eu/AnE6OO0wHKh9brrPaOG5/hZqVAfT3/b1irHCgKJSlaV nP0LqZntvixyF/VTQ/eYEce+rTDXqlaaxvNHyvwzJ65x2M/9yZk4qaLw0Yd+8owBZonU 9BaCMOsU+lYa+/UsCpvnmY7ALoPRDEfrWIrSH5kXAN+3Wgpar/KSr713szf7zThrr5/N IUhzFkRO7rKBk8c7KddpStYatNF9f4eCVQmg/prBkatY64zJCdbeBOeJ7W0jEIktq9kO rZLy4uQkguuO9qa+7ZtQUeUu2JVYiFpjkv6FdTINrJfSoxHkmo3u8bs82ugYyLPIMHkP LDUQ== X-Gm-Message-State: AJIora+hrmLSYJj7XDM4yBOstk1daNzXzPsZG1HPJCYcz5gG1Qml7X97 ItczFxy6PEH9jJQpD5MpoARyXA== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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 = &pfdev->pfdevfreq; + struct dev_pm_opp_config config = { + .regulator_names = pfdev->comp->supply_names, + .regulator_count = pfdev->comp->num_supplies, + }; if (pfdev->comp->num_supplies > 1) { /* @@ -101,13 +105,12 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) return 0; } - ret = devm_pm_opp_set_regulators(dev, pfdev->comp->supply_names, - pfdev->comp->num_supplies); + ret = devm_pm_opp_set_config(dev, &config); if (ret) { /* Continue if the optional regulator is missing */ if (ret != -ENODEV) { if (ret != -EPROBE_DEFER) - DRM_DEV_ERROR(dev, "Couldn't set OPP regulators\n"); + DRM_DEV_ERROR(dev, "Couldn't set OPP config\n"); return ret; } } From patchwork Fri Jul 1 08:20:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902920 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 D7914CCA480 for ; Fri, 1 Jul 2022 08:22:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231298AbiGAIWp (ORCPT ); Fri, 1 Jul 2022 04:22:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234190AbiGAIV5 (ORCPT ); Fri, 1 Jul 2022 04:21:57 -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 2D8D571BE5 for ; Fri, 1 Jul 2022 01:21:30 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id i8-20020a17090aee8800b001ecc929d14dso4882133pjz.0 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=jthG67k22jog0RrCvGRShKNkaAZrvEsihucpm08Hl5uLOHYKDtiFFQ+M2Hx1X6Bl4U pSLRp5a9H3hZTNLFyGz7X5PhWI0SunzTez+ByMilfTnK22BfzH1KwErmnUqJ8olOhM6f yG3AcazEslvqnR5U4D4H1F1Dk23DJ+Rh0hSdz33n/YA5AFYwXcrEXUhS2DPmeXoWZU7s jPW3aZZUsCK5za/nMICj+MZbcYMvMsm8qTvP2K3DxPc6ZivHdkWy9iFYllx7OaF23Qli BU2QIFeANz7flU/KKBKISlIqHEMv/IyFEPkKhU++nSA0Q62Y8eJQZ6xloZV3gEsxdZ1w vt0Q== X-Gm-Message-State: AJIora8Wc+T4eLDT4IszZ+CmN8Gt96ynUxVOzhb5t1t4xx/yr94sXUeM kOjG4ZUQfZksIu8IT40hBIJ1iQ== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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 = { + .genpd_names = opp_genpd_names, + .virt_devs = &opp_virt_devs, + }; err = 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 gr3d *gr3d) if (dev->pm_domain) return 0; - err = devm_pm_opp_attach_genpd(dev, opp_genpd_names, &opp_virt_devs); + err = devm_pm_opp_set_config(dev, &config); if (err) return err; From patchwork Fri Jul 1 08:20:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902922 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 3FF5DCCA47F for ; Fri, 1 Jul 2022 08:22:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233550AbiGAIWt (ORCPT ); Fri, 1 Jul 2022 04:22:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234303AbiGAIV6 (ORCPT ); Fri, 1 Jul 2022 04:21:58 -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 C39ED70E54 for ; Fri, 1 Jul 2022 01:21:32 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id c6-20020a17090abf0600b001eee794a478so5729185pjs.1 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=YGYSwXzBR+/X4rOsRtfSiYiz3+Qq4SQ2wW0r05PYvl8gs2b0wV9VwC3gQBCdrtK0W+ 9TzV44cebdVpJqVdUWdbSwoNEmH2ajwFRYSKPmH4v+3RltPJQesTSUv+UBVBhYl9D9kh lsIKVWIJXS3kLv1aPmSUdScUjO09eqe/Sz3MPu7YTK0/bLYVJCGSQn97PYZi493QsLQS 9I+TaRXNnk8K7ZA0HUV060VPt1UxTa9VMMaJmR9Y49pTh2OEJPUm7OrTFCAdPNGId5ua CM8lhHbGazfwqxncPVFWexrGFdJwARZEx6vs+9hvZegTbnr/+L3xG2MwxMcSx3QIJFgZ xBPA== X-Gm-Message-State: AJIora+9Ks/kPgAlOfAATRhgkPfoERNDH6wS70jcecOpYk3Ndd8sheWI aNneEQUk+cAFqNJ0yPTfNM7JGw== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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 = { + .clk_names = (const char *[]){ "core" }, + .clk_count = 1, + }; ret = core_clks_get(core); if (ret) return ret; - ret = devm_pm_opp_set_clkname(core->dev, "core"); + ret = devm_pm_opp_set_config(core->dev, &config); if (ret) return ret; @@ -862,6 +866,10 @@ static int vcodec_domains_get(struct venus_core *core) const struct venus_resources *res = core->res; struct device *pd; unsigned int i; + struct dev_pm_opp_config config = { + .genpd_names = res->opp_pmdomain, + .virt_devs = &opp_virt_dev, + }; if (!res->vcodec_pmdomains_num) goto skip_pmdomains; @@ -879,7 +887,7 @@ static int vcodec_domains_get(struct venus_core *core) return 0; /* Attach the power domain for setting performance state */ - ret = devm_pm_opp_attach_genpd(dev, res->opp_pmdomain, &opp_virt_dev); + ret = devm_pm_opp_set_config(dev, &config); if (ret) goto opp_attach_err; @@ -978,6 +986,10 @@ static int core_get_v4(struct venus_core *core) struct device *dev = core->dev; const struct venus_resources *res = core->res; int ret; + struct dev_pm_opp_config config = { + .clk_names = (const char *[]){ "core" }, + .clk_count = 1, + }; ret = core_clks_get(core); if (ret) @@ -1003,7 +1015,7 @@ static int core_get_v4(struct venus_core *core) if (legacy_binding) return 0; - ret = devm_pm_opp_set_clkname(dev, "core"); + ret = devm_pm_opp_set_config(dev, &config); if (ret) return ret; From patchwork Fri Jul 1 08:20:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902921 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 2D9F5C43334 for ; Fri, 1 Jul 2022 08:22:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233158AbiGAIWr (ORCPT ); Fri, 1 Jul 2022 04:22:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234723AbiGAIWB (ORCPT ); Fri, 1 Jul 2022 04:22:01 -0400 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AE6F70E65 for ; Fri, 1 Jul 2022 01:21:35 -0700 (PDT) Received: by mail-pg1-x52c.google.com with SMTP id r66so1784513pgr.2 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=HqnRHeRGFaDP5dB6hzUvRcCnPjSYiI0uYcgcQXLN/+5pDYRQXxBIa36OyKpm40swWd BxadMESNi3JMQd9OAfKGj7V0Tce8MLYqoAAQASrP+ZEbhbIkeZtT/9ATZ3POMWKW6Xu/ csD8jdmX3U6g6erSn7ASY6nJ/GVnK1qxsen1NQm0Rx7Laclv2ArVdRXbicUDTRDvvQTX CjzX3xvLBmlp0kmRmXZhG608MNceSiHX7dE9NHUD5OpBQbVKmcRgB8lZOlyUdN5u9pdT 1RyJYdXgQyaG5JUlIEidjaRHx6JKpOldi6zvaJj8nrMek5xwE8gMvWgnkN7WnCQswIBW 5Auw== X-Gm-Message-State: AJIora9a613DxoGc3j3RihFOsWk9z5p83TRMcW2+mBmqzjkt36yqLWAf HHZg07KqgSwjk5CkbROTyoSzag== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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/tegra124-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 = 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 = { + .supported_hw = &hw_version, + .supported_hw_count = 1, + }; - hw_opp_table = dev_pm_opp_set_supported_hw(emc->dev, &hw_version, 1); - err = PTR_ERR_OR_ZERO(hw_opp_table); - if (err) { - dev_err(emc->dev, "failed to set OPP supported HW: %d\n", err); + err = 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 = err; err = 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); return err; } From patchwork Fri Jul 1 08:20:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902923 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 D837FCCA486 for ; Fri, 1 Jul 2022 08:22:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233698AbiGAIWt (ORCPT ); Fri, 1 Jul 2022 04:22:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235307AbiGAIWJ (ORCPT ); Fri, 1 Jul 2022 04:22:09 -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 6B06770E7B for ; Fri, 1 Jul 2022 01:21:38 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id x1-20020a17090abc8100b001ec7f8a51f5so5759227pjr.0 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=6xAVzVElitKKvTWc9m97iUg4EP81XfUaFSwGbdb0YK8Zb3ECbAZ5vSbPvRGdRN6Kxd LIMXpfgwDduJJc2/GIU0f/59mYd6l89TWF2dMRSnpHTqOroaVmr9uvj9KanYGZqopnfJ 3XkwEs3yvNoJsmmtp7K+xGlBB2VALiVahCpCAJGSQivwGExAUy0XULA/1D0HaLEhORvQ f971XlKA4o5EdsgIokO5J2BI0YIaXfFUGiBrwZyCuSCI8jTyG+HeEK+PVKt7GQtS+APs uy4o/60w4ybmWBKsvfvIODWIdNaBmAjLmk7MQBe5VkZLj5AAgQSDNulq/+MDO3z4IyQK aSqA== X-Gm-Message-State: AJIora9aXggrk8C5cbgiEd7RfXONgfdK0TKRHLHlIpGD/G1aXwM7q2/u aEKnDaCykkP5rJ/wbOujz/HViQ== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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 *pdev) const struct sdhci_msm_offset *msm_offset; const struct sdhci_msm_variant_info *var_info; struct device_node *node = pdev->dev.of_node; + struct dev_pm_opp_config opp_config = { + .clk_names = (const char *[]){ "core" }, + .clk_count = 1, + }; host = 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 *pdev) if (ret) goto bus_clk_disable; - ret = devm_pm_opp_set_clkname(&pdev->dev, "core"); + ret = devm_pm_opp_set_config(&pdev->dev, &opp_config); if (ret) goto bus_clk_disable; From patchwork Fri Jul 1 08:20:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902925 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 6A8A6CCA487 for ; Fri, 1 Jul 2022 08:22:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233699AbiGAIWu (ORCPT ); Fri, 1 Jul 2022 04:22:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235157AbiGAIWZ (ORCPT ); Fri, 1 Jul 2022 04:22:25 -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 266A471BFA for ; Fri, 1 Jul 2022 01:21:41 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id k14so1717973plh.4 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=IUeUXppmxwIKzJ+9AprqrMA5R50iF6MdC3fjwtb2azFrGHgzElu2mUTJJ4j1TmMc9B vxhXOrFiS6hzU9zr0sXttWlMEu5/1yzMOty6khuBphYz4AuLapC6Xa9EBmrbpjj2cJJ2 FXRIG51VCaoxQwZ/nIBW2wuGTxJo3OjHrc8eH/WeXl0ktPnWAq87slyLItdGqD3LqHFa nq/zexUsXWiYUO3eN3YNe1TmiHI7WFNGhdTW08kLgHT5Q2MMkqRGLm4rJOUzcMlgddiv 8Tqg1gaZ94Bc95mT5h7xsauJkdpbyXjNhMd7Xd7/HwaKYeaionOAaY01A6EkHRg03gxm ADLQ== X-Gm-Message-State: AJIora9jENEpYMHWVtoXaydKaTqAcxLkO9xdhSvnAomfIFDKLvWYcUOH SmMVSDAlUFKui/m+ipUgV7hfog== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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 = 0; + struct dev_pm_opp_config config = { + .set_opp = ti_opp_supply_set_opp, + }; match = 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; } - ret = PTR_ERR_OR_ZERO(dev_pm_opp_register_set_opp_helper(cpu_dev, - ti_opp_supply_set_opp)); - if (ret) + ret = dev_pm_opp_set_config(cpu_dev, &config); + if (ret < 0) _free_optimized_voltages(dev, &opp_data); return ret; From patchwork Fri Jul 1 08:20:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902924 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 85156CCA488 for ; Fri, 1 Jul 2022 08:22:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233786AbiGAIWv (ORCPT ); Fri, 1 Jul 2022 04:22:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235902AbiGAIW1 (ORCPT ); Fri, 1 Jul 2022 04:22:27 -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 B250572ECC for ; Fri, 1 Jul 2022 01:21:43 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id b2so1705256plx.7 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=8GOeeliARCOj1kDIwgOraX5bCwQ15QxlEmEHgB5NGLrNb+qURtR/EeTq3jeNLIJhaM AFFVdat76FToGBYFmAsHA1XQZ7WTzpOb7DvuZB777crQcImlIipUPxu/GKbJJ342OeIk 6D9otlTWNSvHVjq0bpLE0Cxv2MbnM09gH3Dt9qlgEBCpyjSvaTLLOpIx19bpiJu6iXy+ fJNxLh5W0LdYnkNXoubG9RIHMGkRQMxF9fTtQQkVCyP1RdyrlDzUwQW/yqnhi9PV+qb1 lfDl5iph7vsoBcHDjUFMIzOMkOFxTLFa96Pf+naki/T4P5nIrjuMQWf+KYcBwXqo3MmG 1Bag== X-Gm-Message-State: AJIora/46sSWh77s3D+kE/Ho17yhq+N2X2TAO/yBosySfAlEeiYg+LQJ +QpQGsDSp6YLksbXRM10G8O7Aw== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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; + /* + * 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 = devm_pm_opp_set_clkname(dev, NULL); if (err) { dev_err(dev, "failed to set OPP clk: %d\n", err); From patchwork Fri Jul 1 08:20:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902926 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 EC6D8C43334 for ; Fri, 1 Jul 2022 08:22:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233214AbiGAIWv (ORCPT ); Fri, 1 Jul 2022 04:22:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236276AbiGAIWb (ORCPT ); Fri, 1 Jul 2022 04:22:31 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EA7A72EE1 for ; Fri, 1 Jul 2022 01:21:46 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id l2so1944150pjf.1 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=zz4CbuCznGPZdlc6vxC3aaYxmuuOaFSPwbM7tjw9GiLZJNvE6gsxq4T+bQxZgT+j1e ZIs1jhTTswI9gg0pPpRJxMqG/IUnZ76gANPK6P6PBh7Xmr6HV1Ash1g8jDWGOsfSqpZ5 br+icSwNeOd/Tkk/3va/HUY83eYl4VaHOE+iTjO3GyvwadH5ssn+IyU8IzqfEqng2EZr 5X7aCe0T43zoywE3faPU0FG8pHwZmVjKWBVvcCnqoGkaj4b2dlIZcnxG6zTUx06sykFe J+ph+R+HEb8DTTt+oGr6EtGq5v7rCLf/9ZAu4b/Lg4BbkO1372QxFv8IzXim5+RR4OkT njNA== X-Gm-Message-State: AJIora948MUCpADgUA0ESNwXM0tUal3Y+vb+ixRK5irbt5NhpitDqJ7G NhGyCfdQ7IoBFLtpFLuHBOfjQg== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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 = 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 = { + /* + * 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 = (const char *[]){ NULL }, + .clk_count = 1, + }; + + if (of_machine_is_compatible("nvidia,tegra20")) { hw_version = BIT(tegra_sku_info.soc_process_id); - else + config.supported_hw = &hw_version; + config.supported_hw_count = 1; + } else if (of_machine_is_compatible("nvidia,tegra30")) { hw_version = BIT(tegra_sku_info.soc_speedo_id); + config.supported_hw = &hw_version; + config.supported_hw_count = 1; + } - err = devm_pm_opp_set_supported_hw(dev, &hw_version, 1); + err = 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; } + /* + * 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 *pmc, struct device_node *np) struct generic_pm_domain *genpd; const char *rname = "core"; int err; + struct dev_pm_opp_config config = { + .regulator_names = &rname, + .regulator_count = 1, + }; genpd = 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 = tegra_pmc_core_pd_set_performance_state; genpd->opp_to_performance_state = tegra_pmc_core_pd_opp_to_performance_state; - err = devm_pm_opp_set_regulators(pmc->dev, &rname, 1); + err = 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"); err = pm_genpd_init(genpd, NULL, false); if (err) { From patchwork Fri Jul 1 08:20:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902927 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 003BFC433EF for ; Fri, 1 Jul 2022 08:23:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234412AbiGAIXX (ORCPT ); Fri, 1 Jul 2022 04:23:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236380AbiGAIWf (ORCPT ); Fri, 1 Jul 2022 04:22:35 -0400 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 956AB72EF7 for ; Fri, 1 Jul 2022 01:21:49 -0700 (PDT) Received: by mail-pg1-x532.google.com with SMTP id h192so1780401pgc.4 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=JEQtdWwXIF945n/ZhDxMvfRz146tNtNVpUUomGhAZwd+bFzPLMTujAaBhLUCzBh+VT Ad+tRgm5M1W5ukbyS8cHQzlNxodcRudZI08W+/+7xC+UntJErvxJaaqgIOayUfkkuTNk XWxXw8rkW5edEu8UgkYgsp6WUG8rAfb23WtTFww4AfFGDpcSA8sSphIWKphZC64ZkjNG erQNLl2PYX24RvzihMaMdYTt58sX640whGkuhnf26ZivQh3BP3/HNL3OeQ0fa1REKJjz eoSvCmk9MziosrGNxjKJBeb+mYreUKzxWzObHAKEOOnHYD1AB4/aJIDzY5gPHz3ol0wp Ql6w== X-Gm-Message-State: AJIora+IZjUl1552ApweciVDu5cMSLLPJhEKZmV/Xof4BrlgWoZ+fWcl S7bklHr9616oMvgxPcd2/SqV9A== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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 array 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 = &pdev->dev; + struct dev_pm_opp_config config = { + .clk_names = (const char *[]){ "se" }, + .clk_count = 1, + }; irq = platform_get_irq(pdev, 0); if (irq < 0) @@ -922,7 +926,7 @@ static int spi_geni_probe(struct platform_device *pdev) mas->se.base = base; mas->se.clk = clk; - ret = devm_pm_opp_set_clkname(&pdev->dev, "se"); + ret = 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 *pdev) struct device *dev; struct spi_master *master; struct qcom_qspi *ctrl; + struct dev_pm_opp_config config = { + .clk_names = (const char *[]){ "core" }, + .clk_count = 1, + }; dev = &pdev->dev; @@ -529,7 +533,7 @@ static int qcom_qspi_probe(struct platform_device *pdev) master->handle_err = qcom_qspi_handle_err; master->auto_runtime_pm = true; - ret = devm_pm_opp_set_clkname(&pdev->dev, "core"); + ret = devm_pm_opp_set_config(&pdev->dev, &config); if (ret) return ret; /* OPP table is optional */ From patchwork Fri Jul 1 08:20:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902945 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 4F9B6C43334 for ; Fri, 1 Jul 2022 08:23:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234810AbiGAIXj (ORCPT ); Fri, 1 Jul 2022 04:23:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236418AbiGAIWi (ORCPT ); Fri, 1 Jul 2022 04:22: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 56DFD7358B for ; Fri, 1 Jul 2022 01:21:52 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id r1so1693353plo.10 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=P1gAFPcsb+imGqKx4zawdCc/prT66UCj1XRRQkHPiKOKNmTwxIKeKiZmIMwne7DI3D wTJkKgzDZPFu0jjorUNbkVv0q+XxwTUXpa5wZtKkr1lwiN7xOVrrtK/3BWJ8Pe/MgXbc HUv1Twbv5vtTySqDNZ2stSkU3VconRltxFeDqheUyEaxH/Qvq5SDR9dvY+tmInQWjntP SVEPBZfnlmlQN5h+G10sKA5Tl+l1le+AH9DmS0N4cgi4ns7nXw8k2UwLlmcn5TUWl3GH UUqMdvld/sWEW3zhFEd58AquTpq53J+jF/xJoyDngvegU4aeZqShPGCSM6gbdTx+p7yR EEdg== X-Gm-Message-State: AJIora9QMJFMZQBgflp++yvdg1JPUpSKAuEsxkNTyW14y5P5oRtYUnWp mv4f9zN8TeTehPsY2hbJshuhmA== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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/qcom_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_device *pdev) int irq; bool console = false; struct uart_driver *drv; + struct dev_pm_opp_config config = { + .clk_names = (const char *[]){ "se" }, + .clk_count = 1, + }; if (of_device_is_compatible(pdev->dev.of_node, "qcom,geni-debug-uart")) console = true; @@ -1430,7 +1434,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) if (of_property_read_bool(pdev->dev.of_node, "cts-rts-swap")) port->cts_rts_swap = true; - ret = devm_pm_opp_set_clkname(&pdev->dev, "se"); + ret = devm_pm_opp_set_config(&pdev->dev, &config); if (ret) return ret; /* OPP table is optional */ From patchwork Fri Jul 1 08:20:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902946 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 BE67CC43334 for ; Fri, 1 Jul 2022 08:23:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235157AbiGAIXs (ORCPT ); Fri, 1 Jul 2022 04:23:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232001AbiGAIWn (ORCPT ); Fri, 1 Jul 2022 04:22:43 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D63470E76 for ; Fri, 1 Jul 2022 01:21:55 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id c4so1702225plc.8 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=m1fWki+0lwoyDQ5mdyQw07GpPQ4GCwEmILRC9hHyBwBsoCN3vMJjJx/4I9uhguoEMj GWkCkcfLl9NMs44QFxrEflRHmkqJIz2rGCYaaUO2m2vuzXI9xrsTPgnzDkC6Ct49omF4 +z7akHdKVhR4YRfIc5zm7kzBVwAANax6/6HChbENw0bq/XJN8PAqlE0hhQalagROVHqp lCkAEGKHL12ivD2FMLmKRZ/WpfZGlvFJ0+jENBJJ87sxHTjG3UoIjW1hiBKVl3S5nn4p /xl+SbeC9jTD+DdXMGhPkcWRUf6i9/OkCbagVg0a9mVBxdkJxZx/UTUoTZFLo8lFhpdl 6vig== X-Gm-Message-State: AJIora+XvwdbhdoeG6QLvQaWJX4i2im5xpd8ZsEzXY+anr3/KSQglGJu tbEG3UPEuj2Z4IdE16NxS/HpUg== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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; /* - * 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 = sizeof(*old_opp->supplies) * opp_table->regulator_count; @@ -2097,7 +2097,7 @@ void dev_pm_opp_put_prop_name(struct opp_table *opp_table) EXPORT_SYMBOL_GPL(dev_pm_opp_put_prop_name); /** - * 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; - opp_table = _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 = -EBUSY; - goto err; - } - /* Another CPU that shares the OPP table has set the regulators ? */ if (opp_table->regulators) - return opp_table; + return 0; opp_table->regulators = kmalloc_array(count, sizeof(*opp_table->regulators), GFP_KERNEL); - if (!opp_table->regulators) { - ret = -ENOMEM; - goto err; - } + if (!opp_table->regulators) + return -ENOMEM; for (i = 0; i < count; i++) { reg = regulator_get_optional(dev, names[i]); @@ -2167,7 +2153,7 @@ struct opp_table *dev_pm_opp_set_regulators(struct device *dev, } mutex_unlock(&opp_table->lock); - return opp_table; + return 0; free_regulators: while (i != 0) @@ -2176,26 +2162,20 @@ struct opp_table *dev_pm_opp_set_regulators(struct device *dev, kfree(opp_table->regulators); opp_table->regulators = NULL; opp_table->regulator_count = -1; -err: - dev_pm_opp_put_opp_table(opp_table); - return ERR_PTR(ret); + return ret; } -EXPORT_SYMBOL_GPL(dev_pm_opp_set_regulators); /** - * 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; - if (unlikely(!opp_table)) - return; - if (!opp_table->regulators) - goto put_opp_table; + return; if (opp_table->enabled) { for (i = opp_table->regulator_count - 1; i >= 0; i--) @@ -2218,41 +2198,7 @@ void dev_pm_opp_put_regulators(struct opp_table *opp_table) kfree(opp_table->regulators); opp_table->regulators = NULL; opp_table->regulator_count = -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 = 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); /** * 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, struct dev_pm_opp_config *config) /* Configure supplies */ if (config->regulator_names) { - err = dev_pm_opp_set_regulators(dev, config->regulator_names, - config->regulator_count); - if (IS_ERR(err)) { - ret = PTR_ERR(err); + ret = _opp_set_regulators(opp_table, dev, + config->regulator_names, + config->regulator_count); + if (ret) goto err; - } data->flags |= 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 names[], unsigned int count); struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char *name); void dev_pm_opp_put_clkname(struct opp_table *opp_table); 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_name(struct device *dev, con static inline void dev_pm_opp_put_prop_name(struct opp_table *opp_table) {} -static inline struct opp_table *dev_pm_opp_set_regulators(struct device *dev, 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); From patchwork Fri Jul 1 08:20:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902947 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 364D1CCA479 for ; Fri, 1 Jul 2022 08:24:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235364AbiGAIYB (ORCPT ); Fri, 1 Jul 2022 04:24:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233057AbiGAIXE (ORCPT ); Fri, 1 Jul 2022 04:23:04 -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 63DB47125A for ; Fri, 1 Jul 2022 01:21:58 -0700 (PDT) Received: by mail-pl1-x634.google.com with SMTP id m2so1723916plx.3 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=KgpVu+UQ5lvL9Wp7Z6DjGB4vp2k8RIGSduz4xDYj482urrDNU5qWinsqkTD/pwAkJC 6FAxYMQYbqF/u3O5f12d+lPZAo5UYbyfMO4K2LWTo5Qd/8FDLxt4FLdurkWQ7+Fat8rp zmvQ5NjDXzYnvoFRurQ5b9QrvAKFrvFLxgdPhCpq+K8FPc4HDhosOuSxTqyNY0FHv8YR TaC+YSEtTshpMFz7STez6ggX0qz7NqqUY/Cftd2hDBf5wVz+cIKzbwqwD3/GuUEJZgxU cNTkzBi+Q4FI5eMQsYe4YGKpyJ1QEPSpppN+tXU6v7s6Um82ok9+3SxZkB055rzVt8k4 2kEA== X-Gm-Message-State: AJIora+GNkrQ/Az9HBWYx3TrCyZ4xJXEeQtayiObV4YWFBGHMJKda2kw HdS30v78QN6ISuMeK5Tszos5RQ== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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 device *dev, } /** - * 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-supported-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 = _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; opp_table->supported_hw = 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; opp_table->supported_hw_count = count; - return opp_table; + return 0; } -EXPORT_SYMBOL_GPL(dev_pm_opp_set_supported_hw); /** - * dev_pm_opp_put_supported_hw() - Releases resources blocked for supported 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 structure + * _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 = NULL; - opp_table->supported_hw_count = 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 = 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 = NULL; + opp_table->supported_hw_count = 0; + } } -EXPORT_SYMBOL_GPL(devm_pm_opp_set_supported_hw); /** * 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, struct dev_pm_opp_config *config) /* Configure supported hardware */ if (config->supported_hw) { - err = dev_pm_opp_set_supported_hw(dev, config->supported_hw, - config->supported_hw_count); - if (IS_ERR(err)) { - ret = PTR_ERR(err); + ret = _opp_set_supported_hw(opp_table, config->supported_hw, + config->supported_hw_count); + if (ret) goto err; - } data->flags |= 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 dev_pm_opp_config *config); int devm_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *config); void dev_pm_opp_clear_config(int token); -struct opp_table *dev_pm_opp_set_supported_hw(struct device *dev, const u32 *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 *name); @@ -372,22 +369,6 @@ static inline int dev_pm_opp_unregister_notifier(struct device *dev, struct noti return -EOPNOTSUPP; } -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)) { From patchwork Fri Jul 1 08:20:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902948 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 946C6C433EF for ; Fri, 1 Jul 2022 08:24:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235717AbiGAIYI (ORCPT ); Fri, 1 Jul 2022 04:24:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234348AbiGAIXJ (ORCPT ); Fri, 1 Jul 2022 04:23:09 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C959E71273 for ; Fri, 1 Jul 2022 01:22:01 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id go6so1976041pjb.0 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=hcw6JNwTfZHi9Osp4rYbIgV1FJXQ4h68XryZY8SSWmi0F3ev3BXOkprNXxyccAiyC7 WWn4SxIVx5VWenJy9yOfnJF0a5LZhKX0ffywI2WpCwrqsT3QWGMXvOvwv/GyuglMZ5em ioWnpz0b/mHqnIznh4agilwCe7XeXPEOfPBX1Fz+S42SyfwAN5C8ulNPrRzdX8tlSA60 +MDfMHQMeB4FaQYgdRazsIyIh4oyoVOGZPyb73hGTAvd0SkBWGSKYlE6IeVrhAN8r8/z ZmakXViNVaCYVikWV7jQmBXKMH+GlQVOBE3w5rK6WHrRis9WTWOd2Yd8QKP6Dt8/WvTZ cTLw== X-Gm-Message-State: AJIora+piUyuni4cznAR0BI/a9INeU4nM/FBUPzbSXLISr/eavqGPdtq ct0usCJwHOhOGhH/Nidrln5uzMIJ98/Z9A== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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) } /** - * 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 the + * 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 clks 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 *name) +static int _opp_set_clknames(struct opp_table *opp_table, struct device *dev, + const char * const names[], unsigned int count) { - struct opp_table *opp_table; - int ret; - - opp_table = _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 = -EBUSY; - goto err; - } + /* We support only one clock name for now */ + if (count != 1) + return -EINVAL; /* Another CPU that shares the OPP table has set the clkname ? */ if (opp_table->clk_configured) - return opp_table; + return 0; /* clk shouldn't be initialized at this point */ - if (WARN_ON(opp_table->clk)) { - ret = -EBUSY; - goto err; - } + if (WARN_ON(opp_table->clk)) + return -EBUSY; /* Find clk for the device */ - opp_table->clk = clk_get(dev, name); + opp_table->clk = clk_get(dev, names[0]); if (IS_ERR(opp_table->clk)) { - ret = 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; } opp_table->clk_configured = true; - 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 = ERR_PTR(-EINVAL); - opp_table->clk_configured = 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; } /** - * 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 = 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 = ERR_PTR(-EINVAL); + opp_table->clk_configured = false; + } } -EXPORT_SYMBOL_GPL(devm_pm_opp_set_clkname); /** * 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); dev_pm_opp_put_opp_table(data->opp_table); kfree(data); @@ -2587,17 +2540,10 @@ int dev_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *config) /* Configure clocks */ if (config->clk_names) { - /* We support only one clock name for now */ - if (config->clk_count != 1) { - ret = -EINVAL; - goto err; - } - - err = dev_pm_opp_set_clkname(dev, config->clk_names[0]); - if (IS_ERR(err)) { - ret = PTR_ERR(err); + ret = _opp_set_clknames(opp_table, dev, config->clk_names, + config->clk_count); + if (ret) goto err; - } data->flags |= 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); 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 *name); -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, int (*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_name(struct device *dev, con static inline void dev_pm_opp_put_prop_name(struct opp_table *opp_table) {} -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); From patchwork Fri Jul 1 08:20:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902949 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 A615CC43334 for ; Fri, 1 Jul 2022 08:24:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234666AbiGAIYL (ORCPT ); Fri, 1 Jul 2022 04:24:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234645AbiGAIXg (ORCPT ); Fri, 1 Jul 2022 04:23:36 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23C94735A2 for ; Fri, 1 Jul 2022 01:22:04 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id n16-20020a17090ade9000b001ed15b37424so1968363pjv.3 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=0zSMxLmXjbQTA7Jd7N4dCPZWzD6EgJJhHrumN1k0M/QH+CpJwHXZyUmoSp4a9wQ6eY av1+jPGr/eKf4gTD1a9liWS0JjOPG+yw2rX3EvC9pM2kbURJeAoNxyTViDw3uWgUkb48 OU2+a9zNnFNxOWfnF5nsRpAAsmzglk5WgEcI1VU0oTgX0O72Ptbvp8DeWwMd1xm0IUL1 BROwriSUMvnn7KbXXKaRpstTuHXl+FPQsKGxEGHmesmYKavviZLtEaEFjI/VzOez0SyP oJ4sfJ1YurXX3uhxdtezQtU2xyGk44VCxTVVbZ7g6UefIuNH6IABqDcX2DtSnq3nKmxN Ey9Q== X-Gm-Message-State: AJIora/kFAWuXSFcrxgpoJMe8JXmRiLsS/ZbVhLuowvpe6O5Nmx5Rjow M9ENdjIMXaBzVAA7hHR8lsYTGQ== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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_table) } /** - * 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 = _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); - } /* Another CPU that shares the OPP table has set the helper ? */ if (opp_table->set_opp) - return opp_table; + return 0; data = kzalloc(sizeof(*data), GFP_KERNEL); if (!data) - return ERR_PTR(-ENOMEM); + return -ENOMEM; mutex_lock(&opp_table->lock); opp_table->set_opp_data = data; @@ -2256,60 +2242,26 @@ struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev, opp_table->set_opp = set_opp; - return opp_table; + return 0; } -EXPORT_SYMBOL_GPL(dev_pm_opp_register_set_opp_helper); /** - * 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_opp 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 = NULL; - - mutex_lock(&opp_table->lock); - kfree(opp_table->set_opp_data); - opp_table->set_opp_data = 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_helper(). - * - * 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 = 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 = NULL; - return devm_add_action_or_reset(dev, devm_pm_opp_unregister_set_opp_helper, - opp_table); + mutex_lock(&opp_table->lock); + kfree(opp_table->set_opp_data); + opp_table->set_opp_data = NULL; + mutex_unlock(&opp_table->lock); + } } -EXPORT_SYMBOL_GPL(devm_pm_opp_register_set_opp_helper); 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, struct dev_pm_opp_config *config) /* Configure opp helper */ if (config->set_opp) { - err = dev_pm_opp_register_set_opp_helper(dev, config->set_opp); - if (IS_ERR(err)) { - ret = PTR_ERR(err); + ret = _opp_register_set_opp_helper(opp_table, dev, + config->set_opp); + if (ret) goto err; - } data->flags |= 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); 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, int (*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(struct device *dev, struct noti 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)) -{ - 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 *dev, const char *name) { return ERR_PTR(-EOPNOTSUPP); From patchwork Fri Jul 1 08:20:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902950 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 131E9C433EF for ; Fri, 1 Jul 2022 08:24:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236141AbiGAIYS (ORCPT ); Fri, 1 Jul 2022 04:24:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235243AbiGAIXt (ORCPT ); Fri, 1 Jul 2022 04:23:49 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEDB770AFF for ; Fri, 1 Jul 2022 01:22:07 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id 68so1748842pgb.10 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=iYgjSK3lBGMv6lblhrMekHCLwlTOEyJ5w67SdhcCrZrXM+DtKsEkVD8wKGzVdcoXK6 GrnBIViOEMv/87WFrkrc/HMScI6si6u8VaeUXwJYLKQgclK9MhVrmZKJCTtulDsVW8BB Z9F5Bxpj6JzcmHB2Xoc24JvxNqkdy9neoW574rqj81UwkJby7/ickhg+QM79eR3T/gZ4 DNevbgv7EmdwVNg3vopDs9XPX08fF9Hx/PkAK3nSlgXu+6YX/AQZHNPl1JcpmqMsvEyo 0J26+wLsDqfoxvs67vA9fLe/a+UWydiVcbW7NfX4RNtglzUnilyMtSluGKxwxXUZESfQ EwmQ== X-Gm-Message-State: AJIora++h+Rppuu65wQQnV/WISjSnbNDMsLJQmSlPYLcperDKenfJZq/ 0UgsN6DQuOVfOG9qQcGvtS/hpw== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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) } } -static void _opp_detach_genpd(struct opp_table *opp_table) +static void _detach_genpd(struct opp_table *opp_table) { int index; @@ -2283,7 +2283,7 @@ static void _opp_detach_genpd(struct opp_table *opp_table) } /** - * dev_pm_opp_attach_genpd - Attach genpd(s) for the device and save virtual device pointer + * _opp_attach_genpd - Attach genpd(s) for the device and save virtual 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. @@ -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 *dev, + const char * const *names, struct device ***virt_devs) { - struct opp_table *opp_table; struct device *virt_dev; int index = 0, ret = -EINVAL; const char * const *name = names; - opp_table = _add_opp_table(dev, false); - if (IS_ERR(opp_table)) - return opp_table; - if (opp_table->genpd_virt_devs) - return opp_table; + return 0; /* * 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 = -EPROBE_DEFER; - goto put_table; - } + if (!opp_table->required_opp_count) + return -EPROBE_DEFER; mutex_lock(&opp_table->genpd_virt_dev_lock); @@ -2360,78 +2353,38 @@ struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, *virt_devs = opp_table->genpd_virt_devs; mutex_unlock(&opp_table->genpd_virt_dev_lock); - return opp_table; + return 0; err: - _opp_detach_genpd(opp_table); + _detach_genpd(opp_table); unlock: mutex_unlock(&opp_table->genpd_virt_dev_lock); + return ret; -put_table: - dev_pm_opp_put_opp_table(opp_table); - - return ERR_PTR(ret); } -EXPORT_SYMBOL_GPL(dev_pm_opp_attach_genpd); /** - * 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 puts 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 virtual - * 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 = 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); 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, struct dev_pm_opp_config *config) /* Attach genpds */ if (config->genpd_names) { - err = dev_pm_opp_attach_genpd(dev, config->genpd_names, - config->virt_devs); - if (IS_ERR(err)) { - ret = PTR_ERR(err); + ret = _opp_attach_genpd(opp_table, dev, config->genpd_names, + config->virt_devs); + if (ret) goto err; - } data->flags |= 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); 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_table, 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_name(struct device *dev, con static inline void dev_pm_opp_put_prop_name(struct opp_table *opp_table) {} -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; From patchwork Fri Jul 1 08:20:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902951 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 35D29C43334 for ; Fri, 1 Jul 2022 08:24:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235384AbiGAIYY (ORCPT ); Fri, 1 Jul 2022 04:24:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234007AbiGAIYB (ORCPT ); Fri, 1 Jul 2022 04:24: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 BA29B73905 for ; Fri, 1 Jul 2022 01:22:10 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id cv13so1918920pjb.4 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=kVVpb7dmTR55X4BSWlfNKqil0rWmoyxxJ93quRgrqDIxM1hzi2LevScpHaxkNt73Cg tUDouvjVCx+KJZnhzSRlyQm4vci2+frE2/+ahuIVsD0EPF7ql9jENB3R4dx0eXa95zYn sUXvw9fGXWTloxorRt56Nid0J/bpUsnXdddJU+gulZqoqvDDm1SD+/J8E++P0wxVY+KE qlIbbAvLdNv+NQhnHE/vvScl/t2dgxDSITcE9HaB+s5xvMV050WfIuhTAUxUdtKpOg9W v0O+Gk4TUhHilXJc5Aq22khQoQ9nj+oqmPhb/Ub6vtvTpXXByd7VDRbc8itWhe7zJH62 hKMg== X-Gm-Message-State: AJIora8BPVKOAeYyDreF7NcqtZQ9vB20IUx//x0WTcy3YTad8QfDaGdm R/RrBB51NLX8iLnAz/VfhM9sjA== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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 *opp_table) } /** - * 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 *name) { - struct opp_table *opp_table; - - opp_table = _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 = 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 = kstrdup(name, GFP_KERNEL); + if (!opp_table->prop_name) + return -ENOMEM; } - return opp_table; + return 0; } -EXPORT_SYMBOL_GPL(dev_pm_opp_set_prop_name); /** - * 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 structure + * _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 = NULL; - - dev_pm_opp_put_opp_table(opp_table); + if (opp_table->prop_name) { + kfree(opp_table->prop_name); + opp_table->prop_name = NULL; + } } -EXPORT_SYMBOL_GPL(dev_pm_opp_put_prop_name); /** * _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); @@ -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 *config) { - 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) /* Configure property names */ if (config->prop_name) { - err = dev_pm_opp_set_prop_name(dev, config->prop_name); - if (IS_ERR(err)) { - ret = PTR_ERR(err); + ret = _opp_set_prop_name(opp_table, config->prop_name); + if (ret) goto err; - } data->flags |= 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 dev_pm_opp_config *config); int devm_pm_opp_set_config(struct device *dev, struct dev_pm_opp_config *config); void dev_pm_opp_clear_config(int token); -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_table, 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(struct device *dev, struct noti return -EOPNOTSUPP; } -static inline struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, 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;