I have a PCA9633 I2C leds controller with hardware blinking enabled connected to a STM32MP1. I would like to blink one of the led connected on this controller when the system goes in standby (backlight for the wakeup button). I use a custom trigger which call led_trigger_blink function in pm_suspend. When doing this I get a BUG: scheduling while atomic error message from the kernel. If I replace the call to led_trigger_blink by a call to led_trigger_event(trig, LED_FULL) I have no error and the led is turned ON. The issue come from the pca963x_blink function when i2c_smbus_read_byte_data(client, PCA963X_MODE2) function is called. What is really surprising to me is that i2c_smbus_read_byte_data is also called from pca963x_brightness without issue this time. Any idea what may cause such an error ? Thanks in advance for your help Patrick [ 306.029144] PM: suspend entry (deep) [ 306.034650] Filesystems sync: 0.001 seconds [ 306.039948] Freezing user space processes ... (elapsed 0.001 seconds) done. [ 306.048293] OOM killer disabled. [ 306.051469] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done. [ 306.060167] printk: Suspending console(s) (use no_console_suspend to debug) [ 306.069415] BUG: scheduling while atomic: sh/104/0x00000002 [ 306.069420] Modules linked in: [ 306.069445] CPU: 1 PID: 104 Comm: sh Tainted: G W 5.10.10-00035-ge3756e37171c-dirty #108 [ 306.069450] Hardware name: STM32 (Device Tree Support) [ 306.069490] [<c010d3a4>] (unwind_backtrace) from [<c0109d80>] (show_stack+0x10/0x14) [ 306.069510] [<c0109d80>] (show_stack) from [<c0737424>] (dump_stack+0xc0/0xd4) [ 306.069529] [<c0737424>] (dump_stack) from [<c013e1e4>] (__schedule_bug+0x70/0x84) [ 306.069549] [<c013e1e4>] (__schedule_bug) from [<c073db30>] (__schedule+0x40c/0x51c) [ 306.069567] [<c073db30>] (__schedule) from [<c073dcd0>] (schedule+0x90/0x118) [ 306.069587] [<c073dcd0>] (schedule) from [<c0741ba4>] (schedule_timeout+0x80/0xfc) [ 306.069607] [<c0741ba4>] (schedule_timeout) from [<c073ea3c>] (wait_for_completion_timeout+0x8c/0x104) [ 306.069629] [<c073ea3c>] (wait_for_completion_timeout) from [<c05827b0>] (stm32f7_i2c_smbus_xfer+0x1fc/0x618) [ 306.069649] [<c05827b0>] (stm32f7_i2c_smbus_xfer) from [<c057de70>] (__i2c_smbus_xfer+0x110/0x730) [ 306.069666] [<c057de70>] (__i2c_smbus_xfer) from [<c057e508>] (i2c_smbus_xfer+0x78/0x110) [ 306.069682] [<c057e508>] (i2c_smbus_xfer) from [<c057e680>] (i2c_smbus_read_byte_data+0x3c/0x6c) [ 306.069699] [<c057e680>] (i2c_smbus_read_byte_data) from [<c073acf8>] (pca963x_blink_set+0x138/0x234) [ 306.069718] [<c073acf8>] (pca963x_blink_set) from [<c05ae12c>] (led_blink_setup+0x2c/0xd4) [ 306.069737] [<c05ae12c>] (led_blink_setup) from [<c05af49c>] (led_trigger_blink+0x40/0x5c) [ 306.069758] [<c05af49c>] (led_trigger_blink) from [<c05651a4>] (touchkey_suspend+0x38/0x64) [ 306.069779] [<c05651a4>] (touchkey_suspend) from [<c0479a4c>] (__device_suspend+0xf8/0x36c) [ 306.069798] [<c0479a4c>] (__device_suspend) from [<c047ad64>] (dpm_suspend+0x108/0x1c8) [ 306.069815] [<c047ad64>] (dpm_suspend) from [<c047b110>] (dpm_suspend_start+0x64/0x6c) [ 306.069834] [<c047b110>] (dpm_suspend_start) from [<c015d8d0>] (suspend_devices_and_enter+0x148/0x524) [ 306.069851] [<c015d8d0>] (suspend_devices_and_enter) from [<c015deb8>] (pm_suspend+0x20c/0x27c) [ 306.069865] [<c015deb8>] (pm_suspend) from [<c015cbe0>] (state_store+0x68/0xc8) [ 306.069882] [<c015cbe0>] (state_store) from [<c02992a4>] (kernfs_fop_write+0xf8/0x21c) [ 306.069902] [<c02992a4>] (kernfs_fop_write) from [<c020addc>] (vfs_write+0xec/0x44c) [ 306.069919] [<c020addc>] (vfs_write) from [<c020b284>] (ksys_write+0x60/0xe4) [ 306.069935] [<c020b284>] (ksys_write) from [<c0100060>] (ret_fast_syscall+0x0/0x54) [ 306.069943] Exception stack(0xc26d9fa8 to 0xc26d9ff0) [ 306.069956] 9fa0: 00000001 00000000 00000001 000db920 00000004 00000000 [ 306.069970] 9fc0: 00000001 00000000 b6f04080 00000004 00000004 00000020 000d7598 000d749c [ 306.069979] 9fe0: 00000004 bed41810 b6e53087 b6dde766