Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge back cpufreq core changes for v4.12.

+59 -132
+1
MAINTAINERS
··· 3449 3449 T: git git://git.linaro.org/people/vireshk/linux.git (For ARM Updates) 3450 3450 B: https://bugzilla.kernel.org 3451 3451 F: Documentation/cpu-freq/ 3452 + F: Documentation/devicetree/bindings/cpufreq/ 3452 3453 F: drivers/cpufreq/ 3453 3454 F: include/linux/cpufreq.h 3454 3455 F: tools/testing/selftests/cpufreq/
-5
arch/arm/boot/dts/ste-dbx5x0.dtsi
··· 1189 1189 status = "disabled"; 1190 1190 }; 1191 1191 1192 - cpufreq-cooling { 1193 - compatible = "stericsson,db8500-cpufreq-cooling"; 1194 - status = "disabled"; 1195 - }; 1196 - 1197 1192 mcde@a0350000 { 1198 1193 compatible = "stericsson,mcde"; 1199 1194 reg = <0xa0350000 0x1000>, /* MCDE */
+20
drivers/cpufreq/dbx500-cpufreq.c
··· 11 11 #include <linux/module.h> 12 12 #include <linux/kernel.h> 13 13 #include <linux/cpufreq.h> 14 + #include <linux/cpu_cooling.h> 14 15 #include <linux/delay.h> 15 16 #include <linux/slab.h> 16 17 #include <linux/platform_device.h> ··· 19 18 20 19 static struct cpufreq_frequency_table *freq_table; 21 20 static struct clk *armss_clk; 21 + static struct thermal_cooling_device *cdev; 22 22 23 23 static int dbx500_cpufreq_target(struct cpufreq_policy *policy, 24 24 unsigned int index) ··· 34 32 return cpufreq_generic_init(policy, freq_table, 20 * 1000); 35 33 } 36 34 35 + static int dbx500_cpufreq_exit(struct cpufreq_policy *policy) 36 + { 37 + if (!IS_ERR(cdev)) 38 + cpufreq_cooling_unregister(cdev); 39 + return 0; 40 + } 41 + 42 + static void dbx500_cpufreq_ready(struct cpufreq_policy *policy) 43 + { 44 + cdev = cpufreq_cooling_register(policy->cpus); 45 + if (IS_ERR(cdev)) 46 + pr_err("Failed to register cooling device %ld\n", PTR_ERR(cdev)); 47 + else 48 + pr_info("Cooling device registered: %s\n", cdev->type); 49 + } 50 + 37 51 static struct cpufreq_driver dbx500_cpufreq_driver = { 38 52 .flags = CPUFREQ_STICKY | CPUFREQ_CONST_LOOPS | 39 53 CPUFREQ_NEED_INITIAL_FREQ_CHECK, ··· 57 39 .target_index = dbx500_cpufreq_target, 58 40 .get = cpufreq_generic_get, 59 41 .init = dbx500_cpufreq_init, 42 + .exit = dbx500_cpufreq_exit, 43 + .ready = dbx500_cpufreq_ready, 60 44 .name = "DBX500", 61 45 .attr = cpufreq_generic_attr, 62 46 };
+21 -2
drivers/cpufreq/mt8173-cpufreq.c
··· 573 573 .probe = mt8173_cpufreq_probe, 574 574 }; 575 575 576 - static int mt8173_cpufreq_driver_init(void) 576 + /* List of machines supported by this driver */ 577 + static const struct of_device_id mt8173_cpufreq_machines[] __initconst = { 578 + { .compatible = "mediatek,mt817x", }, 579 + { .compatible = "mediatek,mt8173", }, 580 + { .compatible = "mediatek,mt8176", }, 581 + 582 + { } 583 + }; 584 + 585 + static int __init mt8173_cpufreq_driver_init(void) 577 586 { 587 + struct device_node *np; 588 + const struct of_device_id *match; 578 589 struct platform_device *pdev; 579 590 int err; 580 591 581 - if (!of_machine_is_compatible("mediatek,mt8173")) 592 + np = of_find_node_by_path("/"); 593 + if (!np) 582 594 return -ENODEV; 595 + 596 + match = of_match_node(mt8173_cpufreq_machines, np); 597 + of_node_put(np); 598 + if (!match) { 599 + pr_warn("Machine is not compatible with mt8173-cpufreq\n"); 600 + return -ENODEV; 601 + } 583 602 584 603 err = platform_driver_register(&mt8173_cpufreq_platdrv); 585 604 if (err)
+17 -7
drivers/cpufreq/qoriq-cpufreq.c
··· 52 52 { 53 53 struct device_node *soc; 54 54 u32 sysfreq; 55 + struct clk *pltclk; 56 + int ret; 55 57 58 + /* get platform freq by searching bus-frequency property */ 56 59 soc = of_find_node_by_type(NULL, "soc"); 57 - if (!soc) 58 - return 0; 60 + if (soc) { 61 + ret = of_property_read_u32(soc, "bus-frequency", &sysfreq); 62 + of_node_put(soc); 63 + if (!ret) 64 + return sysfreq; 65 + } 59 66 60 - if (of_property_read_u32(soc, "bus-frequency", &sysfreq)) 61 - sysfreq = 0; 67 + /* get platform freq by its clock name */ 68 + pltclk = clk_get(NULL, "cg-pll0-div1"); 69 + if (IS_ERR(pltclk)) { 70 + pr_err("%s: can't get bus frequency %ld\n", 71 + __func__, PTR_ERR(pltclk)); 72 + return PTR_ERR(pltclk); 73 + } 62 74 63 - of_node_put(soc); 64 - 65 - return sysfreq; 75 + return clk_get_rate(pltclk); 66 76 } 67 77 68 78 static struct clk *cpu_to_clk(int cpu)
-12
drivers/thermal/Kconfig
··· 291 291 Enable this option if you want to have support for thermal management 292 292 controller present in Armada 370 and Armada XP SoC. 293 293 294 - config DB8500_CPUFREQ_COOLING 295 - tristate "DB8500 cpufreq cooling" 296 - depends on ARCH_U8500 || COMPILE_TEST 297 - depends on HAS_IOMEM 298 - depends on CPU_THERMAL 299 - default y 300 - help 301 - Adds DB8500 cpufreq cooling devices, and these cooling devices can be 302 - bound to thermal zone trip points. When a trip point reached, the 303 - bound cpufreq cooling device turns active to set CPU frequency low to 304 - cool down the CPU. 305 - 306 294 config INTEL_POWERCLAMP 307 295 tristate "Intel PowerClamp idle injection driver" 308 296 depends on THERMAL
-1
drivers/thermal/Makefile
··· 41 41 obj-$(CONFIG_IMX_THERMAL) += imx_thermal.o 42 42 obj-$(CONFIG_MAX77620_THERMAL) += max77620_thermal.o 43 43 obj-$(CONFIG_QORIQ_THERMAL) += qoriq_thermal.o 44 - obj-$(CONFIG_DB8500_CPUFREQ_COOLING) += db8500_cpufreq_cooling.o 45 44 obj-$(CONFIG_INTEL_POWERCLAMP) += intel_powerclamp.o 46 45 obj-$(CONFIG_X86_PKG_TEMP_THERMAL) += x86_pkg_temp_thermal.o 47 46 obj-$(CONFIG_INTEL_SOC_DTS_IOSF_CORE) += intel_soc_dts_iosf.o
-105
drivers/thermal/db8500_cpufreq_cooling.c
··· 1 - /* 2 - * db8500_cpufreq_cooling.c - DB8500 cpufreq works as cooling device. 3 - * 4 - * Copyright (C) 2012 ST-Ericsson 5 - * Copyright (C) 2012 Linaro Ltd. 6 - * 7 - * Author: Hongbo Zhang <hongbo.zhang@linaro.com> 8 - * 9 - * This program is free software; you can redistribute it and/or modify 10 - * it under the terms of the GNU General Public License as published by 11 - * the Free Software Foundation; either version 2 of the License, or 12 - * (at your option) any later version. 13 - * 14 - * This program is distributed in the hope that it will be useful, 15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 - * GNU General Public License for more details. 18 - */ 19 - 20 - #include <linux/cpu_cooling.h> 21 - #include <linux/err.h> 22 - #include <linux/module.h> 23 - #include <linux/of.h> 24 - #include <linux/platform_device.h> 25 - #include <linux/slab.h> 26 - 27 - static int db8500_cpufreq_cooling_probe(struct platform_device *pdev) 28 - { 29 - struct thermal_cooling_device *cdev; 30 - 31 - cdev = cpufreq_cooling_register(cpu_present_mask); 32 - if (IS_ERR(cdev)) { 33 - int ret = PTR_ERR(cdev); 34 - 35 - if (ret != -EPROBE_DEFER) 36 - dev_err(&pdev->dev, 37 - "Failed to register cooling device %d\n", 38 - ret); 39 - 40 - return ret; 41 - } 42 - 43 - platform_set_drvdata(pdev, cdev); 44 - 45 - dev_info(&pdev->dev, "Cooling device registered: %s\n", cdev->type); 46 - 47 - return 0; 48 - } 49 - 50 - static int db8500_cpufreq_cooling_remove(struct platform_device *pdev) 51 - { 52 - struct thermal_cooling_device *cdev = platform_get_drvdata(pdev); 53 - 54 - cpufreq_cooling_unregister(cdev); 55 - 56 - return 0; 57 - } 58 - 59 - static int db8500_cpufreq_cooling_suspend(struct platform_device *pdev, 60 - pm_message_t state) 61 - { 62 - return -ENOSYS; 63 - } 64 - 65 - static int db8500_cpufreq_cooling_resume(struct platform_device *pdev) 66 - { 67 - return -ENOSYS; 68 - } 69 - 70 - #ifdef CONFIG_OF 71 - static const struct of_device_id db8500_cpufreq_cooling_match[] = { 72 - { .compatible = "stericsson,db8500-cpufreq-cooling" }, 73 - {}, 74 - }; 75 - MODULE_DEVICE_TABLE(of, db8500_cpufreq_cooling_match); 76 - #endif 77 - 78 - static struct platform_driver db8500_cpufreq_cooling_driver = { 79 - .driver = { 80 - .name = "db8500-cpufreq-cooling", 81 - .of_match_table = of_match_ptr(db8500_cpufreq_cooling_match), 82 - }, 83 - .probe = db8500_cpufreq_cooling_probe, 84 - .suspend = db8500_cpufreq_cooling_suspend, 85 - .resume = db8500_cpufreq_cooling_resume, 86 - .remove = db8500_cpufreq_cooling_remove, 87 - }; 88 - 89 - static int __init db8500_cpufreq_cooling_init(void) 90 - { 91 - return platform_driver_register(&db8500_cpufreq_cooling_driver); 92 - } 93 - 94 - static void __exit db8500_cpufreq_cooling_exit(void) 95 - { 96 - platform_driver_unregister(&db8500_cpufreq_cooling_driver); 97 - } 98 - 99 - /* Should be later than db8500_cpufreq_register */ 100 - late_initcall(db8500_cpufreq_cooling_init); 101 - module_exit(db8500_cpufreq_cooling_exit); 102 - 103 - MODULE_AUTHOR("Hongbo Zhang <hongbo.zhang@stericsson.com>"); 104 - MODULE_DESCRIPTION("DB8500 cpufreq cooling driver"); 105 - MODULE_LICENSE("GPL");