From: Jiale Yao <yaojiale02@163.com>
To: Matthias Fend <matthias.fend@emfend.at>,
Lee Jones <lee@kernel.org>, Pavel Machek <pavel@kernel.org>,
linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Jiale Yao <yaojiale02@163.com>
Subject: [PATCH 1/2] leds: tps6131x: queue torch refresh work on freezable workqueue
Date: Fri, 16 Oct 2026 18:04:34 +0800 [thread overview]
Message-ID: <20261016100435.2581303-2-yaojiale02@163.com> (raw)
In-Reply-To: <20261016100435.2581303-1-yaojiale02@163.com>
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.
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
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
next prev parent reply other threads:[~2026-10-16 10:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 10:04 [PATCH 0/2] leds: freeze delayed hardware access during suspend Jiale Yao
2026-10-16 10:04 ` Jiale Yao [this message]
2026-10-17 7:16 ` Re:[PATCH 1/2] leds: tps6131x: queue torch refresh work on freezable workqueue jiale yao
2026-10-16 10:04 ` [PATCH 2/2] leds: cr0014114: queue recount " Jiale Yao
2026-10-17 7:18 ` jiale yao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261016100435.2581303-2-yaojiale02@163.com \
--to=yaojiale02@163.com \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=matthias.fend@emfend.at \
--cc=pavel@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®