Commit graph

2508 commits

Author SHA1 Message Date
Linus Torvalds
8d7868c41d Thermal control updates for 6.5-rc1
- Add new IOCTLs to the int340x thermal driver to allow user space to
    retrieve the Passive v2 thermal table (Srinivas Pandruvada).
 
  - Add DT bindings for SM6375, MSM8226 and QCM2290 Qcom platforms (Konrad
    Dybcio).
 
  - Add DT bindings and support for QCom MSM8226 (Matti Lehtimäki).
 
  - Add DT bindings for QCom ipq9574 (Praveenkumar I).
 
  - Convert bcm2835 DT bindings to the yaml schema (Stefan Wahren).
 
  - Allow selecting the bang-bang governor as default (Thierry Reding).
 
  - Refactor and prepare the code to set the scene for RCar Gen4 (Wolfram
    Sang).
 
  - Clean up and fix the QCom tsens drivers. Add DT bindings and
    calibration for the MSM8909 platform (Stephan Gerhold).
 
  - Revert a patch introducing a wrong usage of devm_of_iomap() on the
    Mediatek platform (Ricardo Cañuelo).
 
  - Fix the clock vs reset ordering in order to conform to the
    documentation on the sun8i (Christophe JAILLET).
 
  - Prevent setting up undocumented registers, enable the only described
    sensors and add the version 2.1 on the Qoriq sensor (Peng Fan).
 
  - Add DT bindings and support for the Armada AP807 (Alex Leibovich).
 
  - Update the mlx5 driver with the recent thermal changes (Daniel
    Lezcano).
 
  - Convert to platform remove callback returning void on STM32 (Uwe
    Kleine-König).
 
  - Add an error information printing for devm_thermal_add_hwmon_sysfs()
    and remove the error from the Sun8i, Amlogic, i.MX, TI, K3, Tegra,
    Qoriq, Mediateka and QCom (Yangtao Li).
 
  - Register as hwmon sensor for the Generic ADC (Chen-Yu Tsai).
 
  - Use the dev_err_probe() function in the QCom tsens alarm driver (Luca
    Weiss).
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAmSZxuYSHHJqd0Byand5
 c29ja2kubmV0AAoJEILEb/54YlRxVicP/0Gl7fQc2l2/AEwe+FuwZz8xERhbLc4s
 kSXVIJ1B6GScefUmLBqDZoWokVqP4gXgjTnYdqZNJmnCo+hP9i6VzVjVXSI2eNe7
 426cJd7la2K0zWcjsw/apdGa81Btnf0IjIMjeWiZOPVkRE6UmnHBwG52C5Hd+1pa
 EJaRcxv37MvrRKgzwUV+4WSBd5p1v3UrElzs10DXt+mVfRjsV7Y3bxnfW0+kh1sK
 3J/AzPXx1v6e6mnKQQQAso0r1g22n/lfh9C7VQT01fXt704PLx1jNr4vtlGhCJkQ
 sRlodAx+6uSX2GyeVs9hKOPZees3lY9VcZOI3c4g0Sy2ad4Hl7QDRbMmMUiiEVNZ
 fmiIs26RbfeRvl2lNDEYxLxsBaMva4rerVuOlRjkKeXDboa/TyZ2/MwvaE/uaxT7
 yWBoqoY67aPfyS8YgSu/DqRK60J+6PShaYeOJ4deYA6skctCe1v7nRJu07n62RBd
 JuPUUifiBb6jpxDPCRBHLxwUIMK9gzJIRM74ieZs/XSG56v4dJR2e8GmHZLoiLPV
 cc/uyHopQc75z7fYNDHdu7EHzUUGsjI6A9cNoCcdG86+b/pUEXTBLxpEuOv3bXfm
 DtpoS2O0PEJtblTmS4HFJJuJ3I1qUzJZgo/KmwmFEcXOfo2KEqVzcleSr1t+zAbR
 rCTcgVTaYpt4
 =dtvf
 -----END PGP SIGNATURE-----

Merge tag 'thermal-6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull thermal control updates from Rafael Wysocki:
 "These extend the int340x thermal driver, add thermal DT bindings for
  some Qcom platforms, add DT bindings and support for Armada AP807 and
  MSM8909, allow selecting the bang-bang thermal governor as the default
  one, address issues in several thermal drivers for ARM platforms and
  clean up code.

  Specifics:

   - Add new IOCTLs to the int340x thermal driver to allow user space to
     retrieve the Passive v2 thermal table (Srinivas Pandruvada)

   - Add DT bindings for SM6375, MSM8226 and QCM2290 Qcom platforms
     (Konrad Dybcio)

   - Add DT bindings and support for QCom MSM8226 (Matti Lehtimäki)

   - Add DT bindings for QCom ipq9574 (Praveenkumar I)

   - Convert bcm2835 DT bindings to the yaml schema (Stefan Wahren)

   - Allow selecting the bang-bang governor as default (Thierry Reding)

   - Refactor and prepare the code to set the scene for RCar Gen4
     (Wolfram Sang)

   - Clean up and fix the QCom tsens drivers. Add DT bindings and
     calibration for the MSM8909 platform (Stephan Gerhold)

   - Revert a patch introducing a wrong usage of devm_of_iomap() on the
     Mediatek platform (Ricardo Cañuelo)

   - Fix the clock vs reset ordering in order to conform to the
     documentation on the sun8i (Christophe JAILLET)

   - Prevent setting up undocumented registers, enable the only
     described sensors and add the version 2.1 on the Qoriq sensor (Peng
     Fan)

   - Add DT bindings and support for the Armada AP807 (Alex Leibovich)

   - Update the mlx5 driver with the recent thermal changes (Daniel
     Lezcano)

   - Convert to platform remove callback returning void on STM32 (Uwe
     Kleine-König)

   - Add an error information printing for devm_thermal_add_hwmon_sysfs()
     and remove the error from the Sun8i, Amlogic, i.MX, TI, K3, Tegra,
     Qoriq, Mediateka and QCom (Yangtao Li)

   - Register as hwmon sensor for the Generic ADC (Chen-Yu Tsai)

   - Use the dev_err_probe() function in the QCom tsens alarm driver
     (Luca Weiss)"

* tag 'thermal-6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (39 commits)
  thermal/drivers/qcom/temp-alarm: Use dev_err_probe
  thermal/drivers/generic-adc: Register thermal zones as hwmon sensors
  thermal/drivers/mediatek/lvts_thermal: Remove redundant msg in lvts_ctrl_start()
  thermal/drivers/qcom: Remove redundant msg at probe time
  thermal/drivers/ti-soc: Remove redundant msg in ti_thermal_expose_sensor()
  thermal/drivers/qoriq: Remove redundant msg in qoriq_tmu_register_tmu_zone()
  thermal/drivers/tegra: Remove redundant msg in tegra_tsensor_register_channel()
  drivers/thermal/k3: Remove redundant msg in k3_bandgap_probe()
  thermal/drivers/imx: Remove redundant msg in imx8mm_tmu_probe() and imx_sc_thermal_probe()
  thermal/drivers/amlogic: Remove redundant msg in amlogic_thermal_probe()
  thermal/drivers/sun8i: Remove redundant msg in sun8i_ths_register()
  thermal/hwmon: Add error information printing for devm_thermal_add_hwmon_sysfs()
  thermal/drivers/stm32: Convert to platform remove callback returning void
  net/mlx5: Update the driver with the recent thermal changes
  thermal/drivers/armada: Add support for AP807 thermal data
  dt-bindings: armada-thermal: Add armada-ap807-thermal compatible
  thermal/drivers/qoriq: Support version 2.1
  thermal/drivers/qoriq: Only enable supported sensors
  thermal/drivers/qoriq: No need to program site adjustment register
  thermal/drivers/mediatek/lvts_thermal: Register thermal zones as hwmon sensors
  ...
2023-06-26 19:41:26 -07:00
Linus Torvalds
40e8e98f51 Power management updates for 6.5-rc1
- Introduce power capping core support for Intel TPMI (Topology Aware
    Register and PM Capsule Interface) and a TPMI interface driver for
    Intel RAPL (Zhang Rui, Dan Carpenter).
 
  - Fix CONFIG_IOSF_MBI dependency in the Intel RAPL power capping
    driver (Zhang Rui).
 
  - Fix invalid initialization for pl4_supported field in the Intel RAPL
    power capping driver (Sumeet Pawnikar).
 
  - Clean up the intel_idle driver, make it work with VM guests that
    cannot use the MWAIT instruction and address the case in which the
    host may enter a deep idle state when the guest is idle (Arjan van
    de Ven).
 
  - Prevent cpufreq drivers that provide the ->adjust_perf() callback
    without a ->fast_switch() one which is used as a fallback from the
    former in some cases (Wyes Karny).
 
  - Fix some issues related to the AMD P-state cpufreq driver (Mario
    Limonciello, Wyes Karny).
 
  - Fix the energy_performance_preference attribute handling in the
    intel_pstate driver in passive mode (Tero Kristo).
 
  - Fix the handling of pm_suspend_target_state when CONFIG_PM is unset
    (Kai-Heng Feng).
 
  - Correct spelling mistake in a comment in the hibernation code (Wang
    Honghui).
 
  - Add arch_resume_nosmt() prototype to avoid a "missing prototypes"
    build warning (Arnd Bergmann).
 
  - Restrict pm_pr_dbg() to system-wide power transitions and use it in
    a few additional places (Mario Limonciello).
 
  - Drop verification of in-params from genpd_add_device() and ensure
    that all of its callers will do it (Ulf Hansson).
 
  - Prevent possible integer overflows from occurring in
    genpd_parse_state() (Nikita Zhandarovich).
 
  - Reorder fieldls in 'struct devfreq_dev_status' to reduce its size
    somewhat (Christophe JAILLET).
 
  - Ensure that the Exynos PPMU driver is already loaded before the
    Exynos Bus driver starts probing so as to avoid a possible freeze
    loading of the kernel modules (Marek Szyprowski).
 
  - Fix variable deferencing before NULL check in the mtk-cci devfreq
    driver (Sukrut Bellary).
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAmSZwPASHHJqd0Byand5
 c29ja2kubmV0AAoJEILEb/54YlRxu44P/AouvVFDMt+eE76nPfNc10X1lswS0vrT
 X7LmylSDPyWiuz6p8MWGXB6T2nQ+3DbvSfVyBJ960ymkBnE/F9me8o3wB8eGbd6z
 ZvOD8+wVPXS4Cq8gUxy2zV1ul+o5IwwT20cYC6mWjasvByl13vTevN5d6ZQ9o6hS
 1hAQQDd6JjsdLIUyU0EbE4aD+l4h96o45IFxbV86qVH77ywa6VMNdulRKmDcONj3
 kM7jHFYL4xl0TfMjHp4IhGWXK32qGYgX1zYTOU5kSc11IExJfVzQcL2uQ9A0KSLp
 RJ0c93loUsHdMhenNkN4nSBFWBIaftKDLbS+5Ubt0DBuNN7kxWivEVts4DM/wxuB
 72PNl5h8YglcW7LHH2IXb/6HEerzbj42+6y459o+M0DcNTq18gu19OQTK5IGtRrQ
 Yf6+5BhgLR3R1REg0eaBg6njtGq0f5fmW7Iqo52eA8cXhHU0MTDJE1p6ytfN40gH
 ViA+T8HB6Mh91lWHVftbwo3wONHGcfJy+S2hGM45V5LKEGeKHILgmw0nUzO7epWE
 7VIPKGzkVd7h/Drk7X3nQR3DJFA/x5eNhjxt5LZD83cVVg34SS3ST5oH13FI9S7Q
 8zwG5KoHTDrmYug3sxQ+Q9pq8MnOl0ZbgqlVfwyiWjKYmNMbg4elsQG/2zD3t0kv
 y8zXbr7Kr4QB
 =SZV7
 -----END PGP SIGNATURE-----

Merge tag 'pm-6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management updates from Rafael Wysocki:
 "These add Intel TPMI (Topology Aware Register and PM Capsule
  Interface) support to the power capping subsystem, extend the
  intel_idle driver to work in VM guests where MWAIT is not available,
  extend the system-wide power management diagnostics, fix bugs and
  clean up code.

  Specifics:

   - Introduce power capping core support for Intel TPMI (Topology Aware
     Register and PM Capsule Interface) and a TPMI interface driver for
     Intel RAPL (Zhang Rui, Dan Carpenter)

   - Fix CONFIG_IOSF_MBI dependency in the Intel RAPL power capping
     driver (Zhang Rui)

   - Fix invalid initialization for pl4_supported field in the Intel
     RAPL power capping driver (Sumeet Pawnikar)

   - Clean up the intel_idle driver, make it work with VM guests that
     cannot use the MWAIT instruction and address the case in which the
     host may enter a deep idle state when the guest is idle (Arjan van
     de Ven)

   - Prevent cpufreq drivers that provide the ->adjust_perf() callback
     without a ->fast_switch() one which is used as a fallback from the
     former in some cases (Wyes Karny)

   - Fix some issues related to the AMD P-state cpufreq driver (Mario
     Limonciello, Wyes Karny)

   - Fix the energy_performance_preference attribute handling in the
     intel_pstate driver in passive mode (Tero Kristo)

   - Fix the handling of pm_suspend_target_state when CONFIG_PM is unset
     (Kai-Heng Feng)

   - Correct spelling mistake in a comment in the hibernation code (Wang
     Honghui)

   - Add arch_resume_nosmt() prototype to avoid a "missing prototypes"
     build warning (Arnd Bergmann)

   - Restrict pm_pr_dbg() to system-wide power transitions and use it in
     a few additional places (Mario Limonciello)

   - Drop verification of in-params from genpd_add_device() and ensure
     that all of its callers will do it (Ulf Hansson)

   - Prevent possible integer overflows from occurring in
     genpd_parse_state() (Nikita Zhandarovich)

   - Reorder fieldls in 'struct devfreq_dev_status' to reduce its size
     somewhat (Christophe JAILLET)

   - Ensure that the Exynos PPMU driver is already loaded before the
     Exynos Bus driver starts probing so as to avoid a possible freeze
     loading of the kernel modules (Marek Szyprowski)

   - Fix variable deferencing before NULL check in the mtk-cci devfreq
     driver (Sukrut Bellary)"

* tag 'pm-6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (42 commits)
  intel_idle: Add a "Long HLT" C1 state for the VM guest mode
  cpufreq: intel_pstate: Fix energy_performance_preference for passive
  cpufreq: amd-pstate: Add a kernel config option to set default mode
  cpufreq: amd-pstate: Set a fallback policy based on preferred_profile
  ACPI: CPPC: Add definition for undefined FADT preferred PM profile value
  cpufreq: amd-pstate: Set default governor to schedutil
  PM: domains: Move the verification of in-params from genpd_add_device()
  cpufreq: amd-pstate: Make amd-pstate EPP driver name hyphenated
  cpufreq: amd-pstate: Write CPPC enable bit per-socket
  intel_idle: Add support for using intel_idle in a VM guest using just hlt
  cpufreq: Fail driver register if it has adjust_perf without fast_switch
  intel_idle: clean up the (new) state_update_enter_method function
  intel_idle: refactor state->enter manipulation into its own function
  platform/x86/amd: pmc: Use pm_pr_dbg() for suspend related messages
  pinctrl: amd: Use pm_pr_dbg to show debugging messages
  ACPI: x86: Add pm_debug_messages for LPS0 _DSM state tracking
  include/linux/suspend.h: Only show pm_pr_dbg messages at suspend/resume
  powercap: RAPL: Fix a NULL vs IS_ERR() bug
  powercap: RAPL: Fix CONFIG_IOSF_MBI dependency
  powercap: RAPL: fix invalid initialization for pl4_supported field
  ...
2023-06-26 19:36:30 -07:00
Rafael J. Wysocki
a8460ba594 - Add DT bindings for SM6375, MSM8226 and QCM2290 Qcom platforms (Konrad
Dybcio)
 
 - Add DT bindings and support for QCom MSM8226 (Matti Lehtimäki)
 
 - Add DT bindings for QCom ipq9574 (Praveenkumar I)
 
 - Convert bcm2835 DT bindings to the yaml schema (Stefan Wahren)
 
 - Allow selecting the bang-bang governor as default (Thierry Reding)
 
 - Refactor and prepare the code to set the scene for RCar Gen4
   (Wolfram Sang)
 
 - Cleanup and fixes for the QCom tsens drivers. Add DT bindings and
   calibration for the MSM8909 platform (Stephan Gerhold)
 
 - Revert a patch introducing a wrong usage of devm_of_iomap() on the
   Mediatek platform (Ricardo Cañuelo)
 
 - Fix the clock vs reset ordering in order to conform to the
   documentation on the sun8i (Christophe JAILLET)
 
 - Prevent setting up undocumented registers, enable the only described
   sensors and add the version 2.1 on the Qoriq sensor (Peng Fan)
 
 - Add DT bindings and support for the Armada AP807 (Alex Leibovich)
 
 - Update the mlx5 driver with the recent thermal changes (Daniel
   Lezcano)
 
 - Convert to platform remove callback returning void on STM32 (Uwe
   Kleine-König)
 
 - Add an error information printing for devm_thermal_add_hwmon_sysfs()
   and remove the error from the Sun8i, Amlogic, i.MX, TI, K3, Tegra,
   Qoriq, Mediateka and QCom (Yangtao Li)
 
 - Register as hwmon sensor for the Generic ADC (Chen-Yu Tsai)
 
 - Use the dev_err_probe() function in the QCom tsens alarm driver
   (Luca Weiss)
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEEGn3N4YVz0WNVyHskqDIjiipP6E8FAmSZrHQACgkQqDIjiipP
 6E9yrAf+KD4AO8piKP8RoFAwM5TDHz7lQFsf9kcIHA4OjDG9HYG7nV9Y3zlVRb5S
 q4M/e69OCmQBWkntAuNwf3szl5ear7tutJjZb8pCKqQEp83gjyHnK3CrhGYTTFq4
 CWafhhsXhZX9a0twtPoXCO4xD1jxay1Viv0I4uWB8QcNuQbDHYJP9eQtGkppn4ql
 RRYZiYrlsjQ1uyylZ3fEbwcRGT6OGws5xSAhvya+MaU/czEWbjUFpJu37RGobvZ9
 AI8GL4RD46IMsIvrb9xULJu3Fh5j+0Paj7hi6YGQqWPrKvhSFJ8cwc5M0oazslB3
 P02n345laVmGvSskpT64nGZ2ArKr/Q==
 =ZMIC
 -----END PGP SIGNATURE-----

Merge tag 'thermal-v6.5-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/thermal/linux into thermal

Pull thermal control updates for 6.5-rc1 from Daniel Lezcano:

"- Add DT bindings for SM6375, MSM8226 and QCM2290 Qcom platforms (Konrad
   Dybcio)

 - Add DT bindings and support for QCom MSM8226 (Matti Lehtimäki)

 - Add DT bindings for QCom ipq9574 (Praveenkumar I)

 - Convert bcm2835 DT bindings to the yaml schema (Stefan Wahren)

 - Allow selecting the bang-bang governor as default (Thierry Reding)

 - Refactor and prepare the code to set the scene for RCar Gen4
   (Wolfram Sang)

 - Cleanup and fixes for the QCom tsens drivers. Add DT bindings and
   calibration for the MSM8909 platform (Stephan Gerhold)

 - Revert a patch introducing a wrong usage of devm_of_iomap() on the
   Mediatek platform (Ricardo Cañuelo)

 - Fix the clock vs reset ordering in order to conform to the
   documentation on the sun8i (Christophe JAILLET)

 - Prevent setting up undocumented registers, enable the only described
   sensors and add the version 2.1 on the Qoriq sensor (Peng Fan)

 - Add DT bindings and support for the Armada AP807 (Alex Leibovich)

 - Update the mlx5 driver with the recent thermal changes (Daniel
   Lezcano)

 - Convert to platform remove callback returning void on STM32 (Uwe
   Kleine-König)

 - Add an error information printing for devm_thermal_add_hwmon_sysfs()
   and remove the error from the Sun8i, Amlogic, i.MX, TI, K3, Tegra,
   Qoriq, Mediateka and QCom (Yangtao Li)

 - Register as hwmon sensor for the Generic ADC (Chen-Yu Tsai)

 - Use the dev_err_probe() function in the QCom tsens alarm driver
   (Luca Weiss)"

* tag 'thermal-v6.5-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/thermal/linux: (38 commits)
  thermal/drivers/qcom/temp-alarm: Use dev_err_probe
  thermal/drivers/generic-adc: Register thermal zones as hwmon sensors
  thermal/drivers/mediatek/lvts_thermal: Remove redundant msg in lvts_ctrl_start()
  thermal/drivers/qcom: Remove redundant msg at probe time
  thermal/drivers/ti-soc: Remove redundant msg in ti_thermal_expose_sensor()
  thermal/drivers/qoriq: Remove redundant msg in qoriq_tmu_register_tmu_zone()
  thermal/drivers/tegra: Remove redundant msg in tegra_tsensor_register_channel()
  drivers/thermal/k3: Remove redundant msg in k3_bandgap_probe()
  thermal/drivers/imx: Remove redundant msg in imx8mm_tmu_probe() and imx_sc_thermal_probe()
  thermal/drivers/amlogic: Remove redundant msg in amlogic_thermal_probe()
  thermal/drivers/sun8i: Remove redundant msg in sun8i_ths_register()
  thermal/hwmon: Add error information printing for devm_thermal_add_hwmon_sysfs()
  thermal/drivers/stm32: Convert to platform remove callback returning void
  net/mlx5: Update the driver with the recent thermal changes
  thermal/drivers/armada: Add support for AP807 thermal data
  dt-bindings: armada-thermal: Add armada-ap807-thermal compatible
  thermal/drivers/qoriq: Support version 2.1
  thermal/drivers/qoriq: Only enable supported sensors
  thermal/drivers/qoriq: No need to program site adjustment register
  thermal/drivers/mediatek/lvts_thermal: Register thermal zones as hwmon sensors
  ...
2023-06-26 18:56:58 +02:00
Rafael J. Wysocki
f46117bf9d Merge back earlier Intel thermal control material for 6.5. 2023-06-26 18:03:07 +02:00
Rafael J. Wysocki
c89a27f4f8 Merge branch 'powercap'
Merge power capping updates for 6.5-rc1:

 - Introduce power capping core support for Intel TPMI (Topology Aware
   Register and PM Capsule Interface) and a TPMI interface driver for
   Intel RAPL (Zhang Rui, Dan Carpenter).

 - Fix CONFIG_IOSF_MBI dependency in the Intel RAPL power capping
   driver (Zhang Rui).

 - Fix invalid initialization for pl4_supported field in the Intel RAPL
   power capping driver (Sumeet Pawnikar).

* powercap:
  powercap: RAPL: Fix a NULL vs IS_ERR() bug
  powercap: RAPL: Fix CONFIG_IOSF_MBI dependency
  powercap: RAPL: fix invalid initialization for pl4_supported field
  powercap: intel_rapl: Introduce RAPL TPMI interface driver
  powercap: intel_rapl: Introduce core support for TPMI interface
  powercap: intel_rapl: Introduce RAPL I/F type
  powercap: intel_rapl: Make cpu optional for rapl_package
  powercap: intel_rapl: Remove redundant cpu parameter
  powercap: intel_rapl: Add support for lock bit per Power Limit
  powercap: intel_rapl: Cleanup Power Limits support
  powercap: intel_rapl: Use bitmap for Power Limits
  powercap: intel_rapl: Change primitive order
  powercap: intel_rapl: Use index to initialize primitive information
  powercap: intel_rapl: Support per domain energy/power/time unit
  powercap: intel_rapl: Support per Interface primitive information
  powercap: intel_rapl: Support per Interface rapl_defaults
  powercap: intel_rapl: Allow probing without CPUID match
  powercap: intel_rapl: Remove unused field in struct rapl_if_priv
2023-06-26 17:56:05 +02:00
Luca Weiss
57c9eaa4de thermal/drivers/qcom/temp-alarm: Use dev_err_probe
Use the dev_err_probe function instead of dev_err in the probe function
so that the printed message includes the return value and also handles
-EPROBE_DEFER nicely.

Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230625-spmi-temp-alarm-defer-v1-1-2d57acf36855@z3ntu.xyz
2023-06-26 12:10:22 +02:00
Chen-Yu Tsai
85b21fdec9 thermal/drivers/generic-adc: Register thermal zones as hwmon sensors
Register thermal zones as hwmon sensors to let userspace read
temperatures using standard hwmon interface.

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
[Yangtao: only keep devm_thermal_add_hwmon_sysfs]
Signed-off-by: Yangtao Li <frank.li@vivo.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230620090732.50025-11-frank.li@vivo.com
2023-06-26 12:03:14 +02:00
Yangtao Li
27cc5be110 thermal/drivers/mediatek/lvts_thermal: Remove redundant msg in lvts_ctrl_start()
The upper-layer devm_thermal_add_hwmon_sysfs() function can directly
print error information.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230620090732.50025-10-frank.li@vivo.com
2023-06-26 12:03:14 +02:00
Yangtao Li
7adbbb3b7b thermal/drivers/qcom: Remove redundant msg at probe time
The upper-layer devm_thermal_add_hwmon_sysfs() function can directly
print error information.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230620090732.50025-9-frank.li@vivo.com
2023-06-26 12:03:14 +02:00
Yangtao Li
a4ebd42374 thermal/drivers/ti-soc: Remove redundant msg in ti_thermal_expose_sensor()
The upper-layer devm_thermal_add_hwmon_sysfs() function can directly
print error information.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
Acked-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230620090732.50025-8-frank.li@vivo.com
2023-06-26 12:03:14 +02:00
Yangtao Li
f13582a42d thermal/drivers/qoriq: Remove redundant msg in qoriq_tmu_register_tmu_zone()
The upper-layer devm_thermal_add_hwmon_sysfs() function can directly
print error information.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230620090732.50025-7-frank.li@vivo.com
2023-06-26 12:03:14 +02:00
Yangtao Li
2279e8f927 thermal/drivers/tegra: Remove redundant msg in tegra_tsensor_register_channel()
The upper-layer devm_thermal_add_hwmon_sysfs() function can directly
print error information.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230620090732.50025-6-frank.li@vivo.com
2023-06-26 12:03:14 +02:00
Yangtao Li
7c673ef519 drivers/thermal/k3: Remove redundant msg in k3_bandgap_probe()
The upper-layer devm_thermal_add_hwmon_sysfs() function can directly
print error information.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230620090732.50025-5-frank.li@vivo.com
2023-06-26 12:03:14 +02:00
Yangtao Li
b0526e02c6 thermal/drivers/imx: Remove redundant msg in imx8mm_tmu_probe() and imx_sc_thermal_probe()
The upper-layer devm_thermal_add_hwmon_sysfs() function can directly
print error information.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230620090732.50025-4-frank.li@vivo.com
2023-06-26 12:03:14 +02:00
Yangtao Li
c32719ace7 thermal/drivers/amlogic: Remove redundant msg in amlogic_thermal_probe()
The upper-layer devm_thermal_add_hwmon_sysfs() function can directly
print error information.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230620090732.50025-3-frank.li@vivo.com
2023-06-26 12:03:14 +02:00
Yangtao Li
07130d1da8 thermal/drivers/sun8i: Remove redundant msg in sun8i_ths_register()
The upper-layer devm_thermal_add_hwmon_sysfs() function can directly
print error information.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230620090732.50025-2-frank.li@vivo.com
2023-06-26 12:03:14 +02:00
Yangtao Li
8416ecfb32 thermal/hwmon: Add error information printing for devm_thermal_add_hwmon_sysfs()
Ensure that all error handling branches print error information. In this
way, when this function fails, the upper-layer functions can directly
return an error code without missing debugging information. Otherwise,
the error message will be printed redundantly or missing.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230620090732.50025-1-frank.li@vivo.com
2023-06-26 12:03:14 +02:00
Uwe Kleine-König
2ef9533134 thermal/drivers/stm32: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code.  However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

st_thermal_unregister() always returned zero, so convert it to return void
without any loss and then just drop the return from st_mmap_remove().

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230616165641.1055854-1-u.kleine-koenig@pengutronix.de
2023-06-26 12:03:14 +02:00
Alex Leibovich
62a094e757 thermal/drivers/armada: Add support for AP807 thermal data
Add support for the AP807 die thermal data. This is the same as AP806,
except for the coefficients.

ap807 values taken from TSENSE_ADC_16FFC spec, which says:
	T(in Celsius) = T(code)*TSENE_GAIN+TSENE_OFFSET
where in default:
	TSENE_OFFSET = 128.9
	TSENE_GAIN = 0.394

Signed-off-by: Alex Leibovich <alexl@marvell.com>
Tested-by: sa_ip-sw-jenkins <sa_ip-sw-jenkins@marvell.com>
Reviewed-by: Stefan Chulski <stefanc@marvell.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/E1qA7yU-00Ea4u-Je@rmk-PC.armlinux.org.uk
2023-06-26 12:03:14 +02:00
Peng Fan
f12d60c81f thermal/drivers/qoriq: Support version 2.1
i.MX93 use TMU version 2.1, which supports:
 - TRITSR_TP5(When this field is 1, you must add 0.5 K to the temperature
   that TEMP reports. For example, if TEMP is 300 K and TP5=1, then the
   final temperature is 300.5 K.)
 - Has 16 TTRCR register: Temperature Range Control (TTRCR0 - TTRCR15)

This patch is to add this support.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230516083746.63436-4-peng.fan@oss.nxp.com
2023-06-26 12:03:14 +02:00
Peng Fan
9301575df2 thermal/drivers/qoriq: Only enable supported sensors
There are MAX 16 sensors, but not all of them supported. Such as
i.MX8MQ, there are only 3 sensors. Enabling all 16 sensors will
touch reserved bits from i.MX8MQ reference mannual, and TMU will stuck,
temperature will not update anymore.

Fixes: 45038e03d6 ("thermal: qoriq: Enable all sensors before registering them")
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230516083746.63436-3-peng.fan@oss.nxp.com
2023-06-26 12:03:13 +02:00
Pankit Garg
5474e98b3e thermal/drivers/qoriq: No need to program site adjustment register
No need to program site adjustment register, as programming
these registers do not give accurate value and also these
registers are not mentioned in Reference Manual.

Signed-off-by: Pankit Garg <pankit.garg@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230516083746.63436-2-peng.fan@oss.nxp.com
2023-06-26 12:03:13 +02:00
Chen-Yu Tsai
51c8e11933 thermal/drivers/mediatek/lvts_thermal: Register thermal zones as hwmon sensors
Register thermal zones as hwmon sensors to let userspace read
temperatures using standard hwmon interface.

Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230613091317.1691247-1-wenst@chromium.org
2023-06-26 12:03:13 +02:00
Christophe JAILLET
89382022b3 thermal/drivers/sun8i: Fix some error handling paths in sun8i_ths_probe()
Should an error occur after calling sun8i_ths_resource_init() in the probe
function, some resources need to be released, as already done in the
.remove() function.

Switch to the devm_clk_get_enabled() helper and add a new devm_action to
turn sun8i_ths_resource_init() into a fully managed function.

Move the place where reset_control_deassert() is called so that the
recommended order of reset release/clock enable steps is kept.
A64 manual states that:

	3.3.6.4. Gating and reset

	Make sure that the reset signal has been released before the release of
	module clock gating;

This fixes the issue and removes some LoC at the same time.

Fixes: dccc5c3b6f ("thermal/drivers/sun8i: Add thermal driver for H6/H5/H3/A64/A83T/R40")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Maxime Ripard <maxime@cerno.tech>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/a8ae84bd2dc4b55fe428f8e20f31438bf8bb6762.1684089931.git.christophe.jaillet@wanadoo.fr
2023-06-26 12:03:13 +02:00
Ricardo Cañuelo
86edac7d38 Revert "thermal/drivers/mediatek: Use devm_of_iomap to avoid resource leak in mtk_thermal_probe"
This reverts commit f05c7b7d9e.

That change was causing a regression in the generic-adc-thermal-probed
bootrr test as reported in the kernelci-results list [1].
A proper rework will take longer, so revert it for now.

[1] https://groups.io/g/kernelci-results/message/42660

Fixes: f05c7b7d9e ("thermal/drivers/mediatek: Use devm_of_iomap to avoid resource leak in mtk_thermal_probe")
Signed-off-by: Ricardo Cañuelo <ricardo.canuelo@collabora.com>
Suggested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230525121811.3360268-1-ricardo.canuelo@collabora.com
2023-06-26 12:03:13 +02:00
Stephan Gerhold
4af164c1c1 thermal/drivers/qcom/tsens-v0_1: Add MSM8909 data
The MSM8909 SoC has 5 thermal sensors in a TSENS v0.1 block. Like
MDM9607 it uses a non-standard default slope value of 3000 [1] and needs
per-sensor "correction factors" to workaround issues with the factory
calibration [2].

[1]: https://git.codelinaro.org/clo/la/kernel/msm-3.18/-/blob/LA.UM.7.7.c26-09100-8x09.0/arch/arm/boot/dts/qcom/msm8909.dtsi#L476
[2]: 6df022c6d0

Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Stephan Gerhold <stephan.gerhold@kernkonzept.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230508-msm8909-tsens-v5-6-5eb632235ba7@kernkonzept.com
2023-06-26 12:03:13 +02:00
Stephan Gerhold
b6f739da00 thermal/drivers/qcom/tsens-v0_1: Add mdm9607 correction offsets
According to the msm-3.18 vendor kernel from Qualcomm, mdm9607 needs
"correction factors" to adjust for additional offsets observed after the
factory calibration values in the fuses [1, 2].

The fixed offsets should be applied unless there is a special
calibration mode value that indicates that no offsets are needed [3].

Note that the new calibration mode values are called differently in this
patch compared to the vendor kernel:
  - TSENS_TWO_POINT_CALIB_N_WA        -> ONE_PT_CALIB2_NO_OFFSET
  - TSENS_TWO_POINT_CALIB_N_OFFSET_WA -> TWO_PT_CALIB_NO_OFFSET
This is because close inspection of the calibration function [3] reveals
that TSENS_TWO_POINT_CALIB_N_WA is actually a "one point" calibration
because the if statements skip all "point2" related code for it.

[1]: d9d2db1b82
[2]: d75aef53a7
[3]: https://git.codelinaro.org/clo/la/kernel/msm-3.18/-/blob/LE.UM.4.3.2.r1-04200-9x07/drivers/thermal/msm-tsens.c#L2987-3136

Fixes: a2149ab815 ("thermal/drivers/qcom/tsens-v0_1: Add support for MDM9607")
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Stephan Gerhold <stephan.gerhold@kernkonzept.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230508-msm8909-tsens-v5-3-5eb632235ba7@kernkonzept.com
2023-06-26 12:03:13 +02:00
Stephan Gerhold
6812d1dfbc thermal/drivers/qcom/tsens-v0_1: Fix mdm9607 slope values
According to the msm-3.18 vendor kernel from Qualcomm [1], mdm9607 uses
a non-standard slope value of 3000 (instead of 3200) for all sensors.
Fill it properly similar to the 8939 code added recently.

[1]: https://git.codelinaro.org/clo/la/kernel/msm-3.18/-/blob/LE.UM.4.3.2.r1-04200-9x07/arch/arm/boot/dts/qcom/mdm9607.dtsi#L875

Fixes: a2149ab815 ("thermal/drivers/qcom/tsens-v0_1: Add support for MDM9607")
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Stephan Gerhold <stephan.gerhold@kernkonzept.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230508-msm8909-tsens-v5-2-5eb632235ba7@kernkonzept.com
2023-06-26 12:03:13 +02:00
Stephan Gerhold
c631da1f19 thermal/drivers/qcom/tsens: Drop unused legacy structs
The old single-cell parsing code was removed for MSM8939, MDM9607 and
MSM8976 but for some reason the structs defining the bit positions etc
were kept around (unused). Drop them now.

Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Fixes: 51d78b8b1b ("thermal/drivers/tsens: Drop single-cell code for mdm9607")
Fixes: dfadb4599a ("thermal/drivers/tsens: Drop single-cell code for msm8939")
Fixes: 3a908971f7 ("thermal/drivers/tsens: Drop single-cell code for msm8976/msm8956")
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Stephan Gerhold <stephan.gerhold@kernkonzept.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230508-msm8909-tsens-v5-1-5eb632235ba7@kernkonzept.com
2023-06-26 12:03:13 +02:00
Thierry Reding
04bf1fe478 thermal: Allow selecting the bang-bang governor as default
For many setups the bang-bang governor is exactly what we want. Many
ARM SoC-based devices use fans to cool down the entire SoC and that
works well only with the bang-bang governor because it uses the
hysteresis in order to let the fan run for a while to cool the SoC
down below the trip point before switching it off again.

The step-wise governor will behave strangely in these situations. It
doesn't use the hysteresis, so it can lead to situations where the fan
is turned on for only a very brief period and then is switched back off,
only to get switched back on again very quickly because the SoC hasn't
cooled down very much.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20230609124408.3788680-1-thierry.reding@gmail.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2023-06-26 12:03:13 +02:00
Matti Lehtimäki
598e1afca4 thermal/drivers/qcom/tsens-v0_1: Add support for MSM8226
The MSM8226 TSENS IP has 6 thermal sensors in a TSENS v0.1 block.
The thermal sensors use non-standard slope values.

Signed-off-by: Matti Lehtimäki <matti.lehtimaki@gmail.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Luca Weiss <luca@z3ntu.xyz>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230507201225.89694-4-matti.lehtimaki@gmail.com
2023-06-26 12:03:13 +02:00
Wolfram Sang
edeab75b13 drivers/thermal/rcar_gen3_thermal: add reading fuses for Gen4
The registers are differently named and at different offsets, but their
functionality is the same as for Gen3.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230511192220.7523-4-wsa+renesas@sang-engineering.com
2023-06-26 12:03:13 +02:00
Wolfram Sang
a216261d24 drivers/thermal/rcar_gen3_thermal: refactor reading fuses into seprarate function
Gen4 will be very different, so refactor Gen3 access into separate call
first.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230511192220.7523-3-wsa+renesas@sang-engineering.com
2023-06-26 12:03:13 +02:00
Wolfram Sang
fe3bfa7539 drivers/thermal/rcar_gen3_thermal: introduce 'info' structure
More items to describe the TSCs are needed soon, so encapsulate the
current 'ths_tj_1' item into a struct.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230511192220.7523-2-wsa+renesas@sang-engineering.com
2023-06-26 12:03:13 +02:00
Hans de Goede
0bb619f922 thermal/intel/intel_soc_dts_iosf: Fix reporting wrong temperatures
Since commit 955fb8719e ("thermal/intel/intel_soc_dts_iosf: Use Intel
TCC library") intel_soc_dts_iosf is reporting the wrong temperature.

The driver expects tj_max to be in milli-degrees-celcius but after
the switch to the TCC library this is now in degrees celcius so
instead of e.g. 90000 it is set to 90 causing a temperature 45
degrees below tj_max to be reported as -44910 milli-degrees
instead of as 45000 milli-degrees.

Fix this by adding back the lost factor of 1000.

Fixes: 955fb8719e ("thermal/intel/intel_soc_dts_iosf: Use Intel TCC library")
Reported-by: Bernhard Krug <b.krug@elektronenpumpe.de>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Zhang Rui <rui.zhang@intel.com>
Cc: 6.3+ <stable@vger.kernel.org> # 6.3+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2023-06-15 18:07:48 +02:00
Srinivas Pandruvada
ea197ea2ba thermal: intel: int340x_thermal: New IOCTLs for Passive v2 table
Export Passive version 2 table similar to the way _TRT and _ART tables
via IOCTLs.

This removes need for binary utility to read ACPI Passive 2 table by
providing open source support. This table already has open source
implementation in the user space thermald, when the table is part of
data vault exported by the int3400 sysfs.

This table is supported in some older platforms before Ice Lake
generation.

Passive 2 tables contain multiple entries. Each entry has following
fields:

 * Source: Named Reference (String). This is the source device for
   temperature.
 * Target: Named Reference (String). This is the target device to
   control.
 * Priority: Priority of this device compared to others.
 * SamplingPeriod: Time Period in 1/10 of seconds unit.
 * PassiveTemp: Passive Temperature in 1/10 of Kelvin.
 * SourceDomain: Domain for the source (00:Processor, others reserved).
 * ControlKnob: Type of control knob (00:Power Limit 1, others: reserved)
 * Limit: The target state to set on reaching passive temperature.
   This can be a string "max", "min" or a power limit value.
 * LimitStepSize: Step size during activation.
 * UnLimitStepSize: Step size during deactivation.
 * Reserved1: Reserved

Three IOCTLs are added similar to IOCTLs for reading TRT:

ACPI_THERMAL_GET_PSVT_COUNT: Number of passive 2 entries.
ACPI_THERMAL_GET_PSVT_LEN: Total return data size (count x each
  passive 2 entry size).
ACPI_THERMAL_GET_PSVT: Get the data as an array of objects with
  passive 2 entries.

This change is based on original development done by:
Todd Brandt <todd.e.brandt@linux.intel.com>

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
[ rjw: Changelog and subject edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2023-06-13 17:57:39 +02:00
Srinivas Pandruvada
5f7fdb0f25 thermal: intel: int340x: Add new line for UUID display
Prior to the commit "763bd29fd3d1 ("thermal: int340x_thermal: Use
sysfs_emit_at() instead of scnprintf()", there was a new line after each
UUID string.

With the newline removed, existing user space like "thermald" fails to
compare each supported UUID as it is using getline() to read UUID and
apply correct thermal table.

To avoid breaking existing user space, add newline after each UUID string.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Fixes: 763bd29fd3 ("thermal: int340x_thermal: Use sysfs_emit_at() instead of scnprintf()")
Cc: 6.3+ <stable@vger.kernel.org> # 6.3+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2023-05-24 19:50:04 +02:00
Zhang Rui
b4288ce788 powercap: intel_rapl: Introduce RAPL I/F type
Different RAPL Interfaces may have different primitive information and
rapl_defaults calls.

To better distinguish this difference in the RAPL framework code,
introduce a new enum to represent different types of RAPL Interfaces.

No functional change.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Tested-by: Wang Wendy <wendy.wang@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2023-05-24 18:46:20 +02:00
Zhang Rui
bf44b9011d powercap: intel_rapl: Make cpu optional for rapl_package
MSR RAPL Interface always removes a rapl_package when all the CPUs in
that rapl_package are offlined. This is because it relies on an online
CPU to access the MSR.

But for RAPL Interface using MMIO registers, when all the cpus within
the rapl_package are offlined,
1. the register can still be accessed
2. monitoring and setting the Power Pimits for the rapl_package is still
   meaningful because of uncore power.

This means that, a valid rapl_package doesn't rely on one or more cpus
being onlined.

For this sense, make cpu optional for rapl_package. A rapl_package can
be registered either using a CPU id to represent the physical
package/die, or using the physical package id directly.

Note that, the thermal throttling interrupt is not disabled via
MSR_IA32_PACKAGE_THERM_INTERRUPT for such rapl_package at the moment.
If it is still needed in the future, this can be achieved by selecting
an onlined CPU using the physical package id.

Note that, processor_thermal_rapl, the current MMIO RAPL Interface
driver, can also be converted to register using a package id instead.
But this is not done right now because processor_thermal_rapl driver
works on single-package systems only, and offlining the only package
will not happen. So keep the previous logic.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Tested-by: Wang Wendy <wendy.wang@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2023-05-24 18:46:20 +02:00
Zhang Rui
a38f300bb2 powercap: intel_rapl: Use bitmap for Power Limits
Currently, a RAPL package is registered with the number of Power Limits
supported in each RAPL domain. But this doesn't tell which Power Limits
are available. Using the number of Power Limits supported to guess the
availability of each Power Limit is fragile.

Use bitmap to represent the availability of each Power Limit.

Note that PL1 is mandatory thus it does not need to be set explicitly by
the RAPL Interface drivers.

No functional change intended.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Tested-by: Wang Wendy <wendy.wang@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2023-05-24 18:46:19 +02:00
Srinivas Pandruvada
b5d68f84f4 thermal: intel: powerclamp: Fix NULL pointer access issue
If cur_state for the powerclamp cooling device is set to the default
minimum state of 0, without setting first to cur_state > 0, this results
in NULL pointer access.

This NULL pointer access happens in the powercap core idle-inject
function idle_inject_set_duration() as there is no NULL check for
idle_inject_device pointer. This pointer must be allocated by calling
idle_inject_register() or idle_inject_register_full().

In the function powerclamp_set_cur_state(), idle_inject_device pointer
is allocated only when the cur_state > 0. But setting 0 without changing
to any other state, idle_inject_set_duration() will be called with a
NULL idle_inject_device pointer.

To address this, just return from powerclamp_set_cur_state() if the
current cooling device state is the same as the last one. Since the
power-up default cooling device state is 0, changing the state to 0
again here will return without calling idle_inject_set_duration().

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Fixes: 8526eb7fc7 ("thermal: intel: powerclamp: Use powercap idle-inject feature")
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=217386
Tested-by: Risto A. Paju <teknohog@iki.fi>
Cc: 6.3+ <stable@kernel.org> # 6.3+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2023-05-04 20:30:18 +02:00
Linus Torvalds
667de5c684 More thermal control updates for 6.4-rc1
- Add compatible DT bindings for imx6sll and imx6ul to fix a dtbs check
    warning (Stefan Wahren).
 
  - Update the example in the DT bindings to reflect changes with the
    ADC node name for QCom TM and TM5 (Marijn Suijten).
 
  - Fix comments for the cpuidle_cooling_register() function to match the
    function prototype (Chenggang Wang).
 
  - Fix inconsistent temperature read and some Mediatek variant board
    reboot by reverting a change and handling the temperature
    differently (AngeloGioacchino Del Regno).
 
  - Fix a memory leak in the initialization error path for the Mediatek
    driver (Kang Chen).
 
  - Use of_address_to_resource() in the Mediatek driver (Rob Herring).
 
  - Fix unit address in the QCom tsens driver DT bindings (Krzysztof
    Kozlowski).
 
  - Clean up the step-wise thermal governor (Zhang Rui).
 
  - Introduce thermal_zone_device() for accessing the device field of
    struct thermal_zone_device and two drivers use it (Daniel Lezcano).
 
  - Clean up the ACPI thermal driver a bit (Daniel Lezcano).
 
  - Delete the thermal driver for Intel Menlow platforms that is not
    expected to have any users (Rafael Wysocki).
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAmRSa9kSHHJqd0Byand5
 c29ja2kubmV0AAoJEILEb/54YlRxlv8P/j84O8Sds7Zb5jA9r3RYtZ07iqMHjjV6
 EUjS+aZ33d2koQ+X2m+ZqJZ51XmbFMEmtz0jc7zoSwOReMYQhnf1dm/EFvEIJvej
 zNT1wFEhtLtVoMMsTygKywH6sTEbGCi5i+QybN+n96qOwYqI2LaSvfqygkGT9yGC
 b4H42o4S34JcV4Ofdhzd9H7p6AQheKBpvNfAF86DShVioNQZGY0KgOw73bpt+HO0
 9LASf5VN78rS++0JxoJ4tza0VMWM/UdkYmxpj4v2lq6GKUEQlu2XFGCjs3NBEaG8
 CMe4ZEqJXVgGsEwFmEgzzUi9doqFL7vQdRb9LHa/LdHBRF8Eba1VbNLHZQY0mMTZ
 4wgjdyXmuH9dt1cITNJG+ZPXC6xNbjydKgDG++hw7fZ3oOUZnZsndy1uc0Nl56ao
 pNurhxxOZIpMs/EqP8yv+4FKEk2fOQXFEC8Ppo+clKme4DWmK5/ICuiKi0eFzZcG
 kAS3wzeDgXGJyumPUP2/qIoMcKEVtbXypqlE55ILwC1DF5XE4TnMfWxVndMW52Qr
 ZYW3JcPFZdST8afFZ0yXKSF1zyXmrwG8qKCcIzO/7m0/UkHoTujrPJ0/0sQsdv9a
 nrG0P40ygVfHRCLDRjWp7VQrj0PSHdzYx/X82xkLmHxAPShJ+LuUm4dFOZ224y2b
 UnrEvlq+rVSW
 =/bW2
 -----END PGP SIGNATURE-----

Merge tag 'thermal-6.4-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull more thermal control updates from Rafael Wysocki:
 "These are mostly cleanups on top of the previously merged thermal
  control changes plus some driver fixes and the removal of the Intel
  Menlow thermal driver.

  Specifics:

   - Add compatible DT bindings for imx6sll and imx6ul to fix a dtbs
     check warning (Stefan Wahren)

   - Update the example in the DT bindings to reflect changes with the
     ADC node name for QCom TM and TM5 (Marijn Suijten)

   - Fix comments for the cpuidle_cooling_register() function to match
     the function prototype (Chenggang Wang)

   - Fix inconsistent temperature read and some Mediatek variant board
     reboot by reverting a change and handling the temperature
     differently (AngeloGioacchino Del Regno)

   - Fix a memory leak in the initialization error path for the Mediatek
     driver (Kang Chen)

   - Use of_address_to_resource() in the Mediatek driver (Rob Herring)

   - Fix unit address in the QCom tsens driver DT bindings (Krzysztof
     Kozlowski)

   - Clean up the step-wise thermal governor (Zhang Rui)

   - Introduce thermal_zone_device() for accessing the device field of
     struct thermal_zone_device and two drivers use it (Daniel Lezcano)

   - Clean up the ACPI thermal driver a bit (Daniel Lezcano)

   - Delete the thermal driver for Intel Menlow platforms that is not
     expected to have any users (Rafael Wysocki)"

* tag 'thermal-6.4-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  thermal: intel: menlow: Get rid of this driver
  ACPI: thermal: Move to dedicated function sysfs extra attr creation
  ACPI: thermal: Use thermal_zone_device()
  thermal: intel: pch_thermal: Use thermal driver device to write a trace
  thermal: core: Encapsulate tz->device field
  thermal: gov_step_wise: Adjust code logic to match comment
  thermal: gov_step_wise: Delete obsolete comment
  dt-bindings: thermal: qcom-tsens: Correct unit address
  thermal/drivers/mediatek: Use of_address_to_resource()
  thermal/drivers/mediatek: Change clk_prepare_enable to devm_clk_get_enabled in mtk_thermal_probe
  thermal/drivers/mediatek: Use devm_of_iomap to avoid resource leak in mtk_thermal_probe
  thermal/drivers/mediatek: Add temperature constraints to validate read
  Revert "thermal/drivers/mediatek: Add delay after thermal banks initialization"
  thermal/drivers/cpuidle_cooling: Delete unmatched comments
  dt-bindings: thermal: Use generic ADC node name in examples
  dt-bindings: imx-thermal: Add imx6sll and imx6ul compatible
2023-05-03 11:46:01 -07:00
Rafael J. Wysocki
53389edd40 Merge branch 'thermal-core'
Merge additional thermal core and ACPI thermal changes for 6.4-rc1:

 - Clean up the step-wise thermal governor (Zhang Rui).

 - Introduce thermal_zone_device() for accessing the device field of
   struct thermal_zone_device and two drivers use it (Daniel Lezcano).

 - Clean up the ACPI thermal driver a bit (Daniel Lezcano).

 - Delete the thermal driver for Intel Menlow platforms that is not
   expected to have any users (Rafael Wysocki).

* thermal-core:
  thermal: intel: menlow: Get rid of this driver
  ACPI: thermal: Move to dedicated function sysfs extra attr creation
  ACPI: thermal: Use thermal_zone_device()
  thermal: intel: pch_thermal: Use thermal driver device to write a trace
  thermal: core: Encapsulate tz->device field
  thermal: gov_step_wise: Adjust code logic to match comment
  thermal: gov_step_wise: Delete obsolete comment
2023-05-03 15:44:35 +02:00
Rafael J. Wysocki
2b6a7409ac thermal: intel: menlow: Get rid of this driver
According to my information, there are no active users of this driver in
the field.

Moreover, it does some really questionable things and gets in the way of
thermal core improvements, so drop it.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2023-04-27 19:24:13 +02:00
Daniel Lezcano
ba7894be5e thermal: intel: pch_thermal: Use thermal driver device to write a trace
The pch_critical() callback accesses the thermal zone device structure
internals, it dereferences the thermal zone struct device and the 'type'.

Use the available accessors instead of accessing the structure directly.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2023-04-27 19:20:12 +02:00
Daniel Lezcano
7cefbaf081 thermal: core: Encapsulate tz->device field
There are still some drivers needing to play with the thermal zone
device internals. That is not the best but until we can figure out if
the information is really needed, let's encapsulate the field used in
the thermal zone device structure, so we can move forward relocating
the thermal zone device structure definition in the thermal framework
private headers.

Some drivers are accessing tz->device, that implies they need to have
the knowledge of the thermal_zone_device structure but we want to
self-encapsulate this structure and reduce the scope of the structure
to the thermal core only.

By adding this wrapper, these drivers won't need the thermal zone
device structure definition and are no longer an obstacle to its
relocation to the private thermal core headers.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2023-04-27 19:20:12 +02:00
Zhang Rui
e4006bfec1 thermal: gov_step_wise: Adjust code logic to match comment
For the algorithm of choosing the next target state in step_wise
governor, the code does the right thing but is implemented in a
way different from what the comment describes. And this hurts the code
readability.

As the logic in the comment is simpler, adjust the code logic to align
with the comment.

No functional change.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
[ rjw: Subject edit ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2023-04-27 19:17:11 +02:00
Zhang Rui
cead266cdb thermal: gov_step_wise: Delete obsolete comment
Commit 4102c4042a ("thermal/core: Remove DROP_FULL and RAISE_FULL")
removes support for THERMAL_TREND_RAISE_FULL/DROP_FULL but leaves the
comment unchanged.

Delete the obsolte comment about THERMAL_TREND_RAISE_FULL/DROP_FULL.

Fixes: 4102c4042a ("thermal/core: Remove DROP_FULL and RAISE_FULL")
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2023-04-27 19:17:11 +02:00
Linus Torvalds
cb6fe2ceb6 Devicetree updates for v6.4, part 2:
- First part of DT header detangling dropping cpu.h from of_device.h
   and replacing some includes with forward declarations. A handful of
   drivers needed some adjustment to their includes as a result.
 
 - Refactor of_device.h to be used by bus drivers rather than various
   device drivers. This moves non-bus related functions out of
   of_device.h. The end goal is for of_platform.h and of_device.h to stop
   including each other.
 
 - Refactor open coded parsing of "ranges" in some bus drivers to use DT
   address parsing functions
 
 - Add some new address parsing functions of_property_read_reg(),
   of_range_count(), and of_range_to_resource() in preparation to convert
   more open coded parsing of DT addresses to use them.
 
 - Treewide clean-ups to use of_property_read_bool() and
   of_property_present() as appropriate. The ones here are the ones
   that didn't get picked up elsewhere.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEktVUI4SxYhzZyEuo+vtdtY28YcMFAmRIOrkACgkQ+vtdtY28
 YcN9WA//R+QrmSPExhfgio5y+aOJDWucqnAcyAusPctLcF7h7j0CdzpwaSRkdaH4
 KiLjeyt6tKn8wt8w7m/+SmCsSYXPn81GH/Y5I2F40x6QMrY3cVOXUsulKQA+6ZjZ
 PmW3bMcz0Dw9IhUK3R/WX96+9UdoytKg5qoTzNzPTKpvKA1yHa/ogl2FnHJS5W+8
 Rxz+1oJ70VMIWGpBOc0acHuB2S0RHZ46kPKkPTBgFYEwtmJ8qobvV3r3uQapNaIP
 2jnamPu0tAaQoSaJKKSulToziT+sd1sNB+9oyu/kP+t3PXzq4qwp2Gr4jzUYKs4A
 ZF3DPhMR3YLLN41g/L3rtB0T/YIS287sZRuaLhCqldNpRerSDk4b0HRAksGk1XrI
 HqYXjWPbRxqYiIUWkInfregSTYJfGPxeLfLKrawNO34/eEV4JrkSKy8d0AJn04EK
 jTRqI3L7o23ZPxs29uH/3+KK90J3emPZkF7GWVJTEAMsM8jYZduGh7EpsttJLaz/
 QnxbTBm9295ahIdCfo/OQhqjWnaNhpbTzf31pyrBZ/itXV7gQ0xjwqPwiyFwI+o/
 F/r81xqdwQ3Ni8MKt2c7zLyVA95JHPe95KQ3GrDXR68aByJr4RuhKG8Y2Pj1VOb3
 V+Hsu5uhwKrK7Yqe+rHDnJBO00OCO8nwbWhMy2xVxoTkSFCjDmo=
 =89Zj
 -----END PGP SIGNATURE-----

Merge tag 'devicetree-for-6.4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux

Pull more devicetree updates from Rob Herring:

 - First part of DT header detangling dropping cpu.h from of_device.h
   and replacing some includes with forward declarations. A handful of
   drivers needed some adjustment to their includes as a result.

 - Refactor of_device.h to be used by bus drivers rather than various
   device drivers. This moves non-bus related functions out of
   of_device.h. The end goal is for of_platform.h and of_device.h to
   stop including each other.

 - Refactor open coded parsing of "ranges" in some bus drivers to use DT
   address parsing functions

 - Add some new address parsing functions of_property_read_reg(),
   of_range_count(), and of_range_to_resource() in preparation to
   convert more open coded parsing of DT addresses to use them.

 - Treewide clean-ups to use of_property_read_bool() and
   of_property_present() as appropriate. The ones here are the ones that
   didn't get picked up elsewhere.

* tag 'devicetree-for-6.4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (34 commits)
  bus: tegra-gmi: Replace of_platform.h with explicit includes
  hte: Use of_property_present() for testing DT property presence
  w1: w1-gpio: Use of_property_read_bool() for boolean properties
  virt: fsl: Use of_property_present() for testing DT property presence
  soc: fsl: Use of_property_present() for testing DT property presence
  sbus: display7seg: Use of_property_read_bool() for boolean properties
  sparc: Use of_property_read_bool() for boolean properties
  sparc: Use of_property_present() for testing DT property presence
  bus: mvebu-mbus: Remove open coded "ranges" parsing
  of/address: Add of_property_read_reg() helper
  of/address: Add of_range_count() helper
  of/address: Add support for 3 address cell bus
  of/address: Add of_range_to_resource() helper
  of: unittest: Add bus address range parsing tests
  of: Drop cpu.h include from of_device.h
  OPP: Adjust includes to remove of_device.h
  irqchip: loongson-eiointc: Add explicit include for cpuhotplug.h
  cpuidle: Adjust includes to remove of_device.h
  cpufreq: sun50i: Add explicit include for cpu.h
  cpufreq: Adjust includes to remove of_device.h
  ...
2023-04-27 10:09:05 -07:00
Rob Herring
f0fb67c271 thermal/drivers/mediatek: Use of_address_to_resource()
Replace of_get_address() and of_translate_address() calls with single
call to of_address_to_resource().

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20230319163231.226738-1-robh@kernel.org
2023-04-26 10:38:34 +02:00