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 ...
|
a4c1ab2f | 02-Apr-2024 |
Nicolas Pitre <npitre@baylibre.com> |
thermal/drivers/mediatek/lvts_thermal: Add MT8186 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 MT8186 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-9-nico@fluxnic.net
show more ...
|
2cc0b1a2 | 02-Apr-2024 |
Nicolas Pitre <npitre@baylibre.com> |
thermal/drivers/mediatek/lvts_thermal: Guard against efuse data buffer overflow
We don't want to silently fetch garbage past the actual buffer.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com> Si
thermal/drivers/mediatek/lvts_thermal: Guard against efuse data buffer overflow
We don't want to silently fetch garbage past the actual buffer.
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-6-nico@fluxnic.net
show more ...
|
5b3367e2 | 02-Apr-2024 |
Nicolas Pitre <npitre@baylibre.com> |
thermal/drivers/mediatek/lvts_thermal: Use offsets for every calibration byte
Current code assumes calibration values are always stored contiguously in host endian order. A future patch will prove t
thermal/drivers/mediatek/lvts_thermal: Use offsets for every calibration byte
Current code assumes calibration values are always stored contiguously in host endian order. A future patch will prove this wrong.
Let's specify the offset for each calibration byte instead.
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-5-nico@fluxnic.net
show more ...
|
554bca31 | 02-Apr-2024 |
Nicolas Pitre <nico@fluxnic.net> |
thermal/drivers/mediatek/lvts_thermal: Remove .hw_tshut_temp
All the .hw_tshut_temp instances are initialized with the same value. Let's remove those and use a common definition instead. If ever a d
thermal/drivers/mediatek/lvts_thermal: Remove .hw_tshut_temp
All the .hw_tshut_temp instances are initialized with the same value. Let's remove those and use a common definition instead. If ever a different value must be used in the future then an override parameter could be added back.
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-4-nico@fluxnic.net
show more ...
|
62194e63 | 02-Apr-2024 |
Nicolas Pitre <npitre@baylibre.com> |
thermal/drivers/mediatek/lvts_thermal: Move comment
Move efuse data interpretation inside lvts_golden_temp_init() alongside the actual code retrieving wanted value.
Signed-off-by: Nicolas Pitre <np
thermal/drivers/mediatek/lvts_thermal: Move comment
Move efuse data interpretation inside lvts_golden_temp_init() alongside the actual code retrieving wanted value.
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-3-nico@fluxnic.net
show more ...
|
371ed626 | 07-Sep-2023 |
Frank Wunderlich <frank-w@public-files.de> |
thermal/drivers/mediatek: Fix control buffer enablement on MT7896
Reading thermal sensor on mt7986 devices returns invalid temperature:
bpi-r3 ~ # cat /sys/class/thermal/thermal_zone0/temp -274000
thermal/drivers/mediatek: Fix control buffer enablement on MT7896
Reading thermal sensor on mt7986 devices returns invalid temperature:
bpi-r3 ~ # cat /sys/class/thermal/thermal_zone0/temp -274000
Fix this by adding missing members in mtk_thermal_data struct which were used in mtk_thermal_turn_on_buffer after commit 33140e668b10.
Cc: stable@vger.kernel.org Fixes: 33140e668b10 ("thermal/drivers/mediatek: Control buffer enablement tweaks") Signed-off-by: Frank Wunderlich <frank-w@public-files.de> Reviewed-by: Markus Schneider-Pargmann <msp@baylibre.com> Reviewed-by: Daniel Golle <daniel@makrotopia.org> Tested-by: Daniel Golle <daniel@makrotopia.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/20230907112018.52811-1-linux@fw-web.de
show more ...
|
5437d14d | 17-Oct-2023 |
Balsam CHIHI <bchihi@baylibre.com> |
thermal/drivers/mediatek/lvts_thermal: Update calibration data documentation
Update LVTS calibration data documentation for mt8192 and mt8195.
Signed-off-by: Balsam CHIHI <bchihi@baylibre.com> Revi
thermal/drivers/mediatek/lvts_thermal: Update calibration data documentation
Update LVTS calibration data documentation for mt8192 and mt8195.
Signed-off-by: Balsam CHIHI <bchihi@baylibre.com> Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> [bero@baylibre.com: Fix issues pointed out by Nícolas F. R. A. Prado <nfraprado@collabora.com>] Signed-off-by: Bernhard Rosenkränzer <bero@baylibre.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20231017190545.157282-6-bero@baylibre.com
show more ...
|
28873224 | 17-Oct-2023 |
Balsam CHIHI <bchihi@baylibre.com> |
thermal/drivers/mediatek/lvts_thermal: Add mt8192 support
Add LVTS Driver support for MT8192.
Co-developed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Signed-off-by: Nícolas F. R. A. Prado
thermal/drivers/mediatek/lvts_thermal: Add mt8192 support
Add LVTS Driver support for MT8192.
Co-developed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Signed-off-by: Balsam CHIHI <bchihi@baylibre.com> Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> [bero@baylibre.com: cosmetic changes, rebase] Signed-off-by: Bernhard Rosenkränzer <bero@baylibre.com> Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com> Reviewed-by: Alexandre Mergnat <amergnat@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/20231017190545.157282-4-bero@baylibre.com
show more ...
|
8137bb90 | 17-Oct-2023 |
Balsam CHIHI <bchihi@baylibre.com> |
thermal/drivers/mediatek/lvts_thermal: Add suspend and resume
Add suspend and resume support to LVTS driver.
Signed-off-by: Balsam CHIHI <bchihi@baylibre.com> [bero@baylibre.com: suspend/resume in
thermal/drivers/mediatek/lvts_thermal: Add suspend and resume
Add suspend and resume support to LVTS driver.
Signed-off-by: Balsam CHIHI <bchihi@baylibre.com> [bero@baylibre.com: suspend/resume in noirq phase] Co-developed-by: Bernhard Rosenkränzer <bero@baylibre.com> Signed-off-by: Bernhard Rosenkränzer <bero@baylibre.com> Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com> Reviewed-by: Alexandre Mergnat <amergnat@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/20231017190545.157282-3-bero@baylibre.com
show more ...
|