linux-stable/drivers/thermal
Daniel Lezcano 755113d767 thermal/debugfs: Add thermal cooling device debugfs information
The thermal framework does not have any debug information except a
sysfs stat which is a bit controversial. This one allocates big chunks
of memory for every cooling devices with a high number of states and
could represent on some systems in production several megabytes of
memory for just a portion of it. As the sysfs is limited to a page
size, the output is not exploitable with large data array and gets
truncated.

The patch provides the same information than sysfs except the
transitions are dynamically allocated, thus they won't show more
events than the ones which actually occurred. There is no longer a
size limitation and it opens the field for more debugging information
where the debugfs is designed for, not sysfs.

The thermal debugfs directory structure tries to stay consistent with
the sysfs one but in a very simplified way:

thermal/
 -- cooling_devices
    |-- 0
    |   |-- clear
    |   |-- time_in_state_ms
    |   |-- total_trans
    |   `-- trans_table
    |-- 1
    |   |-- clear
    |   |-- time_in_state_ms
    |   |-- total_trans
    |   `-- trans_table
    |-- 2
    |   |-- clear
    |   |-- time_in_state_ms
    |   |-- total_trans
    |   `-- trans_table
    |-- 3
    |   |-- clear
    |   |-- time_in_state_ms
    |   |-- total_trans
    |   `-- trans_table
    `-- 4
        |-- clear
        |-- time_in_state_ms
        |-- total_trans
        `-- trans_table

The content of the files in the cooling devices directory is the same
as the sysfs one except for the trans_table which has the following
format:

Transition	Hits
1->0      	246
0->1      	246
2->1      	632
1->2      	632
3->2      	98
2->3      	98

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
[ rjw: White space fixups, rebase ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2024-01-12 15:34:56 +01:00
..
broadcom thermal: ns: Convert to platform remove callback returning void 2023-09-29 12:34:16 +02:00
intel thermal: trip: Send trip change notifications on all trip updates 2023-12-13 12:37:01 +01:00
mediatek thermal/drivers/mediatek/lvts_thermal: Update calibration data documentation 2023-10-19 02:43:32 +02:00
qcom Thermal control updates for 6.7-rc1 2023-10-31 15:28:37 -10:00
samsung thermal/drivers/exynos: Use set_trips ops 2024-01-02 09:33:19 +01:00
st thermal: stm: Convert to platform remove callback returning void 2023-10-02 14:24:09 +02:00
tegra thermal: tegra-bpmp: Convert to platform remove callback returning void 2023-10-02 14:24:13 +02:00
ti-soc-thermal thermal: ti-bandgap: Convert to platform remove callback returning void 2023-10-02 14:24:15 +02:00
amlogic_thermal.c thermal: amlogic: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions 2024-01-02 09:33:18 +01:00
armada_thermal.c thermal: armada: Convert to platform remove callback returning void 2023-09-29 12:34:16 +02:00
cpufreq_cooling.c - Add more thermal zone device encapsulation: prevent setting 2023-04-03 20:43:32 +02:00
cpuidle_cooling.c thermal: cpuidle_cooling: fix kernel-doc warning and a spello 2023-12-21 12:05:48 +01:00
da9062-thermal.c thermal: da9062: Convert to platform remove callback returning void 2023-09-29 12:34:16 +02:00
db8500_thermal.c thermal/drivers/db8500: Remove redundant of_match_ptr() 2023-08-16 12:09:19 +02:00
devfreq_cooling.c thermal/core: Relocate the traces definition in thermal directory 2023-04-01 20:51:45 +02:00
dove_thermal.c thermal: dove: Convert to platform remove callback returning void 2023-09-29 12:34:16 +02:00
gov_bang_bang.c thermal: core: Pass trip pointer to governor throttle callback 2023-10-20 19:26:37 +02:00
gov_fair_share.c thermal: core: Pass trip pointer to governor throttle callback 2023-10-20 19:26:37 +02:00
gov_power_allocator.c thermal: gov_power_allocator: Support new update callback of weights 2023-12-29 18:01:01 +01:00
gov_step_wise.c thermal: core: Pass trip pointer to governor throttle callback 2023-10-20 19:26:37 +02:00
gov_user_space.c thermal: core: Pass trip pointer to governor throttle callback 2023-10-20 19:26:37 +02:00
hisi_thermal.c thermal: hisi: Convert to platform remove callback returning void 2023-09-29 12:34:16 +02:00
imx8mm_thermal.c thermal/drivers/imx8mm_thermal: Fix function pointer declaration by adding identifier name 2023-10-15 23:40:09 +02:00
imx_sc_thermal.c thermal: Explicitly include correct DT includes 2023-07-31 20:03:42 +02:00
imx_thermal.c thermal: imx: Convert to platform remove callback returning void 2023-09-29 12:34:16 +02:00
k3_bandgap.c thermal: k3_bandgap: Convert to platform remove callback returning void 2023-09-29 12:34:17 +02:00
k3_j72xx_bandgap.c thermal: k3_j72xx_bandgap: Convert to platform remove callback returning void 2023-09-29 12:34:17 +02:00
Kconfig thermal/debugfs: Add thermal cooling device debugfs information 2024-01-12 15:34:56 +01:00
khadas_mcu_fan.c
kirkwood_thermal.c thermal: kirkwood: Convert to platform remove callback returning void 2023-09-29 12:34:17 +02:00
loongson2_thermal.c drivers/thermal/loongson2_thermal: Fix incorrect PTR_ERR() judgment 2024-01-02 09:33:18 +01:00
Makefile thermal/debugfs: Add thermal cooling device debugfs information 2024-01-12 15:34:56 +01:00
max77620_thermal.c thermal/drivers/max77620: Remove duplicate error message 2023-10-15 23:40:10 +02:00
qoriq_thermal.c thermal/drivers/qoriq: Remove redundant msg in qoriq_tmu_register_tmu_zone() 2023-06-26 12:03:14 +02:00
rcar_gen3_thermal.c thermal: rcar_gen3: Convert to platform remove callback returning void 2023-09-29 12:34:17 +02:00
rcar_thermal.c thermal: rcar: Convert to platform remove callback returning void 2023-09-29 12:34:17 +02:00
rockchip_thermal.c thermal: rockchip: Convert to platform remove callback returning void 2023-10-02 14:23:30 +02:00
rzg2l_thermal.c thermal: rzg2l: Convert to platform remove callback returning void 2023-10-02 14:23:51 +02:00
spear_thermal.c thermal: spear: Convert to platform remove callback returning void 2023-10-02 14:24:06 +02:00
sprd_thermal.c thermal: sprd: Convert to platform remove callback returning void 2023-10-02 14:24:08 +02:00
sun8i_thermal.c thermal/drivers/sun8i: Add D1/T113s THS controller support 2024-01-02 09:33:18 +01:00
thermal-generic-adc.c thermal/drivers/generic-adc: Removed unneeded call to platform_set_drvdata() 2023-08-16 12:36:21 +02:00
thermal_acpi.c thermal: ACPI: Include the right header file 2023-10-20 19:26:37 +02:00
thermal_core.c thermal/debugfs: Add thermal cooling device debugfs information 2024-01-12 15:34:56 +01:00
thermal_core.h thermal/debugfs: Add thermal cooling device debugfs information 2024-01-12 15:34:56 +01:00
thermal_debugfs.c thermal/debugfs: Add thermal cooling device debugfs information 2024-01-12 15:34:56 +01:00
thermal_debugfs.h thermal/debugfs: Add thermal cooling device debugfs information 2024-01-12 15:34:56 +01:00
thermal_helpers.c thermal/debugfs: Add thermal cooling device debugfs information 2024-01-12 15:34:56 +01:00
thermal_hwmon.c thermal: Drop redundant and confusing device_is_registered() checks 2023-12-12 13:00:28 +01:00
thermal_hwmon.h thermal/hwmon: Use the right device for devm_thermal_add_hwmon_sysfs() 2023-03-03 20:45:02 +01:00
thermal_mmio.c thermal/core: Use the thermal zone 'devdata' accessor in thermal located drivers 2023-03-03 20:45:02 +01:00
thermal_netlink.c thermal: netlink: Pass thermal zone pointer to notify routines 2024-01-09 13:32:23 +01:00
thermal_netlink.h thermal: netlink: Pass thermal zone pointer to notify routines 2024-01-09 13:32:23 +01:00
thermal_of.c thermal/thermal_of: Allow rebooting after critical temp 2024-01-02 09:33:18 +01:00
thermal_sysfs.c thermal/sysfs: Update governors when the 'weight' has changed 2023-12-29 18:01:01 +01:00
thermal_trace.h thermal/core: Relocate the traces definition in thermal directory 2023-04-01 20:51:45 +02:00
thermal_trace_ipa.h thermal: gov_power_allocator: Change trace functions 2023-12-29 18:01:00 +01:00
thermal_trip.c thermal: netlink: Pass pointers to thermal_notify_tz_trip_change() 2024-01-09 13:30:55 +01:00
uniphier_thermal.c thermal: uniphier: Convert to platform remove callback returning void 2023-10-02 14:24:17 +02:00