Commit 813ce981 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge tag 'cpufreq-arm-updates-6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm

Pull ARM cpufreq updates for 6.5 from Viresh Kumar:

"- Add support to build cpufreq-dt-platdev as module (Zhipeng Wang).

 - Don't allocate Sparc's cpufreq_driver dynamically (Viresh Kumar).

 - Add support for TI's AM62A7 platform (Vibhore Vardhan).

 - Add support for Armada's ap807 platform (Russell King (Oracle)).

 - Add support for StarFive JH7110 SoC (Mason Huo).

 - Fix voltage selection for Mediatek Socs (Daniel Golle).

 - Fix error handling in Tegra's cpufreq driver (Christophe JAILLET).

 - Document Qualcomm's IPQ8074 in DT bindings (Robert Marko).

 - Don't warn for disabling a non-existing frequency for imx6q cpufreq
   driver (Christoph Niedermaier).

 - Use dev_err_probe() in Qualcomm's cpufreq driver (Andrew Halaney)."
parents 40e8e98f 5ee64250
...@@ -28,6 +28,7 @@ select: ...@@ -28,6 +28,7 @@ select:
- qcom,apq8064 - qcom,apq8064
- qcom,apq8096 - qcom,apq8096
- qcom,ipq8064 - qcom,ipq8064
- qcom,ipq8074
- qcom,msm8939 - qcom,msm8939
- qcom,msm8960 - qcom,msm8960
- qcom,msm8974 - qcom,msm8974
......
...@@ -218,7 +218,7 @@ config CPUFREQ_DT ...@@ -218,7 +218,7 @@ config CPUFREQ_DT
If in doubt, say N. If in doubt, say N.
config CPUFREQ_DT_PLATDEV config CPUFREQ_DT_PLATDEV
bool tristate "Generic DT based cpufreq platdev driver"
help help
This adds a generic DT based cpufreq platdev driver for frequency This adds a generic DT based cpufreq platdev driver for frequency
management. This creates a 'cpufreq-dt' platform device, on the management. This creates a 'cpufreq-dt' platform device, on the
......
...@@ -21,6 +21,13 @@ ...@@ -21,6 +21,13 @@
#include <linux/pm_opp.h> #include <linux/pm_opp.h>
#include <linux/slab.h> #include <linux/slab.h>
static const struct of_device_id __maybe_unused armada_8k_cpufreq_of_match[] = {
{ .compatible = "marvell,ap806-cpu-clock" },
{ .compatible = "marvell,ap807-cpu-clock" },
{ },
};
MODULE_DEVICE_TABLE(of, armada_8k_cpufreq_of_match);
/* /*
* Setup the opps list with the divider for the max frequency, that * Setup the opps list with the divider for the max frequency, that
* will be filled at runtime. * will be filled at runtime.
...@@ -127,7 +134,8 @@ static int __init armada_8k_cpufreq_init(void) ...@@ -127,7 +134,8 @@ static int __init armada_8k_cpufreq_init(void)
struct device_node *node; struct device_node *node;
struct cpumask cpus; struct cpumask cpus;
node = of_find_compatible_node(NULL, NULL, "marvell,ap806-cpu-clock"); node = of_find_matching_node_and_match(NULL, armada_8k_cpufreq_of_match,
NULL);
if (!node || !of_device_is_available(node)) { if (!node || !of_device_is_available(node)) {
of_node_put(node); of_node_put(node);
return -ENODEV; return -ENODEV;
...@@ -204,12 +212,6 @@ static void __exit armada_8k_cpufreq_exit(void) ...@@ -204,12 +212,6 @@ static void __exit armada_8k_cpufreq_exit(void)
} }
module_exit(armada_8k_cpufreq_exit); module_exit(armada_8k_cpufreq_exit);
static const struct of_device_id __maybe_unused armada_8k_cpufreq_of_match[] = {
{ .compatible = "marvell,ap806-cpu-clock" },
{ },
};
MODULE_DEVICE_TABLE(of, armada_8k_cpufreq_of_match);
MODULE_AUTHOR("Gregory Clement <gregory.clement@bootlin.com>"); MODULE_AUTHOR("Gregory Clement <gregory.clement@bootlin.com>");
MODULE_DESCRIPTION("Armada 8K cpufreq driver"); MODULE_DESCRIPTION("Armada 8K cpufreq driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
*/ */
#include <linux/err.h> #include <linux/err.h>
#include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -85,6 +86,8 @@ static const struct of_device_id allowlist[] __initconst = { ...@@ -85,6 +86,8 @@ static const struct of_device_id allowlist[] __initconst = {
{ .compatible = "st-ericsson,u9500", }, { .compatible = "st-ericsson,u9500", },
{ .compatible = "st-ericsson,u9540", }, { .compatible = "st-ericsson,u9540", },
{ .compatible = "starfive,jh7110", },
{ .compatible = "ti,omap2", }, { .compatible = "ti,omap2", },
{ .compatible = "ti,omap4", }, { .compatible = "ti,omap4", },
{ .compatible = "ti,omap5", }, { .compatible = "ti,omap5", },
...@@ -165,6 +168,7 @@ static const struct of_device_id blocklist[] __initconst = { ...@@ -165,6 +168,7 @@ static const struct of_device_id blocklist[] __initconst = {
{ .compatible = "ti,dra7", }, { .compatible = "ti,dra7", },
{ .compatible = "ti,omap3", }, { .compatible = "ti,omap3", },
{ .compatible = "ti,am625", }, { .compatible = "ti,am625", },
{ .compatible = "ti,am62a7", },
{ .compatible = "qcom,ipq8064", }, { .compatible = "qcom,ipq8064", },
{ .compatible = "qcom,apq8064", }, { .compatible = "qcom,apq8064", },
...@@ -214,3 +218,4 @@ static int __init cpufreq_dt_platdev_init(void) ...@@ -214,3 +218,4 @@ static int __init cpufreq_dt_platdev_init(void)
sizeof(struct cpufreq_dt_platform_data))); sizeof(struct cpufreq_dt_platform_data)));
} }
core_initcall(cpufreq_dt_platdev_init); core_initcall(cpufreq_dt_platdev_init);
MODULE_LICENSE("GPL");
...@@ -209,6 +209,14 @@ static struct cpufreq_driver imx6q_cpufreq_driver = { ...@@ -209,6 +209,14 @@ static struct cpufreq_driver imx6q_cpufreq_driver = {
.suspend = cpufreq_generic_suspend, .suspend = cpufreq_generic_suspend,
}; };
static void imx6x_disable_freq_in_opp(struct device *dev, unsigned long freq)
{
int ret = dev_pm_opp_disable(dev, freq);
if (ret < 0 && ret != -ENODEV)
dev_warn(dev, "failed to disable %ldMHz OPP\n", freq / 1000000);
}
#define OCOTP_CFG3 0x440 #define OCOTP_CFG3 0x440
#define OCOTP_CFG3_SPEED_SHIFT 16 #define OCOTP_CFG3_SPEED_SHIFT 16
#define OCOTP_CFG3_SPEED_1P2GHZ 0x3 #define OCOTP_CFG3_SPEED_1P2GHZ 0x3
...@@ -254,17 +262,15 @@ static int imx6q_opp_check_speed_grading(struct device *dev) ...@@ -254,17 +262,15 @@ static int imx6q_opp_check_speed_grading(struct device *dev)
val &= 0x3; val &= 0x3;
if (val < OCOTP_CFG3_SPEED_996MHZ) if (val < OCOTP_CFG3_SPEED_996MHZ)
if (dev_pm_opp_disable(dev, 996000000)) imx6x_disable_freq_in_opp(dev, 996000000);
dev_warn(dev, "failed to disable 996MHz OPP\n");
if (of_machine_is_compatible("fsl,imx6q") || if (of_machine_is_compatible("fsl,imx6q") ||
of_machine_is_compatible("fsl,imx6qp")) { of_machine_is_compatible("fsl,imx6qp")) {
if (val != OCOTP_CFG3_SPEED_852MHZ) if (val != OCOTP_CFG3_SPEED_852MHZ)
if (dev_pm_opp_disable(dev, 852000000)) imx6x_disable_freq_in_opp(dev, 852000000);
dev_warn(dev, "failed to disable 852MHz OPP\n");
if (val != OCOTP_CFG3_SPEED_1P2GHZ) if (val != OCOTP_CFG3_SPEED_1P2GHZ)
if (dev_pm_opp_disable(dev, 1200000000)) imx6x_disable_freq_in_opp(dev, 1200000000);
dev_warn(dev, "failed to disable 1.2GHz OPP\n");
} }
return 0; return 0;
...@@ -316,20 +322,16 @@ static int imx6ul_opp_check_speed_grading(struct device *dev) ...@@ -316,20 +322,16 @@ static int imx6ul_opp_check_speed_grading(struct device *dev)
val >>= OCOTP_CFG3_SPEED_SHIFT; val >>= OCOTP_CFG3_SPEED_SHIFT;
val &= 0x3; val &= 0x3;
if (of_machine_is_compatible("fsl,imx6ul")) { if (of_machine_is_compatible("fsl,imx6ul"))
if (val != OCOTP_CFG3_6UL_SPEED_696MHZ) if (val != OCOTP_CFG3_6UL_SPEED_696MHZ)
if (dev_pm_opp_disable(dev, 696000000)) imx6x_disable_freq_in_opp(dev, 696000000);
dev_warn(dev, "failed to disable 696MHz OPP\n");
}
if (of_machine_is_compatible("fsl,imx6ull")) { if (of_machine_is_compatible("fsl,imx6ull")) {
if (val != OCOTP_CFG3_6ULL_SPEED_792MHZ) if (val != OCOTP_CFG3_6ULL_SPEED_792MHZ)
if (dev_pm_opp_disable(dev, 792000000)) imx6x_disable_freq_in_opp(dev, 792000000);
dev_warn(dev, "failed to disable 792MHz OPP\n");
if (val != OCOTP_CFG3_6ULL_SPEED_900MHZ) if (val != OCOTP_CFG3_6ULL_SPEED_900MHZ)
if (dev_pm_opp_disable(dev, 900000000)) imx6x_disable_freq_in_opp(dev, 900000000);
dev_warn(dev, "failed to disable 900MHz OPP\n");
} }
return ret; return ret;
......
...@@ -696,9 +696,16 @@ static const struct mtk_cpufreq_platform_data mt2701_platform_data = { ...@@ -696,9 +696,16 @@ static const struct mtk_cpufreq_platform_data mt2701_platform_data = {
static const struct mtk_cpufreq_platform_data mt7622_platform_data = { static const struct mtk_cpufreq_platform_data mt7622_platform_data = {
.min_volt_shift = 100000, .min_volt_shift = 100000,
.max_volt_shift = 200000, .max_volt_shift = 200000,
.proc_max_volt = 1360000, .proc_max_volt = 1350000,
.sram_min_volt = 0, .sram_min_volt = 0,
.sram_max_volt = 1360000, .sram_max_volt = 1350000,
.ccifreq_supported = false,
};
static const struct mtk_cpufreq_platform_data mt7623_platform_data = {
.min_volt_shift = 100000,
.max_volt_shift = 200000,
.proc_max_volt = 1300000,
.ccifreq_supported = false, .ccifreq_supported = false,
}; };
...@@ -734,7 +741,7 @@ static const struct of_device_id mtk_cpufreq_machines[] __initconst = { ...@@ -734,7 +741,7 @@ static const struct of_device_id mtk_cpufreq_machines[] __initconst = {
{ .compatible = "mediatek,mt2701", .data = &mt2701_platform_data }, { .compatible = "mediatek,mt2701", .data = &mt2701_platform_data },
{ .compatible = "mediatek,mt2712", .data = &mt2701_platform_data }, { .compatible = "mediatek,mt2712", .data = &mt2701_platform_data },
{ .compatible = "mediatek,mt7622", .data = &mt7622_platform_data }, { .compatible = "mediatek,mt7622", .data = &mt7622_platform_data },
{ .compatible = "mediatek,mt7623", .data = &mt7622_platform_data }, { .compatible = "mediatek,mt7623", .data = &mt7623_platform_data },
{ .compatible = "mediatek,mt8167", .data = &mt8516_platform_data }, { .compatible = "mediatek,mt8167", .data = &mt8516_platform_data },
{ .compatible = "mediatek,mt817x", .data = &mt2701_platform_data }, { .compatible = "mediatek,mt817x", .data = &mt2701_platform_data },
{ .compatible = "mediatek,mt8173", .data = &mt2701_platform_data }, { .compatible = "mediatek,mt8173", .data = &mt2701_platform_data },
......
...@@ -661,7 +661,7 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev) ...@@ -661,7 +661,7 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev)
ret = dev_pm_opp_of_find_icc_paths(cpu_dev, NULL); ret = dev_pm_opp_of_find_icc_paths(cpu_dev, NULL);
if (ret) if (ret)
return ret; return dev_err_probe(dev, ret, "Failed to find icc paths\n");
for (num_domains = 0; num_domains < MAX_FREQ_DOMAINS; num_domains++) for (num_domains = 0; num_domains < MAX_FREQ_DOMAINS; num_domains++)
if (!platform_get_resource(pdev, IORESOURCE_MEM, num_domains)) if (!platform_get_resource(pdev, IORESOURCE_MEM, num_domains))
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#include <asm/asi.h> #include <asm/asi.h>
#include <asm/timer.h> #include <asm/timer.h>
static struct cpufreq_driver *cpufreq_us2e_driver;
struct us2e_freq_percpu_info { struct us2e_freq_percpu_info {
struct cpufreq_frequency_table table[6]; struct cpufreq_frequency_table table[6];
}; };
...@@ -300,12 +298,19 @@ static int __init us2e_freq_cpu_init(struct cpufreq_policy *policy) ...@@ -300,12 +298,19 @@ static int __init us2e_freq_cpu_init(struct cpufreq_policy *policy)
static int us2e_freq_cpu_exit(struct cpufreq_policy *policy) static int us2e_freq_cpu_exit(struct cpufreq_policy *policy)
{ {
if (cpufreq_us2e_driver) us2e_freq_target(policy, 0);
us2e_freq_target(policy, 0);
return 0; return 0;
} }
static struct cpufreq_driver cpufreq_us2e_driver = {
.name = "UltraSPARC-IIe",
.init = us2e_freq_cpu_init,
.verify = cpufreq_generic_frequency_table_verify,
.target_index = us2e_freq_target,
.get = us2e_freq_get,
.exit = us2e_freq_cpu_exit,
};
static int __init us2e_freq_init(void) static int __init us2e_freq_init(void)
{ {
unsigned long manuf, impl, ver; unsigned long manuf, impl, ver;
...@@ -319,39 +324,15 @@ static int __init us2e_freq_init(void) ...@@ -319,39 +324,15 @@ static int __init us2e_freq_init(void)
impl = ((ver >> 32) & 0xffff); impl = ((ver >> 32) & 0xffff);
if (manuf == 0x17 && impl == 0x13) { if (manuf == 0x17 && impl == 0x13) {
struct cpufreq_driver *driver; us2e_freq_table = kzalloc(NR_CPUS * sizeof(*us2e_freq_table),
GFP_KERNEL);
ret = -ENOMEM;
driver = kzalloc(sizeof(*driver), GFP_KERNEL);
if (!driver)
goto err_out;
us2e_freq_table = kzalloc((NR_CPUS * sizeof(*us2e_freq_table)),
GFP_KERNEL);
if (!us2e_freq_table) if (!us2e_freq_table)
goto err_out; return -ENOMEM;
driver->init = us2e_freq_cpu_init;
driver->verify = cpufreq_generic_frequency_table_verify;
driver->target_index = us2e_freq_target;
driver->get = us2e_freq_get;
driver->exit = us2e_freq_cpu_exit;
strcpy(driver->name, "UltraSPARC-IIe");
cpufreq_us2e_driver = driver; ret = cpufreq_register_driver(&cpufreq_us2e_driver);
ret = cpufreq_register_driver(driver);
if (ret) if (ret)
goto err_out; kfree(us2e_freq_table);
return 0;
err_out:
if (driver) {
kfree(driver);
cpufreq_us2e_driver = NULL;
}
kfree(us2e_freq_table);
us2e_freq_table = NULL;
return ret; return ret;
} }
...@@ -360,13 +341,8 @@ static int __init us2e_freq_init(void) ...@@ -360,13 +341,8 @@ static int __init us2e_freq_init(void)
static void __exit us2e_freq_exit(void) static void __exit us2e_freq_exit(void)
{ {
if (cpufreq_us2e_driver) { cpufreq_unregister_driver(&cpufreq_us2e_driver);
cpufreq_unregister_driver(cpufreq_us2e_driver); kfree(us2e_freq_table);
kfree(cpufreq_us2e_driver);
cpufreq_us2e_driver = NULL;
kfree(us2e_freq_table);
us2e_freq_table = NULL;
}
} }
MODULE_AUTHOR("David S. Miller <davem@redhat.com>"); MODULE_AUTHOR("David S. Miller <davem@redhat.com>");
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
#include <asm/head.h> #include <asm/head.h>
#include <asm/timer.h> #include <asm/timer.h>
static struct cpufreq_driver *cpufreq_us3_driver;
struct us3_freq_percpu_info { struct us3_freq_percpu_info {
struct cpufreq_frequency_table table[4]; struct cpufreq_frequency_table table[4];
}; };
...@@ -144,12 +142,19 @@ static int __init us3_freq_cpu_init(struct cpufreq_policy *policy) ...@@ -144,12 +142,19 @@ static int __init us3_freq_cpu_init(struct cpufreq_policy *policy)
static int us3_freq_cpu_exit(struct cpufreq_policy *policy) static int us3_freq_cpu_exit(struct cpufreq_policy *policy)
{ {
if (cpufreq_us3_driver) us3_freq_target(policy, 0);
us3_freq_target(policy, 0);
return 0; return 0;
} }
static struct cpufreq_driver cpufreq_us3_driver = {
.name = "UltraSPARC-III",
.init = us3_freq_cpu_init,
.verify = cpufreq_generic_frequency_table_verify,
.target_index = us3_freq_target,
.get = us3_freq_get,
.exit = us3_freq_cpu_exit,
};
static int __init us3_freq_init(void) static int __init us3_freq_init(void)
{ {
unsigned long manuf, impl, ver; unsigned long manuf, impl, ver;
...@@ -167,39 +172,15 @@ static int __init us3_freq_init(void) ...@@ -167,39 +172,15 @@ static int __init us3_freq_init(void)
impl == CHEETAH_PLUS_IMPL || impl == CHEETAH_PLUS_IMPL ||
impl == JAGUAR_IMPL || impl == JAGUAR_IMPL ||
impl == PANTHER_IMPL)) { impl == PANTHER_IMPL)) {
struct cpufreq_driver *driver; us3_freq_table = kzalloc(NR_CPUS * sizeof(*us3_freq_table),
GFP_KERNEL);
ret = -ENOMEM;
driver = kzalloc(sizeof(*driver), GFP_KERNEL);
if (!driver)
goto err_out;
us3_freq_table = kzalloc((NR_CPUS * sizeof(*us3_freq_table)),
GFP_KERNEL);
if (!us3_freq_table) if (!us3_freq_table)
goto err_out; return -ENOMEM;
driver->init = us3_freq_cpu_init;
driver->verify = cpufreq_generic_frequency_table_verify;
driver->target_index = us3_freq_target;
driver->get = us3_freq_get;
driver->exit = us3_freq_cpu_exit;
strcpy(driver->name, "UltraSPARC-III");
cpufreq_us3_driver = driver; ret = cpufreq_register_driver(&cpufreq_us3_driver);
ret = cpufreq_register_driver(driver);
if (ret) if (ret)
goto err_out; kfree(us3_freq_table);
return 0;
err_out:
if (driver) {
kfree(driver);
cpufreq_us3_driver = NULL;
}
kfree(us3_freq_table);
us3_freq_table = NULL;
return ret; return ret;
} }
...@@ -208,13 +189,8 @@ static int __init us3_freq_init(void) ...@@ -208,13 +189,8 @@ static int __init us3_freq_init(void)
static void __exit us3_freq_exit(void) static void __exit us3_freq_exit(void)
{ {
if (cpufreq_us3_driver) { cpufreq_unregister_driver(&cpufreq_us3_driver);
cpufreq_unregister_driver(cpufreq_us3_driver); kfree(us3_freq_table);
kfree(cpufreq_us3_driver);
cpufreq_us3_driver = NULL;
kfree(us3_freq_table);
us3_freq_table = NULL;
}
} }
MODULE_AUTHOR("David S. Miller <davem@redhat.com>"); MODULE_AUTHOR("David S. Miller <davem@redhat.com>");
......
...@@ -686,8 +686,10 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev) ...@@ -686,8 +686,10 @@ static int tegra194_cpufreq_probe(struct platform_device *pdev)
/* Check for optional OPPv2 and interconnect paths on CPU0 to enable ICC scaling */ /* Check for optional OPPv2 and interconnect paths on CPU0 to enable ICC scaling */
cpu_dev = get_cpu_device(0); cpu_dev = get_cpu_device(0);
if (!cpu_dev) if (!cpu_dev) {
return -EPROBE_DEFER; err = -EPROBE_DEFER;
goto err_free_res;
}
if (dev_pm_opp_of_get_opp_desc_node(cpu_dev)) { if (dev_pm_opp_of_get_opp_desc_node(cpu_dev)) {
err = dev_pm_opp_of_find_icc_paths(cpu_dev, NULL); err = dev_pm_opp_of_find_icc_paths(cpu_dev, NULL);
......
...@@ -337,6 +337,7 @@ static const struct of_device_id ti_cpufreq_of_match[] = { ...@@ -337,6 +337,7 @@ static const struct of_device_id ti_cpufreq_of_match[] = {
{ .compatible = "ti,omap34xx", .data = &omap34xx_soc_data, }, { .compatible = "ti,omap34xx", .data = &omap34xx_soc_data, },
{ .compatible = "ti,omap36xx", .data = &omap36xx_soc_data, }, { .compatible = "ti,omap36xx", .data = &omap36xx_soc_data, },
{ .compatible = "ti,am625", .data = &am625_soc_data, }, { .compatible = "ti,am625", .data = &am625_soc_data, },
{ .compatible = "ti,am62a7", .data = &am625_soc_data, },
/* legacy */ /* legacy */
{ .compatible = "ti,omap3430", .data = &omap34xx_soc_data, }, { .compatible = "ti,omap3430", .data = &omap34xx_soc_data, },
{ .compatible = "ti,omap3630", .data = &omap36xx_soc_data, }, { .compatible = "ti,omap3630", .data = &omap36xx_soc_data, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment