Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] thermal/drivers/mediatek/lvts_thermal: CALSCALE, overflow, locking, and IRQ NULL fixes
@ 2026-11-26  0:53 Ilia Snezhkov via B4 Relay
  2026-11-26  0:53 ` [PATCH 1/4] thermal/drivers/mediatek/lvts_thermal: write LVTS_CALSCALE in lvts_ctrl_configure() Ilia Snezhkov via B4 Relay
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Ilia Snezhkov via B4 Relay @ 2026-11-26  0:53 UTC (permalink / raw)
  To: daniel.lezcano, rafael, rui.zhang, lukasz.luba
  Cc: matthias.bgg, angelogioacchino.delregno, linux-pm, linux-mediatek,
	linux-arm-kernel, linux-kernel

This four-patch series fixes four bugs in
drivers/thermal/mediatek/lvts_thermal.c:

1. Write LVTS_CALSCALE_CONF (0x300) to the LVTS_CALSCALE register instead
   of overwriting a local variable and discarding it.
2. Avoid 32-bit overflow and unsigned truncation in
   lvts_temp_to_raw_mt7988(), and skip converting high == INT_MAX in
   lvts_set_trips() while masking high-offset IRQ.
3. Serialize lvts_set_trips() with a per-controller spinlock_t in
   struct lvts_ctrl so concurrent updates across thermal zones on the
   same controller cannot corrupt shared thresholds or LVTS_MONINT via
   unsynchronized RMW.
4. Check lvts_ctrl->sensors[i].tz before calling
   thermal_zone_device_update() in lvts_ctrl_irq_handler() for disabled
   or DT-absent sensor slots.

Found and drafted with an AI coding assistant while bringing up MT6789.

Ilia Snezhkov (4):
  thermal/drivers/mediatek/lvts_thermal: write LVTS_CALSCALE in
    lvts_ctrl_configure()
  thermal/drivers/mediatek/lvts_thermal: avoid 32-bit overflow in
    lvts_temp_to_raw_mt7988() and INT_MAX trips
  thermal/drivers/mediatek/lvts_thermal: serialize lvts_set_trips() per
    controller
  thermal/drivers/mediatek/lvts_thermal: skip sensors without a thermal
    zone in IRQ

 drivers/thermal/mediatek/lvts_thermal.c | 30 ++++++++++++++++---------
 1 file changed, 20 insertions(+), 10 deletions(-)

-- 
2.54.0 (Apple Git-157)





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-26  0:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26  0:53 [PATCH 0/4] thermal/drivers/mediatek/lvts_thermal: CALSCALE, overflow, locking, and IRQ NULL fixes Ilia Snezhkov via B4 Relay
2026-11-26  0:53 ` [PATCH 1/4] thermal/drivers/mediatek/lvts_thermal: write LVTS_CALSCALE in lvts_ctrl_configure() Ilia Snezhkov via B4 Relay
2026-11-26  0:53 ` [PATCH 2/4] thermal/drivers/mediatek/lvts_thermal: avoid 32-bit overflow in lvts_temp_to_raw_mt7988() and INT_MAX trips Ilia Snezhkov via B4 Relay
2026-11-26  0:53 ` [PATCH 3/4] thermal/drivers/mediatek/lvts_thermal: serialize lvts_set_trips() per controller Ilia Snezhkov via B4 Relay
2026-11-26  0:53 ` [PATCH 4/4] thermal/drivers/mediatek/lvts_thermal: skip sensors without a thermal zone in IRQ Ilia Snezhkov via B4 Relay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox