* [PATCH 0/2] leds: freeze delayed hardware access during suspend @ 2026-10-16 10:04 Jiale Yao 2026-10-16 10:04 ` [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 0 siblings, 2 replies; 5+ messages in thread From: Jiale Yao @ 2026-10-16 10:04 UTC (permalink / raw) To: Matthias Fend, Lee Jones, Pavel Machek, linux-leds, linux-kernel Cc: Jiale Yao The TPS6131x torch watchdog refresh and CR0014114 firmware recount callbacks perform bus transfers from delayed work. Both callbacks use the non-freezable system workqueue and can run after their I2C or SPI controller has been suspended. Queue both callbacks on system_freezable_wq. This freezes their hardware access before device suspend and resumes it after devices become available again. Each patch is independent and can be applied separately. Jiale Yao (2): leds: tps6131x: queue torch refresh work on freezable workqueue leds: cr0014114: queue recount work on freezable workqueue drivers/leds/flash/leds-tps6131x.c | 11 +++++++---- drivers/leds/leds-cr0014114.c | 6 ++++-- 2 files changed, 11 insertions(+), 6 deletions(-) -- 2.34.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] leds: tps6131x: queue torch refresh work on freezable workqueue 2026-10-16 10:04 [PATCH 0/2] leds: freeze delayed hardware access during suspend Jiale Yao @ 2026-10-16 10:04 ` Jiale Yao 2026-10-17 7:16 ` jiale yao 2026-10-16 10:04 ` [PATCH 2/2] leds: cr0014114: queue recount " Jiale Yao 1 sibling, 1 reply; 5+ messages in thread From: Jiale Yao @ 2026-10-16 10:04 UTC (permalink / raw) To: Matthias Fend, Lee Jones, Pavel Machek, linux-leds, linux-kernel Cc: Jiale Yao 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re:[PATCH 1/2] leds: tps6131x: queue torch refresh work on freezable workqueue 2026-10-16 10:04 ` [PATCH 1/2] leds: tps6131x: queue torch refresh work on freezable workqueue Jiale Yao @ 2026-10-17 7:16 ` jiale yao 0 siblings, 0 replies; 5+ messages in thread From: jiale yao @ 2026-10-17 7:16 UTC (permalink / raw) To: Matthias Fend, Lee Jones, Pavel Machek, linux-leds, linux-kernel At 2026-10-16 18:04:34, "Jiale Yao" <yaojiale02@163.com> 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@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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] leds: cr0014114: queue recount work on freezable workqueue 2026-10-16 10:04 [PATCH 0/2] leds: freeze delayed hardware access during suspend Jiale Yao 2026-10-16 10:04 ` [PATCH 1/2] leds: tps6131x: queue torch refresh work on freezable workqueue Jiale Yao @ 2026-10-16 10:04 ` Jiale Yao 2026-10-17 7:18 ` jiale yao 1 sibling, 1 reply; 5+ messages in thread From: Jiale Yao @ 2026-10-16 10:04 UTC (permalink / raw) To: Lee Jones, Pavel Machek, linux-leds, linux-kernel; +Cc: Jiale Yao The firmware workaround periodically recounts the LED state by issuing SPI transfers. Its delayed work runs on the non-freezable system workqueue and can therefore access the controller after it has been suspended. Queue the recount work on system_freezable_wq so hardware access is deferred until devices have resumed. Signed-off-by: Jiale Yao <yaojiale02@163.com> --- drivers/leds/leds-cr0014114.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/leds/leds-cr0014114.c b/drivers/leds/leds-cr0014114.c index 3f6931ae0bcc..afe3730e1222 100644 --- a/drivers/leds/leds-cr0014114.c +++ b/drivers/leds/leds-cr0014114.c @@ -155,7 +155,8 @@ static void cr0014114_recount_work(struct work_struct *work) if (ret) dev_warn(priv->dev, "sync of LEDs failed %d\n", ret); - schedule_delayed_work(&priv->work, CR_RECOUNT_DELAY); + queue_delayed_work(system_freezable_wq, &priv->work, + CR_RECOUNT_DELAY); } static int cr0014114_set_sync(struct led_classdev *ldev, @@ -256,7 +257,8 @@ static int cr0014114_probe(struct spi_device *spi) return ret; /* setup recount work to workaround buggy firmware */ - schedule_delayed_work(&priv->work, CR_RECOUNT_DELAY); + queue_delayed_work(system_freezable_wq, &priv->work, + CR_RECOUNT_DELAY); spi_set_drvdata(spi, priv); -- 2.34.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re:[PATCH 2/2] leds: cr0014114: queue recount work on freezable workqueue 2026-10-16 10:04 ` [PATCH 2/2] leds: cr0014114: queue recount " Jiale Yao @ 2026-10-17 7:18 ` jiale yao 0 siblings, 0 replies; 5+ messages in thread From: jiale yao @ 2026-10-17 7:18 UTC (permalink / raw) To: Lee Jones, Pavel Machek, linux-leds, linux-kernel At 2026-10-16 18:04:35, "Jiale Yao" <yaojiale02@163.com> wrote: >The firmware workaround periodically recounts the LED state by issuing >SPI transfers. Its delayed work runs on the non-freezable system >workqueue and can therefore access the controller after it has been >suspended. > >Queue the recount work on system_freezable_wq so hardware access is >deferred until devices have resumed. > Fixes: 9e50d5fb0d18 ("leds: add LED driver for CR0014114 board") >Signed-off-by: Jiale Yao <yaojiale02@163.com> >--- > drivers/leds/leds-cr0014114.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > >diff --git a/drivers/leds/leds-cr0014114.c b/drivers/leds/leds-cr0014114.c >index 3f6931ae0bcc..afe3730e1222 100644 >--- a/drivers/leds/leds-cr0014114.c >+++ b/drivers/leds/leds-cr0014114.c >@@ -155,7 +155,8 @@ static void cr0014114_recount_work(struct work_struct *work) > if (ret) > dev_warn(priv->dev, "sync of LEDs failed %d\n", ret); > >- schedule_delayed_work(&priv->work, CR_RECOUNT_DELAY); >+ queue_delayed_work(system_freezable_wq, &priv->work, >+ CR_RECOUNT_DELAY); > } > > static int cr0014114_set_sync(struct led_classdev *ldev, >@@ -256,7 +257,8 @@ static int cr0014114_probe(struct spi_device *spi) > return ret; > > /* setup recount work to workaround buggy firmware */ >- schedule_delayed_work(&priv->work, CR_RECOUNT_DELAY); >+ queue_delayed_work(system_freezable_wq, &priv->work, >+ CR_RECOUNT_DELAY); > > spi_set_drvdata(spi, priv); > >-- >2.34.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-10-17 7:18 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2026-10-16 10:04 [PATCH 0/2] leds: freeze delayed hardware access during suspend Jiale Yao 2026-10-16 10:04 ` [PATCH 1/2] leds: tps6131x: queue torch refresh work on freezable workqueue Jiale Yao 2026-10-17 7:16 ` jiale yao 2026-10-16 10:04 ` [PATCH 2/2] leds: cr0014114: queue recount " Jiale Yao 2026-10-17 7:18 ` jiale yao
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®