Re:[PATCH 1/2] leds: tps6131x: queue torch refresh work on freezable workqueue

From: jiale yao

Date: Sat Oct 17 2026 - 03:18:08 EST


At 2026-10-16 18:04:34, "Jiale Yao" <yaojiale02@xxxxxxx> wrote:
>The torch watchdog refresh work performs I2C register writes and
>reschedules itself every ten seconds while the torch is enabled. Since
>schedule_delayed_work() uses the non-freezable system workqueue, the
>callback can run after the I2C adapter has been suspended.
>
>Queue the refresh on system_freezable_wq so it is frozen before devices
>are suspended and resumed only after they become available again.
>

Fixes: b338a2ae9b31 ("leds: tps6131x: Add support for Texas Instruments TPS6131X flash LED driver")

>Signed-off-by: Jiale Yao <yaojiale02@xxxxxxx>
>---
> drivers/leds/flash/leds-tps6131x.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
>diff --git a/drivers/leds/flash/leds-tps6131x.c b/drivers/leds/flash/leds-tps6131x.c
>index 5c9a5af5af05..841a6538e75e 100644
>--- a/drivers/leds/flash/leds-tps6131x.c
>+++ b/drivers/leds/flash/leds-tps6131x.c
>@@ -11,6 +11,7 @@
> #include <linux/leds.h>
> #include <linux/module.h>
> #include <linux/regmap.h>
>+#include <linux/workqueue.h>
> #include <media/v4l2-flash-led-class.h>
>
> #define TPS6131X_REG_0 0x00
>@@ -307,8 +308,9 @@ static void tps6131x_torch_refresh_handler(struct work_struct *work)
> return;
> }
>
>- schedule_delayed_work(&tps6131x->torch_refresh_work,
>- TPS6131X_TORCH_REFRESH_INTERVAL_JIFFIES);
>+ queue_delayed_work(system_freezable_wq,
>+ &tps6131x->torch_refresh_work,
>+ TPS6131X_TORCH_REFRESH_INTERVAL_JIFFIES);
> }
>
> static int tps6131x_brightness_set(struct led_classdev *cdev, enum led_brightness brightness)
>@@ -367,8 +369,9 @@ static int tps6131x_brightness_set(struct led_classdev *cdev, enum led_brightnes
> * To prevent this, the mode must be refreshed within the watchdog timeout.
> */
> if (brightness)
>- schedule_delayed_work(&tps6131x->torch_refresh_work,
>- TPS6131X_TORCH_REFRESH_INTERVAL_JIFFIES);
>+ queue_delayed_work(system_freezable_wq,
>+ &tps6131x->torch_refresh_work,
>+ TPS6131X_TORCH_REFRESH_INTERVAL_JIFFIES);
>
> return 0;
> }
>--
>2.34.1