* [PATCH V2 00/30] OPP: Add new configuration interface: dev_pm_opp_set_config()
@ 2022-07-01 8:19 Viresh Kumar
2022-07-01 8:20 ` [PATCH V2 07/30] cpufreq: sun50i: Migrate to dev_pm_opp_set_config() Viresh Kumar
2022-07-01 8:20 ` [PATCH V2 11/30] devfreq: sun8i: " Viresh Kumar
0 siblings, 2 replies; 3+ messages in thread
From: Viresh Kumar @ 2022-07-01 8:19 UTC (permalink / raw)
To: Abhinav Kumar, Adrian Hunter, Alim Akhtar, Alyssa Rosenzweig,
Andy Gross, Bjorn Andersson, Chanwoo Choi, Chen-Yu Tsai,
Dmitry Baryshkov, Dmitry Osipenko, Fabio Estevam,
Greg Kroah-Hartman, Ilia Lin, Jernej Skrabec, Jiri Slaby,
Jonathan Hunter, Krzysztof Kozlowski, Kyungmin Park, Mark Brown,
MyungJoo Ham, Nishanth Menon, NXP Linux Team, Patrice Chotard,
Pengutronix Kernel Team, Qiang Yu, Rafael J. Wysocki, Rob Clark,
Rob Herring, Samuel Holland, Sascha Hauer, Sean Paul, Shawn Guo,
Stanimir Varbanov, Stephen Boyd, Steven Price, Thierry Reding,
Tomeu Vizoso, Ulf Hansson, Viresh Kumar, Viresh Kumar, Yangtao Li
Cc: linux-pm, Vincent Guittot, Dmitry Osipenko, dri-devel, freedreno,
lima, linux-arm-kernel, linux-arm-msm, linux-kernel, linux-media,
linux-mmc, linux-samsung-soc, linux-serial, linux-spi,
linux-sunxi, linux-tegra
Hello,
We have too many configuration specific APIs currently, six of them already,
like dev_pm_opp_set_regulators(). This makes it complex/messy for both the OPP
core and its users to manage. There is also code redundancy in these APIs, in
the way they add/manage the OPP table specific stuff.
This patch series is an attempt to simplify these interfaces by adding a single
interface, dev_pm_opp_set_config(), which replaces all the existing ones. This
series also migrates the users to the new API.
The first two patches help get the API in place, followed by patches to migrate
the end users. Once all the users are migrated, the last few patches remove the
now unused interfaces.
This is pushed here:
git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm.git opp/linux-next
This is already tested by various folks now.
The entire patchset shall get merged via the OPP tree in 5.20-rc1, please do not
merge individual patches.
V1->V2:
- dev_pm_opp_set_config() doesn't return the OPP table anymore, but a token
allocated with xa_alloc(). The same needs to be passed to clear-config API.
- Updated all users according to that as well.
- The clk_names interface is updated to allow multiple clocks.
- Converted few // comments to /* */.
- Added tags by few people.
- Dropped the last patch to rearrange stuff, not required anymore.
Thanks.
--
Viresh
Viresh Kumar (30):
OPP: Track if clock name is configured by platform
OPP: Add dev_pm_opp_set_config() and friends
cpufreq: dt: Migrate to dev_pm_opp_set_config()
cpufreq: imx: Migrate to dev_pm_opp_set_config()
cpufreq: qcom-nvmem: Migrate to dev_pm_opp_set_config()
cpufreq: sti: Migrate to dev_pm_opp_set_config()
cpufreq: sun50i: Migrate to dev_pm_opp_set_config()
cpufreq: tegra20: Migrate to dev_pm_opp_set_config()
cpufreq: ti: Migrate to dev_pm_opp_set_config()
devfreq: exynos: Migrate to dev_pm_opp_set_config()
devfreq: sun8i: Migrate to dev_pm_opp_set_config()
devfreq: tegra30: Migrate to dev_pm_opp_set_config()
drm/lima: Migrate to dev_pm_opp_set_config()
drm/msm: Migrate to dev_pm_opp_set_config()
drm/panfrost: Migrate to dev_pm_opp_set_config()
drm/tegra: Migrate to dev_pm_opp_set_config()
media: venus: Migrate to dev_pm_opp_set_config()
memory: tegra: Migrate to dev_pm_opp_set_config()
mmc: sdhci-msm: Migrate to dev_pm_opp_set_config()
OPP: ti: Migrate to dev_pm_opp_set_config()
soc/tegra: Add comment over devm_pm_opp_set_clkname()
soc/tegra: Migrate to dev_pm_opp_set_config()
spi: qcom: Migrate to dev_pm_opp_set_config()
serial: qcom: Migrate to dev_pm_opp_set_config()
OPP: Remove dev_pm_opp_set_regulators() and friends
OPP: Remove dev_pm_opp_set_supported_hw() and friends
OPP: Remove dev_pm_opp_set_clkname() and friends
OPP: Remove dev_pm_opp_register_set_opp_helper() and friends
OPP: Remove dev_pm_opp_attach_genpd() and friends
OPP: Remove dev_pm_opp_set_prop_name() and friends
drivers/cpufreq/cpufreq-dt.c | 20 +-
drivers/cpufreq/imx-cpufreq-dt.c | 18 +-
drivers/cpufreq/qcom-cpufreq-nvmem.c | 109 +--
drivers/cpufreq/sti-cpufreq.c | 27 +-
drivers/cpufreq/sun50i-cpufreq-nvmem.c | 36 +-
drivers/cpufreq/tegra20-cpufreq.c | 18 +-
drivers/cpufreq/ti-cpufreq.c | 38 +-
drivers/devfreq/exynos-bus.c | 25 +-
drivers/devfreq/sun8i-a33-mbus.c | 8 +-
drivers/devfreq/tegra30-devfreq.c | 8 +-
drivers/gpu/drm/lima/lima_devfreq.c | 12 +-
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 +-
drivers/gpu/drm/panfrost/panfrost_devfreq.c | 9 +-
drivers/gpu/drm/tegra/gr3d.c | 6 +-
.../media/platform/qcom/venus/pm_helpers.c | 18 +-
drivers/memory/tegra/tegra124-emc.c | 17 +-
drivers/mmc/host/sdhci-msm.c | 6 +-
drivers/opp/core.c | 632 ++++++++----------
drivers/opp/opp.h | 23 +
drivers/opp/ti-opp-supply.c | 8 +-
drivers/soc/tegra/common.c | 45 +-
drivers/soc/tegra/pmc.c | 8 +-
drivers/spi/spi-geni-qcom.c | 6 +-
drivers/spi/spi-qcom-qspi.c | 6 +-
drivers/tty/serial/qcom_geni_serial.c | 6 +-
include/linux/pm_opp.h | 121 +---
30 files changed, 605 insertions(+), 661 deletions(-)
--
2.31.1.272.g89b43f80a514
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH V2 07/30] cpufreq: sun50i: Migrate to dev_pm_opp_set_config()
2022-07-01 8:19 [PATCH V2 00/30] OPP: Add new configuration interface: dev_pm_opp_set_config() Viresh Kumar
@ 2022-07-01 8:20 ` Viresh Kumar
2022-07-01 8:20 ` [PATCH V2 11/30] devfreq: sun8i: " Viresh Kumar
1 sibling, 0 replies; 3+ messages in thread
From: Viresh Kumar @ 2022-07-01 8:20 UTC (permalink / raw)
To: Yangtao Li, Rafael J. Wysocki, Viresh Kumar, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland
Cc: linux-pm, Vincent Guittot, Stephen Boyd, Nishanth Menon,
linux-arm-kernel, linux-sunxi, linux-kernel
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 <viresh.kumar@linaro.org>
---
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;
}
--
2.31.1.272.g89b43f80a514
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH V2 11/30] devfreq: sun8i: Migrate to dev_pm_opp_set_config()
2022-07-01 8:19 [PATCH V2 00/30] OPP: Add new configuration interface: dev_pm_opp_set_config() Viresh Kumar
2022-07-01 8:20 ` [PATCH V2 07/30] cpufreq: sun50i: Migrate to dev_pm_opp_set_config() Viresh Kumar
@ 2022-07-01 8:20 ` Viresh Kumar
1 sibling, 0 replies; 3+ messages in thread
From: Viresh Kumar @ 2022-07-01 8:20 UTC (permalink / raw)
To: MyungJoo Ham, Kyungmin Park, Chanwoo Choi, Chen-Yu Tsai,
Jernej Skrabec, Samuel Holland
Cc: Viresh Kumar, linux-pm, Vincent Guittot, Rafael J. Wysocki,
Stephen Boyd, Nishanth Menon, linux-arm-kernel, linux-sunxi,
linux-kernel
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 <viresh.kumar@linaro.org>
---
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;
}
--
2.31.1.272.g89b43f80a514
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-07-01 8:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-01 8:19 [PATCH V2 00/30] OPP: Add new configuration interface: dev_pm_opp_set_config() Viresh Kumar
2022-07-01 8:20 ` [PATCH V2 07/30] cpufreq: sun50i: Migrate to dev_pm_opp_set_config() Viresh Kumar
2022-07-01 8:20 ` [PATCH V2 11/30] devfreq: sun8i: " Viresh Kumar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox