linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: pgeiem <pgeiem@protonmail.com>
To: "linux-leds@vger.kernel.org" <linux-leds@vger.kernel.org>
Subject: [BUG] leds-pca963x : scheduling while atomic
Date: Fri, 07 May 2021 11:24:37 +0000	[thread overview]
Message-ID: <X9rjGDhu5AHcz9W4bDkYC6QsEplnJy1JBw-GAV9rw1-lZoTbPLma8Akqjk75DOdjybnLUFSWQcyL9HqyEvqlnqQ4ZwbsjyWzFdKpeooI5NY=@protonmail.com> (raw)

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

             reply	other threads:[~2021-05-07 11:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-07 11:24 pgeiem [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-05-07 10:17 [BUG] leds-pca963x : scheduling while atomic pgeiem

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='X9rjGDhu5AHcz9W4bDkYC6QsEplnJy1JBw-GAV9rw1-lZoTbPLma8Akqjk75DOdjybnLUFSWQcyL9HqyEvqlnqQ4ZwbsjyWzFdKpeooI5NY=@protonmail.com' \
    --to=pgeiem@protonmail.com \
    --cc=linux-leds@vger.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;
as well as URLs for NNTP newsgroup(s).