summaryrefslogtreecommitdiff
path: root/drivers/thermal
AgeCommit message (Collapse)AuthorFilesLines
2014-04-30thermal: cpu_cooling: Use cpufreq_for_each_valid_entry macro for iterationStratos Karafotis1-20/+13
The cpufreq core now supports the cpufreq_for_each_valid_entry macro helper for iteration over the cpufreq_frequency_table, so use it. Also remove the redundant !! operator. It should have no functional changes. Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-04-10Merge branch 'next' of ↵Linus Torvalds3-19/+35
git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux Pull thermal management updates from Zhang Rui: "We only have a couple of fixes/cleanups for platform thermal drivers this time. Specifics: - rcar thermal driver: avoid updating the thermal zone in case an IRQ was triggered but the temperature didn't effectively change. From Patrick Titiano. - update the imx thermal driver' formula of converting thermal sensor' raw date to real temperature in degree C. From Anson Huang. - trivial code cleanups of ti soc thermal and rcar thermal driver from Jingoo Han and Patrick Titiano" * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: thermal: rcar-thermal: update thermal zone only when temperature changes thermal: rcar-thermal: fix same mask applied twice thermal: ti-soc-thermal: Use SIMPLE_DEV_PM_OPS macro thermal: imx: update formula for thermal sensor
2014-04-08thermal: rcar-thermal: update thermal zone only when temperature changesPatrick Titiano1-1/+6
Avoid updating the thermal zone in case an IRQ was triggered but the temperature didn't effectively change. Note this is not a driver issue. Below is a captured debug trace illustrating the purpose of this patch: out of 8 thermal zone updates, only 2 are actually necessary. [ 41.120000] rcar_thermal_work(): cctemp=25000 [ 41.120000] rcar_thermal_work(): nctemp=30000 [ 41.120000] rcar_thermal_work(): temp is now 30000C, update thermal zone [ 58.990000] rcar_thermal_work(): cctemp=30000 [ 58.990000] rcar_thermal_work(): nctemp=30000 [ 58.990000] rcar_thermal_work(): same temp, do not update thermal zone [ 59.290000] rcar_thermal_work(): cctemp=30000 [ 59.290000] rcar_thermal_work(): nctemp=30000 [ 59.290000] rcar_thermal_work(): same temp, do not update thermal zone [ 59.590000] rcar_thermal_work(): cctemp=30000 [ 59.590000] rcar_thermal_work(): nctemp=30000 [ 59.590000] rcar_thermal_work(): same temp, do not update thermal zone [ 59.890000] rcar_thermal_work(): cctemp=30000 [ 59.890000] rcar_thermal_work(): nctemp=30000 [ 59.890000] rcar_thermal_work(): same temp, do not update thermal zone [ 60.190000] rcar_thermal_work(): cctemp=30000 [ 60.190000] rcar_thermal_work(): nctemp=30000 [ 60.190000] rcar_thermal_work(): same temp, do not update thermal zone [ 60.490000] rcar_thermal_work(): cctemp=30000 [ 60.490000] rcar_thermal_work(): nctemp=30000 [ 60.490000] rcar_thermal_work(): same temp, do not update thermal zone [ 60.790000] rcar_thermal_work(): cctemp=30000 [ 60.790000] rcar_thermal_work(): nctemp=35000 [ 60.790000] rcar_thermal_work(): temp is now 35000C, update thermal zone I suspect this may be due to sensor sampling accuracy / fluctuation, but no formal proof. Signed-off-by: Patrick Titiano <ptitiano@baylibre.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2014-04-08thermal: rcar-thermal: fix same mask applied twicePatrick Titiano1-1/+1
Mask is already applied preceding the if statement. Remove the second mask. Signed-off-by: Patrick Titiano <ptitiano@baylibre.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2014-04-08thermal: ti-soc-thermal: Use SIMPLE_DEV_PM_OPS macroJingoo Han1-4/+2
Use SIMPLE_DEV_PM_OPS macro in order to make the code simpler. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2014-04-08thermal: imx: update formula for thermal sensorAnson Huang1-13/+26
Thermal sensor used to need two calibration points which are in fuse map to get a slope for converting thermal sensor's raw data to real temperature in degree C. Due to the chip calibration limitation, hardware team provides an universal formula to get real temperature from internal thermal sensor raw data: Slope = 0.4297157 - (0.0015976 * 25C fuse); Update the formula, as there will be no hot point calibration data in fuse map from now on. Signed-off-by: Anson Huang <b20788@freescale.com> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2014-04-08Merge tag 'cpu-hotplug-3.15-rc1' of ↵Linus Torvalds1-7/+7
git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm Pull CPU hotplug notifiers registration fixes from Rafael Wysocki: "The purpose of this single series of commits from Srivatsa S Bhat (with a small piece from Gautham R Shenoy) touching multiple subsystems that use CPU hotplug notifiers is to provide a way to register them that will not lead to deadlocks with CPU online/offline operations as described in the changelog of commit 93ae4f978ca7f ("CPU hotplug: Provide lockless versions of callback registration functions"). The first three commits in the series introduce the API and document it and the rest simply goes through the users of CPU hotplug notifiers and converts them to using the new method" * tag 'cpu-hotplug-3.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (52 commits) net/iucv/iucv.c: Fix CPU hotplug callback registration net/core/flow.c: Fix CPU hotplug callback registration mm, zswap: Fix CPU hotplug callback registration mm, vmstat: Fix CPU hotplug callback registration profile: Fix CPU hotplug callback registration trace, ring-buffer: Fix CPU hotplug callback registration xen, balloon: Fix CPU hotplug callback registration hwmon, via-cputemp: Fix CPU hotplug callback registration hwmon, coretemp: Fix CPU hotplug callback registration thermal, x86-pkg-temp: Fix CPU hotplug callback registration octeon, watchdog: Fix CPU hotplug callback registration oprofile, nmi-timer: Fix CPU hotplug callback registration intel-idle: Fix CPU hotplug callback registration clocksource, dummy-timer: Fix CPU hotplug callback registration drivers/base/topology.c: Fix CPU hotplug callback registration acpi-cpufreq: Fix CPU hotplug callback registration zsmalloc: Fix CPU hotplug callback registration scsi, fcoe: Fix CPU hotplug callback registration scsi, bnx2fc: Fix CPU hotplug callback registration scsi, bnx2i: Fix CPU hotplug callback registration ...
2014-04-06Merge tag 'drivers-3.15' of ↵Linus Torvalds1-1/+1
git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc Pull ARM SoC driver changes from Arnd Bergmann: "These changes are mostly for ARM specific device drivers that either don't have an upstream maintainer, or that had the maintainer ask us to pick up the changes to avoid conflicts. A large chunk of this are clock drivers (bcm281xx, exynos, versatile, shmobile), aside from that, reset controllers for STi as well as a large rework of the Marvell Orion/EBU watchdog driver are notable" * tag 'drivers-3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (99 commits) Revert "dts: socfpga: Add DTS entry for adding the stmmac glue layer for stmmac." Revert "net: stmmac: Add SOCFPGA glue driver" ARM: shmobile: r8a7791: Fix SCIFA3-5 clocks ARM: STi: Add reset controller support to mach-sti Kconfig drivers: reset: stih416: add softreset controller drivers: reset: stih415: add softreset controller drivers: reset: Reset controller driver for STiH416 drivers: reset: Reset controller driver for STiH415 drivers: reset: STi SoC system configuration reset controller support dts: socfpga: Add sysmgr node so the gmac can use to reference dts: socfpga: Add support for SD/MMC on the SOCFPGA platform reset: Add optional resets and stubs ARM: shmobile: r7s72100: fix bus clock calculation Power: Reset: Generalize qnap-poweroff to work on Synology devices. dts: socfpga: Update clock entry to support multiple parents ARM: socfpga: Update socfpga_defconfig dts: socfpga: Add DTS entry for adding the stmmac glue layer for stmmac. net: stmmac: Add SOCFPGA glue driver watchdog: orion_wdt: Use %pa to print 'phys_addr_t' drivers: cci: Export CCI PMU revision ...
2014-03-20thermal, x86-pkg-temp: Fix CPU hotplug callback registrationSrivatsa S. Bhat1-7/+7
Subsystems that want to register CPU hotplug callbacks, as well as perform initialization for the CPUs that are already online, often do it as shown below: get_online_cpus(); for_each_online_cpu(cpu) init_cpu(cpu); register_cpu_notifier(&foobar_cpu_notifier); put_online_cpus(); This is wrong, since it is prone to ABBA deadlocks involving the cpu_add_remove_lock and the cpu_hotplug.lock (when running concurrently with CPU hotplug operations). Instead, the correct and race-free way of performing the callback registration is: cpu_notifier_register_begin(); for_each_online_cpu(cpu) init_cpu(cpu); /* Note the use of the double underscored version of the API */ __register_cpu_notifier(&foobar_cpu_notifier); cpu_notifier_register_done(); Fix the thermal x86-pkg-temp code by using this latter form of callback registration. Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <eduardo.valentin@ti.com> Cc: Ingo Molnar <mingo@kernel.org> Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-03Thermal: thermal zone governor fixZhang Rui1-7/+18
This patch does a cleanup about the thermal zone govenor, setting and make the following rule. 1. For thermal zone devices that are registered w/o tz->tzp, they can use the default thermal governor only. 2. For thermal zone devices w/ governor name specified in tz->tzp->governor_name, we will use the default govenor if the governor specified is not available at the moment, and update tz->governor when the matched governor is registered. This also fixes a problem that OF registered thermal zones are running with no governor. Signed-off-by: Zhang Rui <rui.zhang@intel.com> Acked-by: Javi Merino <javi.merino@arm.com>
2014-03-03Thermal: Allow first update of cooling device stateNi Wade1-1/+1
In initialization, if the cooling device is initialized at max cooling state, and the thermal zone temperature is below the first trip point, then the cooling state can't be updated to the right state, untill the first trip point be triggered. To fix this issue, allow first update of cooling device state during registration, initialized "updated" device field as "false" (instead of "true"). Signed-off-by: Wei Ni <wni@nvidia.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2014-03-03thermal,rcar_thermal: Add dependency on HAS_IOMEMRichard Weinberger1-0/+1
Commit beeb5a1e (thermal: rcar-thermal: Enable driver compilation with COMPILE_TEST) broke build on archs wihout io memory. On archs like S390 or um this driver cannot build nor work. Make it depend on HAS_IOMEM to bypass build failures. drivers/thermal/rcar_thermal.c:404: undefined reference to `devm_ioremap_resource' drivers/thermal/rcar_thermal.c:426: undefined reference to `devm_ioremap_resource' Signed-off-by: Richard Weinberger <richard@nod.at> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2014-03-03x86_pkg_temp_thermal: Fix the thermal zone typeJean Delvare1-4/+1
The thermal zone type should not include an instance number. Otherwise each zone is considered a different type and the thermal-to-hwmon bridge fails to group them all in a single hwmon device. I also changed the type to "x86_pkg_temp", because "pkg" was too generic, and other thermal drivers use an underscore, not a dash, as a separator. Or maybe "cpu_pkg_temp" would be better? Signed-off-by: Jean Delvare <jdelvare@suse.de> Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <eduardo.valentin@ti.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2014-03-03x86_pkg_temp_thermal: Do not expose as a hwmon deviceJean Delvare1-1/+5
The temperature value reported by x86_pkg_temp_thermal is already reported by the coretemp driver. So, do not expose this thermal zone as a hwmon device, because it would be redundant. Signed-off-by: Jean Delvare <jdelvare@suse.de> Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <eduardo.valentin@ti.com> Acked-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2014-03-03Thermal: update INT3404 thermal driver help textZhang Rui1-2/+10
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2014-02-24drivers: Enable building of Kirkwood drivers for mach-mvebuAndrew Lunn1-1/+1
With the move of kirkwood into mach-mvebu, drivers Kconfig need tweeking to allow the kirkwood specific drivers to be built. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Mark Brown <broonie@linaro.org> Acked-by: Kishon Vijay Abraham I <kishon@ti.com> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Tested-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Cc: Viresh Kumar <viresh.kumar@linaro.org> Cc: Rafael J. Wysocki <rjw@rjwysocki.net> Cc: Richard Purdie <rpurdie@rpsys.net> Cc: Bryan Wu <cooloney@gmail.com> Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <eduardo.valentin@ti.com> Signed-off-by: Jason Cooper <jason@lakedaemon.net>
2014-01-25Merge branch 'next' of ↵Linus Torvalds14-49/+1377
git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux Pull thermal management updates from Zhang Rui: "This time, the biggest change is the work of representing hardware thermal properties in device tree infrastructure. This work includes the introduction of a device tree bindings for describing the hardware thermal behavior and limits, and also a parser to read and interpret the data, and build thermal zones and thermal binding parameters. It also contains three examples on how to use the new representation on sensor devices, using three different drivers to accomplish it. One driver is in thermal subsystem, the TI SoC thermal, and the other two drivers are in hwmon subsystem. Actually, this would be the first step of the complete work because we still need to check other potential drivers to be converted and then validate the proposed API. But the reason why I include it in this pull request is that, first, this change does not hurt any others without using this approach, second, the principle and concept of this change would not break after converting the remaining drivers. BTW, as you can see, there are several points in this change that do not belong to thermal subsystem. Because it has been suggested by Guenter R that in such cases, it is recommended to send the complete series via one single subsystem. Specifics: - representing hardware thermal properties in device tree infrastructure - fix a regression that the imx thermal driver breaks system suspend. - introduce ACPI INT3403 thermal driver to retrieve temperature data from the INT3403 ACPI device object present on some systems. - introduce debug statement for thermal core and step_wise governor. - assorted fixes and cleanups for thermal core, cpu cooling, exynos thrmal, intel powerclamp and imx thermal driver" * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: (34 commits) thermal: remove const flag from .ops of imx thermal Thermal: update thermal zone device after setting emul_temp intel_powerclamp: Fix cstate counter detection. thermal: imx: add necessary clk operation Thermal cpu cooling: return error if no valid cpu frequency entry thermal: fix cpu_cooling max_level behavior thermal: rcar-thermal: Enable driver compilation with COMPILE_TEST thermal: debug: add debug statement for core and step_wise thermal: imx_thermal: add module device table drivers: thermal: Mark function as static in x86_pkg_temp_thermal.c thermal:samsung: fix compilation warning thermal: imx: correct suspend/resume flow thermal: exynos: fix error return code Thermal: ACPI INT3403 thermal driver MAINTAINERS: add thermal bindings entry in thermal domain arm: dts: make OMAP4460 bandgap node to belong to OCP arm: dts: make OMAP443x bandgap node to belong to OCP arm: dts: add cooling properties on omap5 cpu node arm: dts: add omap5 thermal data arm: dts: add omap5 CORE thermal data ...
2014-01-25Merge tag 'pm+acpi-3.14-rc1' of ↵Linus Torvalds1-6/+6
git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm Pull ACPI and power management updates from Rafael Wysocki: "As far as the number of commits goes, the top spot belongs to ACPI this time with cpufreq in the second position and a handful of PM core, PNP and cpuidle updates. They are fixes and cleanups mostly, as usual, with a couple of new features in the mix. The most visible change is probably that we will create struct acpi_device objects (visible in sysfs) for all devices represented in the ACPI tables regardless of their status and there will be a new sysfs attribute under those objects allowing user space to check that status via _STA. Consequently, ACPI device eject or generally hot-removal will not delete those objects, unless the table containing the corresponding namespace nodes is unloaded, which is extremely rare. Also ACPI container hotplug will be handled quite a bit differently and cpufreq will support CPU boost ("turbo") generically and not only in the acpi-cpufreq driver. Specifics: - ACPI core changes to make it create a struct acpi_device object for every device represented in the ACPI tables during all namespace scans regardless of the current status of that device. In accordance with this, ACPI hotplug operations will not delete those objects, unless the underlying ACPI tables go away. - On top of the above, new sysfs attribute for ACPI device objects allowing user space to check device status by triggering the execution of _STA for its ACPI object. From Srinivas Pandruvada. - ACPI core hotplug changes reducing code duplication, integrating the PCI root hotplug with the core and reworking container hotplug. - ACPI core simplifications making it use ACPI_COMPANION() in the code "glueing" ACPI device objects to "physical" devices. - ACPICA update to upstream version 20131218. This adds support for the DBG2 and PCCT tables to ACPICA, fixes some bugs and improves debug facilities. From Bob Moore, Lv Zheng and Betty Dall. - Init code change to carry out the early ACPI initialization earlier. That should allow us to use ACPI during the timekeeping initialization and possibly to simplify the EFI initialization too. From Chun-Yi Lee. - Clenups of the inclusions of ACPI headers in many places all over from Lv Zheng and Rashika Kheria (work in progress). - New helper for ACPI _DSM execution and rework of the code in drivers that uses _DSM to execute it via the new helper. From Jiang Liu. - New Win8 OSI blacklist entries from Takashi Iwai. - Assorted ACPI fixes and cleanups from Al Stone, Emil Goode, Hanjun Guo, Lan Tianyu, Masanari Iida, Oliver Neukum, Prarit Bhargava, Rashika Kheria, Tang Chen, Zhang Rui. - intel_pstate driver updates, including proper Baytrail support, from Dirk Brandewie and intel_pstate documentation from Ramkumar Ramachandra. - Generic CPU boost ("turbo") support for cpufreq from Lukasz Majewski. - powernow-k6 cpufreq driver fixes from Mikulas Patocka. - cpufreq core fixes and cleanups from Viresh Kumar, Jane Li, Mark Brown. - Assorted cpufreq drivers fixes and cleanups from Anson Huang, John Tobias, Paul Bolle, Paul Walmsley, Sachin Kamat, Shawn Guo, Viresh Kumar. - cpuidle cleanups from Bartlomiej Zolnierkiewicz. - Support for hibernation APM events from Bin Shi. - Hibernation fix to avoid bringing up nonboot CPUs with ACPI EC disabled during thaw transitions from Bjørn Mork. - PM core fixes and cleanups from Ben Dooks, Leonardo Potenza, Ulf Hansson. - PNP subsystem fixes and cleanups from Dmitry Torokhov, Levente Kurusa, Rashika Kheria. - New tool for profiling system suspend from Todd E Brandt and a cpupower tool cleanup from One Thousand Gnomes" * tag 'pm+acpi-3.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (153 commits) thermal: exynos: boost: Automatic enable/disable of BOOST feature (at Exynos4412) cpufreq: exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ Documentation: cpufreq / boost: Update BOOST documentation cpufreq: exynos: Extend Exynos cpufreq driver to support boost cpufreq / boost: Kconfig: Support for software-managed BOOST acpi-cpufreq: Adjust the code to use the common boost attribute cpufreq: Add boost frequency support in core intel_pstate: Add trace point to report internal state. cpufreq: introduce cpufreq_generic_get() routine ARM: SA1100: Create dummy clk_get_rate() to avoid build failures cpufreq: stats: create sysfs entries when cpufreq_stats is a module cpufreq: stats: free table and remove sysfs entry in a single routine cpufreq: stats: remove hotplug notifiers cpufreq: stats: handle cpufreq_unregister_driver() and suspend/resume properly cpufreq: speedstep: remove unused speedstep_get_state platform: introduce OF style 'modalias' support for platform bus PM / tools: new tool for suspend/resume performance optimization ACPI: fix module autoloading for ACPI enumerated devices ACPI: add module autoloading support for ACPI enumerated devices ACPI: fix create_modalias() return value handling ...
2014-01-23Merge branch 'for-linus' of ↵Linus Torvalds1-1/+1
git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial Pull trivial tree updates from Jiri Kosina: "Usual rocket science stuff from trivial.git" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (39 commits) neighbour.h: fix comment sched: Fix warning on make htmldocs caused by wait.h slab: struct kmem_cache is protected by slab_mutex doc: Fix typo in USB Gadget Documentation of/Kconfig: Spelling s/one/once/ mkregtable: Fix sscanf handling lp5523, lp8501: comment improvements thermal: rcar: comment spelling treewide: fix comments and printk msgs IXP4xx: remove '1 &&' from a condition check in ixp4xx_restart() Documentation: update /proc/uptime field description Documentation: Fix size parameter for snprintf arm: fix comment header and macro name asm-generic: uaccess: Spelling s/a ny/any/ mtd: onenand: fix comment header doc: driver-model/platform.txt: fix a typo drivers: fix typo in DEVTMPFS_MOUNT Kconfig help text doc: Fix typo (acces_process_vm -> access_process_vm) treewide: Fix typos in printk drivers/gpu/drm/qxl/Kconfig: reformat the help text ...
2014-01-17thermal: exynos: boost: Automatic enable/disable of BOOST feature (at ↵Lukasz Majewski1-6/+6
Exynos4412) This patch provides auto disable/enable operation for boost. It uses already present thermal infrastructure to provide BOOST hysteresis. The TMU data is modified to work properly with or without BOOST. Hence, the two first trip points with corresponding clip frequencies are adjusted. The first one is reduced from 85 to 70 degrees and the clip frequency is increased to 1.4 GHz from 800 MHz. This trip point is in fact responsible for providing BOOST hysteresis. When temperature exceeds 70 deg, the maximal non BOOST frequency for Exynos4412 is imposed. Since the first trigger level has been "stolen" for BOOST, the second one needs to be a compromise for the previously used two for non BOOST configuration. The 95 deg with modified clip freq (to 400 MHz) should provide a good balance between cooling down the overheated device and throughput on an acceptable level. Two last trigger levels are not modified since, they cause platform shutdown on emergency overheat to happen. The third trip point passage results in SW managed shut down of the system. If the last trip point is crossed, the PMU HW generates the power off signal. Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Acked-by: Eduardo Valentin <eduardo.valentin@ti.com> Reviewed-by: Zhang Rui <rui.zhang@intel.com> [rjw: Changelog] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-01-13sched, thermal: Clean up preempt_enable_no_resched() abusePeter Zijlstra1-1/+1
The only valid use of preempt_enable_no_resched() is if the very next line is schedule() or if we know preemption cannot actually be enabled by that statement due to known more preempt_count 'refs'. Signed-off-by: Peter Zijlstra <peterz@infradead.org> Cc: rjw@rjwysocki.net Cc: Eliezer Tamir <eliezer.tamir@linux.intel.com> Cc: rui.zhang@intel.com Cc: jacob.jun.pan@linux.intel.com Cc: Mike Galbraith <bitbucket@online.de> Cc: hpa@zytor.com Cc: Arjan van de Ven <arjan@linux.intel.com> Cc: lenb@kernel.org Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Andrew Morton <akpm@linux-foundation.org> Link: http://lkml.kernel.org/n/tip-zcfvacdlvlr63qmnn5i58vuj@git.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
2014-01-08thermal: rcar: comment spellingGeert Uytterhoeven1-1/+1
Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org> Acked-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-01-06Merge branch 'misc' of .git into nextZhang Rui1-1/+1
2014-01-06thermal: remove const flag from .ops of imx thermalEduardo Valentin1-1/+1
As per previous changes on thermal framework API, registering a new thermal zone does not require a const thermal zone ops. Thus, this patch removes the flag from imx thermal zone ops. Cc: Zhang Rui <rui.zhang@intel.com> Cc: Grant Likely <grant.likely@linaro.org> Cc: Rob Herring <rob.herring@calxeda.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: devicetree@vger.kernel.org Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2014-01-03Merge branches 'misc' and 'soc' of .git into nextZhang Rui3-1/+33
2014-01-03Thermal: update thermal zone device after setting emul_templan,Tianyu1-0/+3
This patch is to update thermal zone device after setting emul_temp in order to make governor work according to input temperature immediately. Signed-off-by: Lan Tianyu <tianyu.lan@intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2014-01-03intel_powerclamp: Fix cstate counter detection.Yuxuan Shui1-1/+10
Having all zero cstate count doesn't necesserily mean the cstate counter is no functional. Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2014-01-03thermal: imx: add necessary clk operationAnson Huang1-0/+20
Thermal sensor needs pll3_usb_otg when measuring temperature, otherwise the temperature read will be incorrect, so need to enable this clk before sensor working, for alarm function, as hardware will take measurement periodically, so we should keep this clk always on once alarm function is enabled. Signed-off-by: Anson Huang <b20788@freescale.com> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2014-01-02Merge branches 'misc', 'soc', 'soc-eduardo' and 'int3404-thermal' of .git ↵Zhang Rui12-45/+1322
into next
2014-01-02Thermal cpu cooling: return error if no valid cpu frequency entryZhang Rui1-0/+5
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2014-01-02thermal: fix cpu_cooling max_level behaviorEduardo Valentin1-2/+4
As per Documentation/thermal/sysfs-api.txt, max_level is an index, not a counter. Thus, in case a CPU has 3 valid frequencies, max_level is expected to be 2, for instance. The current code makes max_level == number of valid frequencies, which is bogus. This patch fix the cpu_cooling device by ranging max_level properly. Reported-by: Carlos Hernandez <ceh@ti.com> Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2014-01-02thermal: rcar-thermal: Enable driver compilation with COMPILE_TESTLaurent Pinchart1-1/+1
This helps increasing build testing coverage. Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <eduardo.valentin@ti.com> Cc: linux-pm@vger.kernel.org Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Acked-by: Simon Horman <horms@verge.net.au> Acked-by: Eduardo Valentin <eduardo.valentin@ti.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2014-01-02thermal: debug: add debug statement for core and step_wiseAaron Lu2-0/+12
To ease debugging thermal problem, add these dynamic debug statements so that user do not need rebuild kernel to see these info. Based on a patch from Zhang Rui for debugging on bugzilla: https://bugzilla.kernel.org/attachment.cgi?id=98671 A sample output after we turn on dynamic debug with the following cmd: # echo 'module thermal_sys +fp' > /sys/kernel/debug/dynamic_debug/control is like: [ 355.147627] update_temperature: thermal thermal_zone0: last_temperature=52000, current_temperature=55000 [ 355.147636] thermal_zone_trip_update: thermal thermal_zone0: Trip1[type=1,temp=79000]:trend=2,throttle=0 [ 355.147644] get_target_state: thermal cooling_device8: cur_state=0 [ 355.147647] thermal_zone_trip_update: thermal cooling_device8: old_target=-1, target=-1 [ 355.147652] get_target_state: thermal cooling_device7: cur_state=0 [ 355.147655] thermal_zone_trip_update: thermal cooling_device7: old_target=-1, target=-1 [ 355.147660] get_target_state: thermal cooling_device6: cur_state=0 [ 355.147663] thermal_zone_trip_update: thermal cooling_device6: old_target=-1, target=-1 [ 355.147668] get_target_state: thermal cooling_device5: cur_state=0 [ 355.147671] thermal_zone_trip_update: thermal cooling_device5: old_target=-1, target=-1 [ 355.147678] thermal_zone_trip_update: thermal thermal_zone0: Trip2[type=0,temp=90000]:trend=1,throttle=0 [ 355.147776] get_target_state: thermal cooling_device0: cur_state=0 [ 355.147783] thermal_zone_trip_update: thermal cooling_device0: old_target=-1, target=-1 [ 355.147792] thermal_zone_trip_update: thermal thermal_zone0: Trip3[type=0,temp=80000]:trend=1,throttle=0 [ 355.147845] get_target_state: thermal cooling_device1: cur_state=0 [ 355.147849] thermal_zone_trip_update: thermal cooling_device1: old_target=-1, target=-1 [ 355.147856] thermal_zone_trip_update: thermal thermal_zone0: Trip4[type=0,temp=70000]:trend=1,throttle=0 [ 355.147904] get_target_state: thermal cooling_device2: cur_state=0 [ 355.147908] thermal_zone_trip_update: thermal cooling_device2: old_target=-1, target=-1 [ 355.147915] thermal_zone_trip_update: thermal thermal_zone0: Trip5[type=0,temp=60000]:trend=1,throttle=0 [ 355.147963] get_target_state: thermal cooling_device3: cur_state=0 [ 355.147967] thermal_zone_trip_update: thermal cooling_device3: old_target=-1, target=-1 [ 355.147973] thermal_zone_trip_update: thermal thermal_zone0: Trip6[type=0,temp=55000]:trend=1,throttle=1 [ 355.148022] get_target_state: thermal cooling_device4: cur_state=0 [ 355.148025] thermal_zone_trip_update: thermal cooling_device4: old_target=-1, target=1 [ 355.148036] thermal_cdev_update: thermal cooling_device4: zone0->target=1 [ 355.169279] thermal_cdev_update: thermal cooling_device4: set to state 1 Signed-off-by: Aaron Lu <aaron.lu@intel.com> Acked-by: Eduardo Valentin <eduardo.valentin@ti.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2014-01-02thermal: imx_thermal: add module device tableRussell King1-0/+1
Add the module device table declaration so the module can be loaded automatically at boot time. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Acked-by: Shawn Guo <shawn.guo@linaro.org> Acked-by: Eduardo Valentin <eduardo.valentin@ti.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2014-01-02drivers: thermal: Mark function as static in x86_pkg_temp_thermal.cRashika1-1/+1
Mark function sys_set_trip_temp() as static in x86_pkg_temp_thermal.c because it is not used outside this file. This eliminates the following warning in x86_pkg_temp_thermal.c: drivers/thermal/x86_pkg_temp_thermal.c:218:5: warning: no previous prototype for ‘sys_set_trip_temp’ [-Wmissing-prototypes] Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2014-01-02thermal:samsung: fix compilation warningNaveen Krishna Chatradhi1-1/+1
This patch fixes a compilation warning. warning: passing argument 5 of 'thermal_zone_device_register' discards 'const' qualifier from pointer target type [enabled by default] include/linux/thermal.h:270:29: note: expected 'struct thermal_zone_device_ops *' but argument is of type 'const struct thermal_zone_device_ops *' Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2014-01-02thermal: imx: correct suspend/resume flowAnson Huang1-14/+17
Fixes regression introduced by: commit 37713a1e8e4c1a1067ad4c99296f78d3c82ed9c4 Author: Philipp Zabel <p.zabel@pengutronix.de> Date: Thu Aug 1 18:33:12 2013 +0200 thermal: imx: implement thermal alarm interrupt handling The commit 37713a1e8e4 makes imx thermal sensor always powered up as alarm function is enabled, but the suspend callback of imx thermal returns success only if thermal sensor is powered down, so it will always returns fail hence break system's suspend, this patch disables imx thermal sensor before suspend and re-enable it after resume. Signed-off-by: Anson Huang <b20788@freescale.com> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2014-01-02thermal: exynos: fix error return codeJulia Lawall1-0/+1
Set the return variable to an error code as done elsewhere in the function. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> ( if@p1 (\(ret < 0\|ret != 0\)) { ... return ret; } | ret@p1 = 0 ) ... when != ret = e1 when != &ret *if(...) { ... when != ret = e2 when forall return ret; } // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Reviewed-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2014-01-02Thermal: ACPI INT3403 thermal driverSrinivas Pandruvada3-0/+245
The ACPI INT3403 device objects present on some systems can be used to retrieve temperature data from thermal sensors. Add a driver registering each INT3403 device object as a thermal zone device and exposing its _TMP, PATx and GTSH method via the standard thermal control interface under /sys/class/thermal/. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-12-19x86, acpi, idle: Restructure the mwait idle routinesPeter Zijlstra1-3/+1
People seem to delight in writing wrong and broken mwait idle routines; collapse the lot. This leaves mwait_play_dead() the sole remaining user of __mwait() and new __mwait() users are probably doing it wrong. Also remove __sti_mwait() as its unused. Cc: Arjan van de Ven <arjan@linux.intel.com> Cc: Jacob Jun Pan <jacob.jun.pan@linux.intel.com> Cc: Mike Galbraith <bitbucket@online.de> Cc: Len Brown <lenb@kernel.org> Cc: Rui Zhang <rui.zhang@intel.com> Acked-by: Rafael Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20131212141654.616820819@infradead.org Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2013-12-04thermal: ti-soc-thermal: use thermal DT infrastructureEduardo Valentin1-15/+62
This patch improves the ti-soc-thermal driver by adding the support to build the thermal zones based on DT nodes. The driver will have two options now to build the thermal zones. The first option is the zones originally coded in this driver. So, the driver behavior will be same if there is no DT node describing the zones. The second option, when it is found a DT node with thermal data, will used the common infrastructure to build the thermal zone and bind its cooling devices. In case the driver loads thermal data using the legacy mode, this driver still adds to the system a cpufreq cooling device. Loading the thermal data from DT, the driver assumes someone else will add the cpufreq cooling device, like the cpufreq driver. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
2013-12-04thermal: cpu_cooling: introduce of_cpufreq_cooling_registerEduardo Valentin2-6/+51
This patch introduces an API to register cpufreq cooling device based on device tree node. The registration via device tree node differs from normal registration due to the fact that it is needed to fill the device_node structure in order to be able to match the cooling devices with trip points. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
2013-12-04thermal: core: introduce thermal_of_cooling_device_registerEduardo Valentin1-4/+54
This patch adds a new API to allow registering cooling devices in the thermal framework derived from device tree nodes. This API links the cooling device with the device tree node so that binding with thermal zones is possible, given that thermal zones are pointing to cooling device device tree nodes. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
2013-12-04thermal: introduce device tree parserEduardo Valentin5-1/+880
This patch introduces a device tree bindings for describing the hardware thermal behavior and limits. Also a parser to read and interpret the data and feed it in the thermal framework is presented. This patch introduces a thermal data parser for device tree. The parsed data is used to build thermal zones and thermal binding parameters. The output data can then be used to deploy thermal policies. This patch adds also documentation regarding this API and how to define tree nodes to use this infrastructure. Note that, in order to be able to have control on the sensor registration on the DT thermal zone, it was required to allow changing the thermal zone .get_temp callback. For this reason, this patch also removes the 'const' modifier from the .ops field of thermal zone devices. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Acked-by: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
2013-12-04thermal: allow registering without .get_tempEduardo Valentin1-2/+8
This patch changes the thermal core driver to allow registration of thermal zones without the .get_temp callback. The idea behind this change is to allow lazy registration of sensor callbacks. The thermal zone will be disabled whenever the ops does not contain a .get_temp callback. The sysfs interface will be returning -EINVAL on any temperature read operation. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
2013-11-20Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netLinus Torvalds1-16/+9
Pull networking fixes from David Miller: "Mostly these are fixes for fallout due to merge window changes, as well as cures for problems that have been with us for a much longer period of time" 1) Johannes Berg noticed two major deficiencies in our genetlink registration. Some genetlink protocols we passing in constant counts for their ops array rather than something like ARRAY_SIZE(ops) or similar. Also, some genetlink protocols were using fixed IDs for their multicast groups. We have to retain these fixed IDs to keep existing userland tools working, but reserve them so that other multicast groups used by other protocols can not possibly conflict. In dealing with these two problems, we actually now use less state management for genetlink operations and multicast groups. 2) When configuring interface hardware timestamping, fix several drivers that simply do not validate that the hwtstamp_config value is one the driver actually supports. From Ben Hutchings. 3) Invalid memory references in mwifiex driver, from Amitkumar Karwar. 4) In dev_forward_skb(), set the skb->protocol in the right order relative to skb_scrub_packet(). From Alexei Starovoitov. 5) Bridge erroneously fails to use the proper wrapper functions to make calls to netdev_ops->ndo_vlan_rx_{add,kill}_vid. Fix from Toshiaki Makita. 6) When detaching a bridge port, make sure to flush all VLAN IDs to prevent them from leaking, also from Toshiaki Makita. 7) Put in a compromise for TCP Small Queues so that deep queued devices that delay TX reclaim non-trivially don't have such a performance decrease. One particularly problematic area is 802.11 AMPDU in wireless. From Eric Dumazet. 8) Fix crashes in tcp_fastopen_cache_get(), we can see NULL socket dsts here. Fix from Eric Dumzaet, reported by Dave Jones. 9) Fix use after free in ipv6 SIT driver, from Willem de Bruijn. 10) When computing mergeable buffer sizes, virtio-net fails to take the virtio-net header into account. From Michael Dalton. 11) Fix seqlock deadlock in ip4_datagram_connect() wrt. statistic bumping, this one has been with us for a while. From Eric Dumazet. 12) Fix NULL deref in the new TIPC fragmentation handling, from Erik Hugne. 13) 6lowpan bit used for traffic classification was wrong, from Jukka Rissanen. 14) macvlan has the same issue as normal vlans did wrt. propagating LRO disabling down to the real device, fix it the same way. From Michal Kubecek. 15) CPSW driver needs to soft reset all slaves during suspend, from Daniel Mack. 16) Fix small frame pacing in FQ packet scheduler, from Eric Dumazet. 17) The xen-netfront RX buffer refill timer isn't properly scheduled on partial RX allocation success, from Ma JieYue. 18) When ipv6 ping protocol support was added, the AF_INET6 protocol initialization cleanup path on failure was borked a little. Fix from Vlad Yasevich. 19) If a socket disconnects during a read/recvmsg/recvfrom/etc that blocks we can do the wrong thing with the msg_name we write back to userspace. From Hannes Frederic Sowa. There is another fix in the works from Hannes which will prevent future problems of this nature. 20) Fix route leak in VTI tunnel transmit, from Fan Du. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (106 commits) genetlink: make multicast groups const, prevent abuse genetlink: pass family to functions using groups genetlink: add and use genl_set_err() genetlink: remove family pointer from genl_multicast_group genetlink: remove genl_unregister_mc_group() hsr: don't call genl_unregister_mc_group() quota/genetlink: use proper genetlink multicast APIs drop_monitor/genetlink: use proper genetlink multicast APIs genetlink: only pass array to genl_register_family_with_ops() tcp: don't update snd_nxt, when a socket is switched from repair mode atm: idt77252: fix dev refcnt leak xfrm: Release dst if this dst is improper for vti tunnel netlink: fix documentation typo in netlink_set_err() be2net: Delete secondary unicast MAC addresses during be_close be2net: Fix unconditional enabling of Rx interface options net, virtio_net: replace the magic value ping: prevent NULL pointer dereference on write to msg_name bnx2x: Prevent "timeout waiting for state X" bnx2x: prevent CFC attention bnx2x: Prevent panic during DMAE timeout ...
2013-11-20genetlink: make multicast groups const, prevent abuseJohannes Berg1-16/+8
Register generic netlink multicast groups as an array with the family and give them contiguous group IDs. Then instead of passing the global group ID to the various functions that send messages, pass the ID relative to the family - for most families that's just 0 because the only have one group. This avoids the list_head and ID in each group, adding a new field for the mcast group ID offset to the family. At the same time, this allows us to prevent abusing groups again like the quota and dropmon code did, since we can now check that a family only uses a group it owns. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-11-20genetlink: pass family to functions using groupsJohannes Berg1-1/+2
This doesn't really change anything, but prepares for the next patch that will change the APIs to pass the group ID within the family, rather than the global group ID. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-11-14Merge branch 'next' of ↵Linus Torvalds4-12/+38
git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux Pull thermal management updates from Zhang Rui: "This time we only have a few changes as there are no soc thermal changes from Eduardo. The only big change is the introduction of TMON, a tool to help visualize, tune, and test the thermal subsystem. The rest is mostly cleanups and fixes all over. Specifics: - introduce TMON, a tool base on thermal sysfs I/F. It can be used to visualize, tune and test the thermal subsystem. - fix a zone/cooling device binding problem, when both thermal zone bind parameters and .bind() callback are available" * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: tools/thermal: Introduce tmon, a tool for thermal subsystem thermal: Fix binding problem when there is thermal zone params thermal: cpu_cooling: fix return value check in cpufreq_cooling_register() Thermal: Check for validity before doing kfree thermal/intel_powerclamp: Add newer CPU models Thermal: Tidy up error handling in powerclamp_init thermal: Kconfig: cosmetic fixes ACPI/thermal : Remove zone disabled warning typo in drivers/thermal/Kconfig: lpatform instead of platform
2013-11-07Merge branches 'intel_powerclamp', 'tmon' and 'misc' of .git into nextZhang Rui11-30/+72