| 685a7550 | 26-May-2025 |
Mason Chang <mason-cw.chang@mediatek.com> |
thermal/drivers/mediatek/lvts_thermal: Add mt7988 lvts commands
These commands are necessary to avoid severely abnormal and inaccurate temperature readings that are caused by using the default comma
thermal/drivers/mediatek/lvts_thermal: Add mt7988 lvts commands
These commands are necessary to avoid severely abnormal and inaccurate temperature readings that are caused by using the default commands.
Signed-off-by: Mason Chang <mason-cw.chang@mediatek.com> Link: https://lore.kernel.org/r/20250526102659.30225-4-mason-cw.chang@mediatek.com Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
show more ...
|
| 6203a5e6 | 26-May-2025 |
Mason Chang <mason-cw.chang@mediatek.com> |
thermal/drivers/mediatek/lvts_thermal: Add lvts commands and their sizes to driver data
Add LVTS commands and their sizes to driver data in preparation for adding different commands.
Signed-off-by:
thermal/drivers/mediatek/lvts_thermal: Add lvts commands and their sizes to driver data
Add LVTS commands and their sizes to driver data in preparation for adding different commands.
Signed-off-by: Mason Chang <mason-cw.chang@mediatek.com> Link: https://lore.kernel.org/r/20250526102659.30225-3-mason-cw.chang@mediatek.com Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
show more ...
|
| 3159c96a | 05-May-2025 |
Arnd Bergmann <arnd@arndb.de> |
thermal/drivers/mediatek/lvts: Remove unused lvts_debugfs_exit
When debugfs is disabled, the function has no reference any more:
drivers/thermal/mediatek/lvts_thermal.c:266:13: error: 'lvts_debugfs
thermal/drivers/mediatek/lvts: Remove unused lvts_debugfs_exit
When debugfs is disabled, the function has no reference any more:
drivers/thermal/mediatek/lvts_thermal.c:266:13: error: 'lvts_debugfs_exit' defined but not used [-Werror=unused-function] 266 | static void lvts_debugfs_exit(struct lvts_domain *lvts_td) { } | ^~~~~~~~~~~~~~~~~
Fixes: ef280c17a840 ("thermal/drivers/mediatek/lvts: Fix debugfs unregister on failure") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20250505052502.1812867-1-arnd@kernel.org Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
show more ...
|
| 1ec52c15 | 13-Jan-2025 |
Nícolas F. R. A. Prado <nfraprado@collabora.com> |
thermal/drivers/mediatek/lvts: Only update IRQ enable for valid sensors
Only sensors that are valid need to have their interrupts enable status updated based on their thresholds. Use the lvts_for_ea
thermal/drivers/mediatek/lvts: Only update IRQ enable for valid sensors
Only sensors that are valid need to have their interrupts enable status updated based on their thresholds. Use the lvts_for_each_valid_sensor() helper in lvts_update_irq_mask() to ignore invalid sensors.
Currently, since the invalid sensors will always contain zeroed out thresholds (from kzalloc), they will always get their interrupts disabled on this loop. So this commit doesn't change the resulting interrupts configuration, but it slightly optimizes the loop by skipping the invalid sensors, avoids potential future surprises if at some point memory is no longer allocated for invalid sensors, as well as makes the code more obvious.
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Link: https://lore.kernel.org/r/20250113-mt8192-lvts-filtered-suspend-fix-v2-5-07a25200c7c6@collabora.com Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
show more ...
|
| 2738fb3e | 13-Jan-2025 |
Nícolas F. R. A. Prado <nfraprado@collabora.com> |
thermal/drivers/mediatek/lvts: Start sensor interrupts disabled
Interrupts are enabled per sensor in lvts_update_irq_mask() as needed, there's no point in enabling all of them during initialization.
thermal/drivers/mediatek/lvts: Start sensor interrupts disabled
Interrupts are enabled per sensor in lvts_update_irq_mask() as needed, there's no point in enabling all of them during initialization. Change the MONINT register initial value so all sensor interrupts start disabled.
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Link: https://lore.kernel.org/r/20250113-mt8192-lvts-filtered-suspend-fix-v2-4-07a25200c7c6@collabora.com Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
show more ...
|
| fa17ff8e | 13-Jan-2025 |
Nícolas F. R. A. Prado <nfraprado@collabora.com> |
thermal/drivers/mediatek/lvts: Disable low offset IRQ for minimum threshold
In order to get working interrupts, a low offset value needs to be configured. The minimum value for it is 20 Celsius, whi
thermal/drivers/mediatek/lvts: Disable low offset IRQ for minimum threshold
In order to get working interrupts, a low offset value needs to be configured. The minimum value for it is 20 Celsius, which is what is configured when there's no lower thermal trip (ie the thermal core passes -INT_MAX as low trip temperature). However, when the temperature gets that low and fluctuates around that value it causes an interrupt storm.
Prevent that interrupt storm by not enabling the low offset interrupt if the low threshold is the minimum one.
Cc: stable@vger.kernel.org Fixes: 77354eaef821 ("thermal/drivers/mediatek/lvts_thermal: Don't leave threshold zeroed") Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Link: https://lore.kernel.org/r/20250113-mt8192-lvts-filtered-suspend-fix-v2-3-07a25200c7c6@collabora.com Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
show more ...
|
| c612cbcd | 13-Jan-2025 |
Nícolas F. R. A. Prado <nfraprado@collabora.com> |
thermal/drivers/mediatek/lvts: Disable Stage 3 thermal threshold
The Stage 3 thermal threshold is currently configured during the controller initialization to 105 Celsius. From the kernel perspectiv
thermal/drivers/mediatek/lvts: Disable Stage 3 thermal threshold
The Stage 3 thermal threshold is currently configured during the controller initialization to 105 Celsius. From the kernel perspective, this configuration is harmful because: * The stage 3 interrupt that gets triggered when the threshold is crossed is not handled in any way by the IRQ handler, it just gets cleared. Besides, the temperature used for stage 3 comes from the sensors, and the critical thermal trip points described in the Devicetree will already cause a shutdown when crossed (at a lower temperature, of 100 Celsius, for all SoCs currently using this driver). * The only effect of crossing the stage 3 threshold that has been observed is that it causes the machine to no longer be able to enter suspend. Even if that was a result of a momentary glitch in the temperature reading of a sensor (as has been observed on the MT8192-based Chromebooks).
For those reasons, disable the Stage 3 thermal threshold configuration.
Cc: stable@vger.kernel.org Reported-by: Hsin-Te Yuan <yuanhsinte@chromium.org> Closes: https://lore.kernel.org/all/20241108-lvts-v1-1-eee339c6ca20@chromium.org/ Fixes: f5f633b18234 ("thermal/drivers/mediatek: Add the Low Voltage Thermal Sensor driver") Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Link: https://lore.kernel.org/r/20250113-mt8192-lvts-filtered-suspend-fix-v2-2-07a25200c7c6@collabora.com Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
show more ...
|
| a5d4afb9 | 20-Jun-2024 |
Chen-Yu Tsai <wenst@chromium.org> |
thermal/drivers/mediatek/lvts_thermal: Provide default calibration data
On some pre-production hardware, the SoCs do not contain calibration data for the thermal sensors. The downstream drivers prov
thermal/drivers/mediatek/lvts_thermal: Provide default calibration data
On some pre-production hardware, the SoCs do not contain calibration data for the thermal sensors. The downstream drivers provide default values that sort of work, instead of having the thermal sensors not work at all.
Port the default values to the upstream driver. These values are from the ChromeOS kernels, which sadly do not cover the MT7988.
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20240620092306.2352606-1-wenst@chromium.org Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
show more ...
|
| be3e224e | 03-Jun-2024 |
Julien Panis <jpanis@baylibre.com> |
dt-bindings: thermal: mediatek: Fix thermal zone definitions for MT8188
Fix thermal zone names for consistency with the other SoCs: - GPU0 must be used as the first GPU item. - SOCx deal with audio
dt-bindings: thermal: mediatek: Fix thermal zone definitions for MT8188
Fix thermal zone names for consistency with the other SoCs: - GPU0 must be used as the first GPU item. - SOCx deal with audio DSP, video, and infra subsystems.
The naming must be fixed "atomically" so compilation does not break. As a result, the change is made in the dt-bindings and in the LVTS driver within a single commit, despite the checkpatch warning.
The definitions can be safely modified here because they are used only in the LVTS driver, which is modified accordingly, and have not yet been included in a released kernel.
Fixes: 78c88534e5e1 ("dt-bindings: thermal: mediatek: Add LVTS thermal controller definition for MT8188") Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Acked-by: Conor Dooley <conor.dooley@microchip.com> Signed-off-by: Julien Panis <jpanis@baylibre.com> Link: https://lore.kernel.org/r/20240603-mtk-thermal-mt818x-dtsi-v7-2-8c8e3c7a3643@baylibre.com Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
show more ...
|
| 72cacd06 | 04-Jun-2024 |
Julien Panis <jpanis@baylibre.com> |
thermal/drivers/mediatek/lvts_thermal: Return error in case of invalid efuse data
This patch prevents from registering thermal entries and letting the driver misbehave if efuse data is invalid. A de
thermal/drivers/mediatek/lvts_thermal: Return error in case of invalid efuse data
This patch prevents from registering thermal entries and letting the driver misbehave if efuse data is invalid. A device is not properly calibrated if the golden temperature is zero.
Fixes: f5f633b18234 ("thermal/drivers/mediatek: Add the Low Voltage Thermal Sensor driver") Signed-off-by: Julien Panis <jpanis@baylibre.com> Reviewed-by: Nicolas Pitre <npitre@baylibre.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20240604-mtk-thermal-calib-check-v2-1-8f258254051d@baylibre.com Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
show more ...
|
| b66c079a | 03-May-2024 |
Julien Panis <jpanis@baylibre.com> |
thermal/drivers/mediatek/lvts_thermal: Fix wrong lvts_ctrl index
In 'lvts_should_update_thresh()' and 'lvts_ctrl_start()' functions, the parameter passed to 'lvts_for_each_valid_sensor()' macro is a
thermal/drivers/mediatek/lvts_thermal: Fix wrong lvts_ctrl index
In 'lvts_should_update_thresh()' and 'lvts_ctrl_start()' functions, the parameter passed to 'lvts_for_each_valid_sensor()' macro is always 'lvts_ctrl->lvts_data->lvts_ctrl'. In other words, the array index 0 is systematically passed as 'struct lvts_ctrl_data' type item, even when another item should be consumed instead.
Hence, the 'valid_sensor_mask' value which is selected can be wrong because unrelated to the 'struct lvts_ctrl_data' type item that should be used. Hence, some thermal zone can be registered for a sensor 'i' that does not actually exist. Because of the invalid address used as 'lvts_sensor[i].msr', this situation ends up with a crash in 'lvts_get_temp()' function, where this 'msr' pointer is passed to 'readl_poll_timeout()' function. The following message is output: "Unable to handle kernel NULL pointer dereference at virtual address <msr>", with <msr> = 0.
This patch fixes the issue.
Fixes: 11e6f4c31447 ("thermal/drivers/mediatek/lvts_thermal: Allow early empty sensor slots") Signed-off-by: Julien Panis <jpanis@baylibre.com> Reviewed-by: Nicolas Pitre <npitre@baylibre.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/20240503-mtk-thermal-lvts-ctrl-idx-fix-v1-2-f605c50ca117@baylibre.com
show more ...
|
| e2d2266a | 03-May-2024 |
Julien Panis <jpanis@baylibre.com> |
thermal/drivers/mediatek/lvts_thermal: Remove unused members from struct lvts_ctrl_data
In struct lvts_ctrl_data, num_lvts_sensor and cal_offset[] are not used.
Signed-off-by: Julien Panis <jpanis@
thermal/drivers/mediatek/lvts_thermal: Remove unused members from struct lvts_ctrl_data
In struct lvts_ctrl_data, num_lvts_sensor and cal_offset[] are not used.
Signed-off-by: Julien Panis <jpanis@baylibre.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Nicolas Pitre <npitre@baylibre.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20240503-mtk-thermal-lvts-ctrl-idx-fix-v1-1-f605c50ca117@baylibre.com
show more ...
|
| a1191a77 | 02-May-2024 |
Julien Panis <jpanis@baylibre.com> |
thermal/drivers/mediatek/lvts_thermal: Check NULL ptr on lvts_data
Verify that lvts_data is not NULL before using it.
Signed-off-by: Julien Panis <jpanis@baylibre.com> Signed-off-by: Daniel Lezcano
thermal/drivers/mediatek/lvts_thermal: Check NULL ptr on lvts_data
Verify that lvts_data is not NULL before using it.
Signed-off-by: Julien Panis <jpanis@baylibre.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20240502-mtk-thermal-lvts-data-v1-1-65f1b0bfad37@baylibre.com
show more ...
|
| f4745f54 | 02-Apr-2024 |
Nicolas Pitre <npitre@baylibre.com> |
thermal/drivers/mediatek/lvts_thermal: Add MT8188 support
Various values extracted from the vendor's kernel driver.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com> Signed-off-by: Daniel Lezcano
thermal/drivers/mediatek/lvts_thermal: Add MT8188 support
Various values extracted from the vendor's kernel driver.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20240402032729.2736685-15-nico@fluxnic.net
show more ...
|
| 11e6f4c3 | 02-Apr-2024 |
Nicolas Pitre <npitre@baylibre.com> |
thermal/drivers/mediatek/lvts_thermal: Allow early empty sensor slots
Some systems don't always populate sensor controller slots starting at slot 0. Use a bitmap instead of a count to indicate valid
thermal/drivers/mediatek/lvts_thermal: Allow early empty sensor slots
Some systems don't always populate sensor controller slots starting at slot 0. Use a bitmap instead of a count to indicate valid sensor slots. Also create a pretty iterator for that.
About that iterator: it causes checkpatch to complain with "ERROR: Macros with multiple statements should be enclosed in a do - while loop". However this is not possible here. And many similar iterators do exist using the same form in the tree already.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20240402032729.2736685-12-nico@fluxnic.net
show more ...
|
| 684cbb49 | 02-Apr-2024 |
Nicolas Pitre <npitre@baylibre.com> |
thermal/drivers/mediatek/lvts_thermal: Provision for gt variable location
The golden temperature calibration value in nvram is not always the 3rd byte. A future commit will prove this assumption wro
thermal/drivers/mediatek/lvts_thermal: Provision for gt variable location
The golden temperature calibration value in nvram is not always the 3rd byte. A future commit will prove this assumption wrong.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20240402032729.2736685-11-nico@fluxnic.net
show more ...
|