17 May, 2019
1 commit
-
Pull thermal management updates from Zhang Rui:
- Remove the 'module' Kconfig option for thermal subsystem framework
because the thermal framework are required to be ready as early as
possible to avoid overheat at boot time (Daniel Lezcano)- Fix a bug that thermal framework pokes disabled thermal zones upon
resume (Wei Wang)- A couple of cleanups and trivial fixes on int340x thermal drivers
(Srinivas Pandruvada, Zhang Rui, Sumeet Pawnikar)* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux:
drivers: thermal: processor_thermal: Downgrade error message
mlxsw: Remove obsolete dependency on THERMAL=m
hwmon/drivers/core: Simplify complex dependency
thermal/drivers/core: Fix typo in the option name
thermal/drivers/core: Remove depends on THERMAL in Kconfig
thermal/drivers/core: Remove module unload code
thermal/drivers/core: Remove the module Kconfig's option
thermal: core: skip update disabled thermal zones after suspend
thermal: make device_register's type argument const
thermal: intel: int340x: processor_thermal_device: simplify to get driver data
thermal/int3403_thermal: favor _TMP instead of PTYP
16 May, 2019
1 commit
-
Pull thermal soc updates from Eduardo Valentin:
- thermal core has a new devm_* API for registering cooling devices. I
took the entire series, that is why you see changes on drivers/hwmon
in this pull (Guenter Roeck)- rockchip thermal driver gains support to PX30 SoC (Elaine Zhang)
- the generic-adc thermal driver now considers the lookup table DT
property as optional (Jean-Francois Dagenais)- Refactoring of tsens thermal driver (Amit Kucheria)
- Cleanups on cpu cooling driver (Daniel Lezcano)
- broadcom thermal driver dropped support to ACPI (Srinath Mannam)
- tegra thermal driver gains support to OC hw throttle and GPU throtle
(Wei Ni)- Fixes in several thermal drivers.
* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal: (59 commits)
hwmon: (pwm-fan) Use devm_thermal_of_cooling_device_register
hwmon: (npcm750-pwm-fan) Use devm_thermal_of_cooling_device_register
hwmon: (mlxreg-fan) Use devm_thermal_of_cooling_device_register
hwmon: (gpio-fan) Use devm_thermal_of_cooling_device_register
hwmon: (aspeed-pwm-tacho) Use devm_thermal_of_cooling_device_register
thermal: rcar_gen3_thermal: Fix to show correct trip points number
thermal: rcar_thermal: update calculation formula for R-Car Gen3 SoCs
thermal: cpu_cooling: Actually trace CPU load in thermal_power_cpu_get_power
thermal: rockchip: Support the PX30 SoC in thermal driver
dt-bindings: rockchip-thermal: Support the PX30 SoC compatible
thermal: rockchip: fix up the tsadc pinctrl setting error
thermal: broadcom: Remove ACPI support
thermal: Fix build error of missing devm_ioremap_resource on UM
thermal/drivers/cpu_cooling: Remove pointless field
thermal/drivers/cpu_cooling: Add Software Package Data Exchange (SPDX)
thermal/drivers/cpu_cooling: Fixup the header and copyright
thermal/drivers/cpu_cooling: Remove pointless test in power2state()
thermal: rcar_gen3_thermal: disable interrupt in .remove
thermal: rcar_gen3_thermal: fix interrupt type
thermal: Introduce devm_thermal_of_cooling_device_register
...
14 May, 2019
38 commits
-
Currently after store trip points number in 'ret', it is overwritten
afterwards, this cause incorrect trip point number always be shown in
the debug information after register of each thermal zone.This patch fix this issue by moving get of trip number to
end of thermal zone registration.Fixes: 6269e9f790e8d ("thermal: rcar_gen3_thermal: Register hwmon sysfs interface")
Signed-off-by: Jiada Wang
Signed-off-by: Eduardo Valentin -
Update calculation for the R-Car Gen3 and RZ/G2 SoCs which have a
thermal IP block controlled by this driver. That is the:* R-Car D3 (r8a77995)
* R-Car E2 (r8a77990)
* R-Car V3M (r8a77970)
* RZ/G2E (r8a774c0)The calculation update is as documented in the R-Car Gen3 User's Manual,
v1.50 Nov 2018:- When CTEMP is less than 24
T = CTEMP[5:0] * 5.5 - 72
- When CTEMP is equal to/greater than 24
T = CTEMP[5:0] * 5 - 60This was inspired by a patch in the BSP by Van Do
Signed-off-by: Yoshihiro Kaneko
Tested-by: Simon Horman
Acked-by: Wolfram Sang
Reviewed-by: Niklas Söderlund
Signed-off-by: Simon Horman
Signed-off-by: Eduardo Valentin -
The CPU load values passed to the thermal_power_cpu_get_power
tracepoint are zero for all CPUs, unless, unless the
thermal_power_cpu_limit tracepoint is enabled too:irq/41-rockchip-98 [000] .... 290.972410: thermal_power_cpu_get_power:
cpus=0000000f freq=1800000 load={{0x0,0x0,0x0,0x0}} dynamic_power=4815vs
irq/41-rockchip-96 [000] .... 95.773585: thermal_power_cpu_get_power:
cpus=0000000f freq=1800000 load={{0x56,0x64,0x64,0x5e}} dynamic_power=4959
irq/41-rockchip-96 [000] .... 95.773596: thermal_power_cpu_limit:
cpus=0000000f freq=408000 cdev_state=10 power=416There seems to be no good reason for omitting the CPU load information
depending on another tracepoint. My guess is that the intention was to
check whether thermal_power_cpu_get_power is (still) enabled, however
'load_cpu != NULL' already indicates that it was at least enabled when
cpufreq_get_requested_power() was entered, there seems little gain
from omitting the assignment if the tracepoint was just disabled, so
just remove the check.Fixes: 6828a4711f99 ("thermal: add trace events to the power allocator governor")
Signed-off-by: Matthias Kaehlcke
Reviewed-by: Daniel Lezcano
Acked-by: Javi Merino
Acked-by: Viresh Kumar
Signed-off-by: Eduardo Valentin -
PX30 SOC has two Temperature Sensors for CPU and GPU.
Signed-off-by: Elaine Zhang
Signed-off-by: Eduardo Valentin -
Explicitly use the pinctrl to set/unset the right mode
instead of relying on the pinctrl init mode.
And it requires setting the tshut polarity before select pinctrl.When the temperature sensor mode is set to 0, it will automatically
reset the board via the Clock-Reset-Unit (CRU) if the over temperature
threshold is reached. However, when the pinctrl initializes, it does a
transition to "otp_out" which may lead the SoC restart all the time."otp_out" IO may be connected to the RESET circuit on the hardware.
If the IO is in the wrong state, it will trigger RESET.
(similar to the effect of pressing the RESET button)
which will cause the soc to restart all the time.Signed-off-by: Elaine Zhang
Reviewed-by: Daniel Lezcano
Signed-off-by: Eduardo Valentin -
Unlike DT framework, thermal-zones and its parameters can't be parsed
using ACPI framework. So that ACPI support is removed in this driver.Signed-off-by: Srinath Mannam
Reported-by: David Woodhouse
Signed-off-by: Eduardo Valentin -
The devres.o gets linked if HAS_IOMEM is present so on ARCH=um
allyesconfig (COMPILE_TEST) failed on many files with:drivers/thermal/thermal_mmio.o:
In function 'thermal_mmio_probe':thermal_mmio.c:(.text+0xe1):
undefined reference to `devm_ioremap_resource'The users of devm_ioremap_resource() which are compile-testable
should depend on HAS_IOMEM.Reported-by: kbuild test robot
Signed-off-by: Talel Shenhar
Signed-off-by: Eduardo Valentin -
The structure cpufreq_cooling_device provides a backpointer to the thermal
device but this one is used for a trace and to unregister. For the trace,
we don't really need this field and the unregister function as the same
pointer passed as parameter. Remove it.Acked-by: Viresh Kumar
Signed-off-by: Daniel Lezcano
Signed-off-by: Eduardo Valentin -
For license auditing purpose, let's add the SPDX tag.
Signed-off-by: Daniel Lezcano
Acked-by: Viresh Kumar
Acked-by: Philippe Ombredanne
Signed-off-by: Eduardo Valentin -
The copyright format does not conform to the format requested by
Linaro: https://wiki.linaro.org/CopyrightFix it.
Signed-off-by: Daniel Lezcano
Acked-by: Viresh Kumar
Signed-off-by: Eduardo Valentin -
When the static power computation was removed, the test with the power
being negative was not removed. However, the substraction which was
responsible of the negative value was removed and the variable is now
an u32. A double reason to remove the test which does not make sense.Fixes: 84fe2cab48590 ("cpu_cooling: Drop static-power related stuff")
Cc: Viresh Kumar
Signed-off-by: Daniel Lezcano
Acked-by: Viresh Kumar
Signed-off-by: Eduardo Valentin -
Currently IRQ remains enabled after .remove, later if device is probed,
IRQ is requested before .thermal_init, this may cause IRQ function be
called before device is initialized.this patch disables interrupt in .remove, to ensure irq function
only be called after device is fully initialized.Signed-off-by: Jiada Wang
Reviewed-by: Simon Horman
Reviewed-by: Daniel Lezcano
Signed-off-by: Eduardo Valentin -
Currently IRQF_SHARED type interrupt line is allocated, but it
is not appropriate, as the interrupt line isn't shared between
different devices, instead IRQF_ONESHOT is the proper type.By changing interrupt type to IRQF_ONESHOT, now irq handler is
no longer needed, as clear of interrupt status can be done in
threaded interrupt context.Because IRQF_ONESHOT type interrupt line is kept disabled until
the threaded handler has been run, so there is no need to protect
read/write of REG_GEN3_IRQSTR with lock.Fixes: 7d4b269776ec6 ("enable hardware interrupts for trip points")
Signed-off-by: Jiada Wang
Reviewed-by: Simon Horman
Tested-by: Simon Horman
Reviewed-by: Daniel Lezcano
Signed-off-by: Eduardo Valentin -
thermal_of_cooling_device_register() and thermal_cooling_device_register()
are typically called from driver probe functions, and
thermal_cooling_device_unregister() is called from remove functions. This
makes both a perfect candidate for device managed functions.Introduce devm_thermal_of_cooling_device_register(). This function can
also be used to replace thermal_cooling_device_register() by passing a NULL
pointer as device node. The new function requires both struct device *
and struct device_node * as parameters since the struct device_node *
parameter is not always identical to dev->of_node.Don't introduce a device managed remove function since it is not needed
at this point.Signed-off-by: Guenter Roeck
Signed-off-by: Eduardo Valentin -
Certain ADC channels, such as the xilinx-ams temperature channels, give
milliCelcius already when read with iio_read_channel_processed.Rather than having to provide a 1:1 dummy lookup table, simply allow to
bypass the mechanism.Signed-off-by: Jean-Francois Dagenais
Signed-off-by: Eduardo Valentin -
It's impossible to use this driver outside of Device Tree, so if the
probe function is called, the dev.of_node is guaranteed to not be NULL
and guarding against that is pointless. Drop it.Signed-off-by: Andrey Smirnov
Acked-by: Daniel Lezcano
Cc: Chris Healy
Cc: Lucas Stach
Cc: Eduardo Valentin
Cc: Daniel Lezcano
Cc: Angus Ainslie (Purism)
Cc: linux-imx@nxp.com
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin -
This is a generic thermal driver for simple MMIO sensors, of which
amazon,al-thermal is one.This device uses a single MMIO transaction to read the temperature and
report it to the thermal subsystem.Signed-off-by: Talel Shenhar
Reviewed-by: David Woodhouse
Reviewed-by: Daniel Lezcano
Signed-off-by: Eduardo Valentin -
Fix setting value for IRQCTL register. We are setting the last 6 bits
of (IRQCTL) to be 1 (0x3f), this is only suitable for H3ES1.*, according
to Hardware manual values 1 are "setting prohibited" for Gen3.Signed-off-by: Hoan Nguyen An
Acked-by: Wolfram Sang
Reviewed-by: Geert Uytterhoeven
Signed-off-by: Eduardo Valentin -
This will allow calibration routines to correctly include the constants
from anywhere and allow more code sharing.Signed-off-by: Amit Kucheria
Signed-off-by: Eduardo Valentin -
qcs404 has a single TSENS IP block with 10 sensors. It uses version 1.4
of the TSENS IP, functionality for which is encapsulated inside the
qcom,tsens-v1 compatible.Signed-off-by: Amit Kucheria
Signed-off-by: Eduardo Valentin -
get_temp() learns to return temperature regardless of whether it is
returned as ADC code or direct temperature.Signed-off-by: Amit Kucheria
Signed-off-by: Eduardo Valentin -
Just rename the function and move it to allow code sharing with future
versions of TSENS IPSigned-off-by: Amit Kucheria
Signed-off-by: Eduardo Valentin -
The current implementation is based on an algorithm published in the
docs. Instead of reading the temperature thrice w/o any explanation,
improve the algorithm.This will become the basis for a common get_temp routine in the future.
Signed-off-by: Amit Kucheria
Signed-off-by: Eduardo Valentin -
The IP can support 'm' sensors while the platform can enable 'n' sensors
of the 'm' where n
Signed-off-by: Eduardo Valentin -
The IDs cannot be negative, fix the data type.
Signed-off-by: Amit Kucheria
Signed-off-by: Eduardo Valentin -
is_sensor_enabled() checks if the sensors are enabled on this platform.
It is possible that the SoC might choose not to enable all the sensors
that the IP block is capable of supporting.Signed-off-by: Amit Kucheria
Signed-off-by: Eduardo Valentin -
We print a calibration failure message on -EPROBE_DEFER from
nvmem/qfprom as follows:
[ 3.003090] qcom-tsens 4a9000.thermal-sensor: version: 1.4
[ 3.005376] qcom-tsens 4a9000.thermal-sensor: tsens calibration failed
[ 3.113248] qcom-tsens 4a9000.thermal-sensor: version: 1.4This confuses people when, in fact, calibration succeeds later when
nvmem/qfprom device is available. Don't print this message on a
-EPROBE_DEFER.Signed-off-by: Amit Kucheria
Signed-off-by: Eduardo Valentin -
Code cleanup making it easier to read
Signed-off-by: Amit Kucheria
Signed-off-by: Eduardo Valentin -
As we add support for newer versions of the TSENS IP, the current
approach isn't scaling because registers and bitfields get moved around,
requiring platform-specific hacks in the code. By moving to regmap, we
can hide the register level differences away from the code.Define a common set of registers and bit-fields that we care about
across the various tsens IP versions.Signed-off-by: Amit Kucheria
Signed-off-by: Eduardo Valentin -
8974 and 8916 have the same version of the TSENS IP. Merge the files to
allow for better code reuse.Signed-off-by: Amit Kucheria
Signed-off-by: Eduardo Valentin -
Some #defines in tsens-v_0_1.c clash with those in tsens-8974.c. Prefix
them with 8916 to avoid the clash so we can merge the two files.Signed-off-by: Amit Kucheria
Signed-off-by: Eduardo Valentin -
8916 and 8974 use v0.1.0 of the TSENS IP. Rename tsens-8916 to prepare
it for merging with tsens-8974 in a later commit.Signed-off-by: Amit Kucheria
Signed-off-by: Eduardo Valentin -
check_patch complains a lot as follows:
WARNING: function definition argument 'struct tsens_priv *' should also have an identifier name
+ int (*init)(struct tsens_priv *);Fix it.
Signed-off-by: Amit Kucheria
Signed-off-by: Eduardo Valentin -
tsens_get_temp() uses the name 'data' for the void pointer, use the same
in tsens_get_trend() for consistency.Remove a stray space while we're at it.
Signed-off-by: Amit Kucheria
Signed-off-by: Eduardo Valentin -
tmdev seems to imply that this is a device pointer when in fact it is
just private platform data for each tsens device. Rename it to priv
improve code readability.Signed-off-by: Amit Kucheria
Signed-off-by: Eduardo Valentin -
Rename to tsens_priv to denote that it is private data for each tsens
instance.Signed-off-by: Amit Kucheria
Signed-off-by: Eduardo Valentin -
Rename to tsens_plat_data to denote that it is platform-data passed in
at compile-time.Signed-off-by: Amit Kucheria
Signed-off-by: Eduardo Valentin -
Describe how the TSENS device and the various sensors connected to it
are described in the driverSigned-off-by: Amit Kucheria
Signed-off-by: Eduardo Valentin