summaryrefslogtreecommitdiffstats
path: root/drivers/thermal/int340x_thermal
Commit message (Collapse)AuthorAgeFilesLines
* thermal: consistently use int for temperaturesSascha Hauer2015-08-034-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The thermal code uses int, long and unsigned long for temperatures in different places. Using an unsigned type limits the thermal framework to positive temperatures without need. Also several drivers currently will report temperatures near UINT_MAX for temperatures below 0°C. This will probably immediately shut the machine down due to overtemperature if started below 0°C. 'long' is 64bit on several architectures. This is not needed since INT_MAX °mC is above the melting point of all known materials. Consistently use a plain 'int' for temperatures throughout the thermal code and the drivers. This only changes the places in the drivers where the temperature is passed around as pointer, when drivers internally use another type this is not changed. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Acked-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Jean Delvare <jdelvare@suse.de> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com> Reviewed-by: Darren Hart <dvhart@linux.intel.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Peter Feuerer <peter@piie.net> Cc: Punit Agrawal <punit.agrawal@arm.com> Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: Jean Delvare <jdelvare@suse.de> Cc: Peter Feuerer <peter@piie.net> Cc: Heiko Stuebner <heiko@sntech.de> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Stephen Warren <swarren@wwwdotorg.org> Cc: Thierry Reding <thierry.reding@gmail.com> Cc: linux-acpi@vger.kernel.org Cc: platform-driver-x86@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-omap@vger.kernel.org Cc: linux-samsung-soc@vger.kernel.org Cc: Guenter Roeck <linux@roeck-us.net> Cc: Rafael J. Wysocki <rjw@rjwysocki.net> Cc: Maxime Ripard <maxime.ripard@free-electrons.com> Cc: Darren Hart <dvhart@infradead.org> Cc: lm-sensors@lm-sensors.org Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* int340x_thermal/processor_thermal_device: add support to Skylake processorsBrian Bian2015-05-011-0/+4
| | | | | | | Add PCI ID of Skylake thermal reporting device. Signed-off-by: Brian Bian <brian.bian@intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* Thermal/int340x/processor_thermal: Enable auxiliary DTS for BraswellSrinivas Pandruvada2015-05-011-1/+54
| | | | | | | | Support two auxiliary DTS present on Braswell platform using side band IOSF interface. This supports two read write trips, which can be used to get notification on trip violation. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
* Thermal/int340x: Fix memleak for aux tripSrinivas Pandruvada2015-03-051-4/+6
| | | | | | | | When thermal zone device register fails or on module exit, the memory for aux_trip is not freed. This change fixes this issue. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
* thermal: int340x_thermal: Ignore missing _ART, _TRT tablesSrinivas Pandruvada2015-02-281-6/+4
| | | | | | | | | It is possible that _ART/_TRT tables are missing or have errors. Ignore those failures, as INT3400 thermal zone is still required for _OSC or mode switch. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* Thermal/int340x_thermal: remove unused uuids.Zhang Rui2015-02-061-4/+0
| | | | Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: int340x: fix sparse warningLad, Prabhakar2015-02-061-1/+1
| | | | | | | | | this patch fixes following sparse warning: processor_thermal_device.c:188:6: warning: symbol 'proc_thermal_remove' was not declared. Should it be static? Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* Thermal/int340x: LPAT conversion for temperatureSrinivas Pandruvada2015-01-292-3/+20
| | | | | | | | When LPAT table is present, we need to convert raw temperature to real temp using LPAT. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* Thermal/int340x/int3402: Provide notification supportSrinivas Pandruvada2015-01-201-0/+33
| | | | | | | | This driver supports programmable trips, but didn't register notification handler to receive threshold violation notification. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* Thermal/int340x/processor_thermal: Add thermal zone supportSrinivas Pandruvada2015-01-201-0/+90
| | | | | | | | | | | | Added thermal zones for processor thermal using APIs provided by int340x thermal zone module. Like other INT340x devices, processor thermal device can also contain trip points and way to get temperature. On some platform there is no ACPI _TMP method, in those platform using IA64 architecture MSRs to get temperature. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* Thermal/int340x/int3403: Use int340x thermal APISrinivas Pandruvada2015-01-201-198/+10
| | | | | | | | Using APIs from int340x thermal zone module to add and remove thermal zones. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* Thermal/int340x/int3402: Use int340x thermal APISrinivas Pandruvada2015-01-201-178/+11
| | | | | | | | Using APIs from int340x thermal zone module to add and remove thermal zones. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* Thermal/int340x: Add common thermal zone handlerSrinivas Pandruvada2015-01-203-0/+328
| | | | | | | | | | | | | | Most of the processing for each int340x driver to add a thermal zone is very similar and every driver has to duplicate code. Created a common module, which exports API to add and remove zones. In this way, we not only avoid duplicate code but also helps in bug fixes and enhancements. If for some driver default processing for thermal zone callback is not enough they can overide individual callback. The code for this driver is primarily copied from int3402_thermal.c. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* int340x_thermal/processor_thermal_device: return failure whenZhang Rui2015-01-061-0/+2
| | | | | | | | | | | | | | there is no ACPI device object processor_thermal_device driver needs ACPI support to work. Thus, the driver probing should fail when there is no ACPI device object asscociated. This fixes a NULL pointer dereference when the driver is loaded with INT340X feature disabled in BIOS. Reported-by: Chen Yu <yu.c.chen@intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com> Tested-by: Chen Yu <yu.c.chen@intel.com>
* ACPI/int340x_thermal: enumerate INT340X devices even if they're not in _ART/_TRTZhang Rui2015-01-061-12/+4
| | | | | | | | | | For some INT340X thermal devices, even if they are not referred in _TRT/_ART table, they still can be used by userspace for thermal control. Thus change the code to enumerated all the INT340X devices, no matter if they're referred in _TRT/_ART or not. Signed-off-by: Zhang Rui <rui.zhang@intel.com> Tested-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
* Thermal/int340x/int3403: Free acpi notification handlerSrinivas Pandruvada2014-12-241-0/+2
| | | | | | | Remove acpi notification handler when zone is removed. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* Thermal/int340x/processor_thermal: Fix memory leakSrinivas Pandruvada2014-12-241-9/+20
| | | | | | | Address memory leak for buffer allocated with ACPI_ALLOCATE_BUFFER. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* Thermal/int340x/int3403: Fix memory leakSrinivas Pandruvada2014-12-241-0/+2
| | | | | | | Address memory leak for buffer allocated with ACPI_ALLOCATE_BUFFER. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: int340x: Introduce processor reporting deviceSrinivas Pandruvada2014-12-242-0/+299
| | | | | | | | | | | | | | | | | | | | | | | | | | The Int340x thermal provides a processor thermal device, which is used to control processor thermal states. These devices are either reported as a PCI device or an ACPI device. This device provides power limits, control states and optional temperature. This change implements minimal requirements to expose processor power limits which can be used during thermal power limiting. Power limits are exposed via an attribute group called "power_limits" under the device. The exported attributes are: power_limit_0_max_uw power_limit_1_max_uw power_limit_0_min_uw power_limit_1_min_uw power_limit_0_tmin_us power_limit_1_tmin_us power_limit_0_tmax_us power_limit_1_tmax_us power_limit_0_step_uw power_limit_1_step_uw Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: int340x_thermal: drop owner assignment from platform_driversWolfram Sang2014-12-222-2/+0
| | | | | | | | This platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* Thermal/int340x: Handle properly the case when _trt or _art acpi entry is ↵Ilkka Koskinen2014-12-211-4/+4
| | | | | | | | | | | | missing If either of the entries was missing, the driver tried to free memory using uninitialized pointer. In addition, it was dereferencing null pointer. Signed-off-by: Ilkka Koskinen <ilkka.koskinen@linux.intel.com> Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* Thermal/int340x: Clear the error value of the last acpi_bus_get_device() callIlkka Koskinen2014-12-091-0/+2
| | | | | | | | | Previously the return value of the last acpi_bus_get_device() was returned. However, since we only report those issues, it should be cleared to continue as expected. Signed-off-by: Ilkka Koskinen <ilkka.koskinen@linux.intel.com> Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
* Thermal: fix platform_no_drv_owner.cocci warningsWu Fengguang2014-12-091-1/+0
| | | | | | | | | | | | drivers/thermal/int340x_thermal/int3403_thermal.c:468:3-8: No need to set .owner here. The core will do it. Remove .owner field if calls are used which set it automatically Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> Acked-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* Thermal/int340x: avoid unnecessary pointer castingJacob Pan2014-12-091-5/+5
| | | | | | | | | Avoid pointer casting which may also lead to problems on big endian 64 bit systems. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal: int3403: Delete a check before thermal_zone_device_unregister()Markus Elfring2014-12-091-2/+1
| | | | | | | | | | | The thermal_zone_device_unregister() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* thermal/int3400: export uuidsSrinivas Pandruvada2014-12-091-2/+78
| | | | | | | | | | | | | | | | | | | | | INT3400 currently supports only one policy, which can't be changed. This change exports all available policies (uuids) to user space and allow this to be changed. It introduces an attribute group uuids in INT3400 platform driver. There are two attributes exposed: - available_uuids - current_uuid User space can set current_uuid via this interface to one of the available uuids. The uuid change is communicated to firmware, only when the current zone mode is changed to "enabled". So the ideal sequence should be - set INT3400 zone mode to "disabled" - change current_uuid - set INT3400 zone mode to "enabled" Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* Thermal/int3403: Fix thermal hysteresis unit conversionlan,Tianyu2014-11-041-1/+7
| | | | | | | | | | | | | | | | Thermal hysteresis represents a temperature difference. But the original code treats it as a temperature value, Convert it from tenths of degree Kelvin to Milli-Celsius by deducing 273200. This is not right. Kelvin and Celsius have same degree size. From temperature difference view, the conversion between tenths of degree Kelvin unit and Milli-Celsius unit is just to multiply 100. Signed-off-by: Lan Tianyu <tianyu.lan@intel.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
* Thermal: int3400_thermal: use acpi_thermal_rel parsing APIsJacob Pan2014-10-111-159/+13
| | | | | | | | | ACPI _TRT and _ART parsing code has been moved to acpi_thermal_rel such that it can be used by other devices in the future. Use the parsing APIs in acpi_thermal_rel.c instead. Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* Thermal: int340x_thermal: expose acpi thermal relationship tablesJacob Pan2014-10-113-0/+485
| | | | | | | | | | | | | | | | | | | ACPI 4.0 introduced two thermal relationship tables via _ART (active cooling) and _TRT (passive cooling) objects. These tables contain many to many relationships among thermal sensors and cooling devices. This patch parses _ART and _TRT and makes the result available to the userspace via an misc device interface. At the same time, kernel drivers can also request parsing results from internal kernel APIs. The results include source and target devices, influence, and sampling rate in case of _TRT. For _ART, the result shows source device, target device, and weight percentage. Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* Thermal: introduce int3403 thermal driverLan Tianyu2014-10-112-0/+478
| | | | | | | | | | | | ACPI INT3403 device object can be used to retrieve temperature date from temperature sensors present in the system, and to expose device' performance control. The previous INT3403 thermal driver supports temperature reporting only, thus remove it and introduce this new & enhanced one. Signed-off-by: Lan Tianyu <tianyu.lan@intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* Thermal: introduce INT3402 thermal driverAaron Lu2014-10-102-0/+243
| | | | | | | | | | ACPI INT3402 device object could report temperature for the memory module. To expose such information to user space, a thermal zone device is registered for it so that the thermal sysfs interface can expose such information for userspace to use. Signed-off-by: Aaron Lu <aaron.lu@intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* Thermal: int3400 thermal: register to thermal frameworkZhang Rui2014-10-101-0/+103
| | | | Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* Thermal: int3400 thermal: add capability to detect supporting UUIDsZhang Rui2014-10-101-0/+69
| | | | Signed-off-by: Zhang Rui <rui.zhang@intel.com>
* Thermal: introduce int3400 thermal driverZhang Rui2014-10-102-0/+246
Introduce int3400 thermal driver. And make INT3400 driver enumerate the other int340x thermal components shown in _ART/_TRT. Signed-off-by: Zhang Rui <rui.zhang@intel.com>
OpenPOWER on IntegriCloud